Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check constraints before running the application #13

Closed
theofidry opened this issue Nov 27, 2017 · 1 comment
Closed

Check constraints before running the application #13

theofidry opened this issue Nov 27, 2017 · 1 comment
Labels

Comments

@theofidry
Copy link
Member

theofidry commented Nov 27, 2017

Unlike when installing a dependency with Composer, no constraint check is done when installing/using a PHAR. It can be done in an installer but then it's easy to miss it if downloading the PHAR directly, keeping the PHAR around and updating it or copying it from somewhere.

An attempt has been made in PHP-Scoper: link based on Symfony's requirement checker. It however has a few drawbacks:

  • It is limited to checking extensions and the PHP platform (which can be fine) but don't take into consideration polyfills. A possible solution could be to look if a polyfill is included as well and ignore the extension requirement if it is
  • As of now it only checks the project composer.json and don't account for the dependencies composer.json files which is silly
  • There is a lot of boilertemplate due to the fact that it may run on unsupported PHP version. In the case of PHP-Scoper for example, that part is compatible with PHP 5.6 even though the project requires PHP7.1 to be able to provide a nice error message when running on PHP 5.6 instead of crashing with a weird error (which is the whole point of that checker except it's not limited to PHP versions). I however didn't check much more if it could be made more re-usable or something so to be investigated to try to make it simpler.

Edit: Composer 1.6.0 added a check-platform-reqs, I think it's worth checking it out

@theofidry
Copy link
Member Author

Closed by #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant