1 | <?php |
||
20 | class Factory |
||
21 | { |
||
22 | /** |
||
23 | * Collection name. |
||
24 | */ |
||
25 | public const COLLECTION_NAME = 'access_roles'; |
||
26 | /** |
||
27 | * Database. |
||
28 | * |
||
29 | * @var Database |
||
30 | */ |
||
31 | protected $db; |
||
32 | |||
33 | /** |
||
34 | * Resource factory. |
||
35 | * |
||
36 | * @var ResourceFactory |
||
37 | */ |
||
38 | protected $resource_factory; |
||
39 | |||
40 | /** |
||
41 | * Initialize. |
||
42 | */ |
||
43 | public function __construct(Database $db, ResourceFactory $resource_factory) |
||
48 | |||
49 | /** |
||
50 | * Has resource. |
||
51 | */ |
||
52 | public function has(string $name): bool |
||
56 | |||
57 | /** |
||
58 | * Get resources. |
||
59 | */ |
||
60 | public function getAll(?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
68 | |||
69 | /** |
||
70 | * Get resource. |
||
71 | */ |
||
72 | public function getOne(string $name): AccessRoleInterface |
||
86 | |||
87 | /** |
||
88 | * Delete by name. |
||
89 | */ |
||
90 | public function deleteOne(string $name): bool |
||
97 | |||
98 | /** |
||
99 | * Add resource. |
||
100 | */ |
||
101 | public function add(array $resource): ObjectIdInterface |
||
112 | |||
113 | /** |
||
114 | * Update. |
||
115 | */ |
||
116 | public function update(AccessRoleInterface $resource, array $data): bool |
||
124 | |||
125 | /** |
||
126 | * Change stream. |
||
127 | */ |
||
128 | public function watch(?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
136 | |||
137 | /** |
||
138 | * Build instance. |
||
139 | */ |
||
140 | public function build(array $resource): AccessRoleInterface |
||
144 | } |
||
145 |
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.