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
4 changes: 2 additions & 2 deletions Proton/Sniffs/Spacing/ArrowFunctionSpacingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public function process(File $phpcsFile, $stackPtr): void
{
$tokens = $phpcsFile->getTokens();

if ($tokens[$stackPtr]['code'] === T_FN && $tokens[$stackPtr + 1]['code'] !== T_WHITESPACE) {
if ($tokens[$stackPtr]['code'] === T_FN && $tokens[$stackPtr + 1]['code'] !== T_OPEN_PARENTHESIS) {
$phpcsFile->addError(
'The fn arrow function token should always be followed by a space.',
'The fn keyword MUST NOT be succeeded by a space.',
$stackPtr,
'Found',
);
Expand Down
8 changes: 6 additions & 2 deletions Proton/ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0"?>
<ruleset name="Proton">
<ruleset
name="Proton"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/squizlabs/php_codesniffer/phpcs.xsd"
>
<description>
Proton PHP Coding Standard
</description>
Expand Down Expand Up @@ -123,7 +127,6 @@

<!-- # Slevomat Coding Standard -->
<!-- https://github.com/slevomat/coding-standard -->
<config name="installed_paths" value="../../slevomat/coding-standard"/>

<rule ref="SlevomatCodingStandard.PHP.TypeCast"/>
<rule ref="SlevomatCodingStandard.PHP.ShortList"/>
Expand All @@ -133,6 +136,7 @@
<property name="ignoreComplexTernaryConditions" value="1"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
<!-- Require usage of constructor property promotion -->
<rule ref="SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion"/>
<!-- Forbid uses of multiple traits separated by comma -->
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"scripts": {
"test-fix": "phpcs --standard=phpcs.xml --report=diff tests > tests/out.diff && diff tests/out.diff tests/expected.diff",
"test-print": "phpcs --standard=phpcs.xml --report=summary tests",
"test": "phpcs --standard=phpcs.xml --report=csv tests | sort -r | cut -f 2,3,4,6 -d ',' > tests/out.csv && diff tests/expected_csv.txt tests/out.csv"
"test": "phpcs --standard=phpcs.xml --report=csv tests/ | cut -f 1,2,3,4,6 -d ',' | sort -r > tests/out.csv && diff -u tests/expected_csv.txt tests/out.csv"
},
"require": {
"php": "^8.0",
"slevomat/coding-standard": "^8.0",
"squizlabs/php_codesniffer": "^3.7"
"slevomat/coding-standard": "^8.24",
"squizlabs/php_codesniffer": "^4.0"
},
"license": "MIT",
"config": {
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Proton PHP Coding Standard
</description>

<config name="installed_paths" value="Proton"/>
<arg name="basepath" value="." />

<rule ref="Proton"/>

Expand Down
2 changes: 1 addition & 1 deletion tests/correct/ClassOk.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(array $config)

phpinfo2();

call_user_func(fn () => {});
call_user_func(fn() => {});
}

public function ping(Request $request): mixed
Expand Down
226 changes: 115 additions & 111 deletions tests/expected_csv.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/wrong/Class1.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct()
$this->test = new class() {
};

call_user_func(fn() => {});
call_user_func(fn () => {});
}

private function unused() {
Expand Down
File renamed without changes.