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
Suggestion: PHP Linting for Supported Versions #1709
Comments
Feel free to submit a PR! I have Docker containers for PHP versions going back all the way to 4.4 available at https://github.com/phpseclib/docker-php (they're available as different branches). I chiefly use them for benchmarking purposes but certainly linting would be an option to. The PHP official docker containers only go back to 5.3 whereas mine to 4.4. Mine also install optional extensions useful for benchmarking that aren't available by default (gmp, bcmath, mcrypt, ssh2). Maybe I'll do it myself at some point but it isn't a particularly high priority. I mean, if someone finds an issue with phpseclib 1.0 on PHP 4.4 I'll fix it but if PHP 4.4 support got broken, at some point, three years ago, I'm not gonna lose any sleep over it lol. That said, what'd be better than doing |
100% agree, older version support is a nice favor to legacy users, but shouldn't be a priority for developer time. I'm happy to add this, but not sure where. I'm assuming releases are manual via git tag/push? Where would be a good place for you? Maybe as a phing job with target name "lint"? PHPUnit depends on a specific PHP version, so yeah, maintaining 3 different test suites of old PHPUnit versions is a special kind of hell. Nice to see a trustworthy source for old PHP Docker builds, I'll likely be reaching for those, thanks for sharing! |
I hate adding cruft to OSS, so take it or leave it, but if it's helpful here's a very simple + performant one-liner you can add to the build process to syntax check all files using a given PHP version. It prints syntax errors to stdout and returns exit code 1 if any syntax errors are found. (one-liner pulled from discussions here )
Syntax check all files in current directory (recursive):
If you don't have a certain php version installed, you can use Docker. This bash script can be used in place of the php binary for a given version (though it will be much slower - a few seconds). v5.3 is used as an example:
Here's example output for the error fixed in PR #1706 :
The text was updated successfully, but these errors were encountered: