diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..68d77bc --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,23 @@ +name: Coding Standards + +on: [pull_request] + +jobs: + phpcs: + name: PHP_CodeSniffer + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + coverage: none + + - name: Install Composer dependencies + uses: ramsey/composer-install@v2 + + - name: Run test suite + run: composer coding-standards diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist new file mode 100644 index 0000000..57b3de6 --- /dev/null +++ b/.phpcs.xml.dist @@ -0,0 +1,24 @@ + + + Coding standards for PHPUnit Markup Assertions + + + + + + + . + */vendor/* + + + + + + + tests/* + + + + + + diff --git a/composer.json b/composer.json index c704177..5ce1209 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,9 @@ "symfony/dom-crawler": "^3.4|^4.4|^5.4|^6.0" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "phpcompatibility/php-compatibility": "^9.3", + "phpcsstandards/php_codesniffer": "^3.7", "symfony/phpunit-bridge": "^5.2 || ^6.2" }, "autoload": { @@ -33,6 +36,9 @@ } }, "scripts": { + "coding-standards": [ + "phpcs" + ], "test": [ "simple-phpunit --testdox" ], @@ -41,12 +47,16 @@ ] }, "scripts-descriptions": { + "coding-standards": "Check coding standards.", "test": "Run all test suites.", "test-coverage": "Generate code coverage reports in tests/coverage." }, "config": { "preferred-install": "dist", - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } }, "archive": { "exclude": [ diff --git a/src/MarkupAssertionsTrait.php b/src/MarkupAssertionsTrait.php index 14b4906..59bb6fa 100644 --- a/src/MarkupAssertionsTrait.php +++ b/src/MarkupAssertionsTrait.php @@ -1,4 +1,5 @@ setAccessible(true);