Users often execute composer install with a different version of PHP than the version they execute the resulting code with. This can of course lead to problems and it would help if the generated autoloader verified a compatible PHP version is actually used. This is based on the idea implemented in flex: symfony/flex#576
Using either composer/semver#71 or composer/semver#72 a check for PHP should be compiled into the autoload file which verifies that the PHP version used is compatible with all packages present in the composer.lock file which was used to install/generate the autoloader.
We could expand this to other platform packages like extensions, but we need to consider the runtime performance overhead of such a check which means we should probably add an option to dump-autoload to skip this check if we do more than a simple if for the PHP version.
Users often execute composer install with a different version of PHP than the version they execute the resulting code with. This can of course lead to problems and it would help if the generated autoloader verified a compatible PHP version is actually used. This is based on the idea implemented in flex: symfony/flex#576
Using either composer/semver#71 or composer/semver#72 a check for PHP should be compiled into the autoload file which verifies that the PHP version used is compatible with all packages present in the composer.lock file which was used to install/generate the autoloader.
We could expand this to other platform packages like extensions, but we need to consider the runtime performance overhead of such a check which means we should probably add an option to dump-autoload to skip this check if we do more than a simple if for the PHP version.