diff --git a/.github/workflows/php-syntax.yml b/.github/workflows/php-syntax.yml new file mode 100644 index 00000000..07fa0d8d --- /dev/null +++ b/.github/workflows/php-syntax.yml @@ -0,0 +1,52 @@ +name: PHP Syntax + +on: + pull_request: + push: + branches: + - develop + +permissions: + contents: read + +concurrency: + group: php-syntax-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: PHP ${{ matrix.php }} syntax + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: none + coverage: none + + - name: Show PHP version + run: php -v + + - name: Guard against corrupted refactor patterns + run: | + set -euo pipefail + if grep -R -n -E '\b(is_|in_|call_user_func_|port_list_to_|mactrack_display_|mactrack_device_action_)\[' --include='*.php' .; then + echo "Detected corrupted call-pattern rewrite(s)." >&2 + exit 1 + fi + + - name: Lint PHP files + run: | + set -euo pipefail + git ls-files '*.php' | while IFS= read -r f; do + php -l "$f" + done diff --git a/.gitignore b/.gitignore index eb716067..32791f06 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ # +-------------------------------------------------------------------------+ locales/po/*.mo +.omc/ diff --git a/images/index.php b/images/index.php index 828ecbeb..06a9f5c2 100644 --- a/images/index.php +++ b/images/index.php @@ -1,4 +1,6 @@