-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
… class prefixes
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Classes; | ||
|
||
/** | ||
* This is the extension interface to implement if you want to dynamically | ||
* add forbidden class prefixes to the ClassForbiddenNameCheck rule. | ||
* | ||
* The idea is that you want to report usages of classes that you're not supposed to use in application. | ||
* For example: Generated Doctrine proxies from their configured namespace. | ||
* | ||
* To register it in the configuration file use the `phpstan.forbiddenClassNamesExtension` service tag: | ||
* | ||
* ``` | ||
* services: | ||
* - | ||
* class: App\PHPStan\MyExtension | ||
* tags: | ||
* - phpstan.forbiddenClassNamesExtension | ||
* ``` | ||
* | ||
* @api | ||
*/ | ||
interface ForbiddenClassNameExtension | ||
{ | ||
|
||
public const EXTENSION_TAG = 'phpstan.forbiddenClassNamesExtension'; | ||
|
||
/** @return array<string, string> */ | ||
public function getClassPrefixes(): array; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Rules\Classes; | ||
|
||
use PHPStan\Php\PhpVersion; | ||
use PHPStan\Rules\ClassCaseSensitivityCheck; | ||
use PHPStan\Rules\Classes\InstantiationRule; | ||
use PHPStan\Rules\ClassForbiddenNameCheck; | ||
use PHPStan\Rules\ClassNameCheck; | ||
use PHPStan\Rules\FunctionCallParametersCheck; | ||
use PHPStan\Rules\NullsafeCheck; | ||
use PHPStan\Rules\PhpDoc\UnresolvableTypeHelper; | ||
use PHPStan\Rules\Properties\PropertyReflectionFinder; | ||
use PHPStan\Rules\Rule; | ||
use PHPStan\Rules\RuleLevelHelper; | ||
use PHPStan\Testing\RuleTestCase; | ||
use const PHP_VERSION_ID; | ||
|
||
/** | ||
* @extends RuleTestCase<InstantiationRule> | ||
*/ | ||
class ForbiddenNameCheckExtensionRuleTest extends RuleTestCase | ||
{ | ||
|
||
protected function getRule(): Rule | ||
{ | ||
$reflectionProvider = $this->createReflectionProvider(); | ||
return new InstantiationRule( | ||
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
Check failure on line 28 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.2, windows-latest)
|
||
$reflectionProvider, | ||
new FunctionCallParametersCheck(new RuleLevelHelper($reflectionProvider, true, false, true, false, false, true, false), new NullsafeCheck(), new PhpVersion(80000), new UnresolvableTypeHelper(), new PropertyReflectionFinder(), true, true, true, true, true), | ||
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
Check failure on line 30 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
|
||
new ClassNameCheck( | ||
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 31 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
|
||
new ClassCaseSensitivityCheck($reflectionProvider, true), | ||
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 32 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
|
||
new ClassForbiddenNameCheck(self::getContainer()), | ||
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.2)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.1)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, ubuntu-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan with result cache (8.3)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, ubuntu-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, ubuntu-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, ubuntu-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, ubuntu-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, ubuntu-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.2, windows-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.1, windows-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.3, windows-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.4, windows-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (8.0, windows-latest)
Check failure on line 33 in tests/PHPStan/Rules/Classes/ForbiddenNameCheckExtensionRuleTest.php GitHub Actions / PHPStan (7.3, windows-latest)
|
||
), | ||
); | ||
} | ||
|
||
public static function getAdditionalConfigFiles(): array | ||
{ | ||
return array_merge(parent::getAdditionalConfigFiles(), [ | ||
__DIR__ . '/data/forbidden-name-class-extension.neon', | ||
]); | ||
} | ||
|
||
public function testInternalClassFromExtensions():void { | ||
$this->analyse([__DIR__ . '/data/forbidden-name-class-extension.php'], [ | ||
[ | ||
'Referencing prefixed Doctrine class: App\GeneratedProxy\__CG__\App\TestDoctrineEntity.', | ||
31, | ||
'This is most likely unintentional. Did you mean to type \App\TestDoctrineEntity?' | ||
], | ||
[ | ||
'Referencing prefixed PHPStan class: _PHPStan_15755dag8c\TestPhpStanEntity.', | ||
32, | ||
'This is most likely unintentional. Did you mean to type \TestPhpStanEntity?' | ||
], | ||
]); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
services: | ||
- | ||
class: ForbiddenNameClassExtension\CGForbiddenNameClassExtension | ||
tags: | ||
- phpstan.forbiddenClassNamesExtension |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace App\GeneratedProxy\__CG__\App; | ||
|
||
class TestDoctrineEntity | ||
{ | ||
} | ||
|
||
namespace _PHPStan_15755dag8c; | ||
|
||
class TestPhpStanEntity | ||
{ | ||
} | ||
|
||
namespace ForbiddenNameClassExtension; | ||
|
||
use App\GeneratedProxy\__CG__\App\TestEntity; | ||
|
||
class CGForbiddenNameClassExtension implements \PHPStan\Classes\ForbiddenClassNameExtension | ||
{ | ||
|
||
public function getClassPrefixes(): array | ||
{ | ||
return [ | ||
'Doctrine' => 'App\GeneratedProxy\__CG__', | ||
]; | ||
} | ||
|
||
} | ||
|
||
$doctrineEntity = new \App\GeneratedProxy\__CG__\App\TestDoctrineEntity(); | ||
$phpStanEntity = new \_PHPStan_15755dag8c\TestPhpStanEntity(); |