2020-04-22 07:27:58 +00:00
|
|
|
name: "PHP Lint"
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- 'doc/**'
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- 'doc/**'
|
|
|
|
|
2022-06-10 00:30:11 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-04-22 07:27:58 +00:00
|
|
|
jobs:
|
|
|
|
tests:
|
|
|
|
name: "Lint"
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-version:
|
2021-12-08 15:13:33 +00:00
|
|
|
- "7.2"
|
2024-07-25 14:26:13 +00:00
|
|
|
- "nightly"
|
2020-04-22 07:27:58 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: "Checkout"
|
2023-09-07 12:47:04 +00:00
|
|
|
uses: "actions/checkout@v4"
|
2020-04-22 07:27:58 +00:00
|
|
|
|
|
|
|
- name: "Install PHP"
|
|
|
|
uses: "shivammathur/setup-php@v2"
|
|
|
|
with:
|
|
|
|
coverage: "none"
|
|
|
|
extensions: "intl"
|
2021-06-21 19:01:08 +00:00
|
|
|
ini-values: "memory_limit=-1, error_reporting=E_ALL, display_errors=On"
|
2020-04-22 07:27:58 +00:00
|
|
|
php-version: "${{ matrix.php-version }}"
|
|
|
|
|
|
|
|
- name: "Lint PHP files"
|
2024-07-25 14:26:13 +00:00
|
|
|
run: |
|
|
|
|
hasErrors=0
|
|
|
|
for f in $(find src/ tests/ -type f -name '*.php' ! -path '*/vendor/*')
|
|
|
|
do
|
|
|
|
{ error="$(php -derror_reporting=-1 -ddisplay_errors=1 -l -f $f 2>&1 1>&3 3>&-)"; } 3>&1;
|
|
|
|
if [ "$error" != "" ]; then
|
|
|
|
while IFS= read -r line; do echo "::error file=$f::$line"; done <<< "$error"
|
|
|
|
hasErrors=1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ $hasErrors -eq 1 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|