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

Add linter task to phing for checking old PHP versions #1710

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -90,5 +90,10 @@ Need Support?
``` sh
vendor/bin/phing -f build/build.xml sniff
```
6. (Optional) Lint the codebase with a specific PHP version to verify compatibility (requires Docker)

``` sh
vendor/bin/phing -Dphpversion=5.3 -f build/build.xml lint
```

7. Send us a Pull Request
9 changes: 9 additions & 0 deletions build/build.xml
Expand Up @@ -22,4 +22,13 @@
tests/"
dir=".." checkreturn="true" passthru="true" />
</target>
<target name="lint">
<exec command="PHING_PROPERTY=${phpversion};
DEFAULT_PHP_VERSION=$(php -r 'echo phpversion();');
export DOCKER_PHP_VERSION=${PHING_PROPERTY:-$DEFAULT_PHP_VERSION};
find ./phpseclib -type f -name '*.php' -print0
| xargs -0 -n1 -P$(nproc) ./build/docker-php.sh
| (! grep -v '^No syntax errors detected' )"
dir=".." checkreturn="true" passthru="true" />
</target>
</project>
2 changes: 2 additions & 0 deletions build/docker-php.sh
@@ -0,0 +1,2 @@
#! /usr/bin/env bash
docker run -t --rm -v "$PWD:$PWD" -w $PWD php:$DOCKER_PHP_VERSION-cli php -l -n "$@"