From 8a78cd0c5f2724a6dcf3f289a53c9c5fa4062ef4 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 10 May 2026 07:47:09 +0200 Subject: [PATCH] name-collision-detector --- .gitattributes | 1 + .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ Makefile | 3 +++ collision-detector.json | 3 +++ composer.json | 1 + 5 files changed, 34 insertions(+) create mode 100644 collision-detector.json diff --git a/.gitattributes b/.gitattributes index 8fb4d8b..96f533d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,3 +11,4 @@ Makefile export-ignore phpstan.neon export-ignore phpstan-baseline.neon export-ignore phpunit.xml export-ignore +collision-detector.json export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b85d0b..48fc4cf 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 1ee557d..b1889a8 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,6 @@ phpstan: .PHONY: phpstan-generate-baseline phpstan-generate-baseline: php vendor/bin/phpstan analyse -l 8 -c phpstan.neon src tests -b phpstan-baseline.neon + +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 2e48680..8d20484 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "phpstan/phpstan-phpunit": "^2.0.10", "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1", "webmozart/assert": "^1.11.0 || ^2.0" }, "config": {