Skip to content

Commit

Permalink
Fixes based on PHPStan output (ref squizlabs#2201)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Jan 17, 2019
1 parent 6ff6b5e commit bff45d9
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/Files/DummyFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct($content, Ruleset $ruleset, Config $config)
$path = $config->stdinPath;
}

return parent::__construct($path, $ruleset, $config);
parent::__construct($path, $ruleset, $config);

}//end __construct()

Expand Down
12 changes: 0 additions & 12 deletions src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -1120,18 +1120,6 @@ public function getWarningCount()
}//end getWarningCount()


/**
* Returns the number of successes recorded.
*
* @return int
*/
public function getSuccessCount()
{
return $this->successCount;

}//end getSuccessCount()


/**
* Returns the number of fixable errors/warnings raised.
*
Expand Down
5 changes: 3 additions & 2 deletions src/Files/LocalFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function __construct($path, Ruleset $ruleset, Config $config)

$this->reloadContent();

return parent::__construct($this->path, $ruleset, $config);
parent::__construct($this->path, $ruleset, $config);

}//end __construct()

Expand Down Expand Up @@ -88,7 +88,8 @@ public function process()
}

if ($this->configCache['cache'] === false) {
return parent::process();
parent::process();
return;
}

$hash = md5_file($this->path);
Expand Down
4 changes: 2 additions & 2 deletions src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Ruleset
* The key is the fully qualified name of the sniff class
* and the value is the sniff object.
*
* @var array<string, \PHP_CodeSniffer\Sniff>
* @var array<string, \PHP_CodeSniffer\Sniffs\Sniff>
*/
public $sniffs = [];

Expand All @@ -87,7 +87,7 @@ class Ruleset
* The key is the token name being listened for and the value
* is the sniff object.
*
* @var array<int, \PHP_CodeSniffer\Sniff>
* @var array<int, \PHP_CodeSniffer\Sniffs\Sniff>
*/
public $tokenListeners = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ public function process(File $phpcsFile, $stackPtr)
* @param int $change The difference in length between
* the old and new indent.
*
* @return void
* @return bool
*/
protected function adjustIndent(File $phpcsFile, $stackPtr, $length, $change)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function process(File $phpcsFile, $stackPtr)
* @param array $tokens The stack of tokens that make up
* the file.
*
* @return void
* @return bool
*/
public function isMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $tokens)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function process(File $phpcsFile, $stackPtr)
* @param array $tokens The stack of tokens that make up
* the file.
*
* @return void
* @return bool
*/
public function isMultiLineDeclaration($phpcsFile, $stackPtr, $openBracket, $tokens)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function processMemberVar(File $phpcsFile, $stackPtr)
if (empty($propertyInfo) === true) {
return;
}
} catch (Exception $e) {
} catch (\Exception $e) {
// Turns out not to be a property after all.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function process(File $phpcsFile, $stackPtr)
* @param int $stackPtr The position of the current token in
* the stack passed in $tokens.
*
* @return void
* @return bool
*/
private function shouldIgnoreUse($phpcsFile, $stackPtr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizers/CSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct($content, Config $config, $eolChar='\n')
throw new TokenizerException('File appears to be minified and cannot be processed');
}

return parent::__construct($content, $config, $eolChar);
parent::__construct($content, $config, $eolChar);

}//end __construct()

Expand Down
13 changes: 3 additions & 10 deletions src/Tokenizers/JS.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function __construct($content, Config $config, $eolChar='\n')
throw new TokenizerException('File appears to be minified and cannot be processed');
}

return parent::__construct($content, $config, $eolChar);
parent::__construct($content, $config, $eolChar);

}//end __construct()

Expand Down Expand Up @@ -446,14 +446,7 @@ public function tokenize($string)
// Special case for T_DIVIDE which can actually be
// the start of a regular expression.
if ($buffer === $char && $char === '/' && $chars[($i + 1)] !== '*') {
$regex = $this->getRegexToken(
$i,
$string,
$chars,
$tokens,
$this->eolChar
);

$regex = $this->getRegexToken($i, $string, $chars, $tokens);
if ($regex !== null) {
$tokens[] = [
'code' => T_REGULAR_EXPRESSION,
Expand Down Expand Up @@ -918,7 +911,7 @@ public function tokenize($string)
* @param string $chars An array of characters being tokenized.
* @param string $tokens The current array of tokens found in the string.
*
* @return void
* @return array<string, string>|null
*/
public function getRegexToken($char, $string, $chars, $tokens)
{
Expand Down

0 comments on commit bff45d9

Please sign in to comment.