diff --git a/CHANGELOG.md b/CHANGELOG.md index 31e490ed4c..cd53422adc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2268,7 +2268,7 @@ Additionally, thanks to [Alexander Turek][@derrabus] for consulting on the repo - Thanks to [Juliette Reinders Folmer][@jrfnl] for the help with this patch - Array properties set inside a ruleset.xml file can now extend a previous value instead of always overwriting it - e.g., if you include a ruleset that defines forbidden functions, can you now add to that list instead of having to redefine it - - To use this feature, add extends="true" to the property tag + - To use this feature, add extend="true" to the property tag - e.g., property name="forbiddenFunctionNames" type="array" extend="true" - Thanks to [Michael Moravec][@Majkl578] for the patch - If $XDG_CACHE_HOME is set and points to a valid directory, it will be used for caching instead of the system temp directory diff --git a/src/Sniffs/AbstractScopeSniff.php b/src/Sniffs/AbstractScopeSniff.php index d2b6979d57..165474ac46 100644 --- a/src/Sniffs/AbstractScopeSniff.php +++ b/src/Sniffs/AbstractScopeSniff.php @@ -14,7 +14,7 @@ * protected function processTokenWithinScope(\PHP_CodeSniffer\Files\File $phpcsFile, $stackPtr, $currScope) * { * $className = $phpcsFile->getDeclarationName($currScope); - * echo 'encountered a method within class '.$className; + * $phpcsFile->addWarning('encountered a method within class '.$className, $stackPtr, 'MethodFound'); * } * } * diff --git a/src/Tokenizers/Comment.php b/src/Tokenizers/Comment.php index b7c6e3745e..e779c84a20 100644 --- a/src/Tokenizers/Comment.php +++ b/src/Tokenizers/Comment.php @@ -16,14 +16,11 @@ class Comment /** - * Creates an array of tokens when given some PHP code. + * Splits a single doc block comment token up into something that can be easily iterated over. * - * Starts by using token_get_all() but does a lot of extra processing - * to insert information about the context of the token. - * - * @param string $string The string to tokenize. + * @param string $string The doc block comment string to parse. * @param string $eolChar The EOL character to use for splitting strings. - * @param int $stackPtr The position of the first token in the file. + * @param int $stackPtr The position of the token in the "new"/final token stream. * * @return array>> */ diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index 32fefc9473..73a0c4b4a8 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -2298,7 +2298,7 @@ function return types. We want to keep the parenthesis map clean, ) { // Non-empty content. if (is_array($tokens[$x]) === true && $tokens[$x][0] === T_USE) { - // Found a use statements, so search ahead for the closing parenthesis. + // Found a use statement, so search ahead for the closing parenthesis. for ($x += 1; $x < $numTokens; $x++) { if (is_array($tokens[$x]) === false && $tokens[$x] === ')') { continue(2); diff --git a/src/Tokenizers/Tokenizer.php b/src/Tokenizers/Tokenizer.php index 8c90cd7c19..b22de1cc16 100644 --- a/src/Tokenizers/Tokenizer.php +++ b/src/Tokenizers/Tokenizer.php @@ -76,9 +76,9 @@ abstract class Tokenizer /** * Initialise and run the tokenizer. * - * @param string $content The content to tokenize. - * @param \PHP_CodeSniffer\Config | null $config The config data for the run. - * @param string $eolChar The EOL char used in the content. + * @param string $content The content to tokenize. + * @param \PHP_CodeSniffer\Config|null $config The config data for the run. + * @param string $eolChar The EOL char used in the content. * * @return void * @throws \PHP_CodeSniffer\Exceptions\TokenizerException If the file appears to be minified. diff --git a/tests/ConfigDouble.php b/tests/ConfigDouble.php index 62caaba8da..8ebce05858 100644 --- a/tests/ConfigDouble.php +++ b/tests/ConfigDouble.php @@ -41,7 +41,7 @@ final class ConfigDouble extends Config * the ruleset auto-discovery. * Note: there is no need to set this to `true` when a standard * is being passed via the `$cliArgs`. Those settings will always - * respected. + * be respected. * Defaults to `false`. Will result in the standard being set * to "PSR1" if not provided via `$cliArgs`. * @param bool $skipSettingReportWidth Whether to skip setting a report-width to prevent diff --git a/tests/Core/File/GetMethodPropertiesTest.php b/tests/Core/File/GetMethodPropertiesTest.php index 273ff4b288..fff60b9c4f 100644 --- a/tests/Core/File/GetMethodPropertiesTest.php +++ b/tests/Core/File/GetMethodPropertiesTest.php @@ -356,7 +356,7 @@ public function testReturnNamespace() /** - * Test a method with a messy namespaces return type. + * Test a method with a messy namespaced return type. * * @return void */ diff --git a/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/PropertyTypeHandlingSniff.php b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/PropertyTypeHandlingSniff.php index 49f50c433d..3c5fceb999 100644 --- a/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/PropertyTypeHandlingSniff.php +++ b/tests/Core/Ruleset/Fixtures/TestStandard/Sniffs/SetProperty/PropertyTypeHandlingSniff.php @@ -2,7 +2,7 @@ /** * Test fixture. * - * @see \PHP_CodeSniffer\Tests\Core\Ruleset\SetSniffPropertyTest + * @see \PHP_CodeSniffer\Tests\Core\Ruleset\PropertyTypeHandlingTest */ namespace Fixtures\TestStandard\Sniffs\SetProperty; diff --git a/tests/Core/Ruleset/ProcessRulesetShouldProcessElementTest.php b/tests/Core/Ruleset/ProcessRulesetShouldProcessElementTest.php index cd04ae78dc..1f0780c44b 100644 --- a/tests/Core/Ruleset/ProcessRulesetShouldProcessElementTest.php +++ b/tests/Core/Ruleset/ProcessRulesetShouldProcessElementTest.php @@ -88,7 +88,7 @@ protected function initializeConfigAndRuleset() /** - * Destroy the Config object and restor the ini values after the tests. + * Destroy the Config object and restore the ini values after the tests. * * @afterClass * diff --git a/tests/Core/Tokenizers/PHP/AttributesTest.inc b/tests/Core/Tokenizers/PHP/AttributesTest.inc index e539adf8a7..9d56c09527 100644 --- a/tests/Core/Tokenizers/PHP/AttributesTest.inc +++ b/tests/Core/Tokenizers/PHP/AttributesTest.inc @@ -62,7 +62,7 @@ function multiple_attributes_on_parameter_test(#[ParamAttribute, AttributeWithPa /* testFqcnAttribute */ #[Boo\QualifiedName, \Foo\FullyQualifiedName('foo')] -function fqcn_attrebute_test() {} +function fqcn_attribute_test() {} /* testNestedAttributes */ #[Boo\QualifiedName(fn (#[AttributeOne('boo')] $value) => (string) $value)] diff --git a/tests/Core/Util/Timing/TimingTest.php b/tests/Core/Util/Timing/TimingTest.php index 79952c8c75..f5ef115643 100644 --- a/tests/Core/Util/Timing/TimingTest.php +++ b/tests/Core/Util/Timing/TimingTest.php @@ -41,7 +41,7 @@ public function testGetDurationWithoutStartReturnsZero() /** - * Verify that getDuration() returns 0 when the timer wasn't started. + * Verify that getDuration() returns the time in milliseconds. * * @return void */