llaville / php-compatinfo

Library that find out the minimum version and the extensions required for a piece of code to run
https://llaville.github.io/php-compatinfo/7.1/
Other
371 stars 21 forks source link

[6.0.0] compatibility with Symfony 4 #310

Closed remicollet closed 2 years ago

remicollet commented 2 years ago

From composer.json

"symfony/config": "^4.4|^5.0",

But using Symfony 4.4

Fatal error: Declaration of Bartlett\CompatInfo\Application\Event\Dispatcher\EventDispatcher::dispatch(object $event, ?string $eventName = null): object must be compatible with Symfony\Component\EventDispatcher\EventDispatcher::dispatch($event) in /dev/shm/BUILDROOT/php-bartlett-PHP-CompatInfo-6.0.0-1.fc35.remi.x86_64/usr/share/php/Bartlett/CompatInfo/Application/Event/Dispatcher/EventDispatcher.php on line 78

And this is only one among some others

FYI, we don't have Symfony 5 in Fedora, and by lack of Energy... won't probably be there for a while.

FYI, I don't know if I will continue to maintain Fedora packages the usual way, for memory

Alternative way:

Which also mean: no more CI on anything nor upstream collaboration.

llaville commented 2 years ago

From composer.json

"symfony/config": "^4.4|^5.0",

With Symfony 5.4 that became the new LTS, I've a doubt to drop this requirement. But, this is to forget YOU, contributor of first hours (already 10 years, as me) to work, contribute to this project, and package it for FEDORA. I would like here to thank you again for your efforts !

But using Symfony 4.4

Fatal error: Declaration of Bartlett\CompatInfo\Application\Event\Dispatcher\EventDispatcher::dispatch(object $event, ?string $eventName = null): object must be compatible with Symfony\Component\EventDispatcher\EventDispatcher::dispatch($event) in /dev/shm/BUILDROOT/php-bartlett-PHP-CompatInfo-6.0.0-1.fc35.remi.x86_64/usr/share/php/Bartlett/CompatInfo/Application/Event/Dispatcher/EventDispatcher.php on line 78

And this is only one among some others

At least, after preparing a quick Symfony 4 environement only, I can tell you that there is only two compatibility errors. I know it's a pain for a package that is suppose to check PHP code compatibility ;-)

The other one is

Warning: 
Declaration of Bartlett\CompatInfo\Presentation\Console\Style::createProgressBar(int $max = 0) 
should be compatible with 
Symfony\Component\Console\Style\SymfonyStyle::createProgressBar($max = 0) 
in /shared/backups/bartlett/php-compatinfo/src/Presentation/Console/Style.php on line 16

FYI, we don't have Symfony 5 in Fedora, and by lack of Energy... won't probably be there for a while.

I understand your point of view. Especially because Open Source context is very hard. Personally, I don't know if I'm the only user of this package, or if there are 10, 100, 1000 or more. Lack of feedback and real contribution is perharps because this application was too hard to understand for all users. This is why I've began to work on a huge refactoring code to simplify it for an easy maintainance. But I don't know if I've reach my goal !

llaville commented 2 years ago

Tested with these requirements in composer.json, with latest 4 picked from php-compatinfo-db SF4 BC too !

    "require": {
        "php": "^7.4|^8.0",
        "ext-json": "*",
        "ext-libxml": "*",
        "ext-pcre": "*",
        "ext-spl": "*",
        "bartlett/php-compatinfo-db": "^3.6",
        "composer/package-versions-deprecated": "^1.8",
        "doctrine/collections": "^1.4",
        "nikic/php-parser": "^4.10",
        "psr/log": "^1.0",
        "ramsey/uuid": "^3.9|^4.0",
        "symfony/config": "^4.4",
        "symfony/console": "^4.4",
        "symfony/event-dispatcher": "^4.4",
        "symfony/finder": "^4.4",
        "symfony/dependency-injection": "^4.4",
        "symfony/serializer": "^4.4",
        "symfony/stopwatch": "^4.4",

        "symfony/filesystem": "^4.4",
        "symfony/var-exporter": "^4.4",
        "symfony/cache": "^4.4",
        "symfony/messenger": "^4.4",
        "symfony/process": "^4.4"
    },
llaville commented 2 years ago

Here is the corresponding patch for composer.json

diff --git a/composer.json b/composer.json
index 92015b0b..3df7b903 100644
--- a/composer.json
+++ b/composer.json
@@ -21,13 +21,19 @@
         "nikic/php-parser": "^4.10",
         "psr/log": "^1.0",
         "ramsey/uuid": "^3.9|^4.0",
-        "symfony/config": "^4.4|^5.0",
-        "symfony/console": "^4.4|^5.0",
-        "symfony/event-dispatcher": "^4.4|^5.0",
-        "symfony/finder": "^4.4|^5.0",
-        "symfony/dependency-injection": "^4.4|^5.0",
-        "symfony/serializer": "^4.4|^5.0",
-        "symfony/stopwatch": "^4.4|^5.0"
+        "symfony/config": "^4.4",
+        "symfony/console": "^4.4",
+        "symfony/event-dispatcher": "^4.4",
+        "symfony/finder": "^4.4",
+        "symfony/dependency-injection": "^4.4",
+        "symfony/serializer": "^4.4",
+        "symfony/stopwatch": "^4.4",
+
+        "symfony/filesystem": "^4.4",
+        "symfony/var-exporter": "^4.4",
+        "symfony/cache": "^4.4",
+        "symfony/messenger": "^4.4",
+        "symfony/process": "^4.4"
     },
     "require-dev": {
         "composer/composer": "^2.0",
remicollet commented 2 years ago

I confirm 6.0.1 is OK.