Skip to content
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 autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static function ($remaining, $current) {
*
* @return void
*/
public static function addSearchPath(string $path, string $nsPrefix='')
public static function addSearchPath(string $path, string $nsPrefix = '')
{
self::$searchPaths[$path] = rtrim(trim((string) $nsPrefix), '\\');

Expand Down
6 changes: 5 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
<exclude name="Squiz.Commenting.VariableComment.LinkTagNotAllowed"/>
</rule>
<rule ref="Squiz.Formatting.OperatorBracket"/>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<rule ref="Squiz.Operators.ComparisonOperatorUsage"/>
<rule ref="Squiz.PHP.DisallowInlineIf"/>
<rule ref="Squiz.Scope.MethodScope"/>
Expand Down
6 changes: 3 additions & 3 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public function setSettings(array $settings)
*
* @return void
*/
public function __construct(array $cliArgs=[], bool $dieOnUnknownArg=true)
public function __construct(array $cliArgs = [], bool $dieOnUnknownArg = true)
{
if (defined('PHP_CODESNIFFER_IN_TESTS') === true) {
// Let everything through during testing so that we can
Expand Down Expand Up @@ -1490,7 +1490,7 @@ public function printUsage()
*
* @return string|void
*/
public function printShortUsage(bool $returnOutput=false)
public function printShortUsage(bool $returnOutput = false)
{
if (PHP_CODESNIFFER_CBF === true) {
$usage = 'Run "phpcbf --help" for usage information';
Expand Down Expand Up @@ -1633,7 +1633,7 @@ public static function getExecutablePath(string $name)
* @see getConfigData()
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException If the config file can not be written.
*/
public function setConfigData(string $key, ?string $value, bool $temp=false)
public function setConfigData(string $key, ?string $value, bool $temp = false)
{
if (isset($this->overriddenDefaults['runtime-set']) === true
&& isset($this->overriddenDefaults['runtime-set'][$key]) === true
Expand Down
54 changes: 27 additions & 27 deletions src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,9 @@ public function addError(
string $error,
?int $stackPtr,
string $code,
array $data=[],
int $severity=0,
bool $fixable=false
array $data = [],
int $severity = 0,
bool $fixable = false
) {
if ($stackPtr === null) {
$line = 1;
Expand Down Expand Up @@ -708,9 +708,9 @@ public function addWarning(
string $warning,
?int $stackPtr,
string $code,
array $data=[],
int $severity=0,
bool $fixable=false
array $data = [],
int $severity = 0,
bool $fixable = false
) {
if ($stackPtr === null) {
$line = 1;
Expand Down Expand Up @@ -741,8 +741,8 @@ public function addErrorOnLine(
string $error,
int $line,
string $code,
array $data=[],
int $severity=0
array $data = [],
int $severity = 0
) {
return $this->addMessage(true, $error, $line, 1, $code, $data, $severity, false);

Expand All @@ -765,8 +765,8 @@ public function addWarningOnLine(
string $warning,
int $line,
string $code,
array $data=[],
int $severity=0
array $data = [],
int $severity = 0
) {
return $this->addMessage(false, $warning, $line, 1, $code, $data, $severity, false);

Expand All @@ -791,8 +791,8 @@ public function addFixableError(
string $error,
int $stackPtr,
string $code,
array $data=[],
int $severity=0
array $data = [],
int $severity = 0
) {
$recorded = $this->addError($error, $stackPtr, $code, $data, $severity, true);
if ($recorded === true && $this->fixer->enabled === true) {
Expand Down Expand Up @@ -822,8 +822,8 @@ public function addFixableWarning(
string $warning,
int $stackPtr,
string $code,
array $data=[],
int $severity=0
array $data = [],
int $severity = 0
) {
$recorded = $this->addWarning($warning, $stackPtr, $code, $data, $severity, true);
if ($recorded === true && $this->fixer->enabled === true) {
Expand Down Expand Up @@ -2264,7 +2264,7 @@ public function isReference(int $stackPtr)
* @return string The token contents.
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException If the specified position does not exist.
*/
public function getTokensAsString($start, $length, bool $origContent=false)
public function getTokensAsString($start, $length, bool $origContent = false)
{
if (is_int($start) === false || isset($this->tokens[$start]) === false) {
throw new RuntimeException('The $start position for getTokensAsString() must exist in the token stack');
Expand Down Expand Up @@ -2324,10 +2324,10 @@ public function getTokensAsString($start, $length, bool $origContent=false)
public function findPrevious(
$types,
int $start,
?int $end=null,
bool $exclude=false,
?string $value=null,
bool $local=false
?int $end = null,
bool $exclude = false,
?string $value = null,
bool $local = false
) {
$types = (array) $types;

Expand Down Expand Up @@ -2405,10 +2405,10 @@ public function findPrevious(
public function findNext(
$types,
int $start,
?int $end=null,
bool $exclude=false,
?string $value=null,
bool $local=false
?int $end = null,
bool $exclude = false,
?string $value = null,
bool $local = false
) {
$types = (array) $types;

Expand Down Expand Up @@ -2451,7 +2451,7 @@ public function findNext(
*
* @return int
*/
public function findStartOfStatement(int $start, $ignore=null)
public function findStartOfStatement(int $start, $ignore = null)
{
$startTokens = Tokens::BLOCK_OPENERS;
$startTokens[T_OPEN_SHORT_ARRAY] = true;
Expand Down Expand Up @@ -2642,7 +2642,7 @@ public function findStartOfStatement(int $start, $ignore=null)
*
* @return int
*/
public function findEndOfStatement(int $start, $ignore=null)
public function findEndOfStatement(int $start, $ignore = null)
{
$endTokens = [
T_COLON => true,
Expand Down Expand Up @@ -2769,7 +2769,7 @@ public function findEndOfStatement(int $start, $ignore=null)
* FALSE when no matching token could be found between the start of
* the line and the start token.
*/
public function findFirstOnLine($types, int $start, bool $exclude=false, ?string $value=null)
public function findFirstOnLine($types, int $start, bool $exclude = false, ?string $value = null)
{
if (is_array($types) === false) {
$types = [$types];
Expand Down Expand Up @@ -2860,7 +2860,7 @@ public function hasCondition(int $stackPtr, $types)
*
* @return int|false
*/
public function getCondition(int $stackPtr, $type, bool $first=true)
public function getCondition(int $stackPtr, $type, bool $first = true)
{
// Check for the existence of the token.
if (isset($this->tokens[$stackPtr]) === false) {
Expand Down
2 changes: 1 addition & 1 deletion src/Files/FileList.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function __construct(Config $config, Ruleset $ruleset)
*
* @return void
*/
public function addFile(string $path, ?File $file=null)
public function addFile(string $path, ?File $file = null)
{
// No filtering is done for STDIN when the filename
// has not been specified.
Expand Down
4 changes: 2 additions & 2 deletions src/Fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function fixFile()
*
* @throws \PHP_CodeSniffer\Exceptions\RuntimeException When the diff command fails.
*/
public function generateDiff(?string $filePath=null, bool $colors=true)
public function generateDiff(?string $filePath = null, bool $colors = true)
{
if ($filePath === null) {
$filePath = $this->currentFile->getFilename();
Expand Down Expand Up @@ -689,7 +689,7 @@ public function revertToken(int $stackPtr)
*
* @return bool If the change was accepted.
*/
public function substrToken(int $stackPtr, int $start, ?int $length=null)
public function substrToken(int $stackPtr, int $start, ?int $length = null)
{
$current = $this->getTokenContent($stackPtr);

Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Cbf.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Cbf implements Report
* @return bool
* @throws \PHP_CodeSniffer\Exceptions\DeepExitException
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
$errors = $phpcsFile->getFixableCount();
if ($errors !== 0) {
Expand Down Expand Up @@ -139,10 +139,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
$lines = explode(PHP_EOL, $cachedData);
array_pop($lines);
Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Checkstyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Checkstyle implements Report
*
* @return bool
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
$out = new XMLWriter;
$out->openMemory();
Expand Down Expand Up @@ -95,10 +95,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL;
echo '<checkstyle version="'.Config::VERSION.'">'.PHP_EOL;
Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Code implements Report
*
* @return bool
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
if ($report['errors'] === 0 && $report['warnings'] === 0) {
// Nothing to print.
Expand Down Expand Up @@ -340,10 +340,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
if ($cachedData === '') {
return;
Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Csv implements Report
*
* @return bool
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
if ($report['errors'] === 0 && $report['warnings'] === 0) {
// Nothing to print.
Expand Down Expand Up @@ -78,10 +78,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
echo 'File,Line,Column,Type,Message,Source,Severity,Fixable'.PHP_EOL;
echo $cachedData;
Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Diff implements Report
*
* @return bool
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
$errors = $phpcsFile->getFixableCount();
if ($errors === 0) {
Expand Down Expand Up @@ -106,10 +106,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
echo $cachedData;
if ($toScreen === true && $cachedData !== '') {
Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Emacs.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Emacs implements Report
*
* @return bool
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
if ($report['errors'] === 0 && $report['warnings'] === 0) {
// Nothing to print.
Expand Down Expand Up @@ -78,10 +78,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
echo $cachedData;

Expand Down
10 changes: 5 additions & 5 deletions src/Reports/Full.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Full implements Report
*
* @return bool
*/
public function generateFileReport(array $report, File $phpcsFile, bool $showSources=false, int $width=80)
public function generateFileReport(array $report, File $phpcsFile, bool $showSources = false, int $width = 80)
{
if ($report['errors'] === 0 && $report['warnings'] === 0) {
// Nothing to print.
Expand Down Expand Up @@ -238,10 +238,10 @@ public function generate(
int $totalErrors,
int $totalWarnings,
int $totalFixable,
bool $showSources=false,
int $width=80,
bool $interactive=false,
bool $toScreen=true
bool $showSources = false,
int $width = 80,
bool $interactive = false,
bool $toScreen = true
) {
if ($cachedData === '') {
return;
Expand Down
Loading
Loading