Skip to content

Commit 603c013

Browse files
JanTvrdikclaude
andauthored
Use shipmonk/coding-standard (#307)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 69059a5 commit 603c013

38 files changed

+526
-722
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"phpstan/phpstan-phpunit": "^2.0.4",
2121
"phpstan/phpstan-strict-rules": "^2.0.3",
2222
"phpunit/phpunit": "^9.6.22",
23+
"shipmonk/coding-standard": "^0.1.3",
2324
"shipmonk/composer-dependency-analyser": "^1.8.1",
2425
"shipmonk/dead-code-detector": "^0.9.0",
25-
"shipmonk/name-collision-detector": "^2.1.1",
26-
"slevomat/coding-standard": "^8.16.0"
26+
"shipmonk/name-collision-detector": "^2.1.1"
2727
},
2828
"autoload": {
2929
"psr-4": {

composer.lock

Lines changed: 167 additions & 224 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpcs.xml.dist

Lines changed: 5 additions & 411 deletions
Large diffs are not rendered by default.

src/Rule/AllowComparingOnlyComparableTypesRule.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public function getNodeType(): string
3838
* @param BinaryOp $node
3939
* @return list<IdentifierRuleError>
4040
*/
41-
public function processNode(Node $node, Scope $scope): array
41+
public function processNode(
42+
Node $node,
43+
Scope $scope
44+
): array
4245
{
4346
if (
4447
!$node instanceof Greater
@@ -99,7 +102,10 @@ private function isComparable(Type $type): bool
99102
return true;
100103
}
101104

102-
private function isComparableTogether(Type $leftType, Type $rightType): bool
105+
private function isComparableTogether(
106+
Type $leftType,
107+
Type $rightType
108+
): bool
103109
{
104110
$intType = new IntegerType();
105111
$floatType = new FloatType();
@@ -149,7 +155,10 @@ private function isComparableTogether(Type $leftType, Type $rightType): bool
149155
/**
150156
* @param Type[] $allowedTypes
151157
*/
152-
private function containsOnlyTypes(Type $checkedType, array $allowedTypes): bool
158+
private function containsOnlyTypes(
159+
Type $checkedType,
160+
array $allowedTypes
161+
): bool
153162
{
154163
$allowedType = TypeCombinator::union(...$allowedTypes);
155164
return $allowedType->isSuperTypeOf($checkedType)->yes();

src/Rule/BackedEnumGenericsRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ public function getNodeType(): string
2727
* @param InClassNode $node
2828
* @return list<IdentifierRuleError>
2929
*/
30-
public function processNode(Node $node, Scope $scope): array
30+
public function processNode(
31+
Node $node,
32+
Scope $scope
33+
): array
3134
{
3235
$classReflection = $node->getClassReflection();
3336
$backedEnumType = $classReflection->getBackedEnumType();
@@ -55,7 +58,10 @@ public function processNode(Node $node, Scope $scope): array
5558
return [$error];
5659
}
5760

58-
private function hasGenericsTag(ClassReflection $classReflection, string $expectedTag): bool
61+
private function hasGenericsTag(
62+
ClassReflection $classReflection,
63+
string $expectedTag
64+
): bool
5965
{
6066
if ($classReflection->isBackedEnum()) {
6167
$tags = $classReflection->getImplementsTags();

src/Rule/ClassSuffixNamingRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ class ClassSuffixNamingRule implements Rule
2929
/**
3030
* @param array<class-string, string> $superclassToSuffixMapping
3131
*/
32-
public function __construct(ReflectionProvider $reflectionProvider, array $superclassToSuffixMapping = [])
32+
public function __construct(
33+
ReflectionProvider $reflectionProvider,
34+
array $superclassToSuffixMapping = []
35+
)
3336
{
3437
foreach ($superclassToSuffixMapping as $className => $suffix) {
3538
if (!$reflectionProvider->hasClass($className)) {

src/Rule/EnforceEnumMatchRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ public function getNodeType(): string
3232
* @param BinaryOp $node
3333
* @return list<IdentifierRuleError>
3434
*/
35-
public function processNode(Node $node, Scope $scope): array
35+
public function processNode(
36+
Node $node,
37+
Scope $scope
38+
): array
3639
{
3740
if (!$node instanceof Identical && !$node instanceof NotIdentical) {
3841
return [];

src/Rule/EnforceIteratorToArrayPreserveKeysRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ public function getNodeType(): string
2727
* @param FuncCall $node
2828
* @return list<IdentifierRuleError>
2929
*/
30-
public function processNode(Node $node, Scope $scope): array
30+
public function processNode(
31+
Node $node,
32+
Scope $scope
33+
): array
3134
{
3235
if (!$node->name instanceof Name) {
3336
return [];

src/Rule/EnforceListReturnRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ public function getNodeType(): string
2828
* @param ReturnStatementsNode $node
2929
* @return list<IdentifierRuleError>
3030
*/
31-
public function processNode(Node $node, Scope $scope): array
31+
public function processNode(
32+
Node $node,
33+
Scope $scope
34+
): array
3235
{
3336
$methodReflection = $scope->getFunction();
3437

src/Rule/EnforceNativeReturnTypehintRule.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ public function getNodeType(): string
6767
* @param ReturnStatementsNode $node
6868
* @return list<IdentifierRuleError>
6969
*/
70-
public function processNode(Node $node, Scope $scope): array
70+
public function processNode(
71+
Node $node,
72+
Scope $scope
73+
): array
7174
{
7275
if ($this->treatPhpDocTypesAsCertain === false) {
7376
return [];
@@ -202,7 +205,10 @@ private function getTypeOfReturnStatements(ReturnStatementsNode $node): Type
202205
return TypeCombinator::union(...$types);
203206
}
204207

205-
private function getPhpDocReturnType(Node $node, Scope $scope): ?Type
208+
private function getPhpDocReturnType(
209+
Node $node,
210+
Scope $scope
211+
): ?Type
206212
{
207213
$docComment = $node->getDocComment();
208214

0 commit comments

Comments
 (0)