From c1a3132b4c74d5120e80dcd25c80c49f650a4140 Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Mon, 15 Sep 2025 16:52:56 +0200 Subject: [PATCH] Bump dependency for moodle-cs --- composer.json | 2 +- composer.lock | 62 +-- vendor/autoload.php | 5 +- vendor/bin/phpcbf | 7 +- vendor/bin/phpcs | 7 +- vendor/composer/InstalledVersions.php | 38 +- vendor/composer/autoload_classmap.php | 44 -- vendor/composer/autoload_static.php | 52 +- vendor/composer/installed.json | 56 +- vendor/composer/installed.php | 30 +- vendor/composer/platform_check.php | 5 +- .../ValidFunctionNameSniff.php | 16 +- .../ValidVariableNameSniff.php | 33 +- vendor/moodlehq/moodle-cs/moodle/ruleset.xml | 6 +- vendor/phpcsstandards/phpcsextra/CHANGELOG.md | 18 + vendor/phpcsstandards/phpcsextra/README.md | 8 +- .../Sniffs/PHP/NoFQNTrueFalseNullSniff.php | 35 +- .../phpcsstandards/phpcsextra/composer.json | 4 +- vendor/phpcsstandards/phpcsutils/CHANGELOG.md | 57 ++ .../AbstractArrayDeclarationSniff.php | 22 +- .../PHPCSUtils/BackCompat/BCFile.php | 26 +- .../PHPCSUtils/BackCompat/BCTokens.php | 2 +- .../PHPCSUtils/TestUtils/ConfigDouble.php | 6 +- .../TestUtils/UtilityMethodTestCase.php | 12 +- .../PHPCSUtils/Tokens/Collections.php | 1 + .../PHPCSUtils/Utils/ObjectDeclarations.php | 2 +- .../PHPCSUtils/Utils/TypeString.php | 9 +- .../phpcsutils/PHPCSUtils/Utils/Variables.php | 6 + vendor/phpcsstandards/phpcsutils/README.md | 4 +- .../phpcsstandards/phpcsutils/composer.json | 2 +- vendor/squizlabs/php_codesniffer/CHANGELOG.md | 99 +++- vendor/squizlabs/php_codesniffer/README.md | 2 +- .../squizlabs/php_codesniffer/src/Config.php | 2 +- .../php_codesniffer/src/Files/File.php | 11 + .../php_codesniffer/src/Files/FileList.php | 7 +- .../squizlabs/php_codesniffer/src/Ruleset.php | 2 +- .../squizlabs/php_codesniffer/src/Runner.php | 5 +- .../UnconditionalIfStatementSniff.php | 2 +- .../DisallowYodaConditionsSniff.php | 2 + .../Sniffs/PHP/LowerCaseConstantSniff.php | 2 + .../Generic/Sniffs/PHP/SyntaxSniff.php | 37 +- .../UnconditionalIfStatementUnitTest.1.inc | 5 + .../UnconditionalIfStatementUnitTest.php | 8 +- .../DisallowYodaConditionsUnitTest.inc | 19 +- .../DisallowYodaConditionsUnitTest.php | 4 + .../Tests/PHP/LowerCaseConstantUnitTest.1.inc | 9 + .../PHP/LowerCaseConstantUnitTest.1.inc.fixed | 9 + .../Tests/PHP/LowerCaseConstantUnitTest.php | 3 + .../Generic/Tests/PHP/SyntaxUnitTest.php | 107 ++++ .../Tests/PHP/UpperCaseConstantUnitTest.inc | 9 + .../PHP/UpperCaseConstantUnitTest.inc.fixed | 9 + .../Tests/PHP/UpperCaseConstantUnitTest.php | 3 + .../Functions/ValidDefaultValueSniff.php | 7 +- .../WhiteSpace/ObjectOperatorIndentSniff.php | 5 +- .../Functions/ValidDefaultValueUnitTest.1.inc | 4 + .../Functions/ValidDefaultValueUnitTest.php | 1 + .../ObjectOperatorIndentUnitTest.inc | 11 + .../ObjectOperatorIndentUnitTest.inc.fixed | 11 + .../ObjectOperatorIndentUnitTest.php | 1 + .../Classes/PropertyDeclarationSniff.php | 26 + .../SwitchDeclarationSniff.php | 10 +- .../Classes/PropertyDeclarationUnitTest.inc | 8 + .../PropertyDeclarationUnitTest.inc.fixed | 8 + .../Classes/PropertyDeclarationUnitTest.php | 4 + .../SwitchDeclarationUnitTest.inc | 13 + .../SwitchDeclarationUnitTest.inc.fixed | 13 + .../SwitchDeclarationUnitTest.php | 5 + .../Commenting/FunctionCommentSniff.php | 2 +- .../Commenting/VariableCommentSniff.php | 1 + .../Sniffs/PHP/NonExecutableCodeSniff.php | 5 + .../WhiteSpace/MemberVarSpacingSniff.php | 1 + .../LowercaseClassKeywordsUnitTest.inc | 4 + .../LowercaseClassKeywordsUnitTest.inc.fixed | 4 + .../LowercaseClassKeywordsUnitTest.php | 2 + .../Tests/Commenting/BlockCommentUnitTest.inc | 7 + .../Commenting/BlockCommentUnitTest.inc.fixed | 7 + .../DocCommentAlignmentUnitTest.inc | 13 + .../DocCommentAlignmentUnitTest.inc.fixed | 13 + .../DocCommentAlignmentUnitTest.php | 7 + .../Commenting/FunctionCommentUnitTest.inc | 27 + .../FunctionCommentUnitTest.inc.fixed | 27 + .../Commenting/FunctionCommentUnitTest.php | 3 + .../Commenting/VariableCommentUnitTest.inc | 7 + .../VariableCommentUnitTest.inc.fixed | 7 + .../ComparisonOperatorUsageUnitTest.inc | 6 + .../Tests/PHP/NonExecutableCodeUnitTest.1.inc | 18 +- .../Tests/PHP/NonExecutableCodeUnitTest.php | 2 + .../Tests/Scope/MemberVarScopeUnitTest.inc | 4 + .../Tests/Scope/MemberVarScopeUnitTest.php | 1 + .../WhiteSpace/MemberVarSpacingUnitTest.1.inc | 13 + .../MemberVarSpacingUnitTest.1.inc.fixed | 15 + .../WhiteSpace/MemberVarSpacingUnitTest.php | 2 + .../ScopeKeywordSpacingUnitTest.1.inc | 5 + .../ScopeKeywordSpacingUnitTest.1.inc.fixed | 5 + .../ScopeKeywordSpacingUnitTest.php | 1 + .../php_codesniffer/src/Tokenizers/PHP.php | 125 ++++- .../php_codesniffer/src/Util/Common.php | 2 +- .../php_codesniffer/tests/ConfigDouble.php | 7 +- .../Config/AbstractRealConfigTestCase.php | 4 +- .../Files/File/FindExtendedClassNameTest.inc | 6 + .../Files/File/FindExtendedClassNameTest.php | 8 + .../Files/File/FindStartOfStatementTest.inc | 4 + .../Files/File/FindStartOfStatementTest.php | 6 + .../Files/File/GetMemberPropertiesTest.inc | 24 + .../Files/File/GetMemberPropertiesTest.php | 260 +++++++++ .../tests/Core/Filters/GitModifiedTest.php | 2 +- .../tests/Core/Filters/GitStagedTest.php | 2 +- .../Ruleset/DisplayCachedMessagesTest.php | 8 +- .../Fixtures/PropertyTypeHandlingInline.inc | 8 +- .../Ruleset/PopulateTokenListenersTest.php | 4 +- .../Core/Ruleset/PropertyTypeHandlingTest.php | 2 + .../Core/Ruleset/PropertyTypeHandlingTest.xml | 6 +- .../Tokenizers/AbstractTokenizerTestCase.php | 4 +- .../Core/Tokenizers/PHP/BitwiseOrTest.inc | 11 +- .../Core/Tokenizers/PHP/BitwiseOrTest.php | 3 + .../PHP/ContextSensitiveKeywordsTest.inc | 5 + .../PHP/ContextSensitiveKeywordsTest.php | 8 + .../Core/Tokenizers/PHP/DNFTypesTest.inc | 6 + .../Core/Tokenizers/PHP/DNFTypesTest.php | 7 + .../Core/Tokenizers/PHP/EnumCaseTest.inc | 2 + .../Core/Tokenizers/PHP/EnumCaseTest.php | 1 + .../Core/Tokenizers/PHP/ExitKeywordTest.inc | 106 ++++ .../Core/Tokenizers/PHP/ExitKeywordTest.php | 229 ++++++++ .../PHP/NamedFunctionCallArgumentsTest.inc | 20 +- .../PHP/NamedFunctionCallArgumentsTest.php | 30 +- .../PHP/NullableVsInlineThenTest.inc | 8 +- .../PHP/NullableVsInlineThenTest.php | 4 +- .../PHP/OtherContextSensitiveKeywordsTest.inc | 24 +- .../PHP/OtherContextSensitiveKeywordsTest.php | 34 +- .../Core/Tokenizers/PHP/ShortArrayTest.inc | 17 + .../Core/Tokenizers/PHP/ShortArrayTest.php | 51 +- .../Tokenizers/PHP/TypeIntersectionTest.inc | 8 +- .../Tokenizers/PHP/TypeIntersectionTest.php | 2 + .../PHP/UndoNamespacedNameSingleTokenTest.inc | 55 +- .../PHP/UndoNamespacedNameSingleTokenTest.php | 523 ++++++++++++++++++ ...curseScopeMapCaseKeywordConditionsTest.inc | 2 + ...curseScopeMapCaseKeywordConditionsTest.php | 1 + .../Core/Util/Common/IsCamelCapsTest.php | 462 ++++++++++++++-- .../tests/Core/Util/Help/HelpTest.php | 139 +++-- .../Fixtures/ClassOneWithoutStyleError.inc | 18 + .../Fixtures/ClassTwoWithoutStyleError.inc | 20 + .../EndToEnd/Fixtures/ClassWithStyleError.inc | 22 + .../tests/EndToEnd/Fixtures/endtoend.xml.dist | 13 + .../tests/EndToEnd/phpcbf_test.sh | 38 ++ .../tests/EndToEnd/phpcs_test.sh | 28 + 145 files changed, 3137 insertions(+), 511 deletions(-) create mode 100644 vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.inc create mode 100644 vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.php create mode 100644 vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc create mode 100644 vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc create mode 100644 vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/ClassWithStyleError.inc create mode 100644 vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/endtoend.xml.dist create mode 100644 vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcbf_test.sh create mode 100644 vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcs_test.sh diff --git a/composer.json b/composer.json index a4ef0881..9d49e38c 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "GPL-3.0-or-later", "require": { "php": ">=7.4", - "moodlehq/moodle-cs": "v3.5.2", + "moodlehq/moodle-cs": "v3.6.0", "phpcompatibility/php-compatibility": "dev-develop#96072c30" }, "config": { diff --git a/composer.lock b/composer.lock index be3b911f..ac510109 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": "b6e79bfe877fa81e5ad87163adb3a2f8", + "content-hash": "420c79c66ff432fb32303af872fa2033", "packages": [ { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -104,16 +104,16 @@ }, { "name": "moodlehq/moodle-cs", - "version": "v3.5.2", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/moodlehq/moodle-cs.git", - "reference": "0d08e2161f7a3cf682ebcf3ce8dae43549ef197f" + "reference": "9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/moodlehq/moodle-cs/zipball/0d08e2161f7a3cf682ebcf3ce8dae43549ef197f", - "reference": "0d08e2161f7a3cf682ebcf3ce8dae43549ef197f", + "url": "https://api.github.com/repos/moodlehq/moodle-cs/zipball/9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e", + "reference": "9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e", "shasum": "" }, "require": { @@ -170,7 +170,7 @@ "source": "https://github.com/moodlehq/moodle-cs", "wiki": "https://github.com/moodlehq/moodle-cs/wiki" }, - "time": "2025-08-14T01:25:29+00:00" + "time": "2025-09-09T10:41:52+00:00" }, { "name": "phpcompatibility/php-compatibility", @@ -188,8 +188,8 @@ }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.1.0", - "squizlabs/php_codesniffer": "^3.13.0" + "phpcsstandards/phpcsutils": "^1.1.2", + "squizlabs/php_codesniffer": "^3.13.3 || ^4.0" }, "replace": { "wimg/php-compatibility": "*" @@ -197,10 +197,10 @@ "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0.0", "php-parallel-lint/php-parallel-lint": "^1.4.0", - "phpcsstandards/phpcsdevcs": "^1.1.3", - "phpcsstandards/phpcsdevtools": "^1.2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4 || ^10.1.0", - "yoast/phpunit-polyfills": "^1.0.5 || ^2.0.0" + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.3", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4 || ^10.5.32 || ^11.3.3", + "yoast/phpunit-polyfills": "^1.1.5 || ^2.0.5 || ^3.1.0" }, "suggest": { "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." @@ -264,26 +264,26 @@ "type": "thanks_dev" } ], - "time": "2025-07-06T15:59:37+00:00" + "time": "2025-09-09T21:00:45+00:00" }, { "name": "phpcsstandards/phpcsextra", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca" + "reference": "882b8c947ada27eb002870fe77fee9ce0a454cdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/fa4b8d051e278072928e32d817456a7fdb57b6ca", - "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/882b8c947ada27eb002870fe77fee9ce0a454cdb", + "reference": "882b8c947ada27eb002870fe77fee9ce0a454cdb", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.1.0", - "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" + "phpcsstandards/phpcsutils": "^1.1.2", + "squizlabs/php_codesniffer": "^3.13.4 || ^4.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0", @@ -346,26 +346,26 @@ "type": "thanks_dev" } ], - "time": "2025-06-14T07:40:39+00:00" + "time": "2025-09-05T06:54:52+00:00" }, { "name": "phpcsstandards/phpcsutils", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "65355670ac17c34cd235cf9d3ceae1b9252c4dad" + "reference": "b22b59e3d9ec8fe4953e42c7d59117c6eae70eae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/65355670ac17c34cd235cf9d3ceae1b9252c4dad", - "reference": "65355670ac17c34cd235cf9d3ceae1b9252c4dad", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/b22b59e3d9ec8fe4953e42c7d59117c6eae70eae", + "reference": "b22b59e3d9ec8fe4953e42c7d59117c6eae70eae", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" + "squizlabs/php_codesniffer": "^3.13.3 || ^4.0" }, "require-dev": { "ext-filter": "*", @@ -439,20 +439,20 @@ "type": "thanks_dev" } ], - "time": "2025-06-12T04:32:33+00:00" + "time": "2025-09-05T00:00:03+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.2", + "version": "3.13.4", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c" + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119", + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119", "shasum": "" }, "require": { @@ -523,7 +523,7 @@ "type": "thanks_dev" } ], - "time": "2025-06-17T22:17:01+00:00" + "time": "2025-09-05T05:47:09+00:00" } ], "packages-dev": [], diff --git a/vendor/autoload.php b/vendor/autoload.php index e6b418ae..6fb57cb2 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -14,10 +14,7 @@ echo $err; } } - trigger_error( - $err, - E_USER_ERROR - ); + throw new RuntimeException($err); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/vendor/bin/phpcbf b/vendor/bin/phpcbf index 1c0c79c4..a418134f 100755 --- a/vendor/bin/phpcbf +++ b/vendor/bin/phpcbf @@ -24,15 +24,14 @@ if (PHP_VERSION_ID < 80000) { { private $handle; private $position; - private $realpath; public function stream_open($path, $mode, $options, &$opened_path) { // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution $opened_path = substr($path, 17); - $this->realpath = realpath($opened_path) ?: $opened_path; - $opened_path = $this->realpath; - $this->handle = fopen($this->realpath, $mode); + $realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $realpath; + $this->handle = fopen($realpath, $mode); $this->position = 0; return (bool) $this->handle; diff --git a/vendor/bin/phpcs b/vendor/bin/phpcs index 04e658cf..6cb1e7fa 100755 --- a/vendor/bin/phpcs +++ b/vendor/bin/phpcs @@ -24,15 +24,14 @@ if (PHP_VERSION_ID < 80000) { { private $handle; private $position; - private $realpath; public function stream_open($path, $mode, $options, &$opened_path) { // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution $opened_path = substr($path, 17); - $this->realpath = realpath($opened_path) ?: $opened_path; - $opened_path = $this->realpath; - $this->handle = fopen($this->realpath, $mode); + $realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $realpath; + $this->handle = fopen($realpath, $mode); $this->position = 0; return (bool) $this->handle; diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 07b32ed6..2052022f 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -26,12 +26,23 @@ */ class InstalledVersions { + /** + * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to + * @internal + */ + private static $selfDir = null; + /** * @var mixed[]|null * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null */ private static $installed; + /** + * @var bool + */ + private static $installedIsLocalDir; + /** * @var bool|null */ @@ -309,6 +320,24 @@ public static function reload($data) { self::$installed = $data; self::$installedByVendor = array(); + + // when using reload, we disable the duplicate protection to ensure that self::$installed data is + // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, + // so we have to assume it does not, and that may result in duplicate data being returned when listing + // all installed packages for example + self::$installedIsLocalDir = false; + } + + /** + * @return string + */ + private static function getSelfDir() + { + if (self::$selfDir === null) { + self::$selfDir = strtr(__DIR__, '\\', '/'); + } + + return self::$selfDir; } /** @@ -325,7 +354,9 @@ private static function getInstalled() $copiedLocalDir = false; if (self::$canGetVendors) { + $selfDir = self::getSelfDir(); foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + $vendorDir = strtr($vendorDir, '\\', '/'); if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { @@ -333,11 +364,14 @@ private static function getInstalled() $required = require $vendorDir.'/composer/installed.php'; self::$installedByVendor[$vendorDir] = $required; $installed[] = $required; - if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { self::$installed = $required; - $copiedLocalDir = true; + self::$installedIsLocalDir = true; } } + if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { + $copiedLocalDir = true; + } } } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index fc5b7b42..3f37dfb9 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -7,50 +7,6 @@ return array( 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\CategorySniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/CategorySniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\ConstructorReturnSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/ConstructorReturnSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\DocblockDescriptionSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/DocblockDescriptionSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\FileExpectedTagsSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/FileExpectedTagsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\InlineCommentSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/InlineCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\MissingDocblockSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/MissingDocblockSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\PackageSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/PackageSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\TodoCommentSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/TodoCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\ValidTagsSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/ValidTagsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\VariableCommentSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/VariableCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\ControlStructures\\ControlSignatureSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/ControlStructures/ControlSignatureSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\BoilerplateCommentSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Files/BoilerplateCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\LangFilesOrderingSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Files/LangFilesOrderingSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\LineLengthSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Files/LineLengthSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\MoodleInternalSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Files/MoodleInternalSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\RequireLoginSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Files/RequireLoginSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Methods\\MethodDeclarationSpacingSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Methods/MethodDeclarationSpacingSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Namespaces\\NamespaceStatementSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Namespaces/NamespaceStatementSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\NamingConventions\\ValidFunctionNameSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\NamingConventions\\ValidVariableNameSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\AbstractTestCaseSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/AbstractTestCaseSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\ParentSetUpTearDownSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/ParentSetUpTearDownSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCaseCoversSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCaseCoversSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCaseNamesSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCaseNamesSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCaseProviderSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCaseProviderSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCasesAbstractSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCasesAbstractSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestClassesFinalSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestClassesFinalSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestReturnTypeSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestReturnTypeSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\DeprecatedFunctionsSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/DeprecatedFunctionsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\ForbiddenFunctionsSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/ForbiddenFunctionsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\ForbiddenGlobalUseSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/ForbiddenGlobalUseSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\ForbiddenTokensSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/ForbiddenTokensSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\IncludingFileSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/IncludingFileSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\MemberVarScopeSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/MemberVarScopeSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Strings\\ForbiddenStringsSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/Strings/ForbiddenStringsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\WhiteSpace\\SpaceAfterCommaSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/WhiteSpace/SpaceAfterCommaSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\WhiteSpace\\WhiteSpaceInStringsSniff' => $vendorDir . '/moodlehq/moodle-cs/moodle/Sniffs/WhiteSpace/WhiteSpaceInStringsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\Attributes' => $vendorDir . '/moodlehq/moodle-cs/moodle/Util/Attributes.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\Docblocks' => $vendorDir . '/moodlehq/moodle-cs/moodle/Util/Docblocks.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\MoodleUtil' => $vendorDir . '/moodlehq/moodle-cs/moodle/Util/MoodleUtil.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\NamespaceScopeUtil' => $vendorDir . '/moodlehq/moodle-cs/moodle/Util/NamespaceScopeUtil.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\TokenUtil' => $vendorDir . '/moodlehq/moodle-cs/moodle/Util/TokenUtil.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\TypeUtil' => $vendorDir . '/moodlehq/moodle-cs/moodle/Util/TypeUtil.php', - 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin' => $vendorDir . '/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php', 'PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php', 'PHPCSUtils\\BackCompat\\BCFile' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php', 'PHPCSUtils\\BackCompat\\BCTokens' => $vendorDir . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 093538ab..860fe196 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -7,22 +7,22 @@ class ComposerStaticInit574d662ebe51df2403d0358535dbfb75 { public static $prefixLengthsPsr4 = array ( - 'P' => + 'P' => array ( 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => 57, ), - 'M' => + 'M' => array ( 'MoodleHQ\\MoodleCS\\moodle\\' => 25, ), ); public static $prefixDirsPsr4 = array ( - 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => + 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => array ( 0 => __DIR__ . '/..' . '/dealerdirect/phpcodesniffer-composer-installer/src', ), - 'MoodleHQ\\MoodleCS\\moodle\\' => + 'MoodleHQ\\MoodleCS\\moodle\\' => array ( 0 => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle', ), @@ -30,50 +30,6 @@ class ComposerStaticInit574d662ebe51df2403d0358535dbfb75 public static $classMap = array ( 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\CategorySniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/CategorySniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\ConstructorReturnSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/ConstructorReturnSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\DocblockDescriptionSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/DocblockDescriptionSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\FileExpectedTagsSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/FileExpectedTagsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\InlineCommentSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/InlineCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\MissingDocblockSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/MissingDocblockSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\PackageSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/PackageSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\TodoCommentSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/TodoCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\ValidTagsSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/ValidTagsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Commenting\\VariableCommentSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Commenting/VariableCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\ControlStructures\\ControlSignatureSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/ControlStructures/ControlSignatureSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\BoilerplateCommentSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Files/BoilerplateCommentSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\LangFilesOrderingSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Files/LangFilesOrderingSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\LineLengthSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Files/LineLengthSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\MoodleInternalSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Files/MoodleInternalSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Files\\RequireLoginSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Files/RequireLoginSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Methods\\MethodDeclarationSpacingSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Methods/MethodDeclarationSpacingSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Namespaces\\NamespaceStatementSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Namespaces/NamespaceStatementSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\NamingConventions\\ValidFunctionNameSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\NamingConventions\\ValidVariableNameSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\AbstractTestCaseSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/AbstractTestCaseSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\ParentSetUpTearDownSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/ParentSetUpTearDownSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCaseCoversSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCaseCoversSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCaseNamesSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCaseNamesSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCaseProviderSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCaseProviderSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestCasesAbstractSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestCasesAbstractSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestClassesFinalSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestClassesFinalSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHPUnit\\TestReturnTypeSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHPUnit/TestReturnTypeSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\DeprecatedFunctionsSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/DeprecatedFunctionsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\ForbiddenFunctionsSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/ForbiddenFunctionsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\ForbiddenGlobalUseSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/ForbiddenGlobalUseSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\ForbiddenTokensSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/ForbiddenTokensSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\IncludingFileSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/IncludingFileSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\PHP\\MemberVarScopeSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/PHP/MemberVarScopeSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\Strings\\ForbiddenStringsSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/Strings/ForbiddenStringsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\WhiteSpace\\SpaceAfterCommaSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/WhiteSpace/SpaceAfterCommaSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Sniffs\\WhiteSpace\\WhiteSpaceInStringsSniff' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Sniffs/WhiteSpace/WhiteSpaceInStringsSniff.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\Attributes' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Util/Attributes.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\Docblocks' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Util/Docblocks.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\MoodleUtil' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Util/MoodleUtil.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\NamespaceScopeUtil' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Util/NamespaceScopeUtil.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\TokenUtil' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Util/TokenUtil.php', - 'MoodleHQ\\MoodleCS\\moodle\\Util\\TypeUtil' => __DIR__ . '/..' . '/moodlehq/moodle-cs/moodle/Util/TypeUtil.php', - 'PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin' => __DIR__ . '/..' . '/dealerdirect/phpcodesniffer-composer-installer/src/Plugin.php', 'PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php', 'PHPCSUtils\\BackCompat\\BCFile' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php', 'PHPCSUtils\\BackCompat\\BCTokens' => __DIR__ . '/..' . '/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 8f42e682..e6698b5e 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -101,17 +101,17 @@ }, { "name": "moodlehq/moodle-cs", - "version": "v3.5.2", - "version_normalized": "3.5.2.0", + "version": "v3.6.0", + "version_normalized": "3.6.0.0", "source": { "type": "git", "url": "https://github.com/moodlehq/moodle-cs.git", - "reference": "0d08e2161f7a3cf682ebcf3ce8dae43549ef197f" + "reference": "9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/moodlehq/moodle-cs/zipball/0d08e2161f7a3cf682ebcf3ce8dae43549ef197f", - "reference": "0d08e2161f7a3cf682ebcf3ce8dae43549ef197f", + "url": "https://api.github.com/repos/moodlehq/moodle-cs/zipball/9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e", + "reference": "9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e", "shasum": "" }, "require": { @@ -134,7 +134,7 @@ "sebastian/phpcpd": "^6.0", "thor-juhasz/phpunit-coverage-check": "^0.3.0" }, - "time": "2025-08-14T01:25:29+00:00", + "time": "2025-09-09T10:41:52+00:00", "type": "phpcodesniffer-standard", "installation-source": "dist", "autoload": { @@ -271,23 +271,23 @@ }, { "name": "phpcsstandards/phpcsextra", - "version": "1.4.0", - "version_normalized": "1.4.0.0", + "version": "1.4.1", + "version_normalized": "1.4.1.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", - "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca" + "reference": "882b8c947ada27eb002870fe77fee9ce0a454cdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/fa4b8d051e278072928e32d817456a7fdb57b6ca", - "reference": "fa4b8d051e278072928e32d817456a7fdb57b6ca", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/882b8c947ada27eb002870fe77fee9ce0a454cdb", + "reference": "882b8c947ada27eb002870fe77fee9ce0a454cdb", "shasum": "" }, "require": { "php": ">=5.4", - "phpcsstandards/phpcsutils": "^1.1.0", - "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" + "phpcsstandards/phpcsutils": "^1.1.2", + "squizlabs/php_codesniffer": "^3.13.4 || ^4.0" }, "require-dev": { "php-parallel-lint/php-console-highlighter": "^1.0", @@ -296,7 +296,7 @@ "phpcsstandards/phpcsdevtools": "^1.2.1", "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, - "time": "2025-06-14T07:40:39+00:00", + "time": "2025-09-05T06:54:52+00:00", "type": "phpcodesniffer-standard", "extra": { "branch-alias": { @@ -356,23 +356,23 @@ }, { "name": "phpcsstandards/phpcsutils", - "version": "1.1.0", - "version_normalized": "1.1.0.0", + "version": "1.1.2", + "version_normalized": "1.1.2.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", - "reference": "65355670ac17c34cd235cf9d3ceae1b9252c4dad" + "reference": "b22b59e3d9ec8fe4953e42c7d59117c6eae70eae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/65355670ac17c34cd235cf9d3ceae1b9252c4dad", - "reference": "65355670ac17c34cd235cf9d3ceae1b9252c4dad", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/b22b59e3d9ec8fe4953e42c7d59117c6eae70eae", + "reference": "b22b59e3d9ec8fe4953e42c7d59117c6eae70eae", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.13.0 || ^4.0" + "squizlabs/php_codesniffer": "^3.13.3 || ^4.0" }, "require-dev": { "ext-filter": "*", @@ -381,7 +381,7 @@ "phpcsstandards/phpcsdevcs": "^1.1.6", "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0 || ^3.0.0" }, - "time": "2025-06-12T04:32:33+00:00", + "time": "2025-09-05T00:00:03+00:00", "type": "phpcodesniffer-standard", "extra": { "branch-alias": { @@ -452,17 +452,17 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.2", - "version_normalized": "3.13.2.0", + "version": "3.13.4", + "version_normalized": "3.13.4.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c" + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119", + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119", "shasum": "" }, "require": { @@ -474,7 +474,7 @@ "require-dev": { "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, - "time": "2025-06-17T22:17:01+00:00", + "time": "2025-09-05T05:47:09+00:00", "bin": [ "bin/phpcbf", "bin/phpcs" @@ -538,6 +538,6 @@ "install-path": "../squizlabs/php_codesniffer" } ], - "dev": false, + "dev": true, "dev-package-names": [] } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 7d55ac95..5276309f 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,11 +3,11 @@ 'name' => 'moodlehq/local_codechecker', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '94c68a0aa5089bd7a579572916810e2c7239f2b5', + 'reference' => '594a0eb3715cb290601f76f0ea67ffd83b35adc6', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'dev' => false, + 'dev' => true, ), 'versions' => array( 'dealerdirect/phpcodesniffer-composer-installer' => array( @@ -22,16 +22,16 @@ 'moodlehq/local_codechecker' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '94c68a0aa5089bd7a579572916810e2c7239f2b5', + 'reference' => '594a0eb3715cb290601f76f0ea67ffd83b35adc6', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'moodlehq/moodle-cs' => array( - 'pretty_version' => 'v3.5.2', - 'version' => '3.5.2.0', - 'reference' => '0d08e2161f7a3cf682ebcf3ce8dae43549ef197f', + 'pretty_version' => 'v3.6.0', + 'version' => '3.6.0.0', + 'reference' => '9dd34ed27e4b14f6c43d4b3a6b7a6db6267bf87e', 'type' => 'phpcodesniffer-standard', 'install_path' => __DIR__ . '/../moodlehq/moodle-cs', 'aliases' => array(), @@ -55,27 +55,27 @@ 'dev_requirement' => false, ), 'phpcsstandards/phpcsextra' => array( - 'pretty_version' => '1.4.0', - 'version' => '1.4.0.0', - 'reference' => 'fa4b8d051e278072928e32d817456a7fdb57b6ca', + 'pretty_version' => '1.4.1', + 'version' => '1.4.1.0', + 'reference' => '882b8c947ada27eb002870fe77fee9ce0a454cdb', 'type' => 'phpcodesniffer-standard', 'install_path' => __DIR__ . '/../phpcsstandards/phpcsextra', 'aliases' => array(), 'dev_requirement' => false, ), 'phpcsstandards/phpcsutils' => array( - 'pretty_version' => '1.1.0', - 'version' => '1.1.0.0', - 'reference' => '65355670ac17c34cd235cf9d3ceae1b9252c4dad', + 'pretty_version' => '1.1.2', + 'version' => '1.1.2.0', + 'reference' => 'b22b59e3d9ec8fe4953e42c7d59117c6eae70eae', 'type' => 'phpcodesniffer-standard', 'install_path' => __DIR__ . '/../phpcsstandards/phpcsutils', 'aliases' => array(), 'dev_requirement' => false, ), 'squizlabs/php_codesniffer' => array( - 'pretty_version' => '3.13.2', - 'version' => '3.13.2.0', - 'reference' => '5b5e3821314f947dd040c70f7992a64eac89025c', + 'pretty_version' => '3.13.4', + 'version' => '3.13.4.0', + 'reference' => 'ad545ea9c1b7d270ce0fc9cbfb884161cd706119', 'type' => 'library', 'install_path' => __DIR__ . '/../squizlabs/php_codesniffer', 'aliases' => array(), diff --git a/vendor/composer/platform_check.php b/vendor/composer/platform_check.php index 580fa960..d2225c7d 100644 --- a/vendor/composer/platform_check.php +++ b/vendor/composer/platform_check.php @@ -19,8 +19,7 @@ echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; } } - trigger_error( - 'Composer detected issues in your platform: ' . implode(' ', $issues), - E_USER_ERROR + throw new \RuntimeException( + 'Composer detected issues in your platform: ' . implode(' ', $issues) ); } diff --git a/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php b/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php index 9c1350b6..b99c3a60 100644 --- a/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php +++ b/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidFunctionNameSniff.php @@ -127,13 +127,7 @@ protected function processTokenWithinScope(File $phpcsfile, $stackptr, $currscop '" must be in lower-case letters only'; } - $fix = $phpcsfile->addFixableError($error, $stackptr + 2, 'LowercaseMethod'); - if ($fix === true) { - $phpcsfile->fixer->beginChangeset(); - $tokens = $phpcsfile->getTokens(); - $phpcsfile->fixer->replaceToken($stackptr + 2, strtolower($tokens[$stackptr + 2]['content'])); - $phpcsfile->fixer->endChangeset(); - } + $phpcsfile->addError($error, $stackptr + 2, 'LowercaseMethod'); return; } @@ -167,13 +161,7 @@ protected function processTokenOutsideScope(File $phpcsfile, $stackptr) { if (preg_match('/[A-Z]+/', $functionname)) { $error = "function name \"$functionname\" must be lower-case letters only"; - $fix = $phpcsfile->addFixableError($error, $stackptr, 'LowercaseFunction'); - if ($fix === true) { - $phpcsfile->fixer->beginChangeset(); - $tokens = $phpcsfile->getTokens(); - $phpcsfile->fixer->replaceToken($stackptr + 2, strtolower($tokens[$stackptr + 2]['content'])); - $phpcsfile->fixer->endChangeset(); - } + $phpcsfile->addError($error, $stackptr, 'LowercaseFunction'); return; } diff --git a/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php b/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php index e6727016..4c6cda78 100644 --- a/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php +++ b/vendor/moodlehq/moodle-cs/moodle/Sniffs/NamingConventions/ValidVariableNameSniff.php @@ -85,24 +85,14 @@ protected function processMemberVar(File $phpcsfile, $stackptr) { if (preg_match('/[A-Z]+/', $membername)) { $error = "Member variable \"$membername\" must be all lower-case"; - $fix = $phpcsfile->addFixableError($error, $stackptr, 'MemberNameUnderscore'); - if ($fix === true) { - $phpcsfile->fixer->beginChangeset(); - $phpcsfile->fixer->replaceToken($stackptr, strtolower($tokens[$stackptr]['content'])); - $phpcsfile->fixer->endChangeset(); - } + $phpcsfile->addError($error, $stackptr, 'MemberNameUnderscore'); } // Find underscores in variable names (accepting $_foo for private vars). $pos = strpos($membername, '_'); if ($pos > 1) { $error = "Member variable \"$membername\" must not contain underscores."; - $fix = $phpcsfile->addFixableError($error, $stackptr, 'MemberNameUnderscore'); - if ($fix === true) { - $phpcsfile->fixer->beginChangeset(); - $phpcsfile->fixer->replaceToken($stackptr, str_replace('_', '', $tokens[$stackptr]['content'])); - $phpcsfile->fixer->endChangeset(); - } + $phpcsfile->addError($error, $stackptr, 'MemberNameUnderscore'); } // Must not be preceded by 'var' keyword. @@ -168,27 +158,12 @@ protected function processVariableInString(File $phpcsfile, $stackptr) { private function validateMoodleVariableName($varname, File $phpcsfile, $stackptr) { if (preg_match('/[A-Z]+/', $varname) && !in_array($varname, self::$allowedglobals)) { $error = "Variable \"$varname\" must be all lower-case"; - $fix = $phpcsfile->addFixableError($error, $stackptr, 'VariableNameLowerCase'); - if ($fix === true) { - $phpcsfile->fixer->beginChangeset(); - $tokens = $phpcsfile->getTokens(); - $phpcsfile->fixer->replaceToken( - $stackptr, - str_replace('$' . $varname, '$' . strtolower($varname), $tokens[$stackptr]['content']) - ); - $phpcsfile->fixer->endChangeset(); - } + $phpcsfile->addError($error, $stackptr, 'VariableNameLowerCase'); } if (strpos($varname, '_') !== false && !in_array($varname, self::$allowedglobals)) { $error = "Variable \"$varname\" must not contain underscores."; - $fix = $phpcsfile->addFixableError($error, $stackptr, 'VariableNameUnderscore'); - if ($fix === true) { - $phpcsfile->fixer->beginChangeset(); - $tokens = $phpcsfile->getTokens(); - $phpcsfile->fixer->replaceToken($stackptr, str_replace('_', '', $tokens[$stackptr]['content'])); - $phpcsfile->fixer->endChangeset(); - } + $phpcsfile->addError($error, $stackptr, 'VariableNameUnderscore'); } } } diff --git a/vendor/moodlehq/moodle-cs/moodle/ruleset.xml b/vendor/moodlehq/moodle-cs/moodle/ruleset.xml index 0ff0774e..ed2b2fce 100644 --- a/vendor/moodlehq/moodle-cs/moodle/ruleset.xml +++ b/vendor/moodlehq/moodle-cs/moodle/ruleset.xml @@ -83,18 +83,18 @@ - - + + + - diff --git a/vendor/phpcsstandards/phpcsextra/CHANGELOG.md b/vendor/phpcsstandards/phpcsextra/CHANGELOG.md index 4718d506..6f8280c7 100644 --- a/vendor/phpcsstandards/phpcsextra/CHANGELOG.md +++ b/vendor/phpcsstandards/phpcsextra/CHANGELOG.md @@ -14,6 +14,23 @@ This projects adheres to [Keep a CHANGELOG](https://keepachangelog.com/) and use _Nothing yet._ +## [1.4.1] - 2025-09-05 + +### Changed + +#### Other + +* Various housekeeping. + + +### Fixed + +#### Universal + +* `Universal.PHP.NoFQNTrueFalseNull`: fix breakage due to upstream change in tokenization. [#375] + +[#375]: https://github.com/PHPCSStandards/PHPCSExtra/pull/375 + ## [1.4.0] - 2025-06-14 @@ -662,6 +679,7 @@ This initial alpha release contains the following sniffs: [php_version-config]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version [Unreleased]: https://github.com/PHPCSStandards/PHPCSExtra/compare/stable...HEAD +[1.4.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.4.0...1.4.1 [1.4.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.3.1...1.4.0 [1.3.1]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.3.0...1.3.1 [1.3.0]: https://github.com/PHPCSStandards/PHPCSExtra/compare/1.2.1...1.3.0 diff --git a/vendor/phpcsstandards/phpcsextra/README.md b/vendor/phpcsstandards/phpcsextra/README.md index 8b6b42b9..904691d9 100644 --- a/vendor/phpcsstandards/phpcsextra/README.md +++ b/vendor/phpcsstandards/phpcsextra/README.md @@ -43,8 +43,8 @@ PHPCSExtra is a collection of sniffs and standards for use with [PHP_CodeSniffer ## Minimum Requirements * PHP 5.4 or higher. -* [PHP_CodeSniffer][phpcs-gh] version **3.13.0** or higher. -* [PHPCSUtils][phpcsutils-gh] version **1.1.0** or higher. +* [PHP_CodeSniffer][phpcs-gh] version **3.13.4** or higher. +* [PHPCSUtils][phpcsutils-gh] version **1.1.2** or higher. ## Installation @@ -58,7 +58,7 @@ Installing via Composer is highly recommended. Run the following from the root of your project: ```bash composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true -composer require --dev phpcsstandards/phpcsextra:"^1.2.0" +composer require --dev phpcsstandards/phpcsextra:"^1.3.0" ``` ### Composer Global Installation @@ -66,7 +66,7 @@ composer require --dev phpcsstandards/phpcsextra:"^1.2.0" Alternatively, you may want to install this standard globally: ```bash composer global config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true -composer global require --dev phpcsstandards/phpcsextra:"^1.2.0" +composer global require --dev phpcsstandards/phpcsextra:"^1.3.0" ``` ### Updating to a newer version diff --git a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/NoFQNTrueFalseNullSniff.php b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/NoFQNTrueFalseNullSniff.php index e9354b8d..e46c9030 100644 --- a/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/NoFQNTrueFalseNullSniff.php +++ b/vendor/phpcsstandards/phpcsextra/Universal/Sniffs/PHP/NoFQNTrueFalseNullSniff.php @@ -10,6 +10,7 @@ namespace PHPCSExtra\Universal\Sniffs\PHP; +use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; use PHP_CodeSniffer\Util\Tokens; @@ -31,18 +32,17 @@ final class NoFQNTrueFalseNullSniff implements Sniff */ public function register() { - return [ - // PHPCS 3.x on PHP < 8.0. + $targets = [ \T_TRUE, \T_FALSE, \T_NULL, + ]; - // PHPCS 3.x on PHP >= 8.0. - \T_STRING, + if (\version_compare(Config::VERSION, '4.0.0', '>=') === true) { + $targets[] = \T_NS_SEPARATOR; + } - // PHPCS 4.x. - \T_NAME_FULLY_QUALIFIED, - ]; + return $targets; } /** @@ -62,17 +62,21 @@ public function process(File $phpcsFile, $stackPtr) $content = $tokens[$stackPtr]['content']; $contentLC = \strtolower($content); - if ($tokens[$stackPtr]['code'] === \T_NAME_FULLY_QUALIFIED) { + if ($contentLC === '\true' || $contentLC === '\false' || $contentLC === '\null') { // PHPCS 4.x. - if ($contentLC !== '\true' && $contentLC !== '\false' && $contentLC !== '\null') { + } elseif ($tokens[$stackPtr]['code'] === \T_NS_SEPARATOR) { + // PHPCS 4.x for code which is a parse error on PHP 8.0+. + $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); + if ($tokens[$next]['code'] !== \T_STRING) { return; } - } else { - // PHPCS 3.x. - if ($contentLC !== 'true' && $contentLC !== 'false' && $contentLC !== 'null') { + + $nextContentLC = \strtolower($tokens[$next]['content']); + if ($nextContentLC !== 'true' && $nextContentLC !== 'false' && $nextContentLC !== 'null') { return; } - + } else { + // PHPCS 3.x. $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); if ($tokens[$prev]['code'] !== \T_NS_SEPARATOR) { return; @@ -97,9 +101,12 @@ public function process(File $phpcsFile, $stackPtr) ); if ($fix === true) { - if ($tokens[$stackPtr]['code'] === \T_NAME_FULLY_QUALIFIED) { + if ($contentLC === '\true' || $contentLC === '\false' || $contentLC === '\null') { // PHPCS 4.x. $phpcsFile->fixer->replaceToken($stackPtr, \ltrim($tokens[$stackPtr]['content'], '\\')); + } elseif ($tokens[$stackPtr]['code'] === \T_NS_SEPARATOR) { + // PHPCS 4.x for code which is a parse error on PHP 8.0+. + $phpcsFile->fixer->replaceToken($stackPtr, ''); } else { // PHPCS 3.x. $phpcsFile->fixer->replaceToken($prev, ''); diff --git a/vendor/phpcsstandards/phpcsextra/composer.json b/vendor/phpcsstandards/phpcsextra/composer.json index 4b986cb0..599d827d 100644 --- a/vendor/phpcsstandards/phpcsextra/composer.json +++ b/vendor/phpcsstandards/phpcsextra/composer.json @@ -22,8 +22,8 @@ }, "require" : { "php" : ">=5.4", - "squizlabs/php_codesniffer" : "^3.13.0 || ^4.0", - "phpcsstandards/phpcsutils" : "^1.1.0" + "squizlabs/php_codesniffer" : "^3.13.4 || ^4.0", + "phpcsstandards/phpcsutils" : "^1.1.2" }, "require-dev" : { "php-parallel-lint/php-parallel-lint": "^1.4.0", diff --git a/vendor/phpcsstandards/phpcsutils/CHANGELOG.md b/vendor/phpcsstandards/phpcsutils/CHANGELOG.md index fb1723a8..837aecde 100644 --- a/vendor/phpcsstandards/phpcsutils/CHANGELOG.md +++ b/vendor/phpcsstandards/phpcsutils/CHANGELOG.md @@ -10,6 +10,61 @@ This projects adheres to [Keep a CHANGELOG](https://keepachangelog.com/) and use _Nothing yet._ +## [1.1.2] - 2025-09-05 + +### Added + +#### PHPCS BackCompat + +* `BCFile::getMemberProperties()`: sync with PHPCS 3.13.3 - support for PHP 8.4 abstract properties. [#698] + +#### Utils + +* `Variables::getMemberProperties()`: support for PHP 8.4 abstract properties. [#698] + +### Changed + +#### Utils + +* `TypeString::normalizeCase()` will now also normalize a fully qualified `true`, `false` or `null` type to unqualified. [#702] + +#### Other + +* Dropped support for [PHP_CodeSniffer] < 3.13.3. [#698] + Please ensure you run `composer update phpcsstandards/phpcsutils --with-dependencies` to benefit from this. +* Various housekeeping. + +### Fixed + +#### Utils + +* `TypeString::isNullable()`: a type string with a fully qualified `null` was not recognized as nullable. [#702] +* `TypeString::isKeyword()`: a fully qualified `true`, `false` or `null` type was not recognized as a keyword type. [#702] + +_Note: using fully qualified `true`, `false` or `null` in a typestring is not allowed by PHP. Even so, the `TypeString` utility will now handle this in a parse error tolerant manner._ + +[#698]: https://github.com/PHPCSStandards/PHPCSUtils/pull/698 +[#702]: https://github.com/PHPCSStandards/PHPCSUtils/pull/702 + + +## [1.1.1] - 2025-08-10 + +### Changed + +#### TestUtils + +* The [`PHPCSUtils\TestUtils\UtilityMethodTestCase`][`UtilityMethodTestCase`] now uses the PHP_CodeSniffer `LocalFile` instead of the `DummyFile` class under the hood. [#692] + +### Fixed + +#### TestUtils + +* Prevent PHP 8.5 deprecation notices for `Reflection*::setAccessible()` in the [`PHPCSUtils\TestUtils\UtilityMethodTestCase`][`UtilityMethodTestCase`] and the [`PHPCSUtils\TestUtils\ConfigDouble`][`ConfigDouble`] classes. [#695] + +[#692]: https://github.com/PHPCSStandards/PHPCSUtils/pull/692 +[#695]: https://github.com/PHPCSStandards/PHPCSUtils/pull/695 + + ## [1.1.0] - 2025-06-12 ### Added @@ -1221,6 +1276,8 @@ This initial alpha release contains the following utility classes: [Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/stable...HEAD +[1.1.2]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.1...1.1.2 +[1.1.1]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.0...1.1.1 [1.1.0]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.12...1.1.0 [1.0.12]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.11...1.0.12 [1.0.11]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.10...1.0.11 diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php index 1480d25e..2e08b4da 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/AbstractSniffs/AbstractArrayDeclarationSniff.php @@ -478,31 +478,15 @@ public function getActualArrayKey(File $phpcsFile, $startPtr, $endPtr) continue; } - // Handle FQN true/false/null. - if ($this->tokens[$i]['code'] === \T_NAME_FULLY_QUALIFIED) { - $compareReadyKeyword = \strtolower($this->tokens[$i]['content']); - if ($compareReadyKeyword === '\true' - || $compareReadyKeyword === '\false' - || $compareReadyKeyword === '\null' - ) { - // FQN true/false/null on PHPCS 4.x. This can be handled. - $content .= $this->tokens[$i]['content']; - continue; - } - } elseif ($this->tokens[$i]['code'] === \T_NS_SEPARATOR) { - // PHPCS 3.x. + // Handle FQN true/false/null for PHPCS 3.x. + if ($this->tokens[$i]['code'] === \T_NS_SEPARATOR) { $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), null, true); $nextNonEmptyLC = \strtolower($this->tokens[$nextNonEmpty]['content']); if ($nextNonEmpty !== false - // PHPCS 3.x with PHP < 8.0. && ($this->tokens[$nextNonEmpty]['code'] === \T_TRUE || $this->tokens[$nextNonEmpty]['code'] === \T_FALSE - || $this->tokens[$nextNonEmpty]['code'] === \T_NULL - // PHPCS 3.x with PHP >= 8.0 where the namespaced name tokenization has been undone. - || ($this->tokens[$nextNonEmpty]['code'] === \T_STRING - && ($nextNonEmptyLC === 'true' || $nextNonEmptyLC === 'false' || $nextNonEmptyLC === 'null'))) + || $this->tokens[$nextNonEmpty]['code'] === \T_NULL) ) { - // FQN true/false/null on PHPCS 3.x. This can be handled. $content .= $this->tokens[$nextNonEmpty]['content']; $i = $nextNonEmpty; continue; diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php index 4a786015..dfdd98c7 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCFile.php @@ -524,7 +524,7 @@ public static function getMethodParameters(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::getMethodProperties() Original source. * @see \PHPCSUtils\Utils\FunctionDeclarations::getProperties() PHPCSUtils native improved version. @@ -559,6 +559,7 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr) * 'is_static' => boolean, // TRUE if the static keyword was found. * 'is_readonly' => boolean, // TRUE if the readonly keyword was found. * 'is_final' => boolean, // TRUE if the final keyword was found. + * 'is_abstract' => boolean, // TRUE if the abstract keyword was found. * 'type' => string, // The type of the var (empty if no type specified). * 'type_token' => integer|false, // The stack pointer to the start of the type * // or FALSE if there is no type. @@ -573,6 +574,7 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. + * - PHPCS 3.13.3: support for PHP 8.4 abstract properties. * - PHPCS 4.0: properties in interfaces (PHP 8.4+) are accepted. * - PHPCS 4.0: will no longer throw a parse error warning. * @@ -580,6 +582,8 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr) * @see \PHPCSUtils\Utils\Variables::getMemberProperties() PHPCSUtils native improved version. * * @since 1.0.0 + * @since 1.1.0 Sync with PHPCS 4.0.0, remove parse error warning and support PHP 8.4 properties in interfaces. PHPCS(new)#991 + * @since 1.1.2 Sync with PHPCS 3.13.3, support for abstract properties. PHPCS(new)#xxx * * @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned. * @param int $stackPtr The position in the stack of the `T_VARIABLE` token to @@ -626,6 +630,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) T_VAR => T_VAR, T_READONLY => T_READONLY, T_FINAL => T_FINAL, + T_ABSTRACT => T_ABSTRACT, ]; $valid += Tokens::$scopeModifiers; @@ -637,6 +642,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) $isStatic = false; $isReadonly = false; $isFinal = false; + $isAbstract = false; $startOfStatement = $phpcsFile->findPrevious( [ @@ -684,6 +690,9 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) case T_FINAL: $isFinal = true; break; + case T_ABSTRACT: + $isAbstract = true; + break; } } @@ -728,6 +737,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) 'is_static' => $isStatic, 'is_readonly' => $isReadonly, 'is_final' => $isFinal, + 'is_abstract' => $isAbstract, 'type' => $type, 'type_token' => $typeToken, 'type_end_token' => $typeEndToken, @@ -751,7 +761,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 1.3.0. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::getClassProperties() Original source. * @see \PHPCSUtils\Utils\ObjectDeclarations::getClassProperties() PHPCSUtils native improved version. @@ -779,7 +789,7 @@ public static function getClassProperties(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::isReference() Original source. * @see \PHPCSUtils\Utils\Operators::isReference() PHPCSUtils native improved version. @@ -805,7 +815,7 @@ public static function isReference(File $phpcsFile, $stackPtr) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::getTokensAsString() Original source. * @see \PHPCSUtils\Utils\GetTokensAsString Related set of functions. @@ -834,7 +844,7 @@ public static function getTokensAsString(File $phpcsFile, $start, $length, $orig * * Changelog for the PHPCS native function: * - Introduced in PHPCS 2.1.0. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::findStartOfStatement() Original source. * @@ -858,7 +868,7 @@ public static function findStartOfStatement(File $phpcsFile, $start, $ignore = n * * Changelog for the PHPCS native function: * - Introduced in PHPCS 2.1.0. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::findEndOfStatement() Original source. * @@ -882,7 +892,7 @@ public static function findEndOfStatement(File $phpcsFile, $start, $ignore = nul * * Changelog for the PHPCS native function: * - Introduced in PHPCS 0.0.5. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::hasCondition() Original source. * @see \PHPCSUtils\Utils\Conditions::hasCondition() PHPCSUtils native alternative. @@ -907,7 +917,7 @@ public static function hasCondition(File $phpcsFile, $stackPtr, $types) * * Changelog for the PHPCS native function: * - Introduced in PHPCS 1.3.0. - * - The upstream method has received no significant updates since PHPCS 3.13.0. + * - The upstream method has received no significant updates since PHPCS 3.13.3. * * @see \PHP_CodeSniffer\Files\File::getCondition() Original source. * @see \PHPCSUtils\Utils\Conditions::getCondition() More versatile alternative. diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php index 49b8c155..68102588 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/BackCompat/BCTokens.php @@ -72,7 +72,7 @@ final class BCTokens /** * Handle calls to (undeclared) methods for token arrays which haven't received any - * changes since PHPCS 3.13.0. + * changes since PHPCS 3.13.3. * * @since 1.0.0 * diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/ConfigDouble.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/ConfigDouble.php index 2f84796a..1dcf06ac 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/ConfigDouble.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/ConfigDouble.php @@ -211,7 +211,7 @@ private function preventAutoDiscoveryScreenWidth() public function getStaticConfigProperty($name) { $property = new ReflectionProperty('PHP_CodeSniffer\Config', $name); - $property->setAccessible(true); + (\PHP_VERSION_ID < 80100) && $property->setAccessible(true); if ($name === 'overriddenDefaults' && \version_compare($this->phpcsVersion, '3.99.99', '>')) { return $property->getValue($this); @@ -236,7 +236,7 @@ public function getStaticConfigProperty($name) public function setStaticConfigProperty($name, $value) { $property = new ReflectionProperty('PHP_CodeSniffer\Config', $name); - $property->setAccessible(true); + (\PHP_VERSION_ID < 80100) && $property->setAccessible(true); if ($name === 'overriddenDefaults' && \version_compare($this->phpcsVersion, '3.99.99', '>')) { $property->setValue($this, $value); @@ -244,6 +244,6 @@ public function setStaticConfigProperty($name, $value) $property->setValue(null, $value); } - $property->setAccessible(false); + (\PHP_VERSION_ID < 80100) && $property->setAccessible(false); } } diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php index 4a02ca01..8871c421 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/TestUtils/UtilityMethodTestCase.php @@ -12,8 +12,8 @@ use PHP_CodeSniffer\Config; use PHP_CodeSniffer\Exceptions\TokenizerException; -use PHP_CodeSniffer\Files\DummyFile; use PHP_CodeSniffer\Files\File; +use PHP_CodeSniffer\Files\LocalFile; use PHP_CodeSniffer\Ruleset; use PHPCSUtils\BackCompat\Helper; use PHPCSUtils\Exceptions\TestFileNotFound; @@ -253,11 +253,7 @@ protected static function parseFile($caseFile, Ruleset $ruleset, Config $config) parent::fail("Test case file missing. Expected case file location: $caseFile"); } - // Make sure the file gets parsed correctly based on the file type. - $contents = \file_get_contents($caseFile); - $contents = 'phpcs_input_file: ' . $caseFile . \PHP_EOL . $contents; - - $file = new DummyFile($contents, $ruleset, $config); + $file = new LocalFile($caseFile, $ruleset, $config); // Only tokenize the file, do not process it. try { @@ -353,9 +349,9 @@ public static function resetTestFile() public static function setStaticConfigProperty($name, $value) { $property = new ReflectionProperty('PHP_CodeSniffer\Config', $name); - $property->setAccessible(true); + (\PHP_VERSION_ID < 80100) && $property->setAccessible(true); $property->setValue(null, $value); - $property->setAccessible(false); + (\PHP_VERSION_ID < 80100) && $property->setAccessible(false); } /** diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php index 5cfada12..43288eec 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Tokens/Collections.php @@ -478,6 +478,7 @@ final class Collections \T_VAR => \T_VAR, \T_READONLY => \T_READONLY, \T_FINAL => \T_FINAL, + \T_ABSTRACT => \T_ABSTRACT, ]; /** diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php index 3a579261..478fae32 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/ObjectDeclarations.php @@ -440,7 +440,7 @@ public static function getDeclaredEnumCases(File $phpcsFile, $stackPtr) * in the return value. * However, keep in mind that passing the stack pointer of such a property to the * {@see Variables::getMemberProperties()} method is not supported. - * - Interfaces and enums cannot contain properties. This method does not take this into + * - Interfaces (prior to PHP 8.4) and enums cannot contain properties. This method does not take this into * account to allow sniffs to flag this kind of incorrect PHP code. * * @since 1.1.0 diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TypeString.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TypeString.php index 1a5a6b15..0eab1cd7 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TypeString.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/TypeString.php @@ -129,7 +129,7 @@ public static function isKeyword($type) return false; } - $typeLC = \strtolower(\trim($type)); + $typeLC = \strtolower(\ltrim(\trim($type), '\\')); return isset(self::$keywordTypes[$typeLC]); } @@ -137,9 +137,12 @@ public static function isKeyword($type) * Normalize the case for a single type. * * - Types which are recognized PHP "keyword" types will be returned in lowercase. + * - Types which are recognized PHP "keyword" types and are incorrectly provided as fully qualified + * (typically: true/false/null) will be returned as unqualified. * - Class/Interface/Enum names will be returned in their original case. * * @since 1.1.0 + * @since 1.1.2 Will now also normalize (illegal) FQN true/false/null to unqualified. * * @param string $type Type to normalize the case for. * @@ -152,7 +155,7 @@ public static function normalizeCase($type) } if (self::isKeyword($type)) { - return \strtolower($type); + return \strtolower(\ltrim($type, '\\')); } return $type; @@ -218,7 +221,7 @@ public static function isNullable($typeString) // Check for nullable union type. $matched = \preg_match( - '`(?^|[^|&(?\s]+\s*\|)\s*null\s*(?\|\s*[^|&)?\s]+|$)`i', + '`(?^|[^|&(?\s]+\s*\|)\s*[\\\\]?null\s*(?\|\s*[^|&)?\s]+|$)`i', $typeString, $matches ); diff --git a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php index 817134c4..b7469489 100644 --- a/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php +++ b/vendor/phpcsstandards/phpcsutils/PHPCSUtils/Utils/Variables.php @@ -108,6 +108,7 @@ final class Variables * 'is_static' => boolean, // TRUE if the static keyword was found. * 'is_readonly' => boolean, // TRUE if the readonly keyword was found. * 'is_final' => boolean, // TRUE if the final keyword was found. + * 'is_abstract' => boolean, // TRUE if the abstract keyword was found. * 'type' => string, // The type of the var (empty if no type specified). * 'type_token' => integer|false, // The stack pointer to the start of the type * // or FALSE if there is no type. @@ -155,6 +156,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) $isStatic = false; $isReadonly = false; $isFinal = false; + $isAbstract = false; $startOfStatement = $phpcsFile->findPrevious( [ @@ -211,6 +213,9 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) case \T_FINAL: $isFinal = true; break; + case \T_ABSTRACT: + $isAbstract = true; + break; } } @@ -254,6 +259,7 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr) 'is_static' => $isStatic, 'is_readonly' => $isReadonly, 'is_final' => $isFinal, + 'is_abstract' => $isAbstract, 'type' => $type, 'type_token' => $typeToken, 'type_end_token' => $typeEndToken, diff --git a/vendor/phpcsstandards/phpcsutils/README.md b/vendor/phpcsstandards/phpcsutils/README.md index 09d034ff..d1096462 100644 --- a/vendor/phpcsstandards/phpcsutils/README.md +++ b/vendor/phpcsstandards/phpcsutils/README.md @@ -46,7 +46,7 @@ Whether you need to split an `array` into the individual items, are trying to de Includes improved versions of the PHPCS native utility functions and plenty of new utility functions. -These functions are compatible with PHPCS 3.13.0 up to PHPCS `4.x`. +These functions are compatible with PHPCS 3.13.3 up to PHPCS `4.x`. ### A collection of static properties and methods for often-used token groups @@ -78,7 +78,7 @@ To see detailed information about all the available abstract sniffs, utility fun ## Minimum Requirements * PHP 5.4 or higher. -* [PHP_CodeSniffer] 3.13.0+/4.0.0+. +* [PHP_CodeSniffer] 3.13.3+/4.0.0+. * Recommended PHP extensions for optimal functionality: - PCRE with Unicode support (normally enabled by default) diff --git a/vendor/phpcsstandards/phpcsutils/composer.json b/vendor/phpcsstandards/phpcsutils/composer.json index 7fd8d7be..5155061e 100644 --- a/vendor/phpcsstandards/phpcsutils/composer.json +++ b/vendor/phpcsstandards/phpcsutils/composer.json @@ -24,7 +24,7 @@ }, "require" : { "php" : ">=5.4", - "squizlabs/php_codesniffer" : "^3.13.0 || ^4.0", + "squizlabs/php_codesniffer" : "^3.13.3 || ^4.0", "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0" }, "require-dev" : { diff --git a/vendor/squizlabs/php_codesniffer/CHANGELOG.md b/vendor/squizlabs/php_codesniffer/CHANGELOG.md index 70065bef..301ceb8b 100644 --- a/vendor/squizlabs/php_codesniffer/CHANGELOG.md +++ b/vendor/squizlabs/php_codesniffer/CHANGELOG.md @@ -6,6 +6,99 @@ The file documents changes to the PHP_CodeSniffer project. _Nothing yet._ +## [3.13.4] - 2025-09-05 + +### Fixed +- Fixed bug [#1213]: ability to run tests for external standards using the PHPCS native test framework was broken. + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. +- Fixed bug [#1214]: PHP 8.5 "Using null as an array offset" deprecation notices. + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. + +[#1213]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1213 +[#1214]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1214 + + +## [3.13.3] - 2025-09-04 + +### Added +- Tokenizer support for PHP 8.4 dereferencing of new expressions without wrapping parentheses. [#1160] + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. +- Tokenizer support for PHP 8.4 `abstract` properties. [#1183] + - The `File::getMemberProperties()` method now also supports `abstract` properties through a new `is_abstract` array index in the return value. [#1184] + - Additionally, the following sniffs have been updated to support `abstract` properties: + - Generic.PHP.LowerCaseConstant [#1185] + - Generic.PHP.UpperCaseConstant [#1185] + - PSR2.Classes.PropertyDeclaration [#1188] + - Squiz.Commenting.VariableComment [#1186] + - Squiz.WhiteSpace.MemberVarSpacing [#1187] + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patches +- Tokenizer support for the PHP 8.4 "exit as a function call" change. [#1201] + - When `exit`/`die` is used as a fully qualified "function call", it will now be tokenized as `T_NS_SEPARATOR` + `T_EXIT`. + - Additionally, the following sniff has been updated to handle fully qualified exit/die correctly: + - Squiz.PHP.NonExecutableCode + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patches + +### Changed +- Tokenizer/PHP: fully qualified `true`/`false`/`null` will now be tokenized as `T_NS_SEPARATOR` + `T_TRUE`/`T_FALSE`/`T_NULL`. [#1201] + - Previously, these were tokenized as `T_NS_SEPARATOR` + `T_STRING`. + - Additionally, the following sniffs have been updated to handle fully qualified true/false/null correctly: + - Generic.CodeAnalysis.UnconditionalIfStatement + - Generic.ControlStructures.DisallowYodaConditions + - PEAR.Functions.ValidDefaultValue + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patches. +- Generic.PHP.Syntax: the sniff is now able to scan input provided via STDIN on non-Windows OSes. [#915] + - Thanks to [Rodrigo Primo][@rodrigoprimo] for the patch. +- PSR2.ControlStructures.SwitchDeclaration: the `WrongOpener*` error code is now auto-fixable if the identified "wrong opener" is a semi-colon. [#1161] + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. +- The PSR2.Classes.PropertyDeclaration will now check that the abstract modifier keyword is placed before a visibility keyword. [#1188] + - Errors will be reported via a new `AbstractAfterVisibility` error code. + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. +- Various housekeeping, including improvements to the tests and documentation. + - Thanks to [Bernhard Zwein][@benno5020], [Rick Kerkhof][@NanoSector], [Rodrigo Primo][@rodrigoprimo] and [Juliette Reinders Folmer][@jrfnl] for their contributions. + +### Fixed +- Fixed bug [#1112] : `--parallel` option fails if PHP_CodeSniffer is invoked via bash and the invokation creates a non-PHPCS-managed process. + - Thanks to [Rick Kerkhof][@NanoSector] for the patch. +- Fixed bug [#1113] : fatal error when the specified "files to scan" would result in the same file being added multiple times to the queue. + - This error only occured when `--parallel` scanning was enabled. + - Thanks to [Rodrigo Primo][@rodrigoprimo] for the patch. +- Fixed bug [#1154] : PEAR.WhiteSpace.ObjectOperatorIndent: false positive when checking multiple chained method calls in a multidimensional array. + - Thanks to [Rodrigo Primo][@rodrigoprimo] for the patch. +- Fixed bug [#1193] : edge case inconsistency in how empty string array keys for sniff properties are handled. + - Thanks to [Rodrigo Primo][@rodrigoprimo] and [Juliette Reinders Folmer][@jrfnl] for the patch. +- Fixed bug [#1197] : Squiz.Commenting.FunctionComment: return types containing a class name with underscores would be truncated leading to incorrect results. + - Thanks to [Juliette Reinders Folmer][@jrfnl] for the patch. + +### Other +- The [Wiki documentation] is now publicly editable. :tada: + - Update proposals can be submittted by opening a pull request in the [PHPCSStandards/PHP_CodeSniffer-documentation][docs-repo] repository. + Contributions welcome ! + - Thanks to [Anna Filina][@afilina], [Dan Wallis][@fredden] and [Juliette Reinders Folmer][@jrfnl] for their work on getting this set up. +- The [Phar website] has had a facelift. [#107] + - Thanks to [Bernhard Zwein][@benno5020] for making this happen! + +[Wiki documentation]: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki +[docs-repo]: https://github.com/PHPCSStandards/PHP_CodeSniffer-documentation +[Phar website]: https://phars.phpcodesniffer.com/ + +[#107]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/107 +[#915]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/915 +[#1112]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1112 +[#1113]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1113 +[#1154]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1154 +[#1160]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1160 +[#1161]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1161 +[#1183]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1183 +[#1184]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1184 +[#1185]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1185 +[#1186]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1186 +[#1187]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1187 +[#1188]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1188 +[#1193]: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/1193 +[#1197]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1197 +[#1201]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1201 + + ## [3.13.2] - 2025-06-18 ### Changed @@ -653,7 +746,7 @@ All deprecation are slated for removal in PHP_CodeSniffer 4.0. [#608]: https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/608 [ghcli]: https://cli.github.com/ -[ghattest]: https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds +[ghattest]: https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations ## [3.10.2] - 2024-07-22 @@ -7651,6 +7744,8 @@ Additionally, thanks to [Alexander Turek][@derrabus] for consulting on the repo --> [Unreleased]: https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/master...HEAD +[3.13.4]: https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.3...3.13.4 +[3.13.3]: https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.2...3.13.3 [3.13.2]: https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.1...3.13.2 [3.13.1]: https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.0...3.13.1 [3.13.0]: https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.2...3.13.0 @@ -7789,6 +7884,7 @@ Additionally, thanks to [Alexander Turek][@derrabus] for consulting on the repo [@becoded]: https://github.com/becoded [@Benjamin-Loison]: https://github.com/Benjamin-Loison [@benmatselby]: https://github.com/benmatselby +[@benno5020]: https://github.com/benno5020 [@biinari]: https://github.com/biinari [@Billz95]: https://github.com/Billz95 [@biozshock]: https://github.com/biozshock @@ -7913,6 +8009,7 @@ Additionally, thanks to [Alexander Turek][@derrabus] for consulting on the repo [@mrkrstphr]: https://github.com/mrkrstphr [@mythril]: https://github.com/mythril [@Naelyth]: https://github.com/Naelyth +[@NanoSector]: https://github.com/NanoSector [@ndm2]: https://github.com/ndm2 [@nicholascus]: https://github.com/nicholascus [@NickDickinsonWilde]: https://github.com/NickDickinsonWilde diff --git a/vendor/squizlabs/php_codesniffer/README.md b/vendor/squizlabs/php_codesniffer/README.md index 6877929b..18031378 100644 --- a/vendor/squizlabs/php_codesniffer/README.md +++ b/vendor/squizlabs/php_codesniffer/README.md @@ -50,7 +50,7 @@ php phpcbf.phar -h These Phars are signed with the official Release key for PHPCS with the fingerprint `D91D 8696 3AF3 A29B 6520 4622 97B0 2DD8 E507 1466`. -As of PHP_CodeSniffer 3.10.3, the provenance of PHAR files associated with a release can be verified via [GitHub Artifact Attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds) using the [GitHub CLI tool](https://cli.github.com/) with the following command: `gh attestation verify [phpcs|phpcbf].phar -o PHPCSStandards`. +As of PHP_CodeSniffer 3.10.3, the provenance of PHAR files associated with a release can be verified via [GitHub Artifact Attestations](https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations) using the [GitHub CLI tool](https://cli.github.com/) with the following command: `gh attestation verify [phpcs|phpcbf].phar -o PHPCSStandards`. ### Composer If you use Composer, you can install PHP_CodeSniffer system-wide with the following command: diff --git a/vendor/squizlabs/php_codesniffer/src/Config.php b/vendor/squizlabs/php_codesniffer/src/Config.php index e9eeace0..7c681e65 100644 --- a/vendor/squizlabs/php_codesniffer/src/Config.php +++ b/vendor/squizlabs/php_codesniffer/src/Config.php @@ -85,7 +85,7 @@ class Config * * @var string */ - const VERSION = '3.13.2'; + const VERSION = '3.13.4'; /** * Package stability; either stable, beta or alpha. diff --git a/vendor/squizlabs/php_codesniffer/src/Files/File.php b/vendor/squizlabs/php_codesniffer/src/Files/File.php index fe3b7b1c..42e1a39f 100644 --- a/vendor/squizlabs/php_codesniffer/src/Files/File.php +++ b/vendor/squizlabs/php_codesniffer/src/Files/File.php @@ -1851,6 +1851,7 @@ public function getMethodProperties($stackPtr) * 'is_static' => boolean, // TRUE if the static keyword was found. * 'is_readonly' => boolean, // TRUE if the readonly keyword was found. * 'is_final' => boolean, // TRUE if the final keyword was found. + * 'is_abstract' => boolean, // TRUE if the abstract keyword was found. * 'type' => string, // The type of the var (empty if no type specified). * 'type_token' => integer|false, // The stack pointer to the start of the type * // or FALSE if there is no type. @@ -1875,6 +1876,10 @@ public function getMemberProperties($stackPtr) throw new RuntimeException('$stackPtr must be of type T_VARIABLE'); } + if (empty($this->tokens[$stackPtr]['conditions']) === true) { + throw new RuntimeException('$stackPtr is not a class member var'); + } + $conditions = array_keys($this->tokens[$stackPtr]['conditions']); $ptr = array_pop($conditions); if (isset($this->tokens[$ptr]) === false @@ -1921,6 +1926,7 @@ public function getMemberProperties($stackPtr) T_VAR => T_VAR, T_READONLY => T_READONLY, T_FINAL => T_FINAL, + T_ABSTRACT => T_ABSTRACT, ]; $valid += Tokens::$scopeModifiers; @@ -1932,6 +1938,7 @@ public function getMemberProperties($stackPtr) $isStatic = false; $isReadonly = false; $isFinal = false; + $isAbstract = false; $startOfStatement = $this->findPrevious( [ @@ -1979,6 +1986,9 @@ public function getMemberProperties($stackPtr) case T_FINAL: $isFinal = true; break; + case T_ABSTRACT: + $isAbstract = true; + break; }//end switch }//end for @@ -2037,6 +2047,7 @@ public function getMemberProperties($stackPtr) 'is_static' => $isStatic, 'is_readonly' => $isReadonly, 'is_final' => $isFinal, + 'is_abstract' => $isAbstract, 'type' => $type, 'type_token' => $typeToken, 'type_end_token' => $typeEndToken, diff --git a/vendor/squizlabs/php_codesniffer/src/Files/FileList.php b/vendor/squizlabs/php_codesniffer/src/Files/FileList.php index ab52e338..48c86c58 100644 --- a/vendor/squizlabs/php_codesniffer/src/Files/FileList.php +++ b/vendor/squizlabs/php_codesniffer/src/Files/FileList.php @@ -92,7 +92,6 @@ public function __construct(Config $config, Ruleset $ruleset) foreach ($iterator as $file) { $this->files[$file->getPathname()] = null; - $this->numFiles++; } } else { $this->addFile($path); @@ -100,6 +99,7 @@ public function __construct(Config $config, Ruleset $ruleset) }//end foreach reset($this->files); + $this->numFiles = count($this->files); }//end __construct() @@ -132,6 +132,11 @@ public function addFile($path, $file=null) $iterator = new RecursiveIteratorIterator($filter); foreach ($iterator as $path) { + if (array_key_exists($path, $this->files) === true) { + // The path has already been added. + continue; + } + $this->files[$path] = $file; $this->numFiles++; } diff --git a/vendor/squizlabs/php_codesniffer/src/Ruleset.php b/vendor/squizlabs/php_codesniffer/src/Ruleset.php index d1ef2a4d..76149981 100644 --- a/vendor/squizlabs/php_codesniffer/src/Ruleset.php +++ b/vendor/squizlabs/php_codesniffer/src/Ruleset.php @@ -1215,7 +1215,7 @@ private function processRule($rule, $newSniffs, $depth=0) } $value = (string) $element['value']; - if (isset($element['key']) === true) { + if (isset($element['key']) === true && trim($element['key']) !== '') { $key = (string) $element['key']; $values[$key] = $value; $printValue .= $key.'=>'.$value.','; diff --git a/vendor/squizlabs/php_codesniffer/src/Runner.php b/vendor/squizlabs/php_codesniffer/src/Runner.php index d527ea57..7b299c7f 100644 --- a/vendor/squizlabs/php_codesniffer/src/Runner.php +++ b/vendor/squizlabs/php_codesniffer/src/Runner.php @@ -764,7 +764,7 @@ public function processFile($file) * The reporting information returned by each child process is merged * into the main reporter class. * - * @param array $childProcs An array of child processes to wait for. + * @param array $childProcs An array of child processes to wait for. * * @return bool */ @@ -777,7 +777,8 @@ private function processChildProcs($childProcs) while (count($childProcs) > 0) { $pid = pcntl_waitpid(0, $status); - if ($pid <= 0) { + if ($pid <= 0 || isset($childProcs[$pid]) === false) { + // No child or a child with an unmanaged PID was returned. continue; } diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php index db71a967..99223dad 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/CodeAnalysis/UnconditionalIfStatementSniff.php @@ -75,7 +75,7 @@ public function process(File $phpcsFile, $stackPtr) for (; $next <= $end; ++$next) { $code = $tokens[$next]['code']; - if (isset(Tokens::$emptyTokens[$code]) === true) { + if (isset(Tokens::$emptyTokens[$code]) === true || $code === T_NS_SEPARATOR) { continue; } else if ($code !== T_TRUE && $code !== T_FALSE) { $goodCondition = true; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php index 17e81850..49987392 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/ControlStructures/DisallowYodaConditionsSniff.php @@ -164,6 +164,8 @@ public function isArrayStatic(File $phpcsFile, $arrayToken) T_COMMA => T_COMMA, T_TRUE => T_TRUE, T_FALSE => T_FALSE, + T_NULL => T_NULL, + T_NS_SEPARATOR => T_NS_SEPARATOR, ]; for ($i = ($start + 1); $i < $end; $i++) { diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php index 29e184ec..a9a0830f 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php @@ -78,6 +78,7 @@ public function register() $targets[] = T_STATIC; $targets[] = T_READONLY; $targets[] = T_FINAL; + $targets[] = T_ABSTRACT; // Register function keywords to filter out param/return type declarations. $targets[] = T_FUNCTION; @@ -139,6 +140,7 @@ public function process(File $phpcsFile, $stackPtr) || $tokens[$stackPtr]['code'] === T_STATIC || $tokens[$stackPtr]['code'] === T_READONLY || $tokens[$stackPtr]['code'] === T_FINAL + || $tokens[$stackPtr]['code'] === T_ABSTRACT ) { $skipOver = (Tokens::$emptyTokens + $this->propertyTypeTokens); $skipTo = $phpcsFile->findNext($skipOver, ($stackPtr + 1), null, true); diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php index 7297ebc1..803e3802 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/PHP/SyntaxSniff.php @@ -56,10 +56,9 @@ public function process(File $phpcsFile, $stackPtr) $this->phpPath = Config::getExecutablePath('php'); } - $fileName = escapeshellarg($phpcsFile->getFilename()); - $cmd = Common::escapeshellcmd($this->phpPath)." -l -d display_errors=1 -d error_prepend_string='' $fileName 2>&1"; - $output = shell_exec($cmd); - $matches = []; + $cmd = $this->getPhpLintCommand($phpcsFile); + $output = shell_exec($cmd); + $matches = []; if (preg_match('/^.*error:(.*) in .* on line ([0-9]+)/m', trim($output), $matches) === 1) { $error = trim($matches[1]); $line = (int) $matches[2]; @@ -72,4 +71,34 @@ public function process(File $phpcsFile, $stackPtr) }//end process() + /** + * Returns the command used to lint PHP code. + * + * Uses a different command when the content is provided via STDIN. + * + * @param \PHP_CodeSniffer\Files\File $phpcsFile The File object. + * + * @return string The command used to lint PHP code. + */ + private function getPhpLintCommand(File $phpcsFile) + { + if ($phpcsFile->getFilename() === 'STDIN') { + $content = $phpcsFile->getTokensAsString(0, $phpcsFile->numTokens); + return sprintf( + "echo %s | %s -l -d display_errors=1 -d error_prepend_string='' 2>&1", + escapeshellarg($content), + Common::escapeshellcmd($this->phpPath) + ); + } + + $fileName = escapeshellarg($phpcsFile->getFilename()); + return sprintf( + "%s -l -d display_errors=1 -d error_prepend_string='' %s 2>&1", + Common::escapeshellcmd($this->phpPath), + $fileName + ); + + }//end getPhpLintCommand() + + }//end class diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.1.inc index 58b604f7..dfeed37d 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.1.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.1.inc @@ -11,3 +11,8 @@ if (true) { if (file_exists(__FILE__) === true) { } + +// Check handling of case and FQN state. +if (\true) { +} else if (\FALSE) { +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php index d7f2e7e4..32424ee1 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/CodeAnalysis/UnconditionalIfStatementUnitTest.php @@ -50,9 +50,11 @@ public function getWarningList($testFile='') switch ($testFile) { case 'UnconditionalIfStatementUnitTest.1.inc': return [ - 3 => 1, - 5 => 1, - 7 => 1, + 3 => 1, + 5 => 1, + 7 => 1, + 16 => 1, + 17 => 1, ]; default: diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc index 27053c4d..57378df4 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc @@ -7,8 +7,8 @@ if ($value == true) {} if (true === $value) {} if (true == $value) {} -if($value === true){} -if($value == true){} +if($value === false){} +if($value == false){} if(false === $value){} if(!false == $value || true !== $value){} @@ -139,8 +139,8 @@ if (is_array($val) && array('foo', 'bar') === array($foo, $bar) && ['foo', 'bar'] === [$foo, $bar] && array('foo' => true, 'bar' => false) === array(getContents()) - && ['foo' => true, 'bar' => false] === array(getContents()) - && array(getContents()) === ['foo' => true, 'bar' => false] + && ['foo' => true, 'bar' => \false, 'baz' => null] === array(getContents()) + && array(getContents()) === ['foo' => \true, 'bar' => false, 'baz' => \null] ) { } @@ -185,3 +185,14 @@ echo match ($text) { 1 >= $value; 1 <= $value; 1 <=> $value; + +// Handle FQN true/false/null the same as plain true/false/null. +if ($value === \true) {} +if (\true === $value) {} + +if($value == \FALSE){} +if(\FALSE === $value){} +if(!\false == $value || true !== $value){} + +if($value === \Null){} +if(\Null == $value){} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php index 64a487d5..5afa5e89 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php @@ -72,6 +72,10 @@ public function getErrorList() 185 => 1, 186 => 1, 187 => 1, + 191 => 1, + 194 => 1, + 195 => 2, + 198 => 1, ]; }//end getErrorList() diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc index 301f6efd..699c6151 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc @@ -172,3 +172,12 @@ class WithAsym { public protected(set) Type|NULL|bool $asym4 = TRUE; } + +abstract class SkipOverPHP84AbstractProperties { + abstract MyType|TRUE $propA {get;} + protected abstract NULL|MyClass $propB {set;} +} + +$a = \NULL; +$a = \falSe; +$a = \True; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc.fixed index 5dcd342d..883daf88 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.1.inc.fixed @@ -172,3 +172,12 @@ class WithAsym { public protected(set) Type|NULL|bool $asym4 = true; } + +abstract class SkipOverPHP84AbstractProperties { + abstract MyType|TRUE $propA {get;} + protected abstract NULL|MyClass $propB {set;} +} + +$a = \null; +$a = \false; +$a = \true; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php index e4a6b80f..1bff8da4 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/LowerCaseConstantUnitTest.php @@ -70,6 +70,9 @@ public function getErrorList($testFile='') 169 => 1, 171 => 1, 173 => 1, + 181 => 1, + 182 => 1, + 183 => 1, ]; case 'LowerCaseConstantUnitTest.js': diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php index 58433eb1..115677ae 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/SyntaxUnitTest.php @@ -10,6 +10,9 @@ namespace PHP_CodeSniffer\Standards\Generic\Tests\PHP; +use PHP_CodeSniffer\Files\DummyFile; +use PHP_CodeSniffer\Ruleset; +use PHP_CodeSniffer\Tests\ConfigDouble; use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest; /** @@ -60,4 +63,108 @@ public function getWarningList() }//end getWarningList() + /** + * Test the sniff checks syntax when file contents are passed via STDIN. + * + * Note: this test doesn't run on Windows as PHPCS currently doesn't support STDIN on this OS. + * + * @param string $content The content to test. + * @param int $errorCount The expected number of errors. + * @param array $expectedErrors The expected errors. + * + * @dataProvider dataStdIn + * @requires OS ^(?!WIN).* + * + * @return void + */ + public function testStdIn($content, $errorCount, $expectedErrors) + { + $config = new ConfigDouble(); + $config->standards = ['Generic']; + $config->sniffs = ['Generic.PHP.Syntax']; + + $ruleset = new Ruleset($config); + + $file = new DummyFile($content, $ruleset, $config); + $file->process(); + + $this->assertSame( + $errorCount, + $file->getErrorCount(), + 'Error count does not match expected value' + ); + $this->assertSame( + 0, + $file->getWarningCount(), + 'Warning count does not match expected value' + ); + $this->assertSame( + $expectedErrors, + $file->getErrors(), + 'Error list does not match expected errors' + ); + + }//end testStdIn() + + + /** + * Data provider for testStdIn(). + * + * @return array[] + */ + public function dataStdIn() + { + // The error message changed in PHP 8+. + if (PHP_VERSION_ID >= 80000) { + $errorMessage = 'PHP syntax error: syntax error, unexpected token ";", expecting "]"'; + } else { + $errorMessage = 'PHP syntax error: syntax error, unexpected \';\', expecting \']\''; + } + + return [ + 'No syntax errors' => [ + ' [ + ' [ + 1 => [ + 0 => [ + 'message' => $errorMessage, + 'source' => 'Generic.PHP.Syntax.PHPSyntax', + 'listener' => 'PHP_CodeSniffer\\Standards\\Generic\\Sniffs\\PHP\\SyntaxSniff', + 'severity' => 5, + 'fixable' => false, + ], + ], + ], + ], + ], + 'Single error reported even when there is more than one syntax error in the file' => [ + ' [ + 1 => [ + 0 => [ + 'message' => $errorMessage, + 'source' => 'Generic.PHP.Syntax.PHPSyntax', + 'listener' => 'PHP_CodeSniffer\\Standards\\Generic\\Sniffs\\PHP\\SyntaxSniff', + 'severity' => 5, + 'fixable' => false, + ], + ], + ], + ], + ], + ]; + + }//end dataStdIn() + + }//end class diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc index 4d0ca8ff..02b56d65 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc @@ -113,3 +113,12 @@ class WithAsym { protected(set) false|string|null $asym3 = null; public protected(set) Type|null|bool $asym4 = true; } + +abstract class SkipOverPHP84AbstractProperties { + abstract MyType|true $propA {get;} + protected abstract null|MyClass $propB {set;} +} + +$a = \null; +$a = \falSe; +$a = \True; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed index 831f1161..146e8a0c 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc.fixed @@ -113,3 +113,12 @@ class WithAsym { protected(set) false|string|null $asym3 = NULL; public protected(set) Type|null|bool $asym4 = TRUE; } + +abstract class SkipOverPHP84AbstractProperties { + abstract MyType|true $propA {get;} + protected abstract null|MyClass $propB {set;} +} + +$a = \NULL; +$a = \FALSE; +$a = \TRUE; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php index 7738b94d..c1bb909b 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.php @@ -55,6 +55,9 @@ public function getErrorList() 112 => 1, 113 => 1, 114 => 1, + 122 => 1, + 123 => 1, + 124 => 1, ]; }//end getErrorList() diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/ValidDefaultValueSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/ValidDefaultValueSniff.php index 9952daa4..34643acb 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/ValidDefaultValueSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/Functions/ValidDefaultValueSniff.php @@ -54,11 +54,14 @@ public function process(File $phpcsFile, $stackPtr) } if (array_key_exists('default', $param) === true) { - $defaultFound = true; + $defaultFound = true; + $defaultValueLc = strtolower($param['default']); // Check if the arg is type hinted and using NULL for the default. // This does not make the argument optional - it just allows NULL // to be passed in. - if ($param['type_hint'] !== '' && strtolower($param['default']) === 'null') { + if ($param['type_hint'] !== '' + && ($defaultValueLc === 'null' || $defaultValueLc === '\null') + ) { $defaultFound = false; } diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php index 9c64c328..9b3c1df1 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php @@ -191,10 +191,7 @@ public function process(File $phpcsFile, $stackPtr) $next = $phpcsFile->findNext( $this->targets, ($next + 1), - null, - false, - null, - true + $end ); }//end while diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.1.inc index f134c16e..587e70cf 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.1.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.1.inc @@ -114,3 +114,7 @@ class ConstructorPropertyPromotionMixedWithNormalParams { mixed $requiredParam, ) {} } + +// Safeguard correct handling of FQN null as default value. +function foo(Foo $foo = \null, $bar) {} +function foo(Foo $foo = \null, Foz $foz = \NULL, $bar = true, $baz) {} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php index abc2e19d..fdbb0662 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/Functions/ValidDefaultValueUnitTest.php @@ -46,6 +46,7 @@ public function getErrorList($testFile='') 101 => 1, 106 => 1, 114 => 1, + 120 => 1, ]; default: diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc index b1b09d93..c5ced0a3 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc @@ -140,3 +140,14 @@ $someObject ->someOtherFunc(nameA: 23, nameB: 42) ->endSomething($value, name: $value) ->endEverything(); + +// Issue https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1154 +$array = [ + [ + $item->one()->two(), + ], + $item->one() + ->two(), + $item->one() + ->two(), +]; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc.fixed index 5d5b77be..48419d90 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.inc.fixed @@ -140,3 +140,14 @@ $someObject ->someOtherFunc(nameA: 23, nameB: 42) ->endSomething($value, name: $value) ->endEverything(); + +// Issue https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1154 +$array = [ + [ + $item->one()->two(), + ], + $item->one() + ->two(), + $item->one() + ->two(), +]; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.php index 9beb77fe..f8a1e989 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PEAR/Tests/WhiteSpace/ObjectOperatorIndentUnitTest.php @@ -56,6 +56,7 @@ public function getErrorList() 140 => 1, 141 => 1, 142 => 1, + 152 => 1, ]; }//end getErrorList() diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php index 8613f34a..7fe68adf 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/Classes/PropertyDeclarationSniff.php @@ -44,6 +44,7 @@ protected function processMemberVar(File $phpcsFile, $stackPtr) $find[] = T_VAR; $find[] = T_READONLY; $find[] = T_FINAL; + $find[] = T_ABSTRACT; $find[] = T_SEMICOLON; $find[] = T_OPEN_CURLY_BRACKET; @@ -195,6 +196,31 @@ protected function processMemberVar(File $phpcsFile, $stackPtr) } }//end if + if ($hasVisibilityModifier === true && $propertyInfo['is_abstract'] === true) { + $scopePtr = $firstVisibilityModifier; + $abstractPtr = $phpcsFile->findPrevious(T_ABSTRACT, ($stackPtr - 1)); + if ($abstractPtr > $scopePtr) { + $error = 'The abstract declaration must come before the visibility declaration'; + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'AbstractAfterVisibility'); + if ($fix === true) { + $phpcsFile->fixer->beginChangeset(); + + for ($i = ($abstractPtr + 1); $abstractPtr < $stackPtr; $i++) { + if ($tokens[$i]['code'] !== T_WHITESPACE) { + break; + } + + $phpcsFile->fixer->replaceToken($i, ''); + } + + $phpcsFile->fixer->replaceToken($abstractPtr, ''); + $phpcsFile->fixer->addContentBefore($scopePtr, $tokens[$abstractPtr]['content'].' '); + + $phpcsFile->fixer->endChangeset(); + } + } + }//end if + if ($hasVisibilityModifier === true && $propertyInfo['is_static'] === true) { $scopePtr = $lastVisibilityModifier; $staticPtr = $phpcsFile->findPrevious(T_STATIC, ($stackPtr - 1)); diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/ControlStructures/SwitchDeclarationSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/ControlStructures/SwitchDeclarationSniff.php index c846e43e..0c8355d2 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/ControlStructures/SwitchDeclarationSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Sniffs/ControlStructures/SwitchDeclarationSniff.php @@ -172,7 +172,15 @@ public function process(File $phpcsFile, $stackPtr) }//end if } else { $error = strtoupper($type).' statements must be defined using a colon'; - $phpcsFile->addError($error, $nextCase, 'WrongOpener'.$type); + if ($tokens[$opener]['code'] === T_SEMICOLON) { + $fix = $phpcsFile->addFixableError($error, $nextCase, 'WrongOpener'.$type); + if ($fix === true) { + $phpcsFile->fixer->replaceToken($opener, ':'); + } + } else { + // Probably a case/default statement with colon + curly braces. + $phpcsFile->addError($error, $nextCase, 'WrongOpener'.$type); + } }//end if // We only want cases from here on in. diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc index 2e1785a2..15b1bbc0 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc @@ -126,3 +126,11 @@ class AsymmetricVisibility { final static protected(set) bool $wrongOrder12; static public(set) final bool $wrongOrder13; } + +abstract class AbstractProperties { + abstract public int $foo { get; } + abstract protected (D|N)|false $foo { set; } + abstract array $foo { get; } + public ABSTRACT ?int $wrongOrder1 { set; } + protected abstract ?string $wrongOrder2 { get; } +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc.fixed index b398e2fe..a2ffb052 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.inc.fixed @@ -123,3 +123,11 @@ class AsymmetricVisibility { final protected(set) static bool $wrongOrder12; final public(set) static bool $wrongOrder13; } + +abstract class AbstractProperties { + abstract public int $foo { get; } + abstract protected (D|N)|false $foo { set; } + abstract array $foo { get; } + ABSTRACT public ?int $wrongOrder1 { set; } + abstract protected ?string $wrongOrder2 { get; } +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php index bce3d9f1..7d0160fd 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/Classes/PropertyDeclarationUnitTest.php @@ -76,6 +76,10 @@ public function getErrorList() 125 => 1, 126 => 1, 127 => 2, + 132 => 1, + 133 => 1, + 134 => 1, + 135 => 1, ]; }//end getErrorList() diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc index 440cf8a3..7db00c23 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc @@ -609,3 +609,16 @@ switch ( $a ) { jumpOut: doSomething(); + +// Fixable semicolon as case/default scope opener. +switch ($value) { + case 'foo'; + case 'bar' /*comment*/ ; + case 'baz' ; + echo 'foo, bar, or baz'; + break; + default; + echo 'Other'; + default ; + echo 'Other'; +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc.fixed index ca39c76d..c84f389d 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.inc.fixed @@ -604,3 +604,16 @@ switch ( $a ) { jumpOut: doSomething(); + +// Fixable semicolon as case/default scope opener. +switch ($value) { + case 'foo': + case 'bar' /*comment*/: + case 'baz': + echo 'foo, bar, or baz'; + break; + default: + echo 'Other'; + default: + echo 'Other'; +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.php index a292503d..187d9f48 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/PSR2/Tests/ControlStructures/SwitchDeclarationUnitTest.php @@ -63,6 +63,11 @@ public function getErrorList() 541 => 1, 558 => 1, 575 => 1, + 615 => 1, + 616 => 1, + 617 => 1, + 620 => 1, + 622 => 1, ]; }//end getErrorList() diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php index 3531758a..c7003faa 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php @@ -76,7 +76,7 @@ protected function processReturn(File $phpcsFile, $stackPtr, $commentStart) $phpcsFile->addError($error, $return, 'MissingReturnType'); } else { // Support both a return type and a description. - preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9\[\]]+))*)( .*)?`i', $content, $returnParts); + preg_match('`^((?:\|?(?:array\([^\)]*\)|[\\\\a-z0-9_\[\]]+))*)( .*)?`i', $content, $returnParts); if (isset($returnParts[1]) === false) { return; } diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php index afb1be03..055c4160 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php @@ -36,6 +36,7 @@ public function processMemberVar(File $phpcsFile, $stackPtr) T_STATIC => T_STATIC, T_READONLY => T_READONLY, T_FINAL => T_FINAL, + T_ABSTRACT => T_ABSTRACT, T_WHITESPACE => T_WHITESPACE, T_STRING => T_STRING, T_NS_SEPARATOR => T_NS_SEPARATOR, diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php index 4c0d6bcb..f1b9044f 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/PHP/NonExecutableCodeSniff.php @@ -67,6 +67,11 @@ public function process(File $phpcsFile, $stackPtr) $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); + // Allow for PHP 8.4+ fully qualified use of exit/die. + if ($tokens[$stackPtr]['code'] === \T_EXIT && $tokens[$prev]['code'] === \T_NS_SEPARATOR) { + $prev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true); + } + // Tokens which can be used in inline expressions need special handling. if (isset($this->expressionTokens[$tokens[$stackPtr]['code']]) === true) { // If this token is preceded by a logical operator, it only relates to one line diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/MemberVarSpacingSniff.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/MemberVarSpacingSniff.php index 56c1fd7a..7a7a5494 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/MemberVarSpacingSniff.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/WhiteSpace/MemberVarSpacingSniff.php @@ -58,6 +58,7 @@ protected function processMemberVar(File $phpcsFile, $stackPtr) $validPrefixes[] = T_FINAL; $validPrefixes[] = T_VAR; $validPrefixes[] = T_READONLY; + $validPrefixes[] = T_ABSTRACT; $startOfStatement = $phpcsFile->findNext($validPrefixes, ($endOfPreviousStatement + 1), $stackPtr, false, null, true); if ($startOfStatement === false) { diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc index 5f726623..cd69bf57 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc @@ -18,3 +18,7 @@ $anon = new ReadOnly class() {}; class FinalProperties { FINAL int $prop = 1; } + +ABSTRACT class AbstractProperties { + Abstract int $prop {set;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc.fixed index 21074838..f9610197 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.inc.fixed @@ -18,3 +18,7 @@ $anon = new readonly class() {}; class FinalProperties { final int $prop = 1; } + +abstract class AbstractProperties { + abstract int $prop {set;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.php index 0bf0010b..19c0c5d6 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Classes/LowercaseClassKeywordsUnitTest.php @@ -42,6 +42,8 @@ public function getErrorList() 14 => 1, 16 => 1, 19 => 1, + 22 => 1, + 23 => 1, ]; return $errors; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc index 0e5d87ac..4e3f18d0 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc @@ -331,3 +331,10 @@ class AsymVisibility { */ private(set) int $prop = 1; } + +abstract class AbstractProperties { + /** + * Comment should be ignored. + */ + abstract int $prop {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc.fixed index 0935d4ae..7875787b 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/BlockCommentUnitTest.inc.fixed @@ -333,3 +333,10 @@ class AsymVisibility { */ private(set) int $prop = 1; } + +abstract class AbstractProperties { + /** + * Comment should be ignored. + */ + abstract int $prop {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc index e8b13569..1b2eddba 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc @@ -131,3 +131,16 @@ class AsymVisibility { */ private(set) int $prop = 1; } + +/** + * Some info about the class here. + */ +abstract class AbstractClassWithAbstractProp +{ + /** + *Some info about the property here. + * + * @var int + */ + abstract $property {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed index 0b8a68e8..0b505307 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.inc.fixed @@ -131,3 +131,16 @@ class AsymVisibility { */ private(set) int $prop = 1; } + +/** + * Some info about the class here. + */ +abstract class AbstractClassWithAbstractProp +{ + /** + * Some info about the property here. + * + * @var int + */ + abstract $property {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.php index eac7a9ec..4269046d 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/DocCommentAlignmentUnitTest.php @@ -68,6 +68,13 @@ public function getErrorList($testFile='') $errors[121] = 1; $errors[125] = 1; $errors[126] = 1; + + $errors[136] = 1; + $errors[137] = 1; + $errors[141] = 2; + $errors[142] = 1; + $errors[143] = 1; + $errors[144] = 1; }//end if return $errors; diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc index 79060f4f..f5312c60 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc @@ -1167,3 +1167,30 @@ public function setTranslator($a): void { $this->translator = $translator; } + +/** + * Issue PHPCSStandards/PHP_CodeSniffer#1197. + * + * @return int|WP_Error + */ +function doNotTruncateClassNamesContainingUnderscoresAtEndOfType() { + return 0; +} + +/** + * Issue PHPCSStandards/PHP_CodeSniffer#1197. + * + * @return WP_Error|int + */ +function doNotTruncateClassNamesContainingUnderscoresAtStartOfType() { + return 0; +} + +/** + * Issue PHPCSStandards/PHP_CodeSniffer#1197. + * + * @return int|WP_Error|false + */ +function doNotTruncateClassNamesContainingUnderscoresInTheMiddelOfType() { + return 0; +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed index 76fa862a..b0d9fa0e 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed @@ -1167,3 +1167,30 @@ public function setTranslator($a): void { $this->translator = $translator; } + +/** + * Issue PHPCSStandards/PHP_CodeSniffer#1197. + * + * @return integer|WP_Error + */ +function doNotTruncateClassNamesContainingUnderscoresAtEndOfType() { + return 0; +} + +/** + * Issue PHPCSStandards/PHP_CodeSniffer#1197. + * + * @return WP_Error|integer + */ +function doNotTruncateClassNamesContainingUnderscoresAtStartOfType() { + return 0; +} + +/** + * Issue PHPCSStandards/PHP_CodeSniffer#1197. + * + * @return integer|WP_Error|false + */ +function doNotTruncateClassNamesContainingUnderscoresInTheMiddelOfType() { + return 0; +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php index 036bdc62..66f48e2e 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php @@ -141,6 +141,9 @@ public function getErrorList() 1144 => 1, 1145 => 1, 1151 => 1, + 1174 => 1, + 1183 => 1, + 1192 => 1, ]; // Scalar type hints only work from PHP 7 onwards. diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc index bddb2d17..87f8b567 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc @@ -486,3 +486,10 @@ class AsymVisibility { */ private(set) protected int $hasDocblockC; } + +abstract class PHP84AbstractProperties { + /** + * @var Type + */ + abstract Type $hasDocblock {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc.fixed index 2a40e3a0..5c9e263e 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc.fixed @@ -486,3 +486,10 @@ class AsymVisibility { */ private(set) protected int $hasDocblockC; } + +abstract class PHP84AbstractProperties { + /** + * @var Type + */ + abstract Type $hasDocblock {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Operators/ComparisonOperatorUsageUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Operators/ComparisonOperatorUsageUnitTest.inc index 8522438d..60d426e3 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Operators/ComparisonOperatorUsageUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Operators/ComparisonOperatorUsageUnitTest.inc @@ -136,3 +136,9 @@ if (empty($argTags > 0)) { } myFunction($var1 === true ? "" : "foobar"); + +// Verify that FQN true/false are handled the same as unqualified. +if (true) {} +if (\true) {} +for ($var1 = 10; FALSE; $var1--) {} +for ($var1 = 10; \FALSE; $var1--) {} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.1.inc index 4b1d1ca6..87a1409b 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.1.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.1.inc @@ -311,7 +311,7 @@ function parseError2() { // All logical operators are allowed with inline expressions (but this was not correctly handled by the sniff). function exitExpressionsWithLogicalOperators() { $condition = false; - $condition || exit(); + $condition || \exit(); $condition or die(); $condition = true; @@ -327,7 +327,7 @@ function exitExpressionsWithLogicalOperators() { function exitExpressionsInTernary() { $value = $myValue ? $myValue : exit(); $value = $myValue ?: exit(); - $value = $var == 'foo' ? 'bar' : die( 'world' ); + $value = $var == 'foo' ? 'bar' : \die( 'world' ); $value = (!$myValue ) ? exit() : $myValue; $value = $var != 'foo' ? die( 'world' ) : 'bar'; @@ -418,3 +418,17 @@ $closure = function () echo 'foo'; return; // This return should be flagged as not required. }; + +function fqnExitWithCodeAfter() { + do_something(); + exit(); + do_something_else(); +} + +function fqnExitInControlStructureWithCodeAfter() { + if(do_something()) { + die(); + do_something_else(); + } + do_something_else(); +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php index 4b8e0f07..8cab9d04 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php @@ -90,6 +90,8 @@ public function getWarningList($testFile='') 406 => 1, 412 => 1, 419 => 1, + 425 => 1, + 431 => 1, ]; case 'NonExecutableCodeUnitTest.2.inc': diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.inc index 163b65ee..e14477f8 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.inc @@ -85,3 +85,7 @@ class AsymVisibility { protected(set) public $asymPublicProtected = 'hello'; protected private(set) $asymProtectedPrivate = 'hello'; } + +abstract class PHP84AbstractProperties { + abstract string $abstract {get;} +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php index 1d83126a..360323c8 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/Scope/MemberVarScopeUnitTest.php @@ -43,6 +43,7 @@ public function getErrorList() 80 => 1, 81 => 1, 82 => 1, + 90 => 1, ]; }//end getErrorList() diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc index 75d576d2..af4bfb38 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc @@ -459,3 +459,16 @@ class AsymVisibility { private(set) private bool $asymPrivate; } + +abstract class PHP84AbstractProperties { + abstract int $abstractA {get;} + + /** + * Docblock + */ + public abstract string $publicAbstract { set; } + #[AnAttribute] + abstract bool $abstractB {get;} + + abstract protected bool $abstractProtected { set; } +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc.fixed index d87c8b74..40bae3f6 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.1.inc.fixed @@ -446,3 +446,18 @@ class AsymVisibility { private(set) private bool $asymPrivate; } + +abstract class PHP84AbstractProperties { + + abstract int $abstractA {get;} + + /** + * Docblock + */ + public abstract string $publicAbstract { set; } + + #[AnAttribute] + abstract bool $abstractB {get;} + + abstract protected bool $abstractProtected { set; } +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php index 63cd7639..fb695098 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/MemberVarSpacingUnitTest.php @@ -91,6 +91,8 @@ public function getErrorList($testFile='') 456 => 1, 457 => 1, 460 => 1, + 464 => 1, + 471 => 1, ]; default: diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc index e53511f8..921901fe 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc @@ -202,3 +202,8 @@ class AsymVisibility { protected(set) public $asymPublicProtected = 'hello'; protected private(set) $asymProtectedPrivate = 'hello'; } + +abstract class AbstractProperties { + abstract public ?MyType $spacing_correct {get;} + protected abstract $spacing_incorrect { set; } +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed index 8376b560..c0ee0c00 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.1.inc.fixed @@ -195,3 +195,8 @@ class AsymVisibility { protected(set) public $asymPublicProtected = 'hello'; protected private(set) $asymProtectedPrivate = 'hello'; } + +abstract class AbstractProperties { + abstract public ?MyType $spacing_correct {get;} + protected abstract $spacing_incorrect { set; } +} diff --git a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php index 2d20694b..bb419db7 100644 --- a/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php +++ b/vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Tests/WhiteSpace/ScopeKeywordSpacingUnitTest.php @@ -73,6 +73,7 @@ public function getErrorList($testFile='') 197 => 1, 198 => 3, 199 => 2, + 208 => 2, ]; case 'ScopeKeywordSpacingUnitTest.3.inc': diff --git a/vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php b/vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php index 32877a0e..b5a7f84a 100644 --- a/vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php +++ b/vendor/squizlabs/php_codesniffer/src/Tokenizers/PHP.php @@ -694,6 +694,25 @@ protected function tokenize($string) break; } } + + // Fully Qualified `\exit`/`\die` should be preserved. + if ($token[0] === T_EXIT + && $finalTokens[$lastNotEmptyToken]['code'] === T_NS_SEPARATOR + ) { + for ($i = ($lastNotEmptyToken - 1); $i >= 0; $i--) { + if (isset(Tokens::$emptyTokens[$finalTokens[$i]['code']]) === true) { + continue; + } + + if ($finalTokens[$i]['code'] !== T_STRING + && $finalTokens[$i]['code'] !== T_NAMESPACE + ) { + $preserveKeyword = true; + } + + break; + } + } }//end if // Types in typed constants should not be touched, but the constant name should be. @@ -1355,6 +1374,38 @@ protected function tokenize($string) $name = substr($name, 10); } + // Special case keywords which can be used in fully qualified form. + if ($token[0] === T_NAME_FULLY_QUALIFIED) { + $specialCasedType = null; + $nameLc = strtolower($name); + if ($nameLc === 'exit' || $nameLc === 'die') { + $specialCasedType = 'T_EXIT'; + } else if ($nameLc === 'true') { + $specialCasedType = 'T_TRUE'; + } else if ($nameLc === 'false') { + $specialCasedType = 'T_FALSE'; + } else if ($nameLc === 'null') { + $specialCasedType = 'T_NULL'; + } + + if ($specialCasedType !== null) { + $newToken = []; + $newToken['code'] = constant($specialCasedType); + $newToken['type'] = $specialCasedType; + $newToken['content'] = $name; + $finalTokens[$newStackPtr] = $newToken; + ++$newStackPtr; + + if (PHP_CODESNIFFER_VERBOSITY > 1) { + $type = Tokens::tokenName($token[0]); + $content = Common::prepareForOutput($token[1]); + echo "\t\t* token $stackPtr split into individual tokens T_NS_SEPARATOR + $specialCasedType".PHP_EOL; + } + + continue; + } + }//end if + $parts = explode('\\', $name); $partCount = count($parts); $lastPart = ($partCount - 1); @@ -1417,16 +1468,18 @@ protected function tokenize($string) $newToken['type'] = 'T_ATTRIBUTE'; $newToken['content'] = '#['; $finalTokens[$newStackPtr] = $newToken; + $newStackPtr++; - $tokens[$bracketCloser] = []; - $tokens[$bracketCloser][0] = T_ATTRIBUTE_END; - $tokens[$bracketCloser][1] = ']'; + if ($bracketCloser !== null) { + $tokens[$bracketCloser] = []; + $tokens[$bracketCloser][0] = T_ATTRIBUTE_END; + $tokens[$bracketCloser][1] = ']'; - if (PHP_CODESNIFFER_VERBOSITY > 1) { - echo "\t\t* token $bracketCloser changed from T_CLOSE_SQUARE_BRACKET to T_ATTRIBUTE_END".PHP_EOL; + if (PHP_CODESNIFFER_VERBOSITY > 1) { + echo "\t\t* token $bracketCloser changed from T_CLOSE_SQUARE_BRACKET to T_ATTRIBUTE_END".PHP_EOL; + } } - $newStackPtr++; continue; }//end if @@ -2215,7 +2268,7 @@ protected function tokenize($string) } if ($prevNonEmpty === null - && isset(Tokens::$emptyTokens[$tokenType]) === false + && @isset(Tokens::$emptyTokens[$tokenType]) === false ) { // Found the previous non-empty token. if ($tokenType === ':' || $tokenType === ',' || $tokenType === T_ATTRIBUTE_END) { @@ -2234,8 +2287,8 @@ protected function tokenize($string) if ($tokenType === T_FUNCTION || $tokenType === T_FN - || isset(Tokens::$methodPrefixes[$tokenType]) === true - || isset(Tokens::$scopeModifiers[$tokenType]) === true + || @isset(Tokens::$methodPrefixes[$tokenType]) === true + || @isset(Tokens::$scopeModifiers[$tokenType]) === true || $tokenType === T_VAR || $tokenType === T_READONLY ) { @@ -2258,7 +2311,7 @@ protected function tokenize($string) break; } - if (isset(Tokens::$emptyTokens[$tokenType]) === false) { + if (@isset(Tokens::$emptyTokens[$tokenType]) === false) { $lastSeenNonEmpty = $tokenType; } }//end for @@ -2523,16 +2576,37 @@ function return types. We want to keep the parenthesis map clean, } else if (isset($this->tstringContexts[$finalTokens[$lastNotEmptyToken]['code']]) === true && $finalTokens[$lastNotEmptyToken]['code'] !== T_CONST ) { - $preserveTstring = true; + $preserveTstring = true; + $tokenContentLower = strtolower($token[1]); // Special case for syntax like: return new self/new parent // where self/parent should not be a string. - $tokenContentLower = strtolower($token[1]); if ($finalTokens[$lastNotEmptyToken]['code'] === T_NEW && ($tokenContentLower === 'self' || $tokenContentLower === 'parent') ) { $preserveTstring = false; } + + // Special case for fully qualified \true, \false and \null + // where true/false/null should not be a string. + // Note: if this is the _start_ of a longer namespaced name, this will undone again later. + if ($finalTokens[$lastNotEmptyToken]['code'] === T_NS_SEPARATOR + && ($tokenContentLower === 'true' || $tokenContentLower === 'false' || $tokenContentLower === 'null') + ) { + for ($i = ($lastNotEmptyToken - 1); $i >= 0; $i--) { + if (isset(Tokens::$emptyTokens[$finalTokens[$i]['code']]) === true) { + continue; + } + + if ($finalTokens[$i]['code'] !== T_STRING + && $finalTokens[$i]['code'] !== T_NAMESPACE + ) { + $preserveTstring = false; + } + + break; + } + } } else if ($finalTokens[$lastNotEmptyToken]['content'] === '&') { // Function names for functions declared to return by reference. for ($i = ($lastNotEmptyToken - 1); $i >= 0; $i--) { @@ -3127,6 +3201,29 @@ protected function processAdditional() $allowed += Tokens::$magicConstants; for ($x = ($i - 1); $x >= 0; $x--) { + // Allow for PHP 8.4 anon class dereferencing without wrapping parentheses. + // Note: the T_CLASS token has not yet been retokenized to T_ANON_CLASS! + if ($this->tokens[$x]['code'] === T_CLOSE_CURLY_BRACKET + && isset($this->tokens[$x]['scope_condition']) === true + && $this->tokens[$this->tokens[$x]['scope_condition']]['code'] === T_CLASS + ) { + // Now, make sure it is an anonymous class and not a normal class. + for ($y = ($this->tokens[$x]['scope_condition'] + 1); $y < $numTokens; $y++) { + if (isset(Tokens::$emptyTokens[$this->tokens[$y]['code']]) === false) { + break; + } + } + + // Use the same check as used for the anon class retokenization. + if ($this->tokens[$y]['code'] === T_OPEN_PARENTHESIS + || $this->tokens[$y]['code'] === T_OPEN_CURLY_BRACKET + || $this->tokens[$y]['code'] === T_EXTENDS + || $this->tokens[$y]['code'] === T_IMPLEMENTS + ) { + break; + } + } + // If we hit a scope opener, the statement has ended // without finding anything, so it's probably an array // using PHP 7.1 short list syntax. @@ -3476,7 +3573,8 @@ protected function processAdditional() || $this->tokens[$x]['code'] === T_VAR || $this->tokens[$x]['code'] === T_STATIC || $this->tokens[$x]['code'] === T_READONLY - || $this->tokens[$x]['code'] === T_FINAL) + || $this->tokens[$x]['code'] === T_FINAL + || $this->tokens[$x]['code'] === T_ABSTRACT) ) { // This will also confirm constructor property promotion parameters, but that's fine. $confirmed = true; @@ -3605,6 +3703,7 @@ protected function processAdditional() } else if ($this->tokens[$i]['code'] === T_TRUE || $this->tokens[$i]['code'] === T_FALSE || $this->tokens[$i]['code'] === T_NULL + || $this->tokens[$i]['code'] === T_EXIT ) { for ($x = ($i + 1); $x < $numTokens; $x++) { if (isset(Tokens::$emptyTokens[$this->tokens[$x]['code']]) === false) { diff --git a/vendor/squizlabs/php_codesniffer/src/Util/Common.php b/vendor/squizlabs/php_codesniffer/src/Util/Common.php index cb6965f6..eb935f4a 100644 --- a/vendor/squizlabs/php_codesniffer/src/Util/Common.php +++ b/vendor/squizlabs/php_codesniffer/src/Util/Common.php @@ -330,7 +330,7 @@ public static function stripColors($text) /** * Returns true if the specified string is in the camel caps format. * - * @param string $string The string the verify. + * @param string $string The string to verify. * @param boolean $classFormat If true, check to see if the string is in the * class format. Class format strings must start * with a capital letter and contain no diff --git a/vendor/squizlabs/php_codesniffer/tests/ConfigDouble.php b/vendor/squizlabs/php_codesniffer/tests/ConfigDouble.php index 8ebce058..ed02389a 100644 --- a/vendor/squizlabs/php_codesniffer/tests/ConfigDouble.php +++ b/vendor/squizlabs/php_codesniffer/tests/ConfigDouble.php @@ -185,7 +185,8 @@ private function preventAutoDiscoveryScreenWidth() private function getStaticConfigProperty($name) { $property = new ReflectionProperty('PHP_CodeSniffer\Config', $name); - $property->setAccessible(true); + (PHP_VERSION_ID < 80100) && $property->setAccessible(true); + return $property->getValue(); }//end getStaticConfigProperty() @@ -202,9 +203,9 @@ private function getStaticConfigProperty($name) private function setStaticConfigProperty($name, $value) { $property = new ReflectionProperty('PHP_CodeSniffer\Config', $name); - $property->setAccessible(true); + (PHP_VERSION_ID < 80100) && $property->setAccessible(true); $property->setValue(null, $value); - $property->setAccessible(false); + (PHP_VERSION_ID < 80100) && $property->setAccessible(false); }//end setStaticConfigProperty() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Config/AbstractRealConfigTestCase.php b/vendor/squizlabs/php_codesniffer/tests/Core/Config/AbstractRealConfigTestCase.php index 6f5cd884..5d569bb3 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Config/AbstractRealConfigTestCase.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Config/AbstractRealConfigTestCase.php @@ -82,9 +82,9 @@ public static function resetConfigToDefaults() protected static function setStaticConfigProperty($name, $value) { $property = new ReflectionProperty('PHP_CodeSniffer\Config', $name); - $property->setAccessible(true); + (PHP_VERSION_ID < 80100) && $property->setAccessible(true); $property->setValue(null, $value); - $property->setAccessible(false); + (PHP_VERSION_ID < 80100) && $property->setAccessible(false); }//end setStaticConfigProperty() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.inc index dae2cd96..218ebc72 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.inc @@ -44,6 +44,12 @@ class testFECNClassThatImplementsAndExtends implements InterfaceA, InterfaceB ex /* testInterfaceMultiExtends */ interface Multi extends \Package\FooInterface, \BarInterface {}; +/* testExtendedReadonlyAnonClass */ +$anon = new readonly class() extends \Fully\Qualified\MyClass {}; + +/* testExtendedAnonClassWithAttributes */ +$anon = new #[SomeAttribute] class( $p ) extends Partially\Qualified\MyClass {}; + /* testMissingExtendsName */ class testMissingExtendsName extends { /* missing classname */ } // Intentional parse error. diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.php index 327f486b..ce9e537f 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindExtendedClassNameTest.php @@ -129,6 +129,14 @@ public static function dataExtendedClass() 'identifier' => '/* testInterfaceMultiExtends */', 'expected' => '\Package\FooInterface', ], + 'readonly anon class extends fully qualified class' => [ + 'identifier' => '/* testExtendedReadonlyAnonClass */', + 'expected' => '\Fully\Qualified\MyClass', + ], + 'anon class with attribute extends partially qualified class' => [ + 'identifier' => '/* testExtendedAnonClassWithAttributes */', + 'expected' => 'Partially\Qualified\MyClass', + ], 'parse error - extends keyword, but no class name' => [ 'identifier' => '/* testMissingExtendsName */', 'expected' => false, diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.inc index 5b601075..681289ef 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.inc @@ -162,6 +162,10 @@ switch ($foo) { /* testInsideCaseGotoStatement */ goto myLabel; + case 7: + /* testInsideCaseFullyQualifiedDieStatement */ + \die(1); + /* testDefaultStatement */ default: /* testInsideDefaultContinueStatement */ diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.php index 4e0916dd..01e07355 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/FindStartOfStatementTest.php @@ -669,6 +669,12 @@ public static function dataFindStartInsideSwitchCaseDefaultStatements() 'targets' => T_SEMICOLON, 'expectedTarget' => T_GOTO, ], + 'Namespace separator for "die" should be start for contents - close parenthesis' => [ + // Note: not sure if this is actually correct - should this be the open parenthesis ? + 'testMarker' => '/* testInsideCaseFullyQualifiedDieStatement */', + 'targets' => T_CLOSE_PARENTHESIS, + 'expectedTarget' => T_NS_SEPARATOR, + ], 'Default keyword should be start of default statement - default itself' => [ 'testMarker' => '/* testDefaultStatement */', 'targets' => T_DEFAULT, diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.inc index b5fcea94..2f3699e7 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.inc @@ -401,3 +401,27 @@ class AsymVisibility { /* testPHP84IllegalAsymPublicProtectedSetStaticProperty */ public protected(set) static mixed $prop10; } + +abstract class WithAbstractProperties { + /* testPHP84AbstractPublicTypedProp */ + abstract public string $val1 { get; } + /* testPHP84AbstractProtectedTypedProp */ + abstract protected Union|Type $val2 { set; } + /* testPHP84AbstractMiddleTypedProp */ + public abstract Intersection&Type $val3 { get; } + /* testPHP84AbstractImplicitVisibilityTypedProp */ + abstract int $val4 { set; } + /* testPHP84AbstractImplicitVisibilityProp */ + abstract $val5 { get; } + /* testPHP84AbstractNullableTypedProp */ + abstract public ?string $val6 { set; } + /* testPHP84AbstractComplexTypedProp */ + abstract protected (Foo&\Bar)|false $val7 { get; } + + /* testPHP84IllegalAbstractPrivateProp */ + private abstract string $val8 { get; } + /* testPHP84IllegalAbstractReadonlyProp */ + public readonly abstract string $val9 { get; } + /* testPHP84IllegalAbstractStaticProp */ + public abstract static string $val10 { get; } +} diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.php index 3c218911..adb44d46 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Files/File/GetMemberPropertiesTest.php @@ -72,6 +72,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -87,6 +88,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?int', 'type_token' => -2, 'type_end_token' => -2, @@ -102,6 +104,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -117,6 +120,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -132,6 +136,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -147,6 +152,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'bool', 'type_token' => -2, 'type_end_token' => -2, @@ -162,6 +168,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -177,6 +184,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'array', 'type_token' => -2, 'type_end_token' => -2, @@ -192,6 +200,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -207,6 +216,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?string', 'type_token' => -2, 'type_end_token' => -2, @@ -222,6 +232,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -237,6 +248,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -252,6 +264,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -267,6 +280,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -282,6 +296,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -297,6 +312,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -312,6 +328,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -327,6 +344,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -342,6 +360,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -357,6 +376,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'float', 'type_token' => -6, 'type_end_token' => -6, @@ -372,6 +392,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'float', 'type_token' => -13, 'type_end_token' => -13, @@ -387,6 +408,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?string', 'type_token' => -6, 'type_end_token' => -6, @@ -402,6 +424,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?string', 'type_token' => -17, 'type_end_token' => -17, @@ -417,6 +440,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -432,6 +456,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -447,6 +472,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -462,6 +488,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -477,6 +504,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -492,6 +520,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -507,6 +536,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -522,6 +552,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -537,6 +568,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -552,6 +584,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -567,6 +600,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?array', 'type_token' => -2, 'type_end_token' => -2, @@ -582,6 +616,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '\MyNamespace\MyClass', 'type_token' => -5, 'type_end_token' => -2, @@ -597,6 +632,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?ClassName', 'type_token' => -2, 'type_end_token' => -2, @@ -612,6 +648,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?Folder\ClassName', 'type_token' => -4, 'type_end_token' => -2, @@ -627,6 +664,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '\MyNamespace\MyClass\Foo', 'type_token' => -18, 'type_end_token' => -2, @@ -642,6 +680,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -661,6 +700,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -676,6 +716,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -691,6 +732,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'miXed', 'type_token' => -2, 'type_end_token' => -2, @@ -706,6 +748,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?mixed', 'type_token' => -2, 'type_end_token' => -2, @@ -721,6 +764,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?namespace\Name', 'type_token' => -4, 'type_end_token' => -2, @@ -736,6 +780,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'int|float', 'type_token' => -4, 'type_end_token' => -2, @@ -751,6 +796,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'MyClassA|\Package\MyClassB', 'type_token' => -7, 'type_end_token' => -2, @@ -766,6 +812,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'array|bool|int|float|NULL|object|string', 'type_token' => -14, 'type_end_token' => -2, @@ -781,6 +828,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'false|mixed|self|parent|iterable|Resource', 'type_token' => -12, 'type_end_token' => -2, @@ -796,6 +844,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, // Missing static, but that's OK as not an allowed syntax. 'type' => 'callable|void', 'type_token' => -4, @@ -812,6 +861,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?int|float', 'type_token' => -4, 'type_end_token' => -2, @@ -827,6 +877,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'null', 'type_token' => -2, 'type_end_token' => -2, @@ -842,6 +893,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'false', 'type_token' => -2, 'type_end_token' => -2, @@ -857,6 +909,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'bool|FALSE', 'type_token' => -4, 'type_end_token' => -2, @@ -872,6 +925,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'object|ClassName', 'type_token' => -4, 'type_end_token' => -2, @@ -887,6 +941,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'iterable|array|Traversable', 'type_token' => -6, 'type_end_token' => -2, @@ -902,6 +957,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'int|string|INT', 'type_token' => -10, 'type_end_token' => -2, @@ -917,6 +973,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'int', 'type_token' => -2, 'type_end_token' => -2, @@ -932,6 +989,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => '?array', 'type_token' => -2, 'type_end_token' => -2, @@ -947,6 +1005,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string|int', 'type_token' => -4, 'type_end_token' => -2, @@ -962,6 +1021,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string|null', 'type_token' => -4, 'type_end_token' => -2, @@ -977,6 +1037,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string|int', 'type_token' => -4, 'type_end_token' => -2, @@ -992,6 +1053,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => '\InterfaceA|\Sub\InterfaceB|false', 'type_token' => -11, 'type_end_token' => -3, @@ -1007,6 +1069,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => '?string', 'type_token' => -2, 'type_end_token' => -2, @@ -1022,6 +1085,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -1037,6 +1101,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1052,6 +1117,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?int|float', 'type_token' => -4, 'type_end_token' => -2, @@ -1067,6 +1133,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'mixed', 'type_token' => -2, 'type_end_token' => -2, @@ -1086,6 +1153,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'Foo&Bar', 'type_token' => -4, 'type_end_token' => -2, @@ -1101,6 +1169,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'Foo&Bar&Baz', 'type_token' => -6, 'type_end_token' => -2, @@ -1116,6 +1185,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'int&string', 'type_token' => -4, 'type_end_token' => -2, @@ -1131,6 +1201,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?Foo&Bar', 'type_token' => -4, 'type_end_token' => -2, @@ -1147,6 +1218,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'int|string', 'type_token' => -8, 'type_end_token' => -2, @@ -1162,6 +1234,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '\Foo&Bar', 'type_token' => -9, 'type_end_token' => -2, @@ -1177,6 +1250,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'true', 'type_token' => -2, 'type_end_token' => -2, @@ -1192,6 +1266,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?true', 'type_token' => -2, 'type_end_token' => -2, @@ -1207,6 +1282,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'int|string|true', 'type_token' => -6, 'type_end_token' => -2, @@ -1222,6 +1298,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'true|FALSE', 'type_token' => -4, 'type_end_token' => -2, @@ -1238,6 +1315,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '(Foo&\Bar)|bool', 'type_token' => -9, 'type_end_token' => -2, @@ -1253,6 +1331,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'float|(Partially\Qualified&Traversable)', 'type_token' => -10, 'type_end_token' => -2, @@ -1268,6 +1347,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => '(namespace\Foo&Bar)|string', 'type_token' => -10, 'type_end_token' => -2, @@ -1283,6 +1363,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?(A&\Pck\B)|bool', 'type_token' => -11, 'type_end_token' => -2, @@ -1298,6 +1379,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1313,6 +1395,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1328,6 +1411,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1343,6 +1427,7 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1358,6 +1443,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => true, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1373,6 +1459,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1388,6 +1475,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -1403,6 +1491,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => '?string', 'type_token' => -2, 'type_end_token' => -2, @@ -1418,6 +1507,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => '(Foo&\Bar)|bool', 'type_token' => -9, 'type_end_token' => -2, @@ -1434,6 +1524,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'mixed', 'type_token' => -2, 'type_end_token' => -2, @@ -1449,6 +1540,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '(A&B)|null', 'type_token' => -8, 'type_end_token' => -2, @@ -1464,6 +1556,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'bool', 'type_token' => -2, 'type_end_token' => -2, @@ -1479,6 +1572,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => true, 'is_final' => false, + 'is_abstract' => false, 'type' => 'mixed', 'type_token' => -2, 'type_end_token' => -2, @@ -1494,6 +1588,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string', 'type_token' => -2, 'type_end_token' => -2, @@ -1509,6 +1604,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => '?float', 'type_token' => -2, 'type_end_token' => -2, @@ -1524,6 +1620,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'string|int', 'type_token' => -4, 'type_end_token' => -2, @@ -1539,6 +1636,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => true, + 'is_abstract' => false, 'type' => '', 'type_token' => false, 'type_end_token' => false, @@ -1554,6 +1652,7 @@ public static function dataGetMemberProperties() 'is_static' => false, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'mixed', 'type_token' => -2, 'type_end_token' => -2, @@ -1569,12 +1668,173 @@ public static function dataGetMemberProperties() 'is_static' => true, 'is_readonly' => false, 'is_final' => false, + 'is_abstract' => false, 'type' => 'mixed', 'type_token' => -2, 'type_end_token' => -2, 'nullable_type' => false, ], ], + 'php8.4-abstract-public-property' => [ + 'identifier' => '/* testPHP84AbstractPublicTypedProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'string', + 'type_token' => -2, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-abstract-protected-property' => [ + 'identifier' => '/* testPHP84AbstractProtectedTypedProp */', + 'expected' => [ + 'scope' => 'protected', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'Union|Type', + 'type_token' => -4, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-abstract-middle-keyword-property' => [ + 'identifier' => '/* testPHP84AbstractMiddleTypedProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'Intersection&Type', + 'type_token' => -4, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-abstract-implicit-public-typed-property' => [ + 'identifier' => '/* testPHP84AbstractImplicitVisibilityTypedProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => false, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'int', + 'type_token' => -2, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-abstract-implicit-public-untyped-property' => [ + 'identifier' => '/* testPHP84AbstractImplicitVisibilityProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => false, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => '', + 'type_token' => false, + 'type_end_token' => false, + 'nullable_type' => false, + ], + ], + 'php8.4-abstract-public-nullable-typed-property' => [ + 'identifier' => '/* testPHP84AbstractNullableTypedProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => '?string', + 'type_token' => -2, + 'type_end_token' => -2, + 'nullable_type' => true, + ], + ], + 'php8.4-abstract-protected-complex-type-property' => [ + 'identifier' => '/* testPHP84AbstractComplexTypedProp */', + 'expected' => [ + 'scope' => 'protected', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => '(Foo&\Bar)|false', + 'type_token' => -9, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-illegal-abstract-private-property' => [ + 'identifier' => '/* testPHP84IllegalAbstractPrivateProp */', + 'expected' => [ + 'scope' => 'private', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'string', + 'type_token' => -2, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-illegal-abstract-readonly-property' => [ + 'identifier' => '/* testPHP84IllegalAbstractReadonlyProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => false, + 'is_readonly' => true, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'string', + 'type_token' => -2, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], + 'php8.4-illegal-abstract-static-property' => [ + 'identifier' => '/* testPHP84IllegalAbstractStaticProp */', + 'expected' => [ + 'scope' => 'public', + 'scope_specified' => true, + 'set_scope' => false, + 'is_static' => true, + 'is_readonly' => false, + 'is_final' => false, + 'is_abstract' => true, + 'type' => 'string', + 'type_token' => -2, + 'type_end_token' => -2, + 'nullable_type' => false, + ], + ], ]; }//end dataGetMemberProperties() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitModifiedTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitModifiedTest.php index c0b65212..0a4afe3a 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitModifiedTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitModifiedTest.php @@ -228,7 +228,7 @@ public function testExecAlwaysReturnsArray($cmd, $expected) $filter = new GitModified($fakeDI, '/', self::$config, self::$ruleset); $reflMethod = new ReflectionMethod($filter, 'exec'); - $reflMethod->setAccessible(true); + (PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(true); $result = $reflMethod->invoke($filter, $cmd); $this->assertSame($expected, $result); diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitStagedTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitStagedTest.php index 0c936ded..481d4dfd 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitStagedTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Filters/GitStagedTest.php @@ -228,7 +228,7 @@ public function testExecAlwaysReturnsArray($cmd, $expected) $filter = new GitStaged($fakeDI, '/', self::$config, self::$ruleset); $reflMethod = new ReflectionMethod($filter, 'exec'); - $reflMethod->setAccessible(true); + (PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(true); $result = $reflMethod->invoke($filter, $cmd); $this->assertSame($expected, $result); diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/DisplayCachedMessagesTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/DisplayCachedMessagesTest.php index 55b0b708..f58aefe8 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/DisplayCachedMessagesTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/DisplayCachedMessagesTest.php @@ -280,14 +280,14 @@ private function getPlainRuleset() private function mockCachedMessages(Ruleset $ruleset, $messages) { $reflProperty = new ReflectionProperty($ruleset, 'msgCache'); - $reflProperty->setAccessible(true); + (PHP_VERSION_ID < 80100) && $reflProperty->setAccessible(true); $msgCache = $reflProperty->getValue($ruleset); foreach ($messages as $msg => $type) { $msgCache->add($msg, $type); } - $reflProperty->setAccessible(false); + (PHP_VERSION_ID < 80100) && $reflProperty->setAccessible(false); }//end mockCachedMessages() @@ -302,9 +302,9 @@ private function mockCachedMessages(Ruleset $ruleset, $messages) private function invokeDisplayCachedMessages(Ruleset $ruleset) { $reflMethod = new ReflectionMethod($ruleset, 'displayCachedMessages'); - $reflMethod->setAccessible(true); + (PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(true); $reflMethod->invoke($ruleset); - $reflMethod->setAccessible(false); + (PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(false); }//end invokeDisplayCachedMessages() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/Fixtures/PropertyTypeHandlingInline.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/Fixtures/PropertyTypeHandlingInline.inc index 31caeb61..e40ecf3c 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/Fixtures/PropertyTypeHandlingInline.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/Fixtures/PropertyTypeHandlingInline.inc @@ -20,12 +20,12 @@ // phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsBooleanFalseCase fALSe // phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsBooleanFalseTrimmed false -// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsArrayWithOnlyValues[] string, 10, 1.5, null, true, false -// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsArrayWithKeysAndValues[] string=>string,10=>10,float=>1.5,null=>null,true=>true,false=>false +// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsArrayWithOnlyValues[] string, 10, 1.5, , null, true, false +// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsArrayWithKeysAndValues[] string=>string,10=>10,float=>1.5,=>,null=>null,true=>true,false=>false // phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsEmptyArray[] -// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsOldSchoolArrayWithOnlyValues[] string, 10, 1.5, null, true, false -// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsOldSchoolArrayWithKeysAndValues[] string=>string,10=>10,float=>1.5,null=>null,true=>true,false=>false +// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsOldSchoolArrayWithOnlyValues[] string, 10, 1.5, , null, true, false +// phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsOldSchoolArrayWithKeysAndValues[] string=>string,10=>10,float=>1.5,=>,null=>null,true=>true,false=>false // phpcs:set TestStandard.SetProperty.PropertyTypeHandling expectsOldSchoolEmptyArray[] echo 'hello!'; diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PopulateTokenListenersTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PopulateTokenListenersTest.php index 347ffdde..54729ed3 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PopulateTokenListenersTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PopulateTokenListenersTest.php @@ -172,9 +172,9 @@ public static function dataSniffListensToTokenss() public function testRegistersWhenADeprecatedSniffIsLoaded() { $property = new ReflectionProperty(self::$ruleset, 'deprecatedSniffs'); - $property->setAccessible(true); + (PHP_VERSION_ID < 80100) && $property->setAccessible(true); $actualValue = $property->getValue(self::$ruleset); - $property->setAccessible(false); + (PHP_VERSION_ID < 80100) && $property->setAccessible(false); // Only verify there is one deprecated sniff registered. // There are other tests which test the deprecated sniff handling in more detail. diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.php index 1db15aa5..de71ba39 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.php @@ -120,6 +120,7 @@ public static function dataTypeHandling() 'string', '10', '1.5', + '', 'null', 'true', 'false', @@ -128,6 +129,7 @@ public static function dataTypeHandling() 'string' => 'string', 10 => '10', 'float' => '1.5', + 11 => '', 'null' => 'null', 'true' => 'true', 'false' => 'false', diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.xml b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.xml index 2e89a37b..eaca6675 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.xml +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Ruleset/PropertyTypeHandlingTest.xml @@ -25,6 +25,7 @@ + @@ -34,6 +35,7 @@ + @@ -60,9 +62,9 @@ - + - + diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/AbstractTokenizerTestCase.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/AbstractTokenizerTestCase.php index f3daf2bf..aee3aa60 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/AbstractTokenizerTestCase.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/AbstractTokenizerTestCase.php @@ -137,9 +137,9 @@ protected function getTargetToken($commentString, $tokenType, $tokenContent=null public static function clearResolvedTokensCache() { $property = new ReflectionProperty('PHP_CodeSniffer\Tokenizers\PHP', 'resolveTokenCache'); - $property->setAccessible(true); + (PHP_VERSION_ID < 80100) && $property->setAccessible(true); $property->setValue(null, []); - $property->setAccessible(false); + (PHP_VERSION_ID < 80100) && $property->setAccessible(false); }//end clearResolvedTokensCache() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.inc index 822b4413..6e7d5889 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.inc @@ -7,7 +7,7 @@ /* testBitwiseOr1 */ $result = $value | $test /* testBitwiseOr2 */ | $another; -class TypeUnion +abstract class TypeUnion { /* testTypeUnionOOConstSimple */ public const Foo|Bar SIMPLE = new Foo; @@ -96,6 +96,15 @@ class TypeUnion /* testTypeUnionPropertyPublicProtected */ public protected(set) Foo|Bar $asym4; + /* testTypeUnionWithPHP84AbstractKeyword */ + abstract int|string $abstractKeywordA { get; } + + /* testTypeUnionWithPHP84AbstractKeywordFirst */ + abstract protected float|null $abstractKeywordB { set; } + + /* testTypeUnionWithPHP84AbstractKeywordAndFQN */ + abstract \MyClass|false $abstractKeywordC { get; } + public function paramTypes( /* testTypeUnionParam1 */ int|float $paramA /* testBitwiseOrParamDefaultValue */ = CONSTANT_A | CONSTANT_B, diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.php index bfe409ae..17febdc4 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/BitwiseOrTest.php @@ -132,6 +132,9 @@ public static function dataTypeUnion() 'type for public private(set) property' => ['/* testTypeUnionPropertyPublicPrivateSet */'], 'type for protected(set) property' => ['/* testTypeUnionPropertyProtected */'], 'type for public protected(set) property' => ['/* testTypeUnionPropertyPublicProtected */'], + 'type for abstract property, no visibility' => ['/* testTypeUnionWithPHP84AbstractKeyword */'], + 'type for abstract property, reversed modifier order' => ['/* testTypeUnionWithPHP84AbstractKeywordFirst */'], + 'type for abstract property, no visibility, FQN type' => ['/* testTypeUnionWithPHP84AbstractKeywordAndFQN */'], 'type for method parameter' => ['/* testTypeUnionParam1 */'], 'type for method parameter, first in multi-union' => ['/* testTypeUnionParam2 */'], 'type for method parameter, last in multi-union' => ['/* testTypeUnionParam3 */'], diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.inc index e019dfe8..3a591f5a 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.inc @@ -186,6 +186,11 @@ $a = isset($a); /* testUnsetIsKeyword */ unset($a); +/* testFullyQualifiedDieIsKeyword */ +\die; +/* testFullyQualifiedExitIsKeyword */ +\exit($foo); + /* testIncludeIsKeyword */ include 'file.php'; /* testIncludeOnceIsKeyword */ diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.php index 09ff9050..b2d14a9d 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ContextSensitiveKeywordsTest.php @@ -449,6 +449,14 @@ public static function dataKeywords() 'testMarker' => '/* testUnsetIsKeyword */', 'expectedTokenType' => 'T_UNSET', ], + '\\die: statement (fully qualified)' => [ + 'testMarker' => '/* testFullyQualifiedDieIsKeyword */', + 'expectedTokenType' => 'T_EXIT', + ], + '\\exit: statement (fully qualified)' => [ + 'testMarker' => '/* testFullyQualifiedExitIsKeyword */', + 'expectedTokenType' => 'T_EXIT', + ], 'include' => [ 'testMarker' => '/* testIncludeIsKeyword */', diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.inc index ae9dc944..877d57ed 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.inc @@ -193,6 +193,12 @@ abstract class DNFTypes { /* testDNFTypePropertyWithPublicProtectedSet */ public protected(set) (A&B&C)|true $asym4; + /* testDNFTypeWithPHP84AbstractKeyword */ + abstract (className&InterfaceName)|false $abstractKeywordA { set; } + + /* testDNFTypeWithPHP84AbstractKeywordAndPublic */ + abstract public (\className&\InterfaceName)|false $abstractKeywordB { get; } + public function paramTypes( /* testDNFTypeParam1WithAttribute */ #[MyAttribute] diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.php index 5ef220ec..312df1b3 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/DNFTypesTest.php @@ -462,6 +462,13 @@ public static function dataDNFTypeParentheses() 'OO property type: asymmetric vis, public protected(set)' => [ 'testMarker' => '/* testDNFTypePropertyWithPublicProtectedSet */', ], + 'OO property type: with only abstract keyword' => [ + 'testMarker' => '/* testDNFTypeWithPHP84AbstractKeyword */', + ], + 'OO property type: with abstract and public keyword' => [ + 'testMarker' => '/* testDNFTypeWithPHP84AbstractKeywordAndPublic */', + ], + 'OO method param type: first param' => [ 'testMarker' => '/* testDNFTypeParam1WithAttribute */', ], diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.inc index 13b87242..adcce681 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.inc @@ -92,4 +92,6 @@ enum Foo: string { case DEFAULT = 'default'; /* testKeywordAsEnumCaseNameShouldBeString7 */ case ARRAY = 'array'; + /* testKeywordAsEnumCaseNameShouldBeString8 */ + case EXIT = 'exit'; } diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.php index 6836ea05..656a24c3 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/EnumCaseTest.php @@ -142,6 +142,7 @@ public static function dataKeywordAsEnumCaseNameShouldBeString() '"false" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString5 */'], '"default" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString6 */'], '"array" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString7 */'], + '"exit" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString8 */'], ]; }//end dataKeywordAsEnumCaseNameShouldBeString() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.inc new file mode 100644 index 00000000..d3c15183 --- /dev/null +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.inc @@ -0,0 +1,106 @@ +exit; + +/* testNotDieOOPropertyAccess */ +$obj->DIE; + +/* testNotExitOOMethodCall */ +$obj->exit(); + +/* testNotDieOOMethodCall */ +$obj->die(); + +class NotReserved { + /* testNotExitOOConstDeclaration */ + const exit = 10; + + /* testNotDieOOConstDeclaration */ + const die = 'status'; + + /* testNotExitOOMethodDeclaration */ + function Exit() {} + + /* testNotDieOOMethodDeclaration */ + function die() {} +} + +/* testNotExitParamName */ +callMe(exit: 10); + +/* testNotDieParamName */ +callMe(die: 'status'); + +/* testNotExitNamespacedName */ +use My\exit\NameA; + +/* testNotDieNamespacedName */ +use My\die\NameB; + +/* testExitAsFQConstant */ +// Intentional parse error. This is not allowed in PHP, but that's not the concern of the tokenizer. Should still be handled correctly. +\exit; + +/* testDieAsFQConstant */ +// Intentional parse error. This is not allowed in PHP, but that's not the concern of the tokenizer. Should still be handled correctly. +\die; + +/* testNotExitConstantDeclaration */ +// Intentional parse error. This is not allowed in PHP, but that's not the concern of the tokenizer. Should still be handled correctly. +const exit = 10; + +/* testNotDieConstantDeclaration */ +// Intentional parse error. This is not allowed in PHP, but that's not the concern of the tokenizer. Should still be handled correctly. +const die = 'status'; + +/* testNotExitFunctionDeclaration */ +// Intentional parse error. This is not allowed in PHP, but that's not the concern of the tokenizer. Should still be handled correctly. +function exit() {} + +/* testNotDieFunctionDeclaration */ +// Intentional parse error. This is not allowed in PHP, but that's not the concern of the tokenizer. Should still be handled correctly. +function die() {} diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.php new file mode 100644 index 00000000..f1dc7aad --- /dev/null +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ExitKeywordTest.php @@ -0,0 +1,229 @@ + + * @copyright 2024 PHPCSStandards and contributors + * @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence + */ + +namespace PHP_CodeSniffer\Tests\Core\Tokenizers\PHP; + +use PHP_CodeSniffer\Tests\Core\Tokenizers\AbstractTokenizerTestCase; + +final class ExitKeywordTest extends AbstractTokenizerTestCase +{ + + + /** + * Test the retokenization of the `exit`/`die` keywords to T_EXIT. + * + * @param string $testMarker The comment prefacing the target token. + * @param string $testContent The token content to look for. + * + * @dataProvider dataExitIsKeyword + * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize + * + * @return void + */ + public function testExitIsKeyword($testMarker, $testContent) + { + $tokens = $this->phpcsFile->getTokens(); + + $token = $this->getTargetToken($testMarker, [T_EXIT, T_STRING], $testContent); + $tokenArray = $tokens[$token]; + + $this->assertSame(T_EXIT, $tokenArray['code'], 'Token tokenized as '.$tokenArray['type'].', not T_EXIT (code)'); + $this->assertSame('T_EXIT', $tokenArray['type'], 'Token tokenized as '.$tokenArray['type'].', not T_EXIT (type)'); + + }//end testExitIsKeyword() + + + /** + * Data provider. + * + * @see testExitIsKeyword() + * + * @return array> + */ + public static function dataExitIsKeyword() + { + return [ + 'exit as constant' => [ + 'testMarker' => '/* testExitAsConstant */', + 'testContent' => 'exit', + ], + 'die as constant' => [ + 'testMarker' => '/* testDieAsConstant */', + 'testContent' => 'die', + ], + 'exit as constant; mixed case' => [ + 'testMarker' => '/* testExitAsConstantMixedCase */', + 'testContent' => 'Exit', + ], + 'die as constant; uppercase' => [ + 'testMarker' => '/* testDieAsConstantUppercase */', + 'testContent' => 'DIE', + ], + 'exit as function call; no parameters' => [ + 'testMarker' => '/* testExitAsFunctionCallNoParam */', + 'testContent' => 'exit', + ], + 'die as function call; no parameters' => [ + 'testMarker' => '/* testDieAsFunctionCallNoParam */', + 'testContent' => 'die', + ], + 'exit as function call; with parameters' => [ + 'testMarker' => '/* testExitAsFunctionCallWithParam */', + 'testContent' => 'exit', + ], + 'die as function call; with parameters' => [ + 'testMarker' => '/* testDieAsFunctionCallWithParam */', + 'testContent' => 'die', + ], + 'exit as function call; uppercase' => [ + 'testMarker' => '/* testExitAsFunctionCallUppercase */', + 'testContent' => 'EXIT', + ], + 'die as function call; mixed case' => [ + 'testMarker' => '/* testDieAsFunctionCallMixedCase */', + 'testContent' => 'dIE', + ], + 'exit as fully qualified function call; with parameters' => [ + 'testMarker' => '/* testExitAsFQFunctionCallWithParam */', + 'testContent' => 'exit', + ], + 'die as fully qualified function call; no parameters' => [ + 'testMarker' => '/* testDieAsFQFunctionCallNoParam */', + 'testContent' => 'die', + ], + 'exit as fully qualified constant (illegal)' => [ + 'testMarker' => '/* testExitAsFQConstant */', + 'testContent' => 'exit', + ], + 'die as fully qualified constant (illegal)' => [ + 'testMarker' => '/* testDieAsFQConstant */', + 'testContent' => 'die', + ], + ]; + + }//end dataExitIsKeyword() + + + /** + * Verify that the retokenization of `T_EXIT` tokens doesn't negatively impact the tokenization + * of `T_STRING` tokens with the contents "exit" or "die" which aren't in actual fact the keyword. + * + * @param string $testMarker The comment prefacing the target token. + * @param string $testContent The token content to look for. + * @param string $expected The expected token type. Defaults to `T_STRING`. + * + * @dataProvider dataNotExitKeyword + * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize + * + * @return void + */ + public function testNotExitKeyword($testMarker, $testContent, $expected='T_STRING') + { + $tokens = $this->phpcsFile->getTokens(); + $tokenCode = constant($expected); + + $token = $this->getTargetToken($testMarker, [T_EXIT, $tokenCode], $testContent); + $tokenArray = $tokens[$token]; + + $this->assertSame($tokenCode, $tokenArray['code'], 'Token tokenized as '.$tokenArray['type'].', not '.$expected.' (code)'); + $this->assertSame($expected, $tokenArray['type'], 'Token tokenized as '.$tokenArray['type'].', not '.$expected.' (type)'); + + }//end testNotExitKeyword() + + + /** + * Data provider. + * + * @see testNotExitKeyword() + * + * @return array> + */ + public static function dataNotExitKeyword() + { + return [ + 'exit not keyword: OO constant use' => [ + 'testMarker' => '/* testNotExitOOConstantAccess */', + 'testContent' => 'exit', + ], + 'die not keyword: OO constant use' => [ + 'testMarker' => '/* testNotDieOOConstantAccess */', + 'testContent' => 'die', + ], + 'exit not keyword: OO property access' => [ + 'testMarker' => '/* testNotExitOOPropertyAccess */', + 'testContent' => 'exit', + ], + 'die not keyword: OO property access' => [ + 'testMarker' => '/* testNotDieOOPropertyAccess */', + 'testContent' => 'DIE', + ], + 'exit not keyword: OO method call' => [ + 'testMarker' => '/* testNotExitOOMethodCall */', + 'testContent' => 'exit', + ], + 'die not keyword: OO method call' => [ + 'testMarker' => '/* testNotDieOOMethodCall */', + 'testContent' => 'die', + ], + 'exit not keyword: OO constant declaration' => [ + 'testMarker' => '/* testNotExitOOConstDeclaration */', + 'testContent' => 'exit', + ], + 'die not keyword: OO constant declaration' => [ + 'testMarker' => '/* testNotDieOOConstDeclaration */', + 'testContent' => 'die', + ], + 'exit not keyword: OO method declaration' => [ + 'testMarker' => '/* testNotExitOOMethodDeclaration */', + 'testContent' => 'Exit', + ], + 'die not keyword: OO method declaration' => [ + 'testMarker' => '/* testNotDieOOMethodDeclaration */', + 'testContent' => 'die', + ], + 'exit not keyword: parameter label for named param' => [ + 'testMarker' => '/* testNotExitParamName */', + 'testContent' => 'exit', + 'expected' => 'T_PARAM_NAME', + ], + 'die not keyword: parameter label for named param' => [ + 'testMarker' => '/* testNotDieParamName */', + 'testContent' => 'die', + 'expected' => 'T_PARAM_NAME', + ], + 'exit not keyword: part of a namespaced name' => [ + 'testMarker' => '/* testNotExitNamespacedName */', + 'testContent' => 'exit', + ], + 'die not keyword: part of a namespaced name' => [ + 'testMarker' => '/* testNotDieNamespacedName */', + 'testContent' => 'die', + ], + 'exit not keyword: global constant declaration (illegal)' => [ + 'testMarker' => '/* testNotExitConstantDeclaration */', + 'testContent' => 'exit', + ], + 'die not keyword: global constant declaration (illegal)' => [ + 'testMarker' => '/* testNotDieConstantDeclaration */', + 'testContent' => 'die', + ], + 'exit not keyword: global function declaration (illegal)' => [ + 'testMarker' => '/* testNotExitFunctionDeclaration */', + 'testContent' => 'exit', + ], + 'die not keyword: global function declaration (illegal)' => [ + 'testMarker' => '/* testNotDieFunctionDeclaration */', + 'testContent' => 'die', + ], + ]; + + }//end dataNotExitKeyword() + + +}//end class diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.inc index 2f1d20bf..7513ad70 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.inc @@ -106,6 +106,22 @@ $closure = $cond ? function() : bool {return true;} : function() : int {return 1 /* testTernaryWithArrowFunctionsAndReturnTypes */ $fn = $cond ? fn() : bool => true : fn() : int => 123; +/* testPHP84Exit */ +// Exit is a language construct, not a function prior to PHP 8.4. Prior to PHP 8.4, named params were not supported, handle it anyway. +exit(status: $value); + +/* testPHP84Die */ +// Die is a language construct, not a function prior to PHP 8.4. Prior to PHP 8.4, named params were not supported, handle it anyway. +die(status: $value); + +/* testPHP84FullyQualifiedExit */ +// Exit is a language construct, not a function prior to PHP 8.4. Prior to PHP 8.4, named params were not supported, handle it anyway. +\exit(status: $value); + +/* testPHP84FullyQualifiedDie */ +// Die is a language construct, not a function prior to PHP 8.4. Prior to PHP 8.4, named params were not supported, handle it anyway. +\die(status: $value); + /* testCompileErrorNamedBeforePositional */ // Not the concern of PHPCS. Should still be handled. @@ -131,10 +147,6 @@ test(param1:, param2:); // Parse error. Ignore. function_name($variableStoringParamName: $value); -/* testParseErrorExit */ -// Exit is a language construct, not a function. Named params not supported, handle it anyway. -exit(status: $value); - /* testParseErrorEmpty */ // Empty is a language construct, not a function. Named params not supported, handle it anyway. empty(variable: $value); diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.php index 768e41a9..d5259e42 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NamedFunctionCallArgumentsTest.php @@ -214,6 +214,30 @@ public static function dataNamedFunctionCallArguments() '_valid', ], ], + 'PHP 8.4+: named arg in exit()' => [ + 'testMarker' => '/* testPHP84Exit */', + 'parameters' => [ + 'status', + ], + ], + 'PHP 8.4+: named arg in die()' => [ + 'testMarker' => '/* testPHP84Die */', + 'parameters' => [ + 'status', + ], + ], + 'PHP 8.4+: named arg in fully qualified exit()' => [ + 'testMarker' => '/* testPHP84FullyQualifiedExit */', + 'parameters' => [ + 'status', + ], + ], + 'PHP 8.4+: named arg in fully qualified die()' => [ + 'testMarker' => '/* testPHP84FullyQualifiedDie */', + 'parameters' => [ + 'status', + ], + ], // Coding errors which should still be handled. 'invalid: named arg before positional (compile error)' => [ @@ -253,12 +277,6 @@ public static function dataNamedFunctionCallArguments() 'param2', ], ], - 'invalid: named arg in exit() (parse error)' => [ - 'testMarker' => '/* testParseErrorExit */', - 'parameters' => [ - 'status', - ], - ], 'invalid: named arg in empty() (parse error)' => [ 'testMarker' => '/* testParseErrorEmpty */', 'parameters' => [ diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NullableVsInlineThenTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NullableVsInlineThenTest.inc index 56ad3856..ce253912 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NullableVsInlineThenTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/NullableVsInlineThenTest.inc @@ -1,6 +1,6 @@ ['/* testNullableReadonlyOnly */'], 'property declaration, private set' => ['/* testNullablePrivateSet */'], 'property declaration, public and protected set' => ['/* testNullablePublicProtectedSet */'], + 'property declaration, final, no visibility' => ['/* testNullableFinalOnly */'], + 'property declaration, abstract, no visibility' => ['/* testNullableAbstractOnly */'], ]; }//end dataNullable() /** - * Test that "readonly" when not used as the keyword is still tokenized as `T_STRING`. + * Test that a "?" when used as part of a ternary expression is tokenized as `T_INLINE_THEN`. * * @param string $testMarker The comment which prefaces the target token in the test file. * diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.inc index 028592f7..9acb05a3 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.inc @@ -2,12 +2,12 @@ class OtherContextSensitiveKeywords { - const /* testParent */ PARENT = 'PARENT'; - const /* testSelf */ SELF = 'SELF'; + const /* testKeywordParentAsConstantNameShouldBeString */ PARENT = 'PARENT'; + const /* testKeywordSelfAsConstantNameShouldBeString */ SELF = 'SELF'; - const /* testFalse */ FALSE = 'FALSE', - const /* testTrue */ TRUE = 'TRUE', - const /* testNull */ NULL = 'NULL', + const /* testKeywordFalseAsConstantNameShouldBeString */ FALSE = 'FALSE', + const /* testKeywordTrueAsConstantNameShouldBeString */ TRUE = 'TRUE', + const /* testKeywordNullAsConstantNameShouldBeString */ NULL = 'NULL', } abstract class SomeClass @@ -245,3 +245,17 @@ class DNFTypes extends Something { ) : parent|(A&B) => $param->get(); } } + +/* testFalseIsKeywordUppercase */ +if ($a === FALSE) { +/* testTrueIsKeywordMixedCase */ +} elseif ( $b === True) { +/* testNullIsKeywordUppercase */ +} elseif ($c === NULL) {} + +/* testFullyQualifiedFalseIsKeyword */ +$a = \false; +/* testFullyQualifiedTrueIsKeyword */ +$b = \true; +/* testFullyQualifiedNullIsKeyword */ +$c = \null; diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.php index 35c89971..12c70c9d 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/OtherContextSensitiveKeywordsTest.php @@ -67,11 +67,11 @@ public function testStrings($testMarker) public static function dataStrings() { return [ - 'constant declaration: parent' => ['/* testParent */'], - 'constant declaration: self' => ['/* testSelf */'], - 'constant declaration: false' => ['/* testFalse */'], - 'constant declaration: true' => ['/* testTrue */'], - 'constant declaration: null' => ['/* testNull */'], + 'constant declaration: parent' => ['/* testKeywordParentAsConstantNameShouldBeString */'], + 'constant declaration: self' => ['/* testKeywordSelfAsConstantNameShouldBeString */'], + 'constant declaration: false' => ['/* testKeywordFalseAsConstantNameShouldBeString */'], + 'constant declaration: true' => ['/* testKeywordTrueAsConstantNameShouldBeString */'], + 'constant declaration: null' => ['/* testKeywordNullAsConstantNameShouldBeString */'], 'function declaration with return by ref: self' => ['/* testKeywordSelfAfterFunctionByRefShouldBeString */'], 'function declaration with return by ref: parent' => ['/* testKeywordParentAfterFunctionByRefShouldBeString */'], @@ -713,6 +713,30 @@ public static function dataKeywords() 'expectedTokenType' => 'T_PARENT', ], + 'false: in comparison, uppercase' => [ + 'testMarker' => '/* testFalseIsKeywordUppercase */', + 'expectedTokenType' => 'T_FALSE', + ], + 'true: in comparison, mixed case' => [ + 'testMarker' => '/* testTrueIsKeywordMixedCase */', + 'expectedTokenType' => 'T_TRUE', + ], + 'null: in comparison, uppercase' => [ + 'testMarker' => '/* testNullIsKeywordUppercase */', + 'expectedTokenType' => 'T_NULL', + ], + 'false: in assignment, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedFalseIsKeyword */', + 'expectedTokenType' => 'T_FALSE', + ], + 'true: in assignment, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedTrueIsKeyword */', + 'expectedTokenType' => 'T_TRUE', + ], + 'null: in assignment, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedNullIsKeyword */', + 'expectedTokenType' => 'T_NULL', + ], ]; }//end dataKeywords() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.inc index 60b23a51..cf3b91ee 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.inc @@ -68,6 +68,19 @@ $var = $obj?->function_call()[$x]; /* testInterpolatedStringDereferencing */ $var = "PHP{$rocks}"[1]; +/* testNewAnonClassNoParenthesesExpressionDereferencing */ +$a = new class {}[0]; + +$a = new class (['value']) + /* testNewAnonClassParenthesesExpressionDereferencing */ + {}[0]; + +/* testNewAnonClassExtendsExpressionDereferencing */ +$a = new readonly class extends ArrayObject {}[0]; + +/* testNewAnonClassImplementsExpressionDereferencing */ +$a = new class implements ArrayAccess {}[0]; + /* * Short array brackets. */ @@ -106,6 +119,10 @@ if ( true ) : [ $a ] = [ 'hi' ]; endif; +class Foo extends ArrayObject {} +/* testShortListDeclarationAfterClassDeclaration */ +[$a] = ['hi']; + /* testLiveCoding */ // Intentional parse error. This has to be the last test in the file. $array = [ diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.php index da9c7c10..456ee479 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/ShortArrayTest.php @@ -55,29 +55,33 @@ public function testSquareBrackets($testMarker) public static function dataSquareBrackets() { return [ - 'array access 1' => ['/* testArrayAccess1 */'], - 'array access 2' => ['/* testArrayAccess2 */'], - 'array assignment' => ['/* testArrayAssignment */'], - 'function call dereferencing' => ['/* testFunctionCallDereferencing */'], - 'method call dereferencing' => ['/* testMethodCallDereferencing */'], - 'static method call dereferencing' => ['/* testStaticMethodCallDereferencing */'], - 'property dereferencing' => ['/* testPropertyDereferencing */'], - 'property dereferencing with inaccessable name' => ['/* testPropertyDereferencingWithInaccessibleName */'], - 'static property dereferencing' => ['/* testStaticPropertyDereferencing */'], - 'string dereferencing single quotes' => ['/* testStringDereferencing */'], - 'string dereferencing double quotes' => ['/* testStringDereferencingDoubleQuoted */'], - 'global constant dereferencing' => ['/* testConstantDereferencing */'], - 'class constant dereferencing' => ['/* testClassConstantDereferencing */'], - 'magic constant dereferencing' => ['/* testMagicConstantDereferencing */'], - 'array access with curly braces' => ['/* testArrayAccessCurlyBraces */'], - 'array literal dereferencing' => ['/* testArrayLiteralDereferencing */'], - 'short array literal dereferencing' => ['/* testShortArrayLiteralDereferencing */'], - 'class member dereferencing on instantiation 1' => ['/* testClassMemberDereferencingOnInstantiation1 */'], - 'class member dereferencing on instantiation 2' => ['/* testClassMemberDereferencingOnInstantiation2 */'], - 'class member dereferencing on clone' => ['/* testClassMemberDereferencingOnClone */'], - 'nullsafe method call dereferencing' => ['/* testNullsafeMethodCallDereferencing */'], - 'interpolated string dereferencing' => ['/* testInterpolatedStringDereferencing */'], - 'live coding' => ['/* testLiveCoding */'], + 'array access 1' => ['/* testArrayAccess1 */'], + 'array access 2' => ['/* testArrayAccess2 */'], + 'array assignment' => ['/* testArrayAssignment */'], + 'function call dereferencing' => ['/* testFunctionCallDereferencing */'], + 'method call dereferencing' => ['/* testMethodCallDereferencing */'], + 'static method call dereferencing' => ['/* testStaticMethodCallDereferencing */'], + 'property dereferencing' => ['/* testPropertyDereferencing */'], + 'property dereferencing with inaccessable name' => ['/* testPropertyDereferencingWithInaccessibleName */'], + 'static property dereferencing' => ['/* testStaticPropertyDereferencing */'], + 'string dereferencing single quotes' => ['/* testStringDereferencing */'], + 'string dereferencing double quotes' => ['/* testStringDereferencingDoubleQuoted */'], + 'global constant dereferencing' => ['/* testConstantDereferencing */'], + 'class constant dereferencing' => ['/* testClassConstantDereferencing */'], + 'magic constant dereferencing' => ['/* testMagicConstantDereferencing */'], + 'array access with curly braces' => ['/* testArrayAccessCurlyBraces */'], + 'array literal dereferencing' => ['/* testArrayLiteralDereferencing */'], + 'short array literal dereferencing' => ['/* testShortArrayLiteralDereferencing */'], + 'class member dereferencing on instantiation 1' => ['/* testClassMemberDereferencingOnInstantiation1 */'], + 'class member dereferencing on instantiation 2' => ['/* testClassMemberDereferencingOnInstantiation2 */'], + 'class member dereferencing on clone' => ['/* testClassMemberDereferencingOnClone */'], + 'nullsafe method call dereferencing' => ['/* testNullsafeMethodCallDereferencing */'], + 'interpolated string dereferencing' => ['/* testInterpolatedStringDereferencing */'], + 'new anonymous class expression dereferencing 1' => ['/* testNewAnonClassNoParenthesesExpressionDereferencing */'], + 'new anonymous class expression dereferencing 2' => ['/* testNewAnonClassParenthesesExpressionDereferencing */'], + 'new anonymous class expression dereferencing 3' => ['/* testNewAnonClassExtendsExpressionDereferencing */'], + 'new anonymous class expression dereferencing 4' => ['/* testNewAnonClassImplementsExpressionDereferencing */'], + 'live coding' => ['/* testLiveCoding */'], ]; }//end dataSquareBrackets() @@ -133,6 +137,7 @@ public static function dataShortArrays() 'short list after braced control structure' => ['/* testShortListDeclarationAfterBracedControlStructure */'], 'short list after non-braced control structure' => ['/* testShortListDeclarationAfterNonBracedControlStructure */'], 'short list after alternative control structure' => ['/* testShortListDeclarationAfterAlternativeControlStructure */'], + 'short list after class declaration' => ['/* testShortListDeclarationAfterClassDeclaration */'], ]; }//end dataShortArrays() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.inc index 54b3c06e..c5792d6c 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.inc @@ -7,7 +7,7 @@ /* testBitwiseAnd1 */ $result = $value & $test /* testBitwiseAnd2 */ & $another; -class TypeIntersection +abstract class TypeIntersection { /* testTypeIntersectionOOConstSimple */ public const Foo&Bar SIMPLE = new Foo(); @@ -81,6 +81,12 @@ class TypeIntersection /* testTypeIntersectionPropertyWithPublicProtectedSet */ public protected(set) Foo&Bar $asym4; + /* testTypeIntersectionWithPHP84AbstractKeyword */ + abstract className&InterfaceName $abstractKeywordA { get; } + + /* testTypeIntersectionWithPHP84AbstractKeywordFirst */ + abstract protected \className&InterfaceName $abstractKeywordB { set; } + public function paramTypes( /* testTypeIntersectionParam1 */ Foo&Bar $paramA /* testBitwiseAndParamDefaultValue */ = CONSTANT_A & CONSTANT_B, diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.php index 3a4eb007..210a106d 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/TypeIntersectionTest.php @@ -130,6 +130,8 @@ public static function dataTypeIntersection() 'type for asymmetric visibility (public private(set)) prop' => ['/* testTypeIntersectionPropertyWithPublicPrivateSet */'], 'type for asymmetric visibility (protected(set)) property' => ['/* testTypeIntersectionPropertyWithProtectedSet */'], 'type for asymmetric visibility (public protected(set)) prop' => ['/* testTypeIntersectionPropertyWithPublicProtectedSet */'], + 'type for abstract property' => ['/* testTypeIntersectionWithPHP84AbstractKeyword */'], + 'type for abstract property reversed modifier order' => ['/* testTypeIntersectionWithPHP84AbstractKeywordFirst */'], 'type for method parameter' => ['/* testTypeIntersectionParam1 */'], 'type for method parameter, first in multi-intersect' => ['/* testTypeIntersectionParam2 */'], 'type for method parameter, last in multi-intersect' => ['/* testTypeIntersectionParam3 */'], diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.inc index 65c551a8..50dccbdb 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.inc @@ -118,7 +118,7 @@ class MyClass /* testDoubleColonPartiallyQualified */ $value = Level\ClassName::CONSTANT_NAME['key']; - + /* testInstanceOfRelative */ $is = $obj instanceof namespace\ClassName; @@ -133,6 +133,59 @@ class MyClass } } +function testHandlingExitDieTrueFalseNull() { + /* testExitInNamespacedNameStart */ + echo Exit\Name; + /* testExitInNamespacedNameMiddle */ + echo \Not\exit\Name; + /* testExitInNamespacedNameEnd */ + echo \Not\Exit; + /* testFullyQualifiedExitFunctionCall */ + \Exit(); + /* testFullyQualifiedExitConstant */ + // This is a parse error in PHP, but that's not our concern + \exit; + + /* testDieInNamespacedNameStart */ + echo \Die\Name; + /* testDieInNamespacedNameMiddle */ + echo \Not\die\Name; + /* testDieInNamespacedNameEnd */ + echo \Not\DIE; + /* testFullyQualifiedDieFunctionCall */ + \die(); + /* testFullyQualifiedDieConstant */ + // This is a parse error in PHP, but that's not our concern + \DIE; + + /* testFalseInNamespacedNameStart */ + echo False\Name; + /* testFalseInNamespacedNameMiddle */ + echo \Not\false\Name; + /* testFalseInNamespacedNameEnd */ + echo \Not\FALSE; + /* testFullyQualifiedFalse */ + echo \false; + + /* testTrueInNamespacedNameStart */ + echo \True\Name; + /* testTrueInNamespacedNameMiddle */ + echo \Not\true\Name; + /* testTrueInNamespacedNameEnd */ + echo \Not\True; + /* testFullyQualifiedTrue */ + echo \TRUE; + + /* testNullInNamespacedNameStart */ + echo Null\Name; + /* testNullInNamespacedNameMiddle */ + echo \Not\Null\Name; + /* testNullInNamespacedNameEnd */ + echo \Not\null; + /* testFullyQualifiedNull */ + echo \Null; +} + /* testInvalidInPHP8Whitespace */ namespace \ Sublevel \ function_name(); diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.php index 18a88fe8..12ead613 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/PHP/UndoNamespacedNameSingleTokenTest.php @@ -1172,6 +1172,529 @@ public static function dataIdentifierTokenization() ], ], ], + 'exit in partially qualified name (start)' => [ + 'testMarker' => '/* testExitInNamespacedNameStart */', + 'expectedTokens' => [ + [ + 'type' => 'T_STRING', + 'content' => 'Exit', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'exit in fully qualified name (middle)' => [ + 'testMarker' => '/* testExitInNamespacedNameMiddle */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'exit', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'exit in fully qualified name (end)' => [ + 'testMarker' => '/* testExitInNamespacedNameEnd */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Exit', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'PHP 8.4 exit as function call, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedExitFunctionCall */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_EXIT', + 'content' => 'Exit', + ], + [ + 'type' => 'T_OPEN_PARENTHESIS', + 'content' => '(', + ], + ], + ], + 'exit as constant, fully qualified (illegal)' => [ + 'testMarker' => '/* testFullyQualifiedExitConstant */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_EXIT', + 'content' => 'exit', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'die in partially qualified name (start)' => [ + 'testMarker' => '/* testDieInNamespacedNameStart */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Die', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'die in fully qualified name (middle)' => [ + 'testMarker' => '/* testDieInNamespacedNameMiddle */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'die', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'die in fully qualified name (end)' => [ + 'testMarker' => '/* testDieInNamespacedNameEnd */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'DIE', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'PHP 8.4 die as function call, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedDieFunctionCall */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_EXIT', + 'content' => 'die', + ], + [ + 'type' => 'T_OPEN_PARENTHESIS', + 'content' => '(', + ], + ], + ], + 'die as constant, fully qualified (illegal)' => [ + 'testMarker' => '/* testFullyQualifiedDieConstant */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_EXIT', + 'content' => 'DIE', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'false in partially qualified name (start)' => [ + 'testMarker' => '/* testFalseInNamespacedNameStart */', + 'expectedTokens' => [ + [ + 'type' => 'T_STRING', + 'content' => 'False', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'false in fully qualified name (middle)' => [ + 'testMarker' => '/* testFalseInNamespacedNameMiddle */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'false', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'false in fully qualified name (end)' => [ + 'testMarker' => '/* testFalseInNamespacedNameEnd */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'FALSE', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'false, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedFalse */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_FALSE', + 'content' => 'false', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'true in partially qualified name (start)' => [ + 'testMarker' => '/* testTrueInNamespacedNameStart */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'True', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'true in fully qualified name (middle)' => [ + 'testMarker' => '/* testTrueInNamespacedNameMiddle */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'true', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'true in fully qualified name (end)' => [ + 'testMarker' => '/* testTrueInNamespacedNameEnd */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'True', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'true, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedTrue */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_TRUE', + 'content' => 'TRUE', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'null in partially qualified name (start)' => [ + 'testMarker' => '/* testNullInNamespacedNameStart */', + 'expectedTokens' => [ + [ + 'type' => 'T_STRING', + 'content' => 'Null', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'null in fully qualified name (middle)' => [ + 'testMarker' => '/* testNullInNamespacedNameMiddle */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Null', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Name', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'null in fully qualified name (end)' => [ + 'testMarker' => '/* testNullInNamespacedNameEnd */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'Not', + ], + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_STRING', + 'content' => 'null', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'null, fully qualified' => [ + 'testMarker' => '/* testFullyQualifiedNull */', + 'expectedTokens' => [ + [ + 'type' => 'T_NS_SEPARATOR', + 'content' => '\\', + ], + [ + 'type' => 'T_NULL', + 'content' => 'Null', + ], + [ + 'type' => 'T_SEMICOLON', + 'content' => ';', + ], + ], + ], + 'function call, namespace relative, with whitespace (invalid in PHP 8)' => [ 'testMarker' => '/* testInvalidInPHP8Whitespace */', 'expectedTokens' => [ diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.inc b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.inc index 5a0debcd..c41aeddb 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.inc +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.inc @@ -95,6 +95,8 @@ enum Foo: string { case DEFAULT = 'default'; /* testKeywordAsEnumCaseNameShouldBeString7 */ case ARRAY = 'array'; + /* testKeywordAsEnumCaseNameShouldBeString8 */ + case EXIT = 'exit'; } // Test for https://github.com/squizlabs/PHP_CodeSniffer/issues/497 diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.php index ca70a34c..2b185c57 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Tokenizers/Tokenizer/RecurseScopeMapCaseKeywordConditionsTest.php @@ -263,6 +263,7 @@ public static function dataKeywordAsEnumCaseNameShouldBeString() '"false" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString5 */'], '"default" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString6 */'], '"array" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString7 */'], + '"exit" as case name' => ['/* testKeywordAsEnumCaseNameShouldBeString8 */'], ]; }//end dataKeywordAsEnumCaseNameShouldBeString() diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Util/Common/IsCamelCapsTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Util/Common/IsCamelCapsTest.php index 951d7618..609334aa 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Util/Common/IsCamelCapsTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Util/Common/IsCamelCapsTest.php @@ -24,117 +24,489 @@ final class IsCamelCapsTest extends TestCase /** * Test valid public function/method names. * + * @param string $name The tested name. + * @param bool $strict Value of the $strict flag. + * + * @dataProvider dataValidNotClassFormatPublic + * * @return void */ - public function testValidNotClassFormatPublic() + public function testValidNotClassFormatPublic($name, $strict) { - $this->assertTrue(Common::isCamelCaps('thisIsCamelCaps', false, true, true)); - $this->assertTrue(Common::isCamelCaps('thisISCamelCaps', false, true, false)); + $this->assertTrue(Common::isCamelCaps($name, false, true, $strict)); }//end testValidNotClassFormatPublic() + /** + * Data provider. + * + * @see testValidNotClassFormatPublic() + * + * @return array> + */ + public static function dataValidNotClassFormatPublic() + { + return [ + 'lower camelCase string in strict mode' => [ + 'name' => 'thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with acronym in relaxed mode' => [ + 'name' => 'thisISCamelCaps', + 'strict' => false, + ], + 'lower camelCase string with initial acronym' => [ + 'name' => 'ISThisCamelCaps', + 'strict' => false, + ], + ]; + + }//end dataValidNotClassFormatPublic() + + /** * Test invalid public function/method names. * + * @param string $name The tested name. + * + * @dataProvider dataInvalidNotClassFormatPublic + * * @return void */ - public function testInvalidNotClassFormatPublic() + public function testInvalidNotClassFormatPublic($name) { - $this->assertFalse(Common::isCamelCaps('_thisIsCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('thisISCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('ThisIsCamelCaps', false, true, true)); + $this->assertFalse(Common::isCamelCaps($name, false, true, true)); - $this->assertFalse(Common::isCamelCaps('3thisIsCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('*thisIsCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('-thisIsCamelCaps', false, true, true)); + }//end testInvalidNotClassFormatPublic() - $this->assertFalse(Common::isCamelCaps('this*IsCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('this-IsCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('this_IsCamelCaps', false, true, true)); - $this->assertFalse(Common::isCamelCaps('this_is_camel_caps', false, true, true)); - }//end testInvalidNotClassFormatPublic() + /** + * Data provider. + * + * @see testInvalidNotClassFormatPublic() + * + * @return array> + */ + public static function dataInvalidNotClassFormatPublic() + { + return [ + 'string with initial underscore (invalid when $public is true)' => [ + 'name' => '_thisIsCamelCaps', + ], + 'lower camelCase string with acronym (invalid when $strict is true)' => [ + 'name' => 'thisISCamelCaps', + ], + 'lower camelCase string with initial acronym (invalid when $strict is true)' => [ + 'name' => 'ISThisCamelCaps', + ], + 'PascalCase string' => [ + 'name' => 'ThisIsCamelCaps', + ], + 'lower camelCase string with initial digit' => [ + 'name' => '3thisIsCamelCaps', + ], + 'lower camelCase string with initial illegal character: *' => [ + 'name' => '*thisIsCamelCaps', + ], + 'lower camelCase string with initial illegal character: -' => [ + 'name' => '-thisIsCamelCaps', + ], + 'lower camelCase string with initial illegal character: é' => [ + 'name' => 'éCamelCaps', + ], + 'lower camelCase string with medial illegal character: *' => [ + 'name' => 'this*IsCamelCaps', + ], + 'lower camelCase string with medial illegal character: -' => [ + 'name' => 'this-IsCamelCaps', + ], + 'lower camelCase string with medial illegal character: é' => [ + // No camels were harmed in the cspell:disable-next-line. + 'name' => 'thisIsCamélCaps', + ], + 'lower camelCase string with single medial underscore' => [ + 'name' => 'this_IsCamelCaps', + ], + 'snake_case string' => [ + 'name' => 'this_is_camel_caps', + ], + 'empty string' => [ + 'name' => '', + ], + ]; + + }//end dataInvalidNotClassFormatPublic() /** * Test valid private method names. * + * @param string $name The tested name. + * @param bool $strict Value of the $strict flag. + * + * @dataProvider dataValidNotClassFormatPrivate + * * @return void */ - public function testValidNotClassFormatPrivate() + public function testValidNotClassFormatPrivate($name, $strict) { - $this->assertTrue(Common::isCamelCaps('_thisIsCamelCaps', false, false, true)); - $this->assertTrue(Common::isCamelCaps('_thisISCamelCaps', false, false, false)); - $this->assertTrue(Common::isCamelCaps('_i18N', false, false, true)); - $this->assertTrue(Common::isCamelCaps('_i18n', false, false, true)); + $this->assertTrue(Common::isCamelCaps($name, false, false, $strict)); }//end testValidNotClassFormatPrivate() + /** + * Data provider. + * + * @see testValidNotClassFormatPrivate() + * + * @return array> + */ + public static function dataValidNotClassFormatPrivate() + { + return [ + 'lower camelCase string with initial underscore' => [ + 'name' => '_thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with acronym and initial underscore' => [ + 'name' => '_thisISCamelCaps', + 'strict' => false, + ], + 'lower camelCase string with acronym after initial underscore' => [ + 'name' => '_ISThisCamelCaps', + 'strict' => false, + ], + 'numeronym with initial underscore and capital after digit' => [ + 'name' => '_i18N', + 'strict' => true, + ], + 'numeronym with initial underscore and lowercase character after digit' => [ + 'name' => '_i18n', + 'strict' => true, + ], + ]; + + }//end dataValidNotClassFormatPrivate() + + /** * Test invalid private method names. * + * @param string $name The tested name. + * @param bool $strict Value of the $strict flag. + * + * @dataProvider dataInvalidNotClassFormatPrivate + * * @return void */ - public function testInvalidNotClassFormatPrivate() + public function testInvalidNotClassFormatPrivate($name, $strict) { - $this->assertFalse(Common::isCamelCaps('thisIsCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('_thisISCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('__thisIsCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('__thisISCamelCaps', false, false, false)); - - $this->assertFalse(Common::isCamelCaps('3thisIsCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('*thisIsCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('-thisIsCamelCaps', false, false, true)); - $this->assertFalse(Common::isCamelCaps('_this_is_camel_caps', false, false, true)); + $this->assertFalse(Common::isCamelCaps($name, false, false, $strict)); }//end testInvalidNotClassFormatPrivate() + /** + * Data provider. + * + * @see testInvalidNotClassFormatPrivate() + * + * @return array> + */ + public static function dataInvalidNotClassFormatPrivate() + { + return [ + 'lower camelCase string without initial underscore' => [ + 'name' => 'thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with initial underscore, but with an acronym, in strict mode' => [ + 'name' => '_thisISCamelCaps', + 'strict' => true, + ], + 'PascalCase string with initial underscore' => [ + 'name' => '_ThisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with two initial underscores' => [ + 'name' => '__thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with two initial underscores and acronym in relaxed mode' => [ + 'name' => '__thisISCamelCaps', + 'strict' => false, + ], + 'lower camelCase string with initial digit' => [ + 'name' => '3thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with initial illegal character: *' => [ + 'name' => '*thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with initial illegal character: -' => [ + 'name' => '-thisIsCamelCaps', + 'strict' => true, + ], + 'lower camelCase string with initial illegal character: é' => [ + 'name' => 'éCamelCaps', + 'strict' => true, + ], + 'snake_case string with initial underscore' => [ + 'name' => '_this_is_camel_caps', + 'strict' => true, + ], + 'single underscore' => [ + 'name' => '_', + 'strict' => true, + ], + 'empty string' => [ + 'name' => '', + 'strict' => true, + ], + ]; + + }//end dataInvalidNotClassFormatPrivate() + + /** * Test valid class names. * + * @param string $name The tested name. + * @param bool $strict Value of the $strict flag. + * + * @dataProvider dataValidClassFormatPublic + * * @return void */ - public function testValidClassFormatPublic() + public function testValidClassFormatPublic($name, $strict) { - $this->assertTrue(Common::isCamelCaps('ThisIsCamelCaps', true, true, true)); - $this->assertTrue(Common::isCamelCaps('ThisISCamelCaps', true, true, false)); - $this->assertTrue(Common::isCamelCaps('This3IsCamelCaps', true, true, false)); + $this->assertTrue(Common::isCamelCaps($name, true, true, $strict)); }//end testValidClassFormatPublic() + /** + * Data provider. + * + * @see testValidClassFormatPublic() + * + * @return array> + */ + public static function dataValidClassFormatPublic() + { + return [ + 'PascalCase string' => [ + 'name' => 'ThisIsCamelCaps', + 'strict' => true, + ], + 'PascalCase string with acronym' => [ + 'name' => 'ThisISCamelCaps', + 'strict' => false, + ], + 'PascalCase string with digit between words' => [ + 'name' => 'This3IsCamelCaps', + 'strict' => false, + ], + 'PascalCase string with digit inside word' => [ + 'name' => 'Th1sIsCamelCaps', + 'strict' => false, + ], + 'Single capital (strict)' => [ + 'name' => 'A', + 'strict' => true, + ], + 'Single capital with digit (strict)' => [ + 'name' => 'A1', + 'strict' => true, + ], + 'Single capital (relaxed)' => [ + 'name' => 'A', + 'strict' => false, + ], + 'Single capital with digit (relaxed)' => [ + 'name' => 'A1', + 'strict' => false, + ], + ]; + + }//end dataValidClassFormatPublic() + + /** * Test invalid class names. * + * @param string $name The tested name. + * + * @dataProvider dataInvalidClassFormat + * * @return void */ - public function testInvalidClassFormat() + public function testInvalidClassFormat($name) { - $this->assertFalse(Common::isCamelCaps('thisIsCamelCaps', true)); - $this->assertFalse(Common::isCamelCaps('This-IsCamelCaps', true)); - $this->assertFalse(Common::isCamelCaps('This_Is_Camel_Caps', true)); + $this->assertFalse(Common::isCamelCaps($name, true)); }//end testInvalidClassFormat() /** - * Test invalid class names with the private flag set. + * Data provider. + * + * @see testInvalidClassFormat() * - * Note that the private flag is ignored if the class format + * @return array> + */ + public static function dataInvalidClassFormat() + { + return [ + 'lower camelCase string' => [ + 'name' => 'thisIsCamelCaps', + ], + 'PascalCase string with medial illegal character: -' => [ + 'name' => 'This-IsCamelCaps', + ], + 'capitalised snake case' => [ + 'name' => 'This_Is_Camel_Caps', + ], + 'empty string' => [ + 'name' => '', + ], + ]; + + }//end dataInvalidClassFormat() + + + /** + * Test invalid class names with the public flag set. + * + * Note that the public flag is ignored if the class format * flag is set, so these names are all invalid. * + * @param string $name The tested name. + * @param bool $public Value of the $public flag. + * + * @dataProvider dataInvalidClassFormatWithPublicFlag + * + * @return void + */ + public function testInvalidClassFormatWithPublicFlag($name, $public) + { + $this->assertFalse(Common::isCamelCaps($name, true, $public)); + + }//end testInvalidClassFormatWithPublicFlag() + + + /** + * Data provider. + * + * @see testInvalidClassFormatWithPublicFlag() + * + * @return array> + */ + public static function dataInvalidClassFormatWithPublicFlag() + { + return [ + 'PascalCase string with initial underscore (public)' => [ + 'name' => '_ThisIsCamelCaps', + 'public' => true, + ], + 'PascalCase string with initial underscore (private)' => [ + 'name' => '_ThisIsCamelCaps', + 'public' => false, + ], + 'empty string (public)' => [ + 'name' => '', + 'public' => true, + ], + 'empty string (private)' => [ + 'name' => '', + 'public' => false, + ], + ]; + + }//end dataInvalidClassFormatWithPublicFlag() + + + /** + * Test valid strings with default arguments. + * + * @param string $name The tested name. + * + * @dataProvider dataValidDefaultArguments + * * @return void */ - public function testInvalidClassFormatPrivate() + public function testValidDefaultArguments($name) + { + $this->assertTrue(Common::isCamelCaps($name)); + + }//end testValidDefaultArguments() + + + /** + * Data provider. + * + * @see testValidDefaultArguments() + * + * @return array> + */ + public static function dataValidDefaultArguments() + { + return [ + 'lower camelCase string' => [ + 'name' => 'thisIsCamelCaps', + ], + 'lower camelCase string with medial digit' => [ + 'name' => 'this3IsCamelCaps', + ], + ]; + + }//end dataValidDefaultArguments() + + + /** + * Test invalid strings with default arguments. + * + * @param string $name The tested name. + * + * @dataProvider dataInvalidDefaultArguments + * + * @return void + */ + public function testInvalidDefaultArguments($name) + { + $this->assertFalse(Common::isCamelCaps($name)); + + }//end testInvalidDefaultArguments() + + + /** + * Data provider. + * + * @see testInvalidDefaultArguments() + * + * @return array> + */ + public static function dataInvalidDefaultArguments() { - $this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', true, true)); - $this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', true, false)); + return [ + 'PascalCase string' => [ + 'name' => 'ThisIsCamelCaps', + ], + 'PascalCase string with acronym' => [ + 'name' => 'ThisISCamelCaps', + ], + 'lower camelCase string with initial underscore' => [ + 'name' => '_thisIsCamelCaps', + ], + 'lower camelCase string with acronym' => [ + 'name' => 'thisISCamelCaps', + ], + ]; - }//end testInvalidClassFormatPrivate() + }//end dataInvalidDefaultArguments() }//end class diff --git a/vendor/squizlabs/php_codesniffer/tests/Core/Util/Help/HelpTest.php b/vendor/squizlabs/php_codesniffer/tests/Core/Util/Help/HelpTest.php index b3d51a5c..d6165e22 100644 --- a/vendor/squizlabs/php_codesniffer/tests/Core/Util/Help/HelpTest.php +++ b/vendor/squizlabs/php_codesniffer/tests/Core/Util/Help/HelpTest.php @@ -37,12 +37,8 @@ final class HelpTest extends TestCase */ public function testQaArgumentNamesAreWithinAcceptableBounds() { - $help = new Help(new ConfigDouble(), []); - - $reflMethod = new ReflectionMethod($help, 'getAllOptions'); - $reflMethod->setAccessible(true); - $allOptions = $reflMethod->invoke($help); - $reflMethod->setAccessible(false); + $help = new Help(new ConfigDouble(), []); + $allOptions = $this->invokeReflectionMethod($help, 'getAllOptions'); $this->assertGreaterThan(0, count($allOptions), 'No categories found'); @@ -81,12 +77,8 @@ public function testQaArgumentNamesAreWithinAcceptableBounds() */ public function testQaValidCategoryOptionDefinitions() { - $help = new Help(new ConfigDouble(), []); - - $reflMethod = new ReflectionMethod($help, 'getAllOptions'); - $reflMethod->setAccessible(true); - $allOptions = $reflMethod->invoke($help); - $reflMethod->setAccessible(false); + $help = new Help(new ConfigDouble(), []); + $allOptions = $this->invokeReflectionMethod($help, 'getAllOptions'); $this->assertGreaterThan(0, count($allOptions), 'No categories found'); @@ -185,10 +177,7 @@ public function testOptionFiltering($longOptions, $shortOptions, $expected) { $help = new Help(new ConfigDouble(), $longOptions, $shortOptions); - $reflProperty = new ReflectionProperty($help, 'activeOptions'); - $reflProperty->setAccessible(true); - $activeOptions = $reflProperty->getValue($help); - $reflProperty->setAccessible(false); + $activeOptions = $this->getReflectionProperty($help, 'activeOptions'); // Simplify the value to make it comparible. foreach ($activeOptions as $category => $options) { @@ -324,10 +313,7 @@ public function testOptionFilteringSpacerHandling($longOptions, $shortOptions) { $help = new Help(new ConfigDouble(), $longOptions, $shortOptions); - $reflProperty = new ReflectionProperty($help, 'activeOptions'); - $reflProperty->setAccessible(true); - $activeOptions = $reflProperty->getValue($help); - $reflProperty->setAccessible(false); + $activeOptions = $this->getReflectionProperty($help, 'activeOptions'); $this->assertNotEmpty($activeOptions, 'Active options is empty, test is invalid'); @@ -493,10 +479,7 @@ public function testReportWidthCalculations($reportWidth, $longOptions, $expecte $config = new ConfigDouble(["--report-width=$reportWidth", '--no-colors']); $help = new Help($config, $longOptions); - $reflMethod = new ReflectionMethod($help, 'printCategories'); - $reflMethod->setAccessible(true); - $reflMethod->invoke($help); - $reflMethod->setAccessible(false); + $this->invokeReflectionMethod($help, 'printCategories'); $this->expectOutputString($expectedOutput); @@ -572,12 +555,8 @@ public static function dataReportWidthCalculations() */ public function testColorizeVariableInput($input, $expected) { - $help = new Help(new ConfigDouble(), []); - - $reflMethod = new ReflectionMethod($help, 'colorizeVariableInput'); - $reflMethod->setAccessible(true); - $result = $reflMethod->invoke($help, $input); - $reflMethod->setAccessible(false); + $help = new Help(new ConfigDouble(), []); + $result = $this->invokeReflectionMethod($help, 'colorizeVariableInput', $input); $this->assertSame($expected, $result); @@ -640,20 +619,9 @@ public function testPrintCategoryOptionsNoColor($input, $expectedRegex) $config = new ConfigDouble(['--no-colors']); $help = new Help($config, []); - $reflProperty = new ReflectionProperty($help, 'activeOptions'); - $reflProperty->setAccessible(true); - $reflProperty->setValue($help, ['cat' => $input]); - $reflProperty->setAccessible(false); - - $reflMethod = new ReflectionMethod($help, 'setMaxOptionNameLength'); - $reflMethod->setAccessible(true); - $reflMethod->invoke($help); - $reflMethod->setAccessible(false); - - $reflMethod = new ReflectionMethod($help, 'printCategoryOptions'); - $reflMethod->setAccessible(true); - $reflMethod->invoke($help, $input); - $reflMethod->setAccessible(false); + $this->setReflectionProperty($help, 'activeOptions', ['cat' => $input]); + $this->invokeReflectionMethod($help, 'setMaxOptionNameLength'); + $this->invokeReflectionMethod($help, 'printCategoryOptions', $input); $this->expectOutputRegex($expectedRegex['no-color']); @@ -675,20 +643,9 @@ public function testPrintCategoryOptionsColor($input, $expectedRegex) $config = new ConfigDouble(['--colors']); $help = new Help($config, []); - $reflProperty = new ReflectionProperty($help, 'activeOptions'); - $reflProperty->setAccessible(true); - $reflProperty->setValue($help, ['cat' => $input]); - $reflProperty->setAccessible(false); - - $reflMethod = new ReflectionMethod($help, 'setMaxOptionNameLength'); - $reflMethod->setAccessible(true); - $reflMethod->invoke($help); - $reflMethod->setAccessible(false); - - $reflMethod = new ReflectionMethod($help, 'printCategoryOptions'); - $reflMethod->setAccessible(true); - $reflMethod->invoke($help, $input); - $reflMethod->setAccessible(false); + $this->setReflectionProperty($help, 'activeOptions', ['cat' => $input]); + $this->invokeReflectionMethod($help, 'setMaxOptionNameLength'); + $this->invokeReflectionMethod($help, 'printCategoryOptions', $input); $this->expectOutputRegex($expectedRegex['color']); @@ -766,4 +723,70 @@ public static function dataPrintCategoryOptions() }//end dataPrintCategoryOptions() + /** + * Test Helper: invoke a reflected method which is not publicly accessible. + * + * @param \PHP_CodeSniffer\Util\Help $help Instance of a Help object. + * @param string $methodName The name of the method to invoke. + * @param mixed $params Optional. Parameters to pass to the method invocation. + * + * @return mixed + */ + private function invokeReflectionMethod(Help $help, $methodName, $params=null) + { + $reflMethod = new ReflectionMethod($help, $methodName); + (PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(true); + + if ($params === null) { + $returnValue = $reflMethod->invoke($help); + } else { + $returnValue = $reflMethod->invoke($help, $params); + } + + (PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(false); + + return $returnValue; + + }//end invokeReflectionMethod() + + + /** + * Test Helper: retrieve the value of property which is not publicly accessible. + * + * @param \PHP_CodeSniffer\Util\Help $help Instance of a Help object. + * @param string $properyName The name of the property to retrieve. + * + * @return mixed + */ + private function getReflectionProperty(Help $help, $properyName) + { + $reflProperty = new ReflectionProperty($help, $properyName); + (PHP_VERSION_ID < 80100) && $reflProperty->setAccessible(true); + $returnValue = $reflProperty->getValue($help); + (PHP_VERSION_ID < 80100) && $reflProperty->setAccessible(false); + + return $returnValue; + + }//end getReflectionProperty() + + + /** + * Test Helper: set the value of property which is not publicly accessible. + * + * @param \PHP_CodeSniffer\Util\Help $help Instance of a Help object. + * @param string $properyName The name of the property to set. + * @param mixed $value The value to set. + * + * @return void + */ + private function setReflectionProperty(Help $help, $properyName, $value) + { + $reflProperty = new ReflectionProperty($help, $properyName); + (PHP_VERSION_ID < 80100) && $reflProperty->setAccessible(true); + $reflProperty->setValue($help, $value); + (PHP_VERSION_ID < 80100) && $reflProperty->setAccessible(false); + + }//end setReflectionProperty() + + }//end class diff --git a/vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc b/vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc new file mode 100644 index 00000000..700fe7a7 --- /dev/null +++ b/vendor/squizlabs/php_codesniffer/tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc @@ -0,0 +1,18 @@ + + + The coding standard for end to end tests. + + + + . + + + + + + diff --git a/vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcbf_test.sh b/vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcbf_test.sh new file mode 100644 index 00000000..38868323 --- /dev/null +++ b/vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcbf_test.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +function tear_down() { + rm -r tests/EndToEnd/Fixtures/*.fixed +} + +function test_phpcbf_is_working() { + OUTPUT="$(bin/phpcbf --no-cache --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc)" + + assert_successful_code + assert_contains "No violations were found" "$OUTPUT" +} + +function test_phpcbf_is_working_in_parallel() { + OUTPUT="$(bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc)" + + assert_successful_code + assert_contains "No violations were found" "$OUTPUT" +} + +function test_phpcbf_returns_error_on_issues() { + OUTPUT="$(bin/phpcbf --no-colors --no-cache --suffix=.fixed --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc)" + assert_exit_code 1 + + assert_contains "F 1 / 1 (100%)" "$OUTPUT" + assert_contains "A TOTAL OF 1 ERROR WERE FIXED IN 1 FILE" "$OUTPUT" +} + +function test_phpcbf_bug_1112() { + # See https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1112 + if [[ "$(uname)" == "Darwin" ]]; then + # Perform some magic with `& fg` to prevent the processes from turning into a background job. + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc" & fg')" + else + # This is not needed on Linux / GitHub Actions + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcbf --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc"')" + fi +} diff --git a/vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcs_test.sh b/vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcs_test.sh new file mode 100644 index 00000000..3bdf4170 --- /dev/null +++ b/vendor/squizlabs/php_codesniffer/tests/EndToEnd/phpcs_test.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +function test_phpcs_is_working() { + assert_successful_code "$(bin/phpcs --no-cache --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc)" +} + +function test_phpcs_is_working_in_parallel() { + assert_successful_code "$(bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc)" +} + +function test_phpcs_returns_error_on_issues() { + OUTPUT="$(bin/phpcs --no-colors --no-cache --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassWithStyleError.inc)" + assert_exit_code 2 + + assert_contains "E 1 / 1 (100%)" "$OUTPUT" + assert_contains "FOUND 1 ERROR AFFECTING 1 LINE" "$OUTPUT" +} + +function test_phpcs_bug_1112() { + # See https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/1112 + if [[ "$(uname)" == "Darwin" ]]; then + # Perform some magic with `& fg` to prevent the processes from turning into a background job. + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc" & fg')" + else + # This is not needed on Linux / GitHub Actions + assert_successful_code "$(bash -ic 'bash --init-file <(echo "echo \"Subprocess\"") -c "bin/phpcs --no-cache --parallel=2 --standard=tests/EndToEnd/Fixtures/endtoend.xml.dist tests/EndToEnd/Fixtures/ClassOneWithoutStyleError.inc tests/EndToEnd/Fixtures/ClassTwoWithoutStyleError.inc"')" + fi +}