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

[#5616] Adapt array indentation to PSR-2 guidelines by default #5907

Merged
merged 1 commit into from Mar 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/Zend/Code/Generator/PropertyValueGenerator.php
Expand Up @@ -11,6 +11,8 @@


class PropertyValueGenerator extends ValueGenerator class PropertyValueGenerator extends ValueGenerator
{ {
protected $arrayDepth = 1;

/** /**
* @return string * @return string
*/ */
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Code/Generator/ValueGenerator.php
Expand Up @@ -48,7 +48,7 @@ class ValueGenerator extends AbstractGenerator
/** /**
* @var int * @var int
*/ */
protected $arrayDepth = 1; protected $arrayDepth = 0;


/** /**
* @var string * @var string
Expand Down
46 changes: 23 additions & 23 deletions tests/ZendTest/Code/Generator/ValueGeneratorTest.php
Expand Up @@ -42,8 +42,8 @@ public function testPropertyDefaultValueCanHandleArray()
{ {
$expectedSource = <<<EOS $expectedSource = <<<EOS
array( array(
'foo' 'foo'
) )
EOS; EOS;


$valueGenerator = new ValueGenerator(); $valueGenerator = new ValueGenerator();
Expand Down Expand Up @@ -89,22 +89,22 @@ public function testPropertyDefaultValueCanHandleComplexArrayOfTypes()


$expectedSource = <<<EOS $expectedSource = <<<EOS
array( array(
5, 5,
'one' => 1, 'one' => 1,
'two' => '2', 'two' => '2',
'constant1' => __DIR__ . '/anydir1/anydir2', 'constant1' => __DIR__ . '/anydir1/anydir2',
array(
'baz' => true,
'foo',
'bar',
array( array(
'baz' => true, 'baz1',
'foo', 'baz2',
'bar', 'constant2' => ArrayObject::STD_PROP_LIST
array( )
'baz1', ),
'baz2', PHP_EOL
'constant2' => ArrayObject::STD_PROP_LIST )
)
),
PHP_EOL
)
EOS; EOS;


$valueGenerator = new ValueGenerator(); $valueGenerator = new ValueGenerator();
Expand All @@ -128,12 +128,12 @@ public function testPropertyDefaultValueCanHandleArrayWithUnsortedKeys()
$valueGenerator->setValue($value); $valueGenerator->setValue($value);
$expectedSource = <<<EOS $expectedSource = <<<EOS
array( array(
1 => 'a', 1 => 'a',
0 => 'b', 0 => 'b',
'c', 'c',
7 => 'd', 7 => 'd',
3 => 'e' 3 => 'e'
) )
EOS; EOS;


$this->assertEquals($expectedSource, $valueGenerator->generate()); $this->assertEquals($expectedSource, $valueGenerator->generate());
Expand Down