Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Prettify the output of Zend\Code\Generator\ValueGenerator for multi line arrays #5616

Merged
merged 3 commits into from
Mar 4, 2014
Merged

Prettify the output of Zend\Code\Generator\ValueGenerator for multi line arrays #5616

merged 3 commits into from
Mar 4, 2014

Conversation

RalfEggert
Copy link
Contributor

This fix prettifies the output for multi line arrays generated with Zend\Code\Generator\ValueGenerator

Without this fix, an array looks like this.

array(
    'controllers' => array('invokables' => array(
            'Event\Controller\IndexController' => 'Event\Controller\IndexController',
            'Event\Controller\ShopController' => 'Event\Controller\ShopController',
            )),
    'view_manager' => array('template_path_stack' => array(__DIR__ . '/../view'))
    )

With the fix, the same array will look like this:

array(
    'controllers' => array(
        'invokables' => array(
            'Event\Controller\IndexController' => 'Event\Controller\IndexController',
            'Event\Controller\ShopController' => 'Event\Controller\ShopController',
        )
    ),
    'view_manager' => array(
        'template_path_stack' => array(
            __DIR__ . '/../view'
        )
    )
)

Please note the changes for the entry for 'view_manager' and the positions of the braces.

@blanchonvincent
Copy link
Contributor

@RalfEggert Update the unit tests please, there are some fails https://travis-ci.org/zendframework/zf2/jobs/15495156#L281

@RalfEggert
Copy link
Contributor Author

Sorry, forgot about that. The unit tests are fixed now...

@blanchonvincent
Copy link
Contributor

@RalfEggert
Copy link
Contributor Author

To be honest, I don't really understand what failed there... :-(

@zluiten
Copy link
Contributor

zluiten commented Dec 16, 2013

@RalfEggert
Copy link
Contributor Author

@Netiul Thanks, I just checked the ValueGeneratorTest and missed that one. Now it should work...

@blanchonvincent
Copy link
Contributor

@RalfEggert 👍

$expectedSource = <<<EOS
array(
'foo'
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case the close parenthesis should not be indented

@weierophinney weierophinney added this to the 2.3.0 milestone Mar 3, 2014
weierophinney added a commit that referenced this pull request Mar 4, 2014
…tify

Prettify the output of Zend\Code\Generator\ValueGenerator for multi line arrays
weierophinney added a commit that referenced this pull request Mar 4, 2014
@weierophinney weierophinney merged commit c28f71a into zendframework:develop Mar 4, 2014
@weierophinney weierophinney self-assigned this Mar 4, 2014
weierophinney added a commit that referenced this pull request Mar 5, 2014
[#5616] Adapt array indentation to PSR-2 guidelines by default
weierophinney added a commit that referenced this pull request Mar 5, 2014
Based on new tests and links to relevant specifications, the code from #5608
was invalid; header lines may never start with whitespace.

This patch reverts that code, and updates the `fromString()` logic to
capture whitespace on subsequent lines to include in the multi-line
header value. Tests have been updated where necessary to use a regex for
testing the existence of whitespace between multiline values.
weierophinney added a commit that referenced this pull request Mar 5, 2014
weierophinney added a commit that referenced this pull request Mar 5, 2014
Forward port #5616

Conflicts:
	tests/ZendTest/Http/Response/ResponseStreamTest.php
	tests/ZendTest/Http/ResponseTest.php
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
…dframework#5608

Based on new tests and links to relevant specifications, the code from zendframework/zendframework#5608
was invalid; header lines may never start with whitespace.

This patch reverts that code, and updates the `fromString()` logic to
capture whitespace on subsequent lines to include in the multi-line
header value. Tests have been updated where necessary to use a regex for
testing the existence of whitespace between multiline values.
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
Forward port zendframework/zendframework#5616

Conflicts:
	tests/ZendTest/Http/Response/ResponseStreamTest.php
	tests/ZendTest/Http/ResponseTest.php
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants