Skip to content

Commit 140b255

Browse files
committed
Upgrading Doctrine Coding Standard to ^8.2
1 parent 7847db6 commit 140b255

File tree

77 files changed

+121
-40
lines changed

Some content is hidden

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

77 files changed

+121
-40
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"phpstan/phpstan": "^0.12.25",
3939
"beberlei/porpaginas": "^1.2",
4040
"myclabs/php-enum": "^1.6.6",
41-
"doctrine/coding-standard": "^7.0",
41+
"doctrine/coding-standard": "^8.2",
4242
"phpstan/phpstan-webmozart-assert": "^0.12",
4343
"phpstan/extension-installer": "^1.0",
4444
"thecodingmachine/phpstan-strict-rules": "^0.12",

phpcs.xml.dist

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
<exclude-pattern>src/Types/TypeAnnotatedInterfaceType.php</exclude-pattern>
1919
<exclude-pattern>src/Mappers/Proxys/*</exclude-pattern>
2020

21-
<!-- Excluding ServiceResolver.php and QueryFieldDescriptor.php because Slevomat 5.0 does not support array shaped. -->
22-
<!-- Support is added in 5.1 so we can remove these excludes when Slevomat 5.1 is out -->
23-
<exclude-pattern>src/Middlewares/ServiceResolver.php</exclude-pattern>
24-
<exclude-pattern>src/QueryFieldDescriptor.php</exclude-pattern>
25-
2621
<!-- Include full Doctrine Coding Standard -->
2722
<rule ref="Doctrine">
2823
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>

src/AggregateControllerQueryProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use GraphQL\Type\Definition\FieldDefinition;
88
use Psr\Container\ContainerInterface;
99
use TheCodingMachine\GraphQLite\Mappers\DuplicateMappingException;
10+
1011
use function array_filter;
1112
use function array_intersect_key;
1213
use function array_keys;

src/AnnotationReader.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use TheCodingMachine\GraphQLite\Annotations\SourceFieldInterface;
2727
use TheCodingMachine\GraphQLite\Annotations\Type;
2828
use Webmozart\Assert\Assert;
29+
2930
use function array_diff_key;
3031
use function array_filter;
3132
use function array_key_exists;
@@ -40,6 +41,7 @@
4041
use function strpos;
4142
use function strrpos;
4243
use function substr;
44+
4345
use const PHP_MAJOR_VERSION;
4446

4547
class AnnotationReader
@@ -267,8 +269,8 @@ private function getClassAnnotation(ReflectionClass $refClass, string $annotatio
267269
if (PHP_MAJOR_VERSION >= 8) {
268270
$attribute = $refClass->getAttributes($annotationClass)[0] ?? null;
269271
if ($attribute) {
270-
/** @var T $instance */
271272
$instance = $attribute->newInstance();
273+
assert($instance instanceof T);
272274
return $instance;
273275
}
274276
}
@@ -279,6 +281,7 @@ private function getClassAnnotation(ReflectionClass $refClass, string $annotatio
279281
switch ($this->mode) {
280282
case self::STRICT_MODE:
281283
throw $e;
284+
282285
case self::LAX_MODE:
283286
if ($this->isErrorImportant($annotationClass, $refClass->getDocComment() ?: '', $refClass->getName())) {
284287
throw $e;
@@ -322,6 +325,7 @@ private function getMethodAnnotation(ReflectionMethod $refMethod, string $annota
322325
switch ($this->mode) {
323326
case self::STRICT_MODE:
324327
throw $e;
328+
325329
case self::LAX_MODE:
326330
if ($this->isErrorImportant($annotationClass, $refMethod->getDocComment() ?: '', $refMethod->getDeclaringClass()->getName())) {
327331
throw $e;

src/Annotations/AbstractRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ abstract class AbstractRequest
1515
/**
1616
* @param mixed[] $attributes
1717
*/
18-
public function __construct(array $attributes = [], string $name = null, string $outputType = null)
18+
public function __construct(array $attributes = [], ?string $name = null, ?string $outputType = null)
1919
{
2020
$this->outputType = $outputType ?? $attributes['outputType'] ?? null;
2121
$this->name = $name ?? $attributes['name'] ?? null;

src/Annotations/Autowire.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Attribute;
88
use BadMethodCallException;
9+
910
use function is_string;
1011
use function ltrim;
1112

src/Annotations/Decorate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Attribute;
88
use BadMethodCallException;
9+
910
use function is_string;
1011

1112
/**

src/Annotations/EnumType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class EnumType
2424
/**
2525
* @param mixed[] $attributes
2626
*/
27-
public function __construct(array $attributes = [], string $name = null)
27+
public function __construct(array $attributes = [], ?string $name = null)
2828
{
2929
$this->name = $name ?? $attributes['name'] ?? null;
3030
}

src/Annotations/Exceptions/ClassNotFoundException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace TheCodingMachine\GraphQLite\Annotations\Exceptions;
66

77
use InvalidArgumentException;
8+
89
use function sprintf;
910

1011
class ClassNotFoundException extends InvalidArgumentException

src/Annotations/Exceptions/InvalidParameterException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use BadMethodCallException;
88
use ReflectionMethod;
9+
910
use function sprintf;
1011

1112
class InvalidParameterException extends BadMethodCallException

0 commit comments

Comments
 (0)