diff --git a/.gitattributes b/.gitattributes index 5d9f3fa..738ed1e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ Makefile export-ignore phpstan.neon export-ignore CLAUDE.md export-ignore phpunit.xml export-ignore +collision-detector.json export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e8ef71..36a114e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -185,3 +185,29 @@ jobs: - name: "PHPStan" run: "make phpstan" + + name-collision: + name: "Name Collision Detector" + + runs-on: "ubuntu-latest" + timeout-minutes: 60 + + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 + with: + egress-policy: audit + + - name: "Checkout" + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - name: "Install PHP" + uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2 + with: + coverage: "none" + php-version: "8.5" + + - uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3 + + - name: "Name Collision Detector" + run: "make name-collision" diff --git a/Makefile b/Makefile index b2b6703..dc754d1 100644 --- a/Makefile +++ b/Makefile @@ -27,3 +27,6 @@ cs-fix: .PHONY: phpstan phpstan: php vendor/bin/phpstan analyse -l 8 -c phpstan.neon src tests + +name-collision: + php vendor/bin/detect-collisions --configuration collision-detector.json diff --git a/collision-detector.json b/collision-detector.json new file mode 100644 index 0000000..1d85c2b --- /dev/null +++ b/collision-detector.json @@ -0,0 +1,3 @@ +{ + "scanPaths": ["src", "tests"] +} diff --git a/composer.json b/composer.json index 209e87b..ad07036 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1" }, "config": { "platform": {