|
| 1 | +.. include:: /Includes.rst.txt |
| 2 | + |
| 3 | +=========== |
| 4 | +PHP Quality |
| 5 | +=========== |
| 6 | + |
| 7 | +The **PHP Quality** workflow runs static analysis tools — PHP CS Fixer, PHPStan, |
| 8 | +and optionally XML linting — against a PHP project. Each tool can be toggled on |
| 9 | +or off and its invocation command customized. |
| 10 | + |
| 11 | +Inputs |
| 12 | +------ |
| 13 | + |
| 14 | +.. csv-table:: |
| 15 | + :header: "Input", "Type", "Default", "Description" |
| 16 | + |
| 17 | + "php-version", "string", "``8.2``", "PHP version for quality checks." |
| 18 | + "run-cs-fixer", "boolean", "``true``", "Whether to run PHP CS Fixer." |
| 19 | + "cs-fixer-command", "string", "``make test-cs-fixer``", "Command to invoke PHP CS Fixer." |
| 20 | + "run-phpstan", "boolean", "``true``", "Whether to run PHPStan." |
| 21 | + "phpstan-command", "string", "``make test-phpstan``", "Command to invoke PHPStan." |
| 22 | + "run-xml-lint", "boolean", "``false``", "Whether to run XML linting." |
| 23 | + "xml-lint-command", "string", "``make test-xml-lint``", "Command to invoke XML linting." |
| 24 | + "php-extensions", "string", "``""""``", "Space-separated PHP extensions to install." |
| 25 | + "run-environment", "string", "``local``", "Value of the ``RUN_ENVIRONMENT`` env variable passed to each tool." |
| 26 | + |
| 27 | +Usage |
| 28 | +----- |
| 29 | + |
| 30 | +.. code-block:: yaml |
| 31 | + :caption: .github/workflows/php-quality.yml |
| 32 | +
|
| 33 | + name: PHP Quality |
| 34 | + on: [push, pull_request] |
| 35 | +
|
| 36 | + jobs: |
| 37 | + quality: |
| 38 | + uses: TYPO3-Documentation/.github/.github/workflows/reusable-php-quality.yml@main |
| 39 | + with: |
| 40 | + php-version: "8.2" |
| 41 | + run-cs-fixer: true |
| 42 | + run-phpstan: true |
| 43 | + run-xml-lint: false |
| 44 | +
|
| 45 | +Customizing Commands |
| 46 | +-------------------- |
| 47 | + |
| 48 | +By default the workflow expects ``make`` targets in the consuming repository. |
| 49 | +Override the command inputs to use different tooling: |
| 50 | + |
| 51 | +.. code-block:: yaml |
| 52 | +
|
| 53 | + with: |
| 54 | + cs-fixer-command: "vendor/bin/php-cs-fixer fix --dry-run --diff" |
| 55 | + phpstan-command: "vendor/bin/phpstan analyse --no-progress" |
0 commit comments