Skip to content

Docs: various minor fixes #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Sniffs/AbstractScopeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
* }
* }
* </code>
Expand Down
9 changes: 3 additions & 6 deletions src/Tokenizers/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<int, array<string, string|int|array<int>>>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizers/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/Tokenizers/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/ConfigDouble.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/File/GetMethodPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Tokenizers/PHP/AttributesTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Util/Timing/TimingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down