From edf76c2c6f2c90ec77678026a28039224d025e01 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 10 May 2026 07:21:03 +0200 Subject: [PATCH 1/2] name-collision-detector --- .gitattributes | 1 + .github/workflows/build.yml | 26 ++++++++++++++++++++++++++ Makefile | 3 +++ collision-detector.json | 3 +++ composer.json | 3 ++- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 collision-detector.json diff --git a/.gitattributes b/.gitattributes index 581d6e31..ef4dbb7f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,3 +10,4 @@ /phpstan-baseline.neon export-ignore /phpunit.xml export-ignore /CLAUDE.md export-ignore +collision-detector.json export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e9d53f2..0a8faa4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -317,3 +317,29 @@ jobs: with: path: ./tmp key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}" + + 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 c58ca06e..98acaecf 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,6 @@ phpstan: .PHONY: phpstan-generate-baseline phpstan-generate-baseline: php vendor/bin/phpstan analyse -c phpstan.neon -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 00000000..1d85c2b3 --- /dev/null +++ b/collision-detector.json @@ -0,0 +1,3 @@ +{ + "scanPaths": ["src", "tests"] +} diff --git a/composer.json b/composer.json index 25624856..308327f9 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpstan-deprecation-rules": "^2.0", "phpstan/phpstan-strict-rules": "^2.0", - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^9.6", + "shipmonk/name-collision-detector": "^2.1" }, "config": { "sort-packages": true From cf4ae6851697c6bac78ede457ea8ad89a02cb4e4 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 10 May 2026 07:25:39 +0200 Subject: [PATCH 2/2] fix symbol conflicts --- tests/Rules/PHPUnit/data/assert-same.php | 2 +- tests/Type/PHPUnit/data/assert-function-9.6.11.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Rules/PHPUnit/data/assert-same.php b/tests/Rules/PHPUnit/data/assert-same.php index 8ab297bd..0e464a06 100644 --- a/tests/Rules/PHPUnit/data/assert-same.php +++ b/tests/Rules/PHPUnit/data/assert-same.php @@ -1,6 +1,6 @@