Skip to content

Commit 0005802

Browse files
committed
Applying cs-fix
1 parent 93432f8 commit 0005802

28 files changed

+168
-276
lines changed

phpstan.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ parameters:
3030
message: '#Method TheCodingMachine\\GraphQLite\\AnnotationReader::getMethodAnnotations\(\) should return array<int, T of object> but returns array<object>.#'
3131
path: src/AnnotationReader.php
3232
- '#Call to an undefined method GraphQL\\Error\\ClientAware::getMessage()#'
33-
# Needed because of a bug in PHP-CS
34-
- '#PHPDoc tag @param for parameter \$args with type mixed is not subtype of native type array<int, mixed>.#'
3533

3634
#-
3735
# message: '#If condition is always true#'

src/AnnotationReader.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,13 @@ class AnnotationReader
6666
*/
6767
private $mode;
6868

69-
/**
70-
* @var array<string, (object|null)>
71-
*/
69+
/** @var array<string, (object|null)> */
7270
private $methodAnnotationCache = [];
7371

74-
/**
75-
* @var array<string, array<object>>
76-
*/
72+
/** @var array<string, array<object>> */
7773
private $methodAnnotationsCache = [];
7874

79-
/**
80-
* @var array<string, array<object>>
81-
*/
75+
/** @var array<string, array<object>> */
8276
private $propertyAnnotationsCache = [];
8377

8478
/**
@@ -263,8 +257,6 @@ public function getParameterAnnotationsPerParameter(array $refParameters): array
263257
/**
264258
* @param ReflectionMethod|ReflectionProperty $reflection
265259
*
266-
* @return MiddlewareAnnotations
267-
*
268260
* @throws AnnotationException
269261
*/
270262
public function getMiddlewareAnnotations($reflection): MiddlewareAnnotations

src/Annotations/Field.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ class Field extends AbstractRequest
3030
*/
3131
private $for = null;
3232

33-
/**
34-
* @var string|null
35-
*/
33+
/** @var string|null */
3634
private $description;
3735

38-
/**
39-
* @var string|null
40-
*/
36+
/** @var string|null */
4137
private $inputType;
4238

4339
/**
@@ -50,9 +46,11 @@ public function __construct(array $attributes = [])
5046
$this->description = $attributes['description'] ?? null;
5147
$this->inputType = $attributes['inputType'] ?? null;
5248

53-
if (!empty($attributes['for'])) {
54-
$this->for = (array) $attributes['for'];
49+
if (empty($attributes['for'])) {
50+
return;
5551
}
52+
53+
$this->for = (array) $attributes['for'];
5654
}
5755

5856
/**
@@ -71,17 +69,11 @@ public function getFor(): ?array
7169
return $this->for;
7270
}
7371

74-
/**
75-
* @return string|null
76-
*/
7772
public function getDescription(): ?string
7873
{
7974
return $this->description;
8075
}
8176

82-
/**
83-
* @return string|null
84-
*/
8577
public function getInputType(): ?string
8678
{
8779
return $this->inputType;

src/Annotations/Input.php

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace TheCodingMachine\GraphQLite\Annotations;
46

57
use Doctrine\Common\Annotations\Annotation\Attribute;
@@ -20,29 +22,19 @@
2022
*/
2123
class Input
2224
{
23-
/**
24-
* @var string|null
25-
*/
25+
/** @var string|null */
2626
private $class;
2727

28-
/**
29-
* @var string|null
30-
*/
28+
/** @var string|null */
3129
private $name;
3230

33-
/**
34-
* @var bool
35-
*/
31+
/** @var bool */
3632
private $default;
3733

38-
/**
39-
* @var string|null
40-
*/
34+
/** @var string|null */
4135
private $description;
4236

43-
/**
44-
* @var bool
45-
*/
37+
/** @var bool */
4638
private $update;
4739

4840
/**
@@ -51,15 +43,13 @@ class Input
5143
public function __construct(array $attributes = [])
5244
{
5345
$this->name = $attributes['name'] ?? null;
54-
$this->default = $attributes['default'] ?? !isset($attributes['name']);
46+
$this->default = $attributes['default'] ?? ! isset($attributes['name']);
5547
$this->description = $attributes['description'] ?? null;
5648
$this->update = $attributes['update'] ?? false;
5749
}
5850

5951
/**
6052
* Returns the fully qualified class name of the targeted class.
61-
*
62-
* @return string
6353
*/
6454
public function getClass(): string
6555
{
@@ -70,9 +60,6 @@ public function getClass(): string
7060
return $this->class;
7161
}
7262

73-
/**
74-
* @param string $class
75-
*/
7663
public function setClass(string $class): void
7764
{
7865
$this->class = $class;
@@ -96,8 +83,6 @@ public function isDefault(): bool
9683

9784
/**
9885
* Returns description about this input type.
99-
*
100-
* @return string|null
10186
*/
10287
public function getDescription(): ?string
10388
{
@@ -107,8 +92,6 @@ public function getDescription(): ?string
10792
/**
10893
* Returns true if this type should behave as update resource.
10994
* Such input type has all fields optional and without default value in the documentation.
110-
*
111-
* @return bool
11295
*/
11396
public function isUpdate(): bool
11497
{

src/FailedResolvingInputType.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace TheCodingMachine\GraphQLite;
46

57
use RuntimeException;
8+
use function sprintf;
69

710
class FailedResolvingInputType extends RuntimeException
811
{
9-
10-
/**
11-
* @param string $class
12-
* @param string $parameter
13-
*
14-
* @return self
15-
*/
1612
public static function createForMissingConstructorParameter(string $class, string $parameter): self
1713
{
1814
return new self(sprintf("Parameter '%s' is missing for class '%s' constructor. It should be mapped as required field.", $parameter, $class));
1915
}
2016

21-
/**
22-
* @return self
23-
*/
2417
public static function createForDecorator(): self
2518
{
2619
return new self('Input type cannot be a decorator');

0 commit comments

Comments
 (0)