diff --git a/README.md b/README.md index 9924920..9749943 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,10 @@ function doesAThing(array $data): int { #### SlevomatCodingStandard.Functions.StaticClosure #### SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure #### SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses +#### SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions + +PHPStorm can be configured with Editor -> General -> Auto Import: _Function_: `Prefer FQN` + #### SlevomatCodingStandard.TypeHints.DeclareStrictTypes #### SlevomatCodingStandard.TypeHints.ReturnTypeHint #### SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing diff --git a/composer.json b/composer.json index 60f20c4..ec4d4e8 100644 --- a/composer.json +++ b/composer.json @@ -4,18 +4,18 @@ "homepage": "https://github.com/previousnext/coding-standard", "keywords": ["drupal", "phpcs"], "require": { - "php": "^8.0", + "php": "^8.1", "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "drupal/coder": "^8.3.24", - "slevomat/coding-standard": "^8.13.2", - "squizlabs/php_codesniffer": "^3.7.1" + "slevomat/coding-standard": "^8.15.0", + "squizlabs/php_codesniffer": "^3.10.1" }, "require-dev": { - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9.4", - "phpstan/phpstan-deprecation-rules": "^1.1.1", - "phpstan/phpstan-strict-rules": "^1.4.4", - "phpunit/phpunit": "^9.5.27" + "phpstan/extension-installer": "^1.3.1", + "phpstan/phpstan": "^1.11.3", + "phpstan/phpstan-deprecation-rules": "^1.2.0", + "phpstan/phpstan-strict-rules": "^1.6.0", + "phpunit/phpunit": "^9.6.19" }, "license": "MIT", "autoload": { diff --git a/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php b/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php new file mode 100644 index 0000000..e3bd05b --- /dev/null +++ b/tests/Sniffs/FullyQualifiedGlobalFunctionsTest.php @@ -0,0 +1,29 @@ +getErrorCount()); + self::assertSniffError($report, 7, FullyQualifiedGlobalFunctionsSniff::CODE_NON_FULLY_QUALIFIED); + } + + protected static function getSniffName(): string { + return 'SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions'; + } + +} diff --git a/tests/Sniffs/fixtures/FullyQualifiedGlobalFunctionsError.php b/tests/Sniffs/fixtures/FullyQualifiedGlobalFunctionsError.php new file mode 100644 index 0000000..e3d61a6 --- /dev/null +++ b/tests/Sniffs/fixtures/FullyQualifiedGlobalFunctionsError.php @@ -0,0 +1,7 @@ +