Skip to content

Commit 8582d14

Browse files
chore(deps): update dependency doctrine/coding-standard to v11 (#132)
* chore(deps): update dependency doctrine/coding-standard to v11 * style: run cs fix Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Simon Podlipsky <[email protected]>
1 parent ac53eb6 commit 8582d14

17 files changed

+63
-136
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"webonyx/graphql-php": "^15.0"
2424
},
2525
"require-dev": {
26-
"doctrine/coding-standard": "^9.0",
26+
"doctrine/coding-standard": "^11.0",
2727
"infection/infection": "^0.26.0",
2828
"phpstan/extension-installer": "^1.1",
2929
"phpstan/phpstan": "^1.3",

src/Builder/EnumBuilder.php

+7-16
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,29 @@
1717
*/
1818
class EnumBuilder extends TypeBuilder
1919
{
20-
private string|null $name;
21-
2220
/**
2321
* TODO @var (EnumValues&array)|callable(): EnumValues&array
2422
*
2523
* @var EnumValues&array
2624
*/
2725
private array $values = [];
2826

29-
final private function __construct(?string $name)
27+
final private function __construct(private string|null $name)
3028
{
31-
$this->name = $name;
3229
}
3330

34-
/**
35-
* @return static
36-
*/
31+
/** @return static */
3732
public static function create(string $name): self
3833
{
3934
return new static($name);
4035
}
4136

42-
/**
43-
* @return $this
44-
*/
37+
/** @return $this */
4538
public function addValue(
4639
int|string $value,
47-
?string $name = null,
48-
?string $description = null,
49-
string|null $deprecationReason = null
40+
string|null $name = null,
41+
string|null $description = null,
42+
string|null $deprecationReason = null,
5043
): self {
5144
$name ??= (string) $value;
5245
if (preg_match(self::VALID_NAME_PATTERN, $name) !== 1) {
@@ -67,9 +60,7 @@ public function addValue(
6760
return $this;
6861
}
6962

70-
/**
71-
* @psalm-return EnumTypeConfig
72-
*/
63+
/** @psalm-return EnumTypeConfig */
7364
public function build(): array
7465
{
7566
return [

src/Builder/FieldBuilder.php

+6-17
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
*/
2222
class FieldBuilder
2323
{
24-
private string $name;
25-
2624
/** @psalm-var FieldType */
2725
private mixed $type;
2826

@@ -36,12 +34,9 @@ class FieldBuilder
3634
/** @psalm-var (ArgumentListConfig&array)|null */
3735
private array|null $args = null;
3836

39-
/**
40-
* @psalm-param FieldType $type
41-
*/
42-
final private function __construct(string $name, $type)
37+
/** @psalm-param FieldType $type */
38+
final private function __construct(private string $name, $type)
4339
{
44-
$this->name = $name;
4540
$this->type = $type;
4641
}
4742

@@ -55,9 +50,7 @@ public static function create(string $name, $type): self
5550
return new static($name, $type);
5651
}
5752

58-
/**
59-
* @return $this
60-
*/
53+
/** @return $this */
6154
public function setDescription(string $description): self
6255
{
6356
$this->description = $description;
@@ -70,7 +63,7 @@ public function setDescription(string $description): self
7063
*
7164
* @return $this
7265
*/
73-
public function addArgument(string $name, $type, ?string $description = null, mixed $defaultValue = null): self
66+
public function addArgument(string $name, $type, string|null $description = null, mixed $defaultValue = null): self
7467
{
7568
if ($this->args === null) {
7669
$this->args = [];
@@ -104,19 +97,15 @@ public function setResolver(callable $resolver): self
10497
return $this;
10598
}
10699

107-
/**
108-
* @return $this
109-
*/
100+
/** @return $this */
110101
public function setDeprecationReason(string $reason): self
111102
{
112103
$this->deprecationReason = $reason;
113104

114105
return $this;
115106
}
116107

117-
/**
118-
* @psalm-return FieldDefinitionConfig
119-
*/
108+
/** @psalm-return FieldDefinitionConfig */
120109
public function build(): array
121110
{
122111
return [

src/Builder/InputFieldBuilder.php

+5-16
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
*/
2222
class InputFieldBuilder
2323
{
24-
private string $name;
25-
2624
/** @psalm-var ArgumentType */
2725
private mixed $type;
2826

@@ -32,12 +30,9 @@ class InputFieldBuilder
3230

3331
private mixed $defaultValue;
3432

35-
/**
36-
* @psalm-param ArgumentType $type
37-
*/
38-
final private function __construct(string $name, $type)
33+
/** @psalm-param ArgumentType $type */
34+
final private function __construct(private string $name, $type)
3935
{
40-
$this->name = $name;
4136
$this->type = $type;
4237
}
4338

@@ -51,29 +46,23 @@ public static function create(string $name, $type): self
5146
return new static($name, $type);
5247
}
5348

54-
/**
55-
* @return $this
56-
*/
49+
/** @return $this */
5750
public function setDefaultValue(mixed $defaultValue): self
5851
{
5952
$this->defaultValue = $defaultValue;
6053

6154
return $this;
6255
}
6356

64-
/**
65-
* @return $this
66-
*/
57+
/** @return $this */
6758
public function setDescription(string $description): self
6859
{
6960
$this->description = $description;
7061

7162
return $this;
7263
}
7364

74-
/**
75-
* @psalm-return InputObjectFieldConfig
76-
*/
65+
/** @psalm-return InputObjectFieldConfig */
7766
public function build(): array
7867
{
7968
$config = [

src/Builder/InputObjectBuilder.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,14 @@
1414
*/
1515
class InputObjectBuilder extends TypeBuilder
1616
{
17-
private string|null $name;
18-
1917
/** @var callable():array<FieldConfig>|array<FieldConfig> */
2018
private $fields = [];
2119

22-
final private function __construct(?string $name)
20+
final private function __construct(private string|null $name)
2321
{
24-
$this->name = $name;
2522
}
2623

27-
/**
28-
* @return static
29-
*/
24+
/** @return static */
3025
public static function create(string $name): self
3126
{
3227
return new static($name);
@@ -44,9 +39,7 @@ public function setFields(callable|array $fields): self
4439
return $this;
4540
}
4641

47-
/**
48-
* @psalm-return InputObjectConfig
49-
*/
42+
/** @psalm-return InputObjectConfig */
5043
public function build(): array
5144
{
5245
return [

src/Builder/InterfaceBuilder.php

+6-17
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
*/
1515
class InterfaceBuilder extends TypeBuilder
1616
{
17-
private string|null $name;
18-
1917
/** @var InterfaceType[] */
2018
private array $interfaces = [];
2119

@@ -25,22 +23,17 @@ class InterfaceBuilder extends TypeBuilder
2523
/** @var array<FieldDefinition|array<string, mixed>>|callable():array<FieldDefinition|array<string, mixed>> */
2624
private $fields = [];
2725

28-
final private function __construct(?string $name)
26+
final private function __construct(private string|null $name)
2927
{
30-
$this->name = $name;
3128
}
3229

33-
/**
34-
* @return static
35-
*/
36-
public static function create(?string $name = null): self
30+
/** @return static */
31+
public static function create(string|null $name = null): self
3732
{
3833
return new static($name);
3934
}
4035

41-
/**
42-
* @return $this
43-
*/
36+
/** @return $this */
4437
public function addInterface(InterfaceType $interfaceType): self
4538
{
4639
$this->interfaces[] = $interfaceType;
@@ -60,19 +53,15 @@ public function setFields(callable|array $fields): self
6053
return $this;
6154
}
6255

63-
/**
64-
* @return $this
65-
*/
56+
/** @return $this */
6657
public function setResolveType(callable $resolveType): self
6758
{
6859
$this->resolveType = $resolveType;
6960

7061
return $this;
7162
}
7263

73-
/**
74-
* @psalm-return InterfaceConfig
75-
*/
64+
/** @psalm-return InterfaceConfig */
7665
public function build(): array
7766
{
7867
return [

src/Builder/ObjectBuilder.php

+4-13
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
*/
2121
class ObjectBuilder extends TypeBuilder
2222
{
23-
private string|null $name;
24-
2523
/** @var InterfaceType[] */
2624
private array $interfaces = [];
2725

@@ -31,22 +29,17 @@ class ObjectBuilder extends TypeBuilder
3129
/** @var callable(mixed, array<mixed>, mixed, ResolveInfo) : mixed|null */
3230
private $fieldResolver;
3331

34-
final private function __construct(?string $name)
32+
final private function __construct(private string|null $name)
3533
{
36-
$this->name = $name;
3734
}
3835

39-
/**
40-
* @return static
41-
*/
36+
/** @return static */
4237
public static function create(string $name): self
4338
{
4439
return new static($name);
4540
}
4641

47-
/**
48-
* @return $this
49-
*/
42+
/** @return $this */
5043
public function addInterface(InterfaceType $interfaceType): self
5144
{
5245
$this->interfaces[] = $interfaceType;
@@ -101,9 +94,7 @@ public function setFieldResolver(callable $fieldResolver): self
10194
return $this;
10295
}
10396

104-
/**
105-
* @psalm-return ObjectConfig
106-
*/
97+
/** @psalm-return ObjectConfig */
10798
public function build(): array
10899
{
109100
return [

src/Builder/TypeBuilder.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ abstract class TypeBuilder
88
{
99
public const VALID_NAME_PATTERN = '~^[_a-zA-Z][_a-zA-Z0-9]*$~';
1010

11-
protected ?string $description = null;
11+
protected string|null $description = null;
1212

13-
/**
14-
* @return $this
15-
*/
13+
/** @return $this */
1614
public function setDescription(string $description): self
1715
{
1816
$this->description = $description;

src/Builder/UnionBuilder.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,24 @@
2020
*/
2121
class UnionBuilder extends TypeBuilder
2222
{
23-
private string|null $name;
2423
/** @psalm-var ResolveType|null */
2524
private $resolveType = null;
2625

2726
/** @psalm-var Types */
2827
private $types;
2928

3029
/** @psalm-param Types $types */
31-
final private function __construct(iterable|callable $types, ?string $name = null)
30+
final private function __construct(iterable|callable $types, private string|null $name = null)
3231
{
3332
$this->types = $types;
34-
$this->name = $name;
3533
}
3634

3735
/**
3836
* @psalm-param Types $types
3937
*
4038
* @return static
4139
*/
42-
public static function create(?string $name, iterable|callable $types): self
40+
public static function create(string|null $name, iterable|callable $types): self
4341
{
4442
return new static($types, $name);
4543
}
@@ -56,9 +54,7 @@ public function setResolveType(callable $resolveType): self
5654
return $this;
5755
}
5856

59-
/**
60-
* @psalm-return UnionConfig
61-
*/
57+
/** @psalm-return UnionConfig */
6258
public function build(): array
6359
{
6460
return [

src/Exception/InvalidArgument.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
final class InvalidArgument extends Exception implements ClientAware
1616
{
17-
private function __construct(string $message = '', int $code = 0, ?Throwable $previous = null)
17+
private function __construct(string $message = '', int $code = 0, Throwable|null $previous = null)
1818
{
1919
parent::__construct($message, $code, $previous);
2020
}
@@ -28,7 +28,7 @@ public static function valueNotIso8601Compliant(mixed $invalidValue): self
2828
{
2929
return new self(sprintf(
3030
'DateTime type expects input value to be ISO 8601 compliant. Given invalid value "%s"',
31-
Utils::printSafeJson($invalidValue)
31+
Utils::printSafeJson($invalidValue),
3232
));
3333
}
3434

0 commit comments

Comments
 (0)