Update phpdocumentor/reflection to 3.0.1 #189

Open
wants to merge 2 commits into
from

Projects

None yet

3 participants

@grappler
grappler commented Jan 1, 2017

This adds PHP 7 support

@grappler
grappler commented Jan 1, 2017

This does not work as nikic/php-parser a dependency of phpdocumentor/reflection was updated from version 0.9.4 to 1.0

This would be the migration path that we would need to take to support PHP7 https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-1.0.md

nikic/php-parser is now on version 3.0 which supports PHP 7.1 features-
https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-2.0.md
https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-3.0.md

@JDGrimes
Contributor
JDGrimes commented Jan 2, 2017

Note that I played with this here: JDGrimes@bfb7379...72a4bc1. There was just one small issue that had to be fixed.

@grappler
grappler commented Jan 2, 2017

@JDGrimes Thanks, I added your fix but it did not solve it.

@JDGrimes
Contributor
JDGrimes commented Jan 2, 2017

No, it still fails on PHP 7 (and 7.1), but it fixes the unrelated issue that was causing failures on lower versions of PHP (5.4-5.6).

@grappler
grappler commented Jan 2, 2017

@JDGrimes Sorry, I missed that. Ok. it seems like the latest version of phpdocumentor/reflection is not PHP7 compatible.

@JDGrimes
Contributor
JDGrimes commented Jan 2, 2017

Also, HHVM is broken by updating phpdocumentor/reflection:

Fatal error: Declaration of WP_Parser\File_Reflector::enterNode() must be compatible with that of PhpParser\NodeVisitor::enterNode() in /home/travis/build/WordPress/phpdoc-parser/lib/class-file-reflector.php on line 14

Because of \PHPParser\Node vs \PHPParser_Node, I think.

@JDGrimes
Contributor
JDGrimes commented Jan 2, 2017

phpdocumentor/reflection's own tests pass on PHP 7. So does phpDocumentor/ReflectionDockBlock, which is where these errors are coming from. Maybe @mvriel or @jaapio could enlighten us?

@grappler
grappler commented Jan 2, 2017

The master and develop branch of phpdocumentor/reflection seem to be going in different directions. I updated the phpdocumentor/reflection to the develop branch of phpdocumentor/reflection but that does not fix it but shows other issues.

@jaapio
jaapio commented Jan 2, 2017 edited

@JDGrimes you are right, the reason why we updated the version from 1 to 3 was because we already had a version 2 in alpha, which is currently in development. (We will skip 2)

Version 3 is not backwards compatible with V1. So more modifications are needed to be able to upgrade to v3. To migrate you will have to migrate from snake-cased classes to namespaces.

While writing this, I saw an update to phpdocumentor/reflection which is ok, but realize that this is in development. And is a complete rewrite. So you will have to change many more. We will most likely stop supporting v3 when v4 is released.

@grappler
grappler commented Jan 2, 2017

@jaapio Thank you for replying. So version 3.0 is being maintained in master and version 2.0 which most likely will become 4.0 when released is being developed in develop. Does version 3.0 support PHP7?

@jaapio
jaapio commented Jan 2, 2017

It should be able to parse php7 code and run on php7. But It will not have full php7 support. Not all namespace formats are supported for example.

grappler and others added some commits Jan 22, 2017
@grappler grappler Update phpdocumentor/reflection to lastest master 786a0f5
@JDGrimes @grappler JDGrimes Modifies the file reflector to avoid errors
Modifies the file reflector to avoid errors like this:

```
Undefined property: PhpParser\Node\Stmt\Function_::$uses

/Users/johngrimes/git/WP-Parser/lib/class-file-reflector.php:174
/Users/johngrimes/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:133
/Users/johngrimes/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
/Users/johngrimes/git/WP-Parser/vendor/phpdocumentor/reflection/src/phpDocumentor/Reflection/Traverser.php:52
/Users/johngrimes/git/WP-Parser/vendor/phpdocumentor/reflection/src/phpDocumentor/Reflection/FileReflector.php:163
/Users/johngrimes/git/WP-Parser/lib/runner.php:56
```

# Conflicts:
#	composer.json
#	composer.lock
36fd71b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment