Skip to content

Commit d5a6692

Browse files
renovate-botondrejmirtes
authored andcommitted
Update dependency slevomat/coding-standard to v7
1 parent 1ab10d8 commit d5a6692

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+271
-178
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
/tools
33
/tests/tmp
44
/vendor
5-
composer.lock
5+
/composer.lock
66
.phpunit.result.cache

Diff for: build-cs/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"require-dev": {
66
"consistence-community/coding-standard": "^3.11",
77
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
8-
"slevomat/coding-standard": "^6.4.1"
8+
"slevomat/coding-standard": "^7.0.0"
99
},
1010
"config": {
1111
"allow-plugins": {

Diff for: build-cs/composer.lock

+45-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: phpcs.xml

+59-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<ruleset name="PHPStan PHPDoc Parser">
2+
<ruleset name="PHPStan deprecation rules">
33
<config name="php_version" value="70100"/>
44
<arg name="colors"/>
55
<arg name="extensions" value="php"/>
@@ -9,47 +9,71 @@
99
<arg value="sp"/>
1010
<file>src</file>
1111
<file>tests</file>
12+
1213
<rule ref="build-cs/vendor/consistence-community/coding-standard/Consistence/ruleset.xml">
1314
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>
14-
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameAfterKeyword"/>
15+
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable"/>
1516
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation"/>
16-
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly"/>
17+
<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedExceptions"/>
1718
<exclude name="Consistence.Exceptions.ExceptionDeclaration"/>
18-
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
19-
<exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch"/>
19+
<exclude name="Squiz.Commenting.FunctionComment"/>
20+
<exclude name="Squiz.PHP.Heredoc.NotAllowed"/>
21+
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
2022
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
2123
</rule>
2224
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
2325
<properties>
2426
<property name="caseSensitive" value="false"/>
27+
<property name="psr12Compatible" value="true"/>
2528
</properties>
2629
</rule>
2730
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
2831
<properties>
29-
<property name="newlinesCountBetweenOpenTagAndDeclare" value="0"/>
32+
<property name="declareOnFirstLine" value="true"/>
3033
</properties>
3134
</rule>
32-
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"/>
3335
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
3436
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification"/>
37+
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
38+
</rule>
39+
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation">
40+
<severity>10</severity>
41+
</rule>
42+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
43+
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingTraversableTypeHintSpecification"/>
44+
</rule>
45+
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.UselessAnnotation">
46+
<severity>10</severity>
3547
</rule>
3648
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
3749
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
50+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint"/>
51+
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
52+
</rule>
53+
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation">
54+
<severity>10</severity>
3855
</rule>
56+
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure.UnusedInheritedVariable"/>
57+
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException"/>
58+
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable.UnusedVariable"/>
3959
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition"/>
40-
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
41-
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
42-
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit"/>
60+
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit">
61+
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit.UselessElseIf"/>
62+
</rule>
4363
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
4464
<rule ref="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming"/>
45-
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowShortTernaryOperator"/>
4665
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
4766
<properties>
48-
<property name="rootNamespaces" type="array" value="src=>PHPStan\PhpDocParser,tests/PHPStan=>PHPStan\PhpDocParser"/>
67+
<property name="rootNamespaces" type="array">
68+
<element key="src" value="PHPStan\PhpDocParser"/>
69+
<element key="tests/PHPStan" value="PHPStan\PhpDocParser"/>
70+
</property>
71+
4972
</properties>
5073
</rule>
5174
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
5275
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
76+
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
5377
<rule ref="SlevomatCodingStandard.Operators.RequireCombinedAssignmentOperator"/>
5478
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition"/>
5579
<rule ref="SlevomatCodingStandard.Classes.TraitUseDeclaration"/>
@@ -58,11 +82,31 @@
5882
<rule ref="SlevomatCodingStandard.Variables.UselessVariable"/>
5983
<!--<rule ref="SlevomatCodingStandard.Functions.UnusedParameter"/>-->
6084
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
85+
<rule ref="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly">
86+
<properties>
87+
<property name="searchAnnotations" value="true"/>
88+
<property name="namespacesRequiredToUse" value=""/>
89+
<property name="allowPartialUses" value="true"/>
90+
<property name="allowFallbackGlobalFunctions" value="false"/>
91+
<property name="allowFallbackGlobalConstants" value="false"/>
92+
<property name="allowFullyQualifiedExceptions" value="false"/>
93+
<property name="allowFullyQualifiedNameForCollidingClasses" value="true"/>
94+
<property name="allowFullyQualifiedNameForCollidingFunctions" value="true"/>
95+
<property name="allowFullyQualifiedNameForCollidingConstants" value="true"/>
96+
</properties>
97+
</rule>
6198
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
99+
<rule ref="SlevomatCodingStandard.Namespaces.UseSpacing"/>
62100
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
63101
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses"/>
102+
<rule ref="Squiz.WhiteSpace.FunctionSpacing">
103+
<properties>
104+
<property name="spacing" value="1" />
105+
<property name="spacingBeforeFirst" value="1"/>
106+
<property name="spacingAfterLast" value="1"/>
107+
</properties>
108+
</rule>
109+
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
110+
<rule ref="Consistence.NamingConventions.ValidVariableName.NotCamelCaps"/>
64111
<exclude-pattern>tests/*/data</exclude-pattern>
65-
<exclude-pattern>tests/*/traits</exclude-pattern>
66-
<exclude-pattern>tests/notAutoloaded</exclude-pattern>
67-
<exclude-pattern>src/Reflection/SignatureMap/functionMap.php</exclude-pattern>
68112
</ruleset>

Diff for: src/Ast/ConstExpr/ConstExprArrayNode.php

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PHPStan\PhpDocParser\Ast\ConstExpr;
44

55
use PHPStan\PhpDocParser\Ast\NodeAttributes;
6+
use function implode;
67

78
class ConstExprArrayNode implements ConstExprNode
89
{

Diff for: src/Ast/Node.php

-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ interface Node
88
public function __toString(): string;
99

1010
/**
11-
* @param string $key
1211
* @param mixed $value
1312
*/
1413
public function setAttribute(string $key, $value): void;
1514

1615
public function hasAttribute(string $key): bool;
1716

1817
/**
19-
* @param string $key
2018
* @return mixed
2119
*/
2220
public function getAttribute(string $key);

Diff for: src/Ast/NodeAttributes.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
namespace PHPStan\PhpDocParser\Ast;
44

5+
use function array_key_exists;
6+
57
trait NodeAttributes
68
{
79

810
/** @var array<string, mixed> */
911
private $attributes = [];
1012

1113
/**
12-
* @param string $key
1314
* @param mixed $value
1415
*/
1516
public function setAttribute(string $key, $value): void
@@ -23,7 +24,6 @@ public function hasAttribute(string $key): bool
2324
}
2425

2526
/**
26-
* @param string $key
2727
* @return mixed
2828
*/
2929
public function getAttribute(string $key)

0 commit comments

Comments
 (0)