We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
8 | abstract class TypeDefinition |
||
9 | { |
||
10 | abstract public function getDefinition(); |
||
11 | |||
12 | 37 | protected function __construct() |
|
13 | { |
||
14 | 37 | } |
|
15 | |||
16 | /** |
||
17 | * @return static |
||
18 | */ |
||
19 | 37 | public static function create() |
|
20 | { |
||
21 | 37 | return new static(); |
|
22 | } |
||
23 | |||
24 | 37 | protected function resolveTypeSection() |
|
30 | |||
31 | 37 | protected function nameSection() |
|
32 | { |
||
33 | 37 | $node = self::createNode('name', 'scalar'); |
|
34 | 37 | $node->isRequired(); |
|
35 | 37 | $node->validate() |
|
36 | ->ifTrue(function ($name) { |
||
37 | 32 | return !\preg_match('/^[_a-z][_0-9a-z]*$/i', $name); |
|
38 | 37 | }) |
|
39 | 37 | ->thenInvalid('Invalid type name "%s". (see https://facebook.github.io/graphql/October2016/#Name)') |
|
40 | 37 | ->end(); |
|
41 | |||
42 | 37 | return $node; |
|
43 | } |
||
44 | |||
45 | 37 | protected function defaultValueSection() |
|
51 | |||
52 | 37 | protected function descriptionSection() |
|
58 | |||
59 | 37 | protected function deprecationReasonSelection() |
|
67 | |||
68 | 37 | protected function typeSelection($isRequired = false) |
|
80 | |||
81 | /** |
||
82 | * @internal |
||
83 | * |
||
84 | * @param string $name |
||
85 | * @param string $type |
||
86 | * |
||
87 | * @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition |
||
88 | */ |
||
89 | 37 | protected static function createNode($name, $type = 'array') |
|
93 | } |
||
94 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.