Skip to content

PHP

Linters

Linter Additional
phpcs
PHP_PHPCS
GitHub stars sarif
phpstan
PHP_PHPSTAN
GitHub stars sarif
psalm
PHP_PSALM
GitHub stars sarif
phplint
PHP_PHPLINT
GitHub stars sarif
php-cs-fixer
PHP_PHPCSFIXER
GitHub stars

Linted files

  • File extensions:
    • .php

Configuration in MegaLinter

Variable Description Default value
PHP_PRE_COMMANDS List of bash commands to run before the linters None
PHP_POST_COMMANDS List of bash commands to run after the linters None
PHP_FILTER_REGEX_INCLUDE Custom regex including filter
PHP_FILTER_REGEX_EXCLUDE Custom regex excluding filter

Behind the scenes

Installation

  • Dockerfile commands :
RUN update-alternatives --install /usr/bin/php php /usr/bin/php84 110
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
ENV PATH="/root/.composer/vendor/bin:${PATH}"
ENV PHP_CS_FIXER_IGNORE_ENV=true