Closed llaville closed 4 years ago
@remicollet a pre-release of version 5.3.0 is available on branch 5.3
Like for PHP Reflect 4.4, if you may have a look on it for FEDORA, i'll glad to get your feedback ! I've already tested features and unit tests
Test build for upcoming bartlett/php-compatinfo 5.3.0 and bartlett/php-reflect 4.4.0
Using phpdocumentor/type-resolver 1.3.0
Testing against PHP 7.2, 7.3, 7.4 and 8.0
Both test suite passes, BUT, it doesn't work
Warning: Declaration of Bartlett\Reflect\Console\Application::setDispatcher(Symfony\Contracts\EventDispatcher\EventDispatcherInterface $dispatcher): void should be compatible with Symfony\Component\Console\Application::setDispatcher(Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher) in /usr/share/php/Bartlett/Reflect/Console/Application.php on line 44
Warning: Declaration of Bartlett\Reflect\Event\CacheAwareEventDispatcher::doDispatch($listeners, $eventName, Symfony\Contracts\EventDispatcher\Event $event): void should be compatible with Symfony\Component\EventDispatcher\EventDispatcher::doDispatch($listeners, $eventName, Symfony\Component\EventDispatcher\Event $event) in /usr/share/php/Bartlett/Reflect/Event/CacheAwareEventDispatcher.php on line 28
Fatal error: Uncaught TypeError: Argument 3 passed to Bartlett\Reflect\Event\CacheAwareEventDispatcher::doDispatch() must be an instance of Symfony\Contracts\EventDispatcher\Event, instance of Symfony\Component\Console\Event\ConsoleTerminateEvent given, called in /usr/share/php/Symfony4/Component/EventDispatcher/EventDispatcher.php on line 239 and defined in /usr/share/php/Bartlett/Reflect/Event/CacheAwareEventDispatcher.php:35
Stack trace:
#0 /usr/share/php/Symfony4/Component/EventDispatcher/EventDispatcher.php(239): Bartlett\Reflect\Event\CacheAwareEventDispatcher->doDispatch(Array, 'console.termina...', Object(Symfony\Component\Console\Event\ConsoleTerminateEvent))
#1 /usr/share/php/Symfony4/Component/EventDispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'console.termina...', Object(Symfony\Component\Console\Event\ConsoleTerminateEvent))
#2 /usr/share/php/Symfony4/Component/Console/Application.php(1033): Symfony\Component\EventDispatcher\EventDispatcher->dispat in /usr/share/php/Bartlett/Reflect/Event/CacheAwareEventDispatcher.php on line 35
Looks like it is not compatible with Symfony 4.4 (we don't have 5.0 yet)
Notice in Symfony code
/**
* @final since Symfony 4.3, the type-hint will be updated to the interface from symfony/contracts in 5.0
*/
public function setDispatcher(EventDispatcherInterface $dispatcher)
So looks like you cannot redefine this documented as final method
I confirm and see my error: I used the Symfony\Contracts\EventDispatcher\EventDispatcherInterface
from https://github.com/symfony/event-dispatcher-contracts
package that is available since SF 5.0
Backport to be compatible with SF 4.4 was made here at https://github.com/symfony/event-dispatcher/blob/master/EventDispatcherInterface.php#L23
I'll change it : affect php-reflect 4.4
Tests run with PHP 7.1.33 and Symfony 4.4.10 (to highlight issue)
Unit tests OK with Symfony 5.1
PHPUnit 9.2.5 by Sebastian Bergmann and contributors.
Runtime: PHP 7.4.7 with Xdebug 2.9.6
Configuration: /shared/backups/bartlett/php-compat-info/phpunit.xml.dist
........................................... 43 / 43 (100%)
Time: 00:01.911, Memory: 38.00 MB
OK (43 tests, 61 assertions)
But still a warning (will try to fix), while all feature results are ok
Warning: Declaration of Bartlett\Reflect\Console\Application::setDispatcher(Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher): void should be compatible with Symfony\Component\Console\Application::setDispatcher(Symfony\Contracts\EventDispatcher\EventDispatcherInterface $dispatcher) in /shared/backups/bartlett/php-compat-info/vendor/bartlett/php-reflect/src/Bartlett/Reflect/Console/Application.php on line 116
Fix apply on php-reflect (see my comment) solve the warning. CompatInfo 5.3.0 will be released in few days after Reflect 4.4 ; Perharps I'll time to add more detection of PHP features with help of nikic/php-parser 4.5 or greater, but it's just a thinking. Current copy of branch 5.3 is a stable PHP 7 compatible version
Unit tests OK with Symfony 4.4
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Runtime: PHP 7.1.33 with Xdebug 2.9.6
Configuration: /shared/backups/bartlett/php-compat-info/phpunit.xml.dist
........................................... 43 / 43 (100%)
Time: 2.2 seconds, Memory: 36.00 MB
OK (43 tests, 61 assertions)
And all features LGTM
@remicollet FYI branch 5.3 is now ready for upcoming version 5.3.0
I've in mind to push, in next days, a new branch 5.4 that will be branch 5.3 (version 5.3.0) plus code reorganized into sniff services (some already exists https://github.com/llaville/php-compat-info/tree/master/src/Bartlett/CompatInfo/Sniffs/PHP, but are not yet used by the compatibility analyser). This branch (5.4) will be a compromise between version 5.3.0 that not yet detect full PHP 7.x features, and major rewrite 6.0 (full code rewrite).
To resume:
Just been released the stable version 5.3.0
New minor version 5.3 will :
bartlett/php-compatinfo-db
1.xjean85/pretty-package-versions
handles now the Application version rather thansebastian/version
(available in phpReflect)