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

Feature/gh353 #354

Closed deubert-it closed 1 year ago

deubert-it commented 2 years ago

PR related to my feature request #353

To get a quick start into this codebase I added a simple ddev config including a phpunit and phpcompatinfo wrapper. If you have ddev installed, working on this repository should now be very easy.

These are my first steps in this new repository, so of course feel free to move things to correct locations or give me feedback how I can improve things.

I got most parts of my feature request working, but there are some very crude implementations that should be reviewed and refactored by someone who knows this codebase. Probably needs some more testing as well. I added some unittests but they are not covering everything. The only real feature missing is version checking for php extensions. But I could not make sense of the mixed extension data and also do not see it very often in the wild that a specific extension version is required. For myself, I can live without this feature.

I left "@TODO" messages with comments where action should be taken.

However, there should be minimal risk regarding this implementation as new code is only touched when the new option "--verify-composer-json" is added to the analyse:run command.

Output example, phpcompatinfo scanning itself:

 ddev phpcompatinfo analyse:run --verify-composer-json src

 [..]

 [INFO] starting composer.json verification                                                                             
 [INFO] configured php platform version 7.4.0 in composer.json matches the required php version constraint ^7.4 || ^8.0 
 [INFO] minimal required php version 7.4.0 from analysis matches the required php version constraint in composer.json   
        ^7.4 || ^8.0                                                                                                    
 [INFO] the composer.json platform-php config 7.4.0 is >= the required php minimal version 7.4.0 from analysis          
 [INFO] the required extension phar (>= version 1.0.0) is not listed in composer.json but bundled                       
 [INFO] the required extension core (>= version 7.2.0) is not listed in composer.json but bundled                       
 [INFO] the required extension spl (>= version 5.1.0) is listed in composer.json ext-spl (version *)                    
 [INFO] the required extension date (>= version 5.2.0) is not listed in composer.json but bundled                       
 [INFO] the required extension standard (>= version 8.0.0alpha1) is not listed in composer.json but bundled             
 [INFO] the required extension json (>= version 1.6.0) is listed in composer.json ext-json (version *)                  
 [WARNING] the extension libxml (version *) which is listed in composer.json was not found by the analyser, might be    
           removed from the requirements (make sure you also check your dependencies before removing)                   
 [WARNING] the extension pcre (version *) which is listed in composer.json was not found by the analyser, might be      
           removed from the requirements (make sure you also check your dependencies before removing)                   
 [OK] composer.json verification successful!
llaville commented 1 year ago

Sorry I can't accept this PR in current state. As I've received no feedback to my question in #353, I'll close it !