diff --git a/.composer-require-checker.json b/.composer-require-checker.json new file mode 100644 index 0000000000..dc85dc0e97 --- /dev/null +++ b/.composer-require-checker.json @@ -0,0 +1,90 @@ +{ + "symbol-whitelist": [ + "array", + "Composer\\Autoload\\ClassLoader", + "false", + "null", + "parent", + "pcntl_fork", + "pcntl_waitpid", + "pcntl_wexitstatus", + "PHP_CODESNIFFER_CBF", + "PHP_CODESNIFFER_VERBOSITY", + "PHP_CodeSniffer\\Tests\\Standards\\AbstractSniffUnitTest", + "posix_isatty", + "self", + "T_ANON_CLASS", + "T_ASPERAND", + "T_ATTRIBUTE_END", + "T_BACKTICK", + "T_BINARY_CAST", + "T_BITWISE_AND", + "T_BITWISE_NOT", + "T_BITWISE_OR", + "T_BITWISE_XOR", + "T_BOOLEAN_NOT", + "T_CLOSE_CURLY_BRACKET", + "T_CLOSE_PARENTHESIS", + "T_CLOSE_SHORT_ARRAY", + "T_CLOSE_SQUARE_BRACKET", + "T_CLOSE_USE_GROUP", + "T_CLOSURE", + "T_COLON", + "T_COMMA", + "T_DIVIDE", + "T_DOC_COMMENT_CLOSE_TAG", + "T_DOC_COMMENT_OPEN_TAG", + "T_DOC_COMMENT_STAR", + "T_DOC_COMMENT_STRING", + "T_DOC_COMMENT_TAG", + "T_DOC_COMMENT_WHITESPACE", + "T_DOLLAR", + "T_DOUBLE_QUOTED_STRING", + "T_END_NOWDOC", + "T_ENUM_CASE", + "T_EQUAL", + "T_FALSE", + "T_FN_ARROW", + "T_GOTO_LABEL", + "T_GREATER_THAN", + "T_HEREDOC", + "T_INLINE_ELSE", + "T_INLINE_THEN", + "T_LESS_THAN", + "T_MATCH_ARROW", + "T_MATCH_DEFAULT", + "T_MINUS", + "T_MODULUS", + "T_MULTIPLY", + "T_NONE", + "T_NOWDOC", + "T_NULL", + "T_NULLABLE", + "T_OBJECT", + "T_OPEN_CURLY_BRACKET", + "T_OPEN_PARENTHESIS", + "T_OPEN_SHORT_ARRAY", + "T_OPEN_SQUARE_BRACKET", + "T_OPEN_USE_GROUP", + "T_PARAM_NAME", + "T_PARENT", + "T_PHPCS_DISABLE", + "T_PHPCS_ENABLE", + "T_PHPCS_IGNORE_FILE", + "T_PHPCS_IGNORE", + "T_PHPCS_SET", + "T_PLUS", + "T_PROPERTY", + "T_PROTOTYPE", + "T_SELF", + "T_SEMICOLON", + "T_START_NOWDOC", + "T_STRING_CONCAT", + "T_THIS", + "T_TRUE", + "T_TYPE_INTERSECTION", + "T_TYPE_UNION", + "T_ZSR_EQUAL", + "true" + ] +} diff --git a/.gitattributes b/.gitattributes index 3e7371b7a0..2286c3eda0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ +.composer-require-checker.json export-ignore .cspell.json export-ignore .gitattributes export-ignore .github/ export-ignore diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 480b5d14b2..d19f5ec52d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -142,10 +142,6 @@ jobs: if: ${{ matrix.custom_ini == false && matrix.php == '7.4' }} run: cs2pr ./phpcs-report.xml - - name: 'Composer: validate config' - if: ${{ matrix.custom_ini == false }} - run: composer validate --no-check-all --strict - - name: Download the PHPCS phar uses: actions/download-artifact@v3 with: diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 48f6209d7c..94894a3c1a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -57,3 +57,20 @@ jobs: diff -B ./src/Standards/PSR12/ruleset.xml <(xmllint --format "./src/Standards/PSR12/ruleset.xml") diff -B ./src/Standards/Squiz/ruleset.xml <(xmllint --format "./src/Standards/Squiz/ruleset.xml") diff -B ./src/Standards/Zend/ruleset.xml <(xmllint --format "./src/Standards/Zend/ruleset.xml") + + check-composer: + name: Check composer.json + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: 'Composer: validate config' + run: composer --no-interaction validate --no-check-all --strict + + - name: Install Composer dependencies + uses: "ramsey/composer-install@v2" + + - name: 'Composer require checker' + run: vendor/bin/composer-require-checker check --config-file=.composer-require-checker.json diff --git a/composer.json b/composer.json index 0ada4e5535..25cd4cd6bf 100644 --- a/composer.json +++ b/composer.json @@ -27,13 +27,36 @@ }, "require": { "php": ">=7.2.0", + "ext-dom": "*", + "ext-iconv": "*", + "ext-json": "*", + "ext-libxml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "ext-simplexml": "*" }, "require-dev": { + "maglnet/composer-require-checker": "^3.0", "phpunit/phpunit": "^8.0 || ^9.0" }, + "suggest": { + "ext-posix": "More reliable detection of STDIN being a terminal device", + "ext-pcntl": "Allow files to be processed in parallel" + }, + "autoload": { + "psr-4": { + "PHP_CodeSniffer\\": "src/" + }, + "files": [ + "autoload.php", + "src/Util/Tokens.php" + ] + }, + "autoload-dev": { + "psr-4": { + "PHP_CodeSniffer\\Tests\\": "tests/" + } + }, "bin": [ "bin/phpcs", "bin/phpcbf"