diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 91301a9..fbf46dd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -265,6 +265,58 @@ jobs: - name: "Run phpstan/phpstan" run: "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=768M --no-progress" + phpmd: + name: "Check Rules with PHPMD" + + needs: "install" + + runs-on: "${{ matrix.operating-system }}" + + continue-on-error: false + + strategy: + fail-fast: false + + matrix: + operating-system: + - "ubuntu-20.04" + + php-version: + - "7.4" + + dependencies: + - "" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2.3.4" + + - name: "Install PHP" + uses: "shivammathur/setup-php@2.12.0" + with: + php-version: "${{ matrix.php-version }}" + extensions: "${{ env.PHP_EXTENSIONS }}" + ini-values: "${{ env.PHP_INI_VALUES }}" + coverage: "none" + tools: "composer:v2" + + - name: "Determine composer cache directory" + id: "determine-composer-cache-directory" + run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2.1.6" + with: + path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Update dependencies with composer" + run: "composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction -v --ansi ${{ matrix.dependencies }}" + + - name: "Run phpmd/phpmd" + run: "vendor/bin/phpmd src github phpmd.ruleset.xml" + tests: name: "UnitTests with PHPUnit" diff --git a/composer.json b/composer.json index 6a10881..1c9bbdf 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "laminas/laminas-dependency-plugin": "^2.1.2", "laminas/laminas-modulemanager": "^2.10.2", "mikey179/vfsstream": "^1.6.9", - "mimmi20/coding-standard": "^2.2.3", + "mimmi20/coding-standard": "^2.3.0", "pepakriz/phpstan-exception-rules": "^0.11.7", "php-amqplib/php-amqplib": "^3.0.0", "php-console/php-console": "^3.1.8", diff --git a/phpmd.ruleset.xml b/phpmd.ruleset.xml new file mode 100644 index 0000000..bc1a82d --- /dev/null +++ b/phpmd.ruleset.xml @@ -0,0 +1,60 @@ + + + The coding standard. + + + + + + + + + + + + + \DateTime, + \DateInterval, + \DateTimeZone + + + + + + + + + + + + + + + 130 + + + + + + + + + + + + + 15 + + + + + + + + + + diff --git a/phpunit.xml b/phpunit.xml index dc793b7..3240b2d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -33,7 +33,7 @@ tests/ - + src/ diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 6ee73f5..ca73879 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -183,6 +183,9 @@ use Monolog\Processor\UidProcessor; use Monolog\Processor\WebProcessor; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ final class ConfigProvider { /**