Skip to content

restrict reflection doc block #23848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ElectricMaxxx
Copy link
Contributor

@ElectricMaxxx ElectricMaxxx commented Aug 10, 2017

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 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.

@xabbuh
Copy link
Member

xabbuh commented Aug 10, 2017

Can you expand the fixtures to make use of such an annotation?

@nicolas-grekas
Copy link
Member

Are our tests broken because of this bug in phpdocumentor? If yes, we should merge (but a component's composer.json should be patched also, isn't it?), if not, it's not our job to provide an exclusion list to me.

@xabbuh
Copy link
Member

xabbuh commented Aug 10, 2017

@nicolas-grekas Having an annotation without parentheses is so common that we IMO should not fail on those classes.

@nicolas-grekas
Copy link
Member

then we need a test case that ensures we hit the issue also, as you asked for already btw :)
and src/Symfony/Component/PropertyInfo/composer.json needs the same patch

@ElectricMaxxx
Copy link
Contributor Author

Any hints on which test class to add an @api anotation i.e.?

@ElectricMaxxx
Copy link
Contributor Author

I added a simple testcase which definetly fails on 3.2.1. I required it localy and saw the test failing with the well know error.

@@ -72,6 +72,7 @@ public function typesProvider()
array('donotexist', null, null, null),
array('staticGetter', null, null, null),
array('staticSetter', null, null, null),
array('emptyVar', null, null, null),
Copy link
Member

Choose a reason for hiding this comment

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

looks like you need to adapt the ReflectionExtractorTest for this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was enough locally to get the issue. But i will have a look in the other one too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now i understood what you ment :-)

@ElectricMaxxx
Copy link
Contributor Author

ElectricMaxxx commented Aug 10, 2017

Just give me a hint when i should squash the commits.

@@ -12,9 +12,12 @@
namespace Symfony\Component\PropertyInfo\Tests\Fixtures;

use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is wrong, was my first try. I will remove it.


/**
* @author Kévin Dunglas <dunglas@gmail.com>
*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this too. This is not the annotation i whanted to test.

@ElectricMaxxx ElectricMaxxx force-pushed the restrictic_more_doc_block_version branch from c0859fb to 9fc7723 Compare August 10, 2017 12:39
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'id', array()));
$this->assertTrue($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'Guid', array()));
$this->assertFalse($this->extractor->isReadable('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', 'guid', array()));
$this->assertEquals(
Copy link
Member

Choose a reason for hiding this comment

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

should be assertSame to match the previous assertions

The version 3.2.0 and 3.2.1 of reflection-docblock is broken and lower version as 3.1 miss some tags
@ElectricMaxxx ElectricMaxxx force-pushed the restrictic_more_doc_block_version branch from 9fc7723 to 6760127 Compare August 10, 2017 13:41
@ElectricMaxxx
Copy link
Contributor Author

assertSame() it is now.

@nicolas-grekas
Copy link
Member

Thank you @ElectricMaxxx.

@nicolas-grekas nicolas-grekas merged commit 6760127 into symfony:3.3 Aug 10, 2017
nicolas-grekas added a commit that referenced this pull request Aug 10, 2017
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 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
@ElectricMaxxx ElectricMaxxx deleted the restrictic_more_doc_block_version branch August 10, 2017 14:44
@fabpot fabpot mentioned this pull request Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants