phpDocumentor / ReflectionDocBlock

MIT License
9.35k stars 119 forks source link

PHP 8.0 Broken Relative Types #248

Closed GrahamCampbell closed 4 years ago

GrahamCampbell commented 4 years ago

Resolving relative types in phpdoc was broken recently, presumably due to https://github.com/php/php-src/commit/7a3dcc3e339cde2177ba4fe8fc45f78c94dfbb29.

GrahamCampbell commented 4 years ago

It also looks like the current test suite crashes on PHP 8.0:

PHPUnit 9.3-dev by Sebastian Bergmann and contributors.

Runtime:       PHP 8.0.0-dev
Configuration: /data/phpunit.xml.dist
Warning:       xdebug.mode=coverage has to be set in php.ini

  Warning - The configuration file did not pass validation!
  The following problems have been detected:

  Line 20:
  - Element 'filter': This element is not expected.

  Test results may not be as expected.

...

Test 'phpDocumentor\Reflection\DocBlockFactoryTest::testCreateDocBlockFromReflection' started
PHP Fatal error:  Type mixed cannot be marked as nullable since mixed already includes null in /data/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php(34) : eval()'d code on line 1198
PHP Stack trace:
PHP   1. {main}() /data/vendor/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main() /data/vendor/phpunit/phpunit/phpunit:61
PHP   3. PHPUnit\TextUI\Command->run() /data/vendor/phpunit/phpunit/src/TextUI/Command.php:94
PHP   4. PHPUnit\TextUI\TestRunner->run() /data/vendor/phpunit/phpunit/src/TextUI/Command.php:141
PHP   5. PHPUnit\Framework\TestSuite->run() /data/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:682
PHP   6. PHPUnit\Framework\TestSuite->run() /data/vendor/phpunit/phpunit/src/Framework/TestSuite.php:665
PHP   7. PHPUnit\Framework\TestSuite->run() /data/vendor/phpunit/phpunit/src/Framework/TestSuite.php:665
PHP   8. phpDocumentor\Reflection\DocBlockFactoryTest->run() /data/vendor/phpunit/phpunit/src/Framework/TestSuite.php:665
PHP   9. PHPUnit\Framework\TestResult->run() /data/vendor/phpunit/phpunit/src/Framework/TestCase.php:869
PHP  10. phpDocumentor\Reflection\DocBlockFactoryTest->runBare() /data/vendor/phpunit/phpunit/src/Framework/TestResult.php:733
PHP  11. phpDocumentor\Reflection\DocBlockFactoryTest->runTest() /data/vendor/phpunit/phpunit/src/Framework/TestCase.php:1128
PHP  12. phpDocumentor\Reflection\DocBlockFactoryTest->testCreateDocBlockFromReflection() /data/vendor/phpunit/phpunit/src/Framework/TestCase.php:1522
PHP  13. Mockery::mock() /data/tests/unit/DocBlockFactoryTest.php:68
PHP  14. Mockery\Container->mock() /data/vendor/mockery/mockery/library/Mockery.php:123
PHP  15. Mockery\Loader\EvalLoader->load() /data/vendor/mockery/mockery/library/Mockery/Container.php:230
GrahamCampbell commented 4 years ago

It also looks like the current test suite crashes on PHP 8.0:

This is actually a known bug in Mockery, a noted down in https://github.com/mockery/mockery/issues/1083. I will be fixing that soon (probably after the PHP 8.0 feature freeze, so Dave is not spammed with more partial PHP 8 fix PRs).

GrahamCampbell commented 4 years ago

I have fixed the issue with Mockery now. If you update the lock file, the tests should run on PHP 8 again.

jaapio commented 4 years ago

Just updated mockery, let's see what happens.

xabbuh commented 4 years ago

see phpDocumentor/TypeResolver#114