Skip to content

Commit

Permalink
Add linter task to phing for checking old PHP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rsynnest committed Nov 9, 2021
1 parent 213fa40 commit d87bfb3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
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. (Recommended) Lint the codebase with specified PHP version to verify rough backwards compatibility (depends on 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 "$@"

0 comments on commit d87bfb3

Please sign in to comment.