From 95cdbe577513286c36dcf513fe76f269e8a32125 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Wed, 13 Sep 2023 11:29:32 +0200 Subject: [PATCH] name-collision-detector --- .github/workflows/lint.yml | 22 ++++++++++++++ Makefile | 3 ++ collision-detector.json | 14 +++++++++ composer.json | 3 +- composer.lock | 59 +++++++++++++++++++++++++++++++++++++- 5 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 collision-detector.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index de30850963..d6e8ba5787 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -134,3 +134,25 @@ jobs: - name: "Composer Require Checker" run: "make composer-require-checker" + + name-collision: + name: "Name Collision Detector" + + runs-on: "ubuntu-latest" + timeout-minutes: 60 + + steps: + - name: "Checkout" + uses: actions/checkout@v3 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "8.2" + + - name: "Install dependencies" + run: "composer install --no-interaction --no-progress" + + - name: "Name Collision Detector" + run: "make name-collision" diff --git a/Makefile b/Makefile index 1bcca2c96f..2dbc0c16e7 100644 --- a/Makefile +++ b/Makefile @@ -71,3 +71,6 @@ phpstan-pro: composer-require-checker: php build/composer-require-checker.phar check --config-file $(CURDIR)/build/composer-require-checker.json + +name-collision: + php vendor/bin/detect-collisions diff --git a/collision-detector.json b/collision-detector.json new file mode 100644 index 0000000000..f76bb1a6fc --- /dev/null +++ b/collision-detector.json @@ -0,0 +1,14 @@ +{ + "scanPaths": ["src", "build", "tests"], + "excludePaths": [ + "tests/PHPStan/Analyser/data/parse-error.php", + "tests/PHPStan/Analyser/data/multipleParseErrors.php", + "tests/PHPStan/Parser/data/cleaning-1-before.php", + "tests/PHPStan/Parser/data/cleaning-1-after.php", + "tests/PHPStan/Rules/Functions/data/duplicate-function.php", + "tests/PHPStan/Rules/Classes/data/duplicate-class.php", + "tests/notAutoloaded", + "tests/PHPStan/Rules/Functions/data/define-bug-3349.php", + "tests/PHPStan/Levels/data/stubs/function.php" + ] +} diff --git a/composer.json b/composer.json index e721e77707..cf646ad292 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,8 @@ "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.5.1", "phpunit/phpunit": "^9.5.4", - "rector/rector": "^0.17" + "rector/rector": "^0.17", + "shipmonk/name-collision-detector": "dev-master" }, "config": { "platform": { diff --git a/composer.lock b/composer.lock index 42990e5bf7..17741ed8a6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "15370fe06e70912dc718f07a86da0ef0", + "content-hash": "66a1ad030befadba6ebd1b506ba58cd2", "packages": [ { "name": "clue/ndjson-react", @@ -6561,6 +6561,63 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "shipmonk/name-collision-detector", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/shipmonk-rnd/name-collision-detector.git", + "reference": "6c9c6bc0cdd1d56df80ad145147ca22618bf9d77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/shipmonk-rnd/name-collision-detector/zipball/6c9c6bc0cdd1d56df80ad145147ca22618bf9d77", + "reference": "6c9c6bc0cdd1d56df80ad145147ca22618bf9d77", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/schema": "^1.1.0", + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "editorconfig-checker/editorconfig-checker": "^10.3.0", + "ergebnis/composer-normalize": "^2.19", + "phpstan/phpstan": "^1.8.7", + "phpstan/phpstan-phpunit": "^1.1.1", + "phpstan/phpstan-strict-rules": "^1.2.3", + "phpunit/phpunit": "^8.5.28 || ^9.5.20", + "slevomat/coding-standard": "^8.0.1" + }, + "default-branch": true, + "bin": [ + "bin/detect-collisions" + ], + "type": "library", + "autoload": { + "psr-4": { + "ShipMonk\\NameCollision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Simple tool to find ambiguous classes or any other name duplicates within your project.", + "keywords": [ + "ambiguous", + "autoload", + "autoloading", + "classname", + "collision", + "namespace" + ], + "support": { + "issues": "https://github.com/shipmonk-rnd/name-collision-detector/issues", + "source": "https://github.com/shipmonk-rnd/name-collision-detector/tree/master" + }, + "time": "2023-09-01T13:43:26+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.1",