8000 bug #23848 restrict reflection doc block (ElectricMaxxx) · symfony/symfony@f534315 · GitHub
[go: up one dir, main page]

Skip to content

Commit f534315

Browse files
bug #23848 restrict reflection doc block (ElectricMaxxx)
This PR was merged into the 3.3 branch. Discussion ---------- restrict reflection doc block | Q | A | ------------- | --- | Branch? | 3.1, 3.2, 3.3, master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT I think we should have same behavior on 2.8 and 3.0 but there `phpdocumentor/reflection` is required and i whanted to avoid conflicts. ### Reason: The version 3.2.0 and 3.2.1 of phpdocumentor/reflection-docblock 10000 is really broken. All Annotations lide `@api`, means without any bracket, leads to errors like `Uninitialized string offset: 0`. We in the CMF do not require that bundle directly, but symfony does and so we get braking builds. Commits ------- 6760127 restrict reflection doc block
2 parents 3d54c3b + 6760127 commit f534315

File tree

5 files changed

+64
-29
lines changed

5 files changed

+64
-29
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"sensio/framework-extra-bundle": "^3.0.2"
103103
},
104104
"conflict": {
105-
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.1",
105+
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
106106
"phpdocumentor/type-resolver": "<0.2.0",
107107
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
108108
},

src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function typesProvider()
7272
array('donotexist', null, null, null),
7373
array('staticGetter', null, null, null),
7474
array('staticSetter', null, null, null),
75+
array('emptyVar', null, null, null),
7576
);
7677
}
7778

src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function testGetProperties()
4141
'B',
4242
'Guid',
4343
'g',
44+
'emptyVar',
4445
'foo',
4546
'foo2',
4647
'foo3',
@@ -122,37 +123,63 @@ public function php71TypesProvider()
122123
);
123124
}
124125

125-
public function testIsReadable()
126+
/**
127+
* @dataProvider getReadableProperties
128+
*/
129+
public function testIsReadable($property, $expected)
130+
{
131+
$this->assertSame(
132+
$expected,
133+
$this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property, array())
134+
);
135+
}
136+
137+
public function getReadableProperties()
138+
{
139+
return array(
140+
array('bar', false),
141+
array('baz', false),
142+
array('parent', true),
143+
array('a', true),
144+
array('b', false),
145+
array('c', true),
146+
array('d', true),
147+
array('e', false),
148+
array('f', false),
149+
array('Id', true),
150+
array('id', true),
151+
array('Guid', true),
152+
array('guid', false),
153+
);
154+
}
155+
156+
/**
157+
* @dataProvider getWritableProperties
158+
*/
159+
public function testIsWritable($property, $expected)
126160
{
127-
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'bar', array()));
128-
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'baz', array()));
129-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'parent', array()));
130-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'a', array()));
131-
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'b', array()));
132-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'c', array()));
133-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'd', array()));
134-
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'e', array()));
135-
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'f', array()));
136-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'Id', array()));
137-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'id', array()));
138-
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'Guid', array()));
139-
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'guid', array()));
161+
$this->assertSame(
162+
$expected,
163+
$this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property, array())
164+
);
140165
}
141166

142-
public function testIsWritable()
167+
public function getWritableProperties()
143168
{
144-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'bar', array()));
145-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'baz', array()));
146-
$this->assertTrue($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'parent', array()));
147-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'a', array()));
148-
$this->assertTrue($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'b', array()));
149-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'c', array()));
150-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'd', array()));
151-
$this->assertTrue($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'e', array()));
152-
$this->assertTrue($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'f', array()));
153-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'Id', array()));
154-
$this->assertTrue($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'Guid', array()));
155-
$this->assertFalse($this->extractor->isWritable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'guid', array()));
169+
return array(
170+
array('bar', false),
171+
array('baz', false),
172+
array('parent', true),
173+
array('a', false),
174+
array('b', true),
175+
array('c', false),
176+
array('d', false),
177+
array('e', true),
178+
array('f', true),
179+
array('Id', false),
180+
array('Guid', true),
181+
array('guid', false),
182+
);
156183
}
157184

158185
public function testSingularize()

src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class Dummy extends ParentDummy
6868
*/
6969
public $g;
7070

71+
/**
72+
* This should not be removed.
73+
*
74+
* @var
75+
*/
76+
public $emptyVar;
77+
7178
public static function getStatic()
7279
{
7380
}

src/Symfony/Component/PropertyInfo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"doctrine/annotations": "~1.0"
3535
},
3636
"conflict": {
37-
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.1",
37+
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
3838
"phpdocumentor/type-resolver": "<0.2.0",
3939
"symfony/dependency-injection": "<3.3"
4040
},

0 commit comments

Comments
 (0)
0