-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Prettify the output of Zend\Code\Generator\ValueGenerator for multi line arrays #5616
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,9 +40,15 @@ public function testPropertyDefaultValueCanHandleStrings() | |
|
|
||
| public function testPropertyDefaultValueCanHandleArray() | ||
| { | ||
| $expectedSource = <<<EOS | ||
| array( | ||
| 'foo' | ||
| ) | ||
| EOS; | ||
|
|
||
| $valueGenerator = new ValueGenerator(); | ||
| $valueGenerator->setValue(array('foo')); | ||
| $this->assertEquals('array(\'foo\')', $valueGenerator->generate()); | ||
| $this->assertEquals($expectedSource, $valueGenerator->generate()); | ||
| } | ||
|
|
||
| public function testPropertyDefaultValueCanHandleUnquotedString() | ||
|
|
@@ -95,10 +101,10 @@ public function testPropertyDefaultValueCanHandleComplexArrayOfTypes() | |
| 'baz1', | ||
| 'baz2', | ||
| 'constant2' => ArrayObject::STD_PROP_LIST | ||
| ) | ||
| ), | ||
| ) | ||
| ), | ||
| PHP_EOL | ||
| ) | ||
| ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, do I misinterpret this or is it outdated? http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Arrays
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what you interpreted. Any of that examples shows the close parenthesis indented. Instead they are aligned to the first non white character in the line. PD: Some parts of that article are outdated and don't follow PSR-2
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still don't get it. So your are saying, that this code block is not following the ZF2 standards? If not, how should it look like?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RalfEggert Could you take a look from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Maks3w Yes, the result of the ValueGeneratorTest::testPropertyDefaultValueCanHandleArrayWithUnsortedKeys() runs as expected, since the ArrayDepth is set to 1 as default. If it would be set to 0, I would expect: |
||
| EOS; | ||
|
|
||
| $valueGenerator = new ValueGenerator(); | ||
|
|
@@ -127,7 +133,7 @@ public function testPropertyDefaultValueCanHandleArrayWithUnsortedKeys() | |
| 'c', | ||
| 7 => 'd', | ||
| 3 => 'e' | ||
| ) | ||
| ) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| EOS; | ||
|
|
||
| $this->assertEquals($expectedSource, $valueGenerator->generate()); | ||
|
|
||
There was a problem hiding this comment.
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