Skip to content

Commit

Permalink
Fixed spelling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Jan 27, 2020
1 parent 039b6d3 commit e9ebf52
Show file tree
Hide file tree
Showing 28 changed files with 52 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ public function getDeclarationName($stackPtr)
* )
* </code>
*
* Parameters with default values have an additional array indexs of:
* Parameters with default values have an additional array indexes of:
* 'default' => string, // The full content of the default value.
* 'default_token' => integer, // The stack pointer to the start of the default value.
* 'default_equal_token' => integer, // The stack pointer to the equals sign.
Expand Down
2 changes: 1 addition & 1 deletion src/Fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function fixFile()
* @param string $filePath Optional file path to diff the file against.
* If not specified, the original version of the
* file will be used.
* @param boolean $colors Print colored output or not.
* @param boolean $colors Print coloured output or not.
*
* @return string
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Reports/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ public function generate(
$valueWidth = max($valueWidth, strlen($value));
}

$countWidth = strlen($totalCount);
$nrOfThousandSeps = floor($countWidth / 3);
$countWidth += $nrOfThousandSeps;
// Length of the total string, plus however many
// thousands separators there are.
$countWidth = (strlen($totalCount) + floor($countWidth / 3));

// Account for 'total' line.
$valueWidth = max(5, $valueWidth);
Expand Down
2 changes: 1 addition & 1 deletion src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ public function registerSniffs($files, $restrictions, $exclusions)


/**
* Populates the array of PHP_CodeSniffer_Sniff's for this file.
* Populates the array of PHP_CodeSniffer_Sniff objects for this file.
*
* @return void
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If sniff registration fails.
Expand Down
13 changes: 6 additions & 7 deletions src/Sniffs/AbstractScopeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ abstract class AbstractScopeSniff implements Sniff
* the scope, by calling the
* processTokenOutsideScope method.
*
* @see PHP_CodeSniffer.getValidScopeTokeners()
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified tokens arrays are empty
* or invalid.
*/
Expand Down Expand Up @@ -133,20 +132,20 @@ final public function process(File $phpcsFile, $stackPtr)
$tokens = $phpcsFile->getTokens();

$foundScope = false;
$skipPtrs = [];
$skipTokens = [];
foreach ($tokens[$stackPtr]['conditions'] as $scope => $code) {
if (isset($this->scopeTokens[$code]) === true) {
$skipPtrs[] = $this->processTokenWithinScope($phpcsFile, $stackPtr, $scope);
$foundScope = true;
$skipTokens[] = $this->processTokenWithinScope($phpcsFile, $stackPtr, $scope);
$foundScope = true;
}
}

if ($this->listenOutside === true && $foundScope === false) {
$skipPtrs[] = $this->processTokenOutsideScope($phpcsFile, $stackPtr);
$skipTokens[] = $this->processTokenOutsideScope($phpcsFile, $stackPtr);
}

if (empty($skipPtrs) === false) {
return min($skipPtrs);
if (empty($skipTokens) === false) {
return min($skipTokens);
}

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<![CDATA[
$shortVar <em>=</em> (1 + 2);
$veryLongVarName <em>=</em> 'string';
$var <em>=</em> foo($bar, $baz, $quux);
$var <em>=</em> foo($bar, $baz);
]]>
</code>
<code title="Not aligned; harder to read">
<![CDATA[
$shortVar <em>=</em> (1 + 2);
$veryLongVarName <em>=</em> 'string';
$var <em>=</em> foo($bar, $baz, $quux);
$var <em>=</em> foo($bar, $baz);
]]>
</code>
</code_comparison>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Detects for-loops that can be simplified to a while-loop.
*
* This rule is based on the PMD rule catalog. Detects for-loops that can be
* This rule is based on the PMD rule catalogue. Detects for-loops that can be
* simplified as a while-loop.
*
* <code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Detects for-loops that use a function call in the test expression.
*
* This rule is based on the PMD rule catalog. Detects for-loops that use a
* This rule is based on the PMD rule catalogue. Detects for-loops that use a
* function call in the test expression.
*
* <code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Detects incrementer jumbling in for loops.
*
* This rule is based on the PMD rule catalog. The jumbling incrementer sniff
* This rule is based on the PMD rule catalogue. The jumbling incrementer sniff
* detects the usage of one and the same incrementer into an outer and an inner
* loop. Even it is intended this is confusing code.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Detects unconditional if- and elseif-statements.
*
* This rule is based on the PMD rule catalog. The Unconditional If Statement
* This rule is based on the PMD rule catalogue. The Unconditional If Statement
* sniff detects statement conditions that are only set to one of the constant
* values <b>true</b> or <b>false</b>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Detects unnecessary final modifiers inside of final classes.
*
* This rule is based on the PMD rule catalog. The Unnecessary Final Modifier
* This rule is based on the PMD rule catalogue. The Unnecessary Final Modifier
* sniff detects the use of the final modifier inside of a final class which
* is unnecessary.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* Detects unnecessary overridden methods that simply call their parent.
*
* This rule is based on the PMD rule catalog. The Useless Overriding Method
* sniff detects the use of methods that only call their parent classes's method
* This rule is based on the PMD rule catalogue. The Useless Overriding Method
* sniff detects the use of methods that only call their parent class's method
* with the same name and arguments. These methods are not required.
*
* <code>
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Generic/Sniffs/Files/ByteOrderMarkSniff.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* A simple sniff for detecting BOMs that may corrupt application work.
* A simple sniff for detecting a BOM definition that may corrupt application work.
*
* @author Piotr Karas <[email protected]>
* @author Greg Sherwood <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Bans PHP 4 style constructors.
*
* Favor PHP 5 constructor syntax, which uses "function __construct()".
* Favour PHP 5 constructor syntax, which uses "function __construct()".
* Avoid PHP 4 constructor syntax, which uses "function ClassName()".
*
* @author Greg Sherwood <[email protected]>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Check for merge conflict artifacts
* Check for merge conflict artefacts.
*
* @author Juliette Reinders Folmer <[email protected]>
* @copyright 2017 Juliette Reinders Folmer. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function processTokenOutsideScope(File $phpcsFile, $stackPtr)
for ($i = 0; $i < $stackPtr; $i++) {
// Skip classes and functions as will we never get
// into their scopes when including this file, although
// we have a chance of getting into IF's, WHILE's etc.
// we have a chance of getting into IF, WHILE etc.
if (($tokens[$i]['code'] === T_CLASS
|| $tokens[$i]['code'] === T_INTERFACE
|| $tokens[$i]['code'] === T_FUNCTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function process(File $phpcsFile, $stackPtr)

foreach ($strings as $string) {
// If the string has "new" in it, it is not allowed.
// We don't bother checking if the word "new" is echo'd
// We don't bother checking if the word "new" is printed to screen
// because that is unlikely to happen. We assume the use
// of "new" is for object instantiation.
if (strstr($string, ' new ') !== false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
}//end if

// If we are within an argument we should be ignoring commas
// as these are not signaling the end of an argument.
// as these are not signalling the end of an argument.
if ($inArg === false && $tokens[$i]['code'] === T_COMMA) {
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($i + 1), $closeBracket, true);
if ($next === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function process(File $phpcsFile, $stackPtr)
} else {
$phpcsFile->fixer->beginChangeset();
for ($i = ($prev + 1); $i < $parenCloser; $i++) {
// Maintian existing newline.
// Maintain existing newline.
if ($tokens[$i]['line'] === $tokens[$prev]['line']) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Standards/Squiz/Docs/Arrays/ArrayDeclarationStandard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<code_comparison>
<code title="Valid: array keyword lowercase">
<![CDATA[
$array = <em>a</em>rray('val1', 'val2');
$array = array('val1', 'val2');
]]>
</code>
<code title="Invalid: first letter capitalised">
<![CDATA[
$array = <em>A</em>rray('val1', 'val2');
$array = Array('val1', 'val2');
]]>
</code>
</code_comparison>
Expand All @@ -30,14 +30,14 @@ $array = <em>A</em>rray('val1', 'val2');
<code title="Valid: first key on second line">
<![CDATA[
$array = array(
<em>'key1'</em> => 'value1',
'key1' => 'value1',
'key2' => 'value2',
);
]]>
</code>
<code title="Invalid: first key on same line">
<![CDATA[
$array = array(<em>'key1'</em> => 'value1',
$array = array('key1' => 'value1',
'key2' => 'value2',
);
]]>
Expand Down
2 changes: 1 addition & 1 deletion src/Standards/Squiz/Sniffs/CSS/NamedColoursSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class NamedColoursSniff implements Sniff
/**
* A list of named colours.
*
* This is the list of standard colours defined in the CSS spec.
* This is the list of standard colours defined in the CSS specification.
*
* @var array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function process(File $phpcsFile, $stackPtr)
}//end if
} else if ($tokens[$nextToken]['code'] === T_VARIABLE) {
// Find the nearest catch block in this scope and, if the caught var
// matches our rethrown var, use the exception types being caught as
// matches our re-thrown var, use the exception types being caught as
// exception types that are being thrown as well.
$catch = $phpcsFile->findPrevious(
T_CATCH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function process(File $phpcsFile, $stackPtr)
if ($tokens[$nextToken]['code'] === T_CATCH
|| $tokens[$nextToken]['code'] === T_FINALLY
) {
// The end brace becomes the CATCH's end brace.
// The end brace becomes the CATCH end brace.
$stackPtr = $tokens[$nextToken]['scope_closer'];
$endBrace = $tokens[$stackPtr];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function process(File $phpcsFile, $stackPtr)
* Processes the contents of a single set of brackets.
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param int $openBracket The position of the open bracker
* @param int $openBracket The position of the open bracket
* in the stack.
*
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ public function process(File $phpcsFile, $stackPtr)
$end = $tokens[$stackPtr]['parenthesis_closer'];
}//end if

$requiredOps = 0;
$foundOps = 0;
$foundBools = 0;
$requiredOps = 0;
$foundOps = 0;
$foundBooleans = 0;

$lastNonEmpty = $start;

Expand Down Expand Up @@ -188,7 +188,7 @@ public function process(File $phpcsFile, $stackPtr)
}

if ($tokens[$i]['code'] === T_TRUE || $tokens[$i]['code'] === T_FALSE) {
$foundBools++;
$foundBooleans++;
}

if ($phpcsFile->tokenizerType !== 'JS'
Expand Down Expand Up @@ -223,7 +223,7 @@ public function process(File $phpcsFile, $stackPtr)

if ($phpcsFile->tokenizerType !== 'JS'
&& $foundOps < $requiredOps
&& ($requiredOps !== $foundBools)
&& ($requiredOps !== $foundBooleans)
) {
$error = 'Implicit true comparisons prohibited; use === TRUE instead';
$phpcsFile->addError($error, $stackPtr, 'ImplicitTrue');
Expand Down
14 changes: 7 additions & 7 deletions src/Standards/Squiz/Sniffs/PHP/LowercasePHPFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ public function process(File $phpcsFile, $stackPtr)
$ignore = Tokens::$emptyTokens;
$ignore[] = T_BITWISE_AND;
$prev = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true);
$pprev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true);
$prevPrev = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($prev - 1), null, true);

if ($tokens[$next]['code'] !== T_OPEN_PARENTHESIS) {
// Is this a use statement importing a PHP native function ?
if ($tokens[$next]['code'] !== T_NS_SEPARATOR
&& $tokens[$prev]['code'] === T_STRING
&& $tokens[$prev]['content'] === 'function'
&& $pprev !== false
&& $tokens[$pprev]['code'] === T_USE
&& $prevPrev !== false
&& $tokens[$prevPrev]['code'] === T_USE
) {
$error = 'Use statements for PHP native functions must be lowercase; expected "%s" but found "%s"';
$data = [
Expand All @@ -116,10 +116,10 @@ public function process(File $phpcsFile, $stackPtr)
}

if ($tokens[$prev]['code'] === T_NS_SEPARATOR) {
if ($pprev !== false
&& ($tokens[$pprev]['code'] === T_STRING
|| $tokens[$pprev]['code'] === T_NAMESPACE
|| $tokens[$pprev]['code'] === T_NEW)
if ($prevPrev !== false
&& ($tokens[$prevPrev]['code'] === T_STRING
|| $tokens[$prevPrev]['code'] === T_NAMESPACE
|| $tokens[$prevPrev]['code'] === T_NEW)
) {
// Namespaced class/function, not an inbuilt function.
// Could potentially give false negatives for non-namespaced files
Expand Down
6 changes: 3 additions & 3 deletions src/Tokenizers/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1469,12 +1469,12 @@ private function createLevelMap()
echo str_repeat("\t", ($level + 1));
echo "Process token $i on line $line [col:$col;len:$len;lvl:$level;";
if (empty($conditions) !== true) {
$condString = 'conds;';
$conditionString = 'conds;';
foreach ($conditions as $condition) {
$condString .= Util\Tokens::tokenName($condition).',';
$conditionString .= Util\Tokens::tokenName($condition).',';
}

echo rtrim($condString, ',').';';
echo rtrim($conditionString, ',').';';
}

echo "]: $type => $content".PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion src/Util/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static function isStdinATTY()
* Prepares token content for output to screen.
*
* Replaces invisible characters so they are visible. On non-Windows
* OSes it will also colour the invisible characters.
* operating systems it will also colour the invisible characters.
*
* @param string $content The content to prepare.
* @param string[] $exclude A list of characters to leave invisible.
Expand Down

0 comments on commit e9ebf52

Please sign in to comment.