Skip to content

Commit 21ea2e9

Browse files
authored
name-collision-detector (#294)
1 parent 6851172 commit 21ea2e9

7 files changed

Lines changed: 37 additions & 3 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
/phpstan-baseline.neon export-ignore
1111
/phpunit.xml export-ignore
1212
/CLAUDE.md export-ignore
13+
collision-detector.json export-ignore

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,3 +317,29 @@ jobs:
317317
with:
318318
path: ./tmp
319319
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
320+
321+
name-collision:
322+
name: "Name Collision Detector"
323+
324+
runs-on: "ubuntu-latest"
325+
timeout-minutes: 60
326+
327+
steps:
328+
- name: Harden the runner (Audit all outbound calls)
329+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
330+
with:
331+
egress-policy: audit
332+
333+
- name: "Checkout"
334+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
335+
336+
- name: "Install PHP"
337+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
338+
with:
339+
coverage: "none"
340+
php-version: "8.5"
341+
342+
- uses: "ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520" # v3
343+
344+
- name: "Name Collision Detector"
345+
run: "make name-collision"

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ phpstan:
3131
.PHONY: phpstan-generate-baseline
3232
phpstan-generate-baseline:
3333
php vendor/bin/phpstan analyse -c phpstan.neon -b phpstan-baseline.neon
34+
35+
name-collision:
36+
php vendor/bin/detect-collisions --configuration collision-detector.json

collision-detector.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"scanPaths": ["src", "tests"]
3+
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"php-parallel-lint/php-parallel-lint": "^1.2",
1919
"phpstan/phpstan-deprecation-rules": "^2.0",
2020
"phpstan/phpstan-strict-rules": "^2.0",
21-
"phpunit/phpunit": "^9.6"
21+
"phpunit/phpunit": "^9.6",
22+
"shipmonk/name-collision-detector": "^2.1"
2223
},
2324
"config": {
2425
"sort-packages": true

tests/Rules/PHPUnit/data/assert-same.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php declare(strict_types = 1);
22

3-
namespace ExampleTestCase;
3+
namespace ExampleTestCaseAsserts;
44

55
class FooTestCase extends \PHPUnit\Framework\TestCase
66
{

tests/Type/PHPUnit/data/assert-function-9.6.11.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace AssertFunction;
3+
namespace AssertFunction96;
44

55
use function PHPStan\Testing\assertType;
66
use function PHPUnit\Framework\assertObjectHasProperty;

0 commit comments

Comments
 (0)