We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 6 |
| Paths | 2 |
| Total Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | 2 | public static function toConfig(Node $node, $property = 'fields') |
|
| 12 | { |
||
| 13 | 2 | $config = []; |
|
| 14 | 2 | if (!empty($node->$property)) { |
|
| 15 | 2 | foreach ($node->$property as $definition) { |
|
| 16 | $fieldConfig = [ |
||
| 17 | 2 | 'type' => TypeNode::toConfig($definition), |
|
| 18 | 2 | 'description' => DescriptionNode::toConfig($definition), |
|
| 19 | ]; |
||
| 20 | |||
| 21 | 2 | if (!empty($definition->arguments)) { |
|
| 22 | 2 | $fieldConfig['args'] = self::toConfig($definition, 'arguments'); |
|
| 23 | } |
||
| 24 | |||
| 25 | 2 | if (!empty($definition->defaultValue)) { |
|
| 26 | 1 | $fieldConfig['defaultValue'] = self::astValueNodeToConfig($definition->defaultValue); |
|
| 27 | } |
||
| 28 | |||
| 29 | 2 | $directiveConfig = DirectiveNode::toConfig($definition); |
|
| 30 | 2 | if (isset($directiveConfig['deprecationReason'])) { |
|
| 31 | 1 | $fieldConfig['deprecationReason'] = $directiveConfig['deprecationReason']; |
|
| 32 | } |
||
| 33 | |||
| 34 | 2 | $config[$definition->name->value] = $fieldConfig; |
|
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | 2 | return $config; |
|
| 39 | } |
||
| 40 | |||
| 68 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: