-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Transpile you app from PHP7 to PHP5 #330
Comments
This would be the next level. |
But why? |
@rask there is a number of CLI apps that by design should be compatible with low PHP targets, a few examples on top of my head: Composer, PHPBrew and Psysh. In the case of those applications, having to stick with PHP 5.4 for example cripples the code-base, whereas a transpiler would allow to not abandon those lower versions whilst benefiting from the new PHP versions. |
I get the idea, but wouldn't this introduce issues with things like strict typehints, when transpiled to fully dynamic types (which rely on user input for instance)? The transpiler would need to generate type checking code on the fly to prevent issues like these. |
Indeed if you had guards but dropped them in favour of strict types & typehints you would loose something. However I think that's an acceptable loss, at least for the first iteration. In my experience very few people were putting guards properly before so I don't think this will be a big issue, at least to most users |
Small update: no real progress on that front but now we do have Rector which allows to downgrade as well instead of upgrading. PHPStan does use it to some degree to add support for PHP 7.2. |
Feature Request
It could be interesting to have a Box compactor which transpile the code from PHP7 to PHP5. As a result, for example, one could ship a PHP 7.2 app into a PHAR which would be compatible with PHP 5.4.
Some transpilers already exists, such as:
The text was updated successfully, but these errors were encountered: