We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
18 | class ArgumentsTransformer |
||
19 | { |
||
20 | /** |
||
21 | * @var ValidatorInterface |
||
22 | */ |
||
23 | protected $validator; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $classesMap; |
||
29 | |||
30 | /** |
||
31 | * @var PropertyAccessor |
||
32 | */ |
||
33 | protected $accessor; |
||
34 | |||
35 | 1 | public function __construct(ValidatorInterface $validator, $classesMap = []) |
|
41 | |||
42 | /** |
||
43 | * Get the PHP class for a given type. |
||
44 | * |
||
45 | * @param string $type |
||
46 | * |
||
47 | * @return object|false |
||
48 | */ |
||
49 | 1 | private function getTypeClassInstance(string $type) |
|
55 | |||
56 | /** |
||
57 | * Extract given type from Resolve Info. |
||
58 | * |
||
59 | * @param string $type |
||
60 | * @param ResolveInfo $info |
||
61 | * |
||
62 | * @return Type |
||
63 | */ |
||
64 | 1 | private function getType(string $type, ResolveInfo $info): Type |
|
68 | |||
69 | /** |
||
70 | * Populate an object based on type with given data. |
||
71 | * |
||
72 | * @param Type $type |
||
73 | * @param mixed $data |
||
74 | * @param bool $multiple |
||
75 | * @param ResolveInfo $info |
||
76 | * |
||
77 | * @return mixed |
||
78 | */ |
||
79 | 1 | private function populateObject(Type $type, $data, $multiple = false, ResolveInfo $info) |
|
125 | |||
126 | /** |
||
127 | * Given a GraphQL type and an array of data, populate corresponding object recursively |
||
128 | * using annoted classes. |
||
129 | * |
||
130 | * @param string $argType |
||
131 | * @param mixed $data |
||
132 | * @param ResolveInfo $info |
||
133 | * |
||
134 | * @return mixed |
||
135 | */ |
||
136 | 1 | public function getInstanceAndValidate(string $argType, $data, ResolveInfo $info, string $argName) |
|
155 | |||
156 | /** |
||
157 | * Transform a list of arguments into their corresponding php class and validate them. |
||
158 | * |
||
159 | * @param array $mapping |
||
160 | * @param mixed $data |
||
161 | * @param ResolveInfo $info |
||
162 | * |
||
163 | * @return array |
||
164 | */ |
||
165 | 1 | public function getArguments(array $mapping, $data, ResolveInfo $info) |
|
185 | } |
||
186 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.