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
8 changes: 7 additions & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<rule ref="Squiz.PHP.DisallowInlineIf"/>
<rule ref="Squiz.Scope.MethodScope"/>
<rule ref="Squiz.Strings.ConcatenationSpacing"/>
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
<rule ref="Generic.Strings.UnnecessaryHeredoc"/>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
<rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/>
<rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
Expand Down Expand Up @@ -133,6 +135,7 @@
<element key="print" value="echo"/>
<element key="is_null" value="null"/>
<element key="create_function" value="null"/>
<element key="join" value="implode"/>
</property>
</properties>
</rule>
Expand All @@ -150,7 +153,7 @@

<!-- This test file specifically *needs* Windows line endings for testing purposes. -->
<rule ref="Generic.Files.LineEndings.InvalidEOLChar">
<exclude-pattern>tests/Core/Tokenizers/PHP/StableCommentWhitespaceWinTest\.php</exclude-pattern>
<exclude-pattern>tests/Core/Tokenizers/PHP/*WinTest\.php</exclude-pattern>
</rule>

<!-- Avoid false positive with this sniff detecting itself -->
Expand All @@ -161,4 +164,7 @@

<!-- Require visibility for class constants. -->
<rule ref="PSR12.Properties.ConstantVisibility"/>

<!-- Handle consistent formatting of return types. -->
<rule ref="PSR12.Functions.ReturnTypeDeclaration"/>
</ruleset>
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1592,7 +1592,7 @@ public static function getExecutablePath(string $name)
return $data;
}

if ($name === "php") {
if ($name === 'php') {
// For php, we know the executable path. There's no need to look it up.
return PHP_BINARY;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ public function getFixedWarningCount()
*
* @return int
*/
public function getFirstRunCount(string $type):int
public function getFirstRunCount(string $type): int
{
return $this->firstRunCounts[$type];

Expand Down
4 changes: 2 additions & 2 deletions src/Reports/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function generateFileReport(array $report, File $phpcsFile, bool $showSou
$messagesObject->column = $column;
$messagesObject->fixable = $fixable;

$messages .= json_encode($messagesObject).",";
$messages .= json_encode($messagesObject).',';
}
}
}//end foreach
Expand Down Expand Up @@ -99,7 +99,7 @@ public function generate(
) {
echo '{"totals":{"errors":'.$totalErrors.',"warnings":'.$totalWarnings.',"fixable":'.$totalFixable.'},"files":{';
echo rtrim($cachedData, ',');
echo "}}".PHP_EOL;
echo '}}'.PHP_EOL;

}//end generate()

Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/ExplainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function testExplainCustomRuleset()
public function testExplainWithDeprecatedSniffs()
{
// Set up the ruleset.
$standard = __DIR__."/ShowSniffDeprecationsTest.xml";
$standard = __DIR__.'/ShowSniffDeprecationsTest.xml';
$config = new ConfigDouble(["--standard=$standard", '-e']);
$ruleset = new Ruleset($config);

Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/GetIgnorePatternsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class GetIgnorePatternsTest extends TestCase
public static function setUpBeforeClass(): void
{
// Set up the ruleset.
$standard = __DIR__."/GetIgnorePatternsTest.xml";
$standard = __DIR__.'/GetIgnorePatternsTest.xml';
$config = new ConfigDouble(["--standard=$standard"]);
self::$ruleset = new Ruleset($config);

Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Ruleset/GetIncludePatternsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final class GetIncludePatternsTest extends TestCase
public static function setUpBeforeClass(): void
{
// Set up the ruleset.
$standard = __DIR__."/GetIncludePatternsTest.xml";
$standard = __DIR__.'/GetIncludePatternsTest.xml';
$config = new ConfigDouble(["--standard=$standard"]);
self::$ruleset = new Ruleset($config);

Expand Down
2 changes: 1 addition & 1 deletion tests/Core/Tokenizers/PHP/AttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public static function dataAttributeOnTextLookingLikeCloseTag()
],
[
'T_WHITESPACE',
" ",
' ',
],
[
'T_CONSTANT_ENCAPSED_STRING',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testTabWidthNotSet()
$config = new ConfigDouble();
$ruleset = new Ruleset($config);

$content = <<<EOD
$content = <<<'EOD'
<?php
echo 'foo';
EOD;
Expand Down Expand Up @@ -71,7 +71,7 @@ public function testLengthSettingRespectsEncoding()
$config->tabWidth = 4;
$ruleset = new Ruleset($config);

$content = <<<EOD
$content = <<<'EOD'
<?php
echo 'пасха пасха';
EOD;
Expand Down
8 changes: 4 additions & 4 deletions tests/Core/Util/Common/PrepareForOutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ public static function dataPrepareForOutput()
'expectedWin' => "\\r\\n\\t",
],
'Spaces are replaced with a unique mark' => [
'content' => " ",
'content' => ' ',
'exclude' => [],
'expected' => "\033[30;1m·\033[0m\033[30;1m·\033[0m\033[30;1m·\033[0m\033[30;1m·\033[0m",
'expectedWin' => " ",
'expectedWin' => ' ',
],
'Other characters are unaffected' => [
'content' => "{echo 1;}",
'content' => '{echo 1;}',
'exclude' => [],
'expected' => "{echo\033[30;1m·\033[0m1;}",
'expectedWin' => "{echo 1;}",
'expectedWin' => '{echo 1;}',
],
'No replacements' => [
'content' => 'nothing-should-be-replaced',
Expand Down
Loading