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

php-compatinfo-db version #300

Closed remicollet closed 3 years ago

remicollet commented 3 years ago

Is there any plan to support php-compatinfo-db v3 in old v5 ?

llaville commented 3 years ago

You read in my minds ! I'm currently prepare a 5.5 branch for a 5.5.0 release that will use compatinfo-db 3.3

llaville commented 3 years ago

branch 5.5 is available if you want to have a look on preview release 5.5.0

Unit tests (all groups) PASSED

phpunit --group features,large,reference,regression,default

PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.34 with Xdebug 3.0.3
Configuration: /shared/backups/bartlett/php-compat-info-v55/phpunit.xml.dist

...............................................................  63 / 166 ( 37%)
............................................................... 126 / 166 ( 75%)
........................................                        166 / 166 (100%)

Time: 9.81 seconds, Memory: 82.95 MB

OK (166 tests, 451 assertions)

Code migration is applied with only one commit 20eeb294aaed1f3db99ad51bb15247a5a45d2c59

llaville commented 3 years ago

@remicollet waiting your feedback before publish the new release 5.5.0

remicollet commented 3 years ago

Tried eee33868bcfb662d55eb7164b9bb749619c8b9d6

Everything seems OK (still working on 1 issue, probably a missing dep on my side, in clean env), but build + test suite works in my dev env.

remicollet commented 3 years ago

OK, found something...

During compatinfo-db setup there is proxy files generated

> vendor/bin/doctrine orm:generate-proxies

 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\ClassRelationship"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Class_"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\ConstantRelationship"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Constant_"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Dependency"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Extension"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\FunctionRelationship"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Function_"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\IniEntry"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\IniRelationship"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Platform"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Relationship"
 Processing entity "Bartlett\CompatInfoDb\Infrastructure\Persistence\Doctrine\Entity\Release"

BUT

 Proxy classes generated to "/tmp"

WHich is obviously not suitable for distribution (and .phar is probably affected)

Need to find a way to set cache directory OR to for the use AUTOGENERATE_FILE_NOT_EXISTS (instead of AUTOGENERATE_NEVER) to avoid failure such as

PHP Warning: require(/tmp/__CG__BartlettCompatInfoDbInfrastructurePersistenceDoctrineEntityExtension.php): Failed to open stream: No such file or directory in /usr/share/php/Doctrine/Common3/Proxy/AbstractProxyFactory.php on line 185

remicollet commented 3 years ago

OK, simple workaround, in php-compatinfo-db

diff -up ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php.foo ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php
--- ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php.foo  2021-03-11 14:07:50.842278889 +0100
+++ ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php  2021-03-11 14:07:53.649268435 +0100
@@ -28,7 +28,7 @@ final class EntityManagerFactory
     public static function create(array $connection, Cache $cache = null): EntityManagerInterface
     {
         $paths = [implode(DIRECTORY_SEPARATOR, [__DIR__, 'Entity'])];
-        $isDevMode = false;
+        $isDevMode = true;
         $proxyDir = null;
         $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache);
remicollet commented 3 years ago

So, I'm fine with 5.5.0 as soon as https://github.com/llaville/php-compatinfo-db/pull/67 is included

llaville commented 3 years ago

Branch 5.5 include commit https://github.com/llaville/php-compat-info/commit/a9ccda3efa918754883162b281ba2020d9b98657 to autogenerate proxy files (see new PR https://github.com/llaville/php-compatinfo-db/pull/68 that superceed your PR 67)