Passed
Push — feature/0.7.0 ( 0c7d59...ae5b22 )
by Ryuichi
78:01 queued 33:04
created

AnnotationDelegator::read()   B

Complexity

Conditions 8
Paths 7

Size

Total Lines 21
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 16
nc 7
nop 3
dl 0
loc 21
rs 7.1428
c 0
b 0
f 0
1
<?php
2
namespace WebStream\Delegate;
3
4
use WebStream\Core\CoreInterface;
5
use WebStream\Core\CoreController;
6
use WebStream\Core\CoreService;
7
use WebStream\Core\CoreModel;
8
use WebStream\Core\CoreView;
9
use WebStream\Core\CoreHelper;
10
use WebStream\Container\Container;
11
use WebStream\Annotation\Base\IAnnotatable;
12
use WebStream\Annotation\Reader\AnnotationReader;
13
use WebStream\Annotation\Container\AnnotationContainer;
14
15
/**
16
 * AnnotationDelegator
17
 * @author Ryuichi TANAKA.
18
 * @since 2015/02/11
19
 * @version 0.4
20
 */
21
class AnnotationDelegator
22
{
23
    /**
24
     * @var Container コンテナ
25
     */
26
    private $container;
27
28
    /**
29
     * @var Logger ロガー
0 ignored issues
show
Bug introduced by
The type WebStream\Delegate\Logger was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
     */
31
    private $logger;
32
33
    /**
34
     * Constructor
35
     * @param CoreInterface インスタンス
36
     * @param Container DIContainer
37
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
38
    public function __construct(Container $container)
39
    {
40
        $this->container = $container;
41
        $this->logger = $container->logger;
0 ignored issues
show
Bug Best Practice introduced by
The property logger does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
Documentation Bug introduced by
It seems like $container->logger can also be of type string. However, the property $logger is declared as type WebStream\Delegate\Logger. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
42
    }
43
44
    /**
45
     * Destructor
46
     */
47
    public function __destruct()
48
    {
49
        $this->logger->debug("AnnotationDelegator container is clear.");
50
    }
51
52
    /**
53
     * アノテーション情報をロードする
54
     * @param object インスタンス
55
     * @param string メソッド
56
     * @param string アノテーションクラスパス
57
     * @return Container コンテナ
58
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
59
    public function read($instance, $method = null, $classpath = null)
60
    {
61
        if (!$instance instanceof IAnnotatable) {
62
            $this->logger->warn("Annotation is not available this class: " . get_class($instance));
63
            return;
64
        }
65
66
        $this->container->executeMethod = $method ?: "";
0 ignored issues
show
Bug Best Practice introduced by
The property executeMethod does not exist on WebStream\Container\Container. Since you implemented __set, consider adding a @property annotation.
Loading history...
67
68
        if ($instance instanceof CoreController) {
69
            return $this->readController($instance, $classpath);
70
        } elseif ($instance instanceof CoreService) {
71
            return $this->readService($instance, $classpath);
72
        } elseif ($instance instanceof CoreModel) {
73
            return $this->readModel($instance, $classpath);
74
        } elseif ($instance instanceof CoreView) {
75
            return $this->readView($instance, $classpath);
76
        } elseif ($instance instanceof CoreHelper) {
77
            return $this->readHelper($instance, $classpath);
78
        } else {
79
            return $this->readModule($instance, $classpath);
80
        }
81
    }
82
83
    /**
84
     * Controllerのアノテーション情報をロードする
85
     * @param CoreController インスタンス
86
     * @param string アノテーションクラスパス
87
     * @return Container コンテナ
88
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
89
    private function readController(CoreController $instance, $classpath)
90
    {
91
        $container = $this->container;
92
        $reader = new AnnotationReader($instance, $container);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...onReader::__construct() has too many arguments starting with $container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

92
        $reader = /** @scrutinizer ignore-call */ new AnnotationReader($instance, $container);

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. Please note the @ignore annotation hint above.

Loading history...
93
        $reader->read($classpath);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...nnotationReader::read() has too many arguments starting with $classpath. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

93
        $reader->/** @scrutinizer ignore-call */ 
94
                 read($classpath);

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. Please note the @ignore annotation hint above.

Loading history...
94
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();
0 ignored issues
show
Bug introduced by
The method getInjectedAnnotationInfo() does not exist on WebStream\Annotation\Reader\AnnotationReader. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

94
        /** @scrutinizer ignore-call */ 
95
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
95
96
        $factory = new AnnotationDelegatorFactory($injectedAnnotation, $container);
97
        $annotationContainer = new AnnotationContainer();
98
99
        // exceptions
100
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
101
102
        // @Header
103
        $annotationContainer->header = $factory->createAnnotationCallable("header");
0 ignored issues
show
Bug Best Practice introduced by
The property header does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
104
105
        // @Filter
106
        $annotationContainer->filter = $factory->createAnnotationCallable("filter");
0 ignored issues
show
Bug Best Practice introduced by
The property filter does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
107
108
        // @Template
109
        $annotationContainer->template = $factory->createAnnotationCallable("template");
0 ignored issues
show
Bug Best Practice introduced by
The property template does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
110
111
        // @ExceptionHandler
112
        $annotationContainer->exceptionHandler = $factory->createAnnotationCallable("exceptionHandler");
0 ignored issues
show
Bug Best Practice introduced by
The property exceptionHandler does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
113
114
        // @Alias
115
        $annotationContainer->alias = $factory->createAnnotationCallable("alias");
0 ignored issues
show
Bug Best Practice introduced by
The property alias does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
116
117
        // custom annotation
118
        $annotationContainer->customAnnotations = $factory->createCustomAnnotationCallable();
0 ignored issues
show
Bug Best Practice introduced by
The property customAnnotations does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
119
120
        return $annotationContainer;
121
    }
122
123
    /**
124
     * Serviceのアノテーション情報をロードする
125
     * @param CoreService インスタンス
126
     * @param string アノテーションクラスパス
127
     * @return Container コンテナ
128
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
129
    private function readService(CoreService $instance, $classpath)
130
    {
131
        $container = $this->container;
132
        $reader = new AnnotationReader($instance, $container);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...onReader::__construct() has too many arguments starting with $container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

132
        $reader = /** @scrutinizer ignore-call */ new AnnotationReader($instance, $container);

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. Please note the @ignore annotation hint above.

Loading history...
133
        $reader->read($classpath);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...nnotationReader::read() has too many arguments starting with $classpath. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

133
        $reader->/** @scrutinizer ignore-call */ 
134
                 read($classpath);

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. Please note the @ignore annotation hint above.

Loading history...
134
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();
135
136
        $factory = new AnnotationDelegatorFactory($injectedAnnotation, $container);
137
        $annotationContainer = new AnnotationContainer();
138
139
        // exceptions
140
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
141
142
        // @Filter
143
        $annotationContainer->filter = $factory->createAnnotationCallable("filter");
0 ignored issues
show
Bug Best Practice introduced by
The property filter does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
144
145
        // @ExceptionHandler
146
        $annotationContainer->exceptionHandler = $factory->createAnnotationCallable("exceptionHandler");
0 ignored issues
show
Bug Best Practice introduced by
The property exceptionHandler does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
147
148
        // @Alias
149
        $annotationContainer->alias = $factory->createAnnotationCallable("alias");
0 ignored issues
show
Bug Best Practice introduced by
The property alias does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
150
151
        // custom annotation
152
        $annotationContainer->customAnnotations = $factory->createCustomAnnotationCallable();
0 ignored issues
show
Bug Best Practice introduced by
The property customAnnotations does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
153
154
        return $annotationContainer;
155
    }
156
157
    /**
158
     * Modelのアノテーション情報をロードする
159
     * @param CoreModel インスタンス
160
     * @param string アノテーションクラスパス
161
     * @return Container コンテナ
162
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
163
    private function readModel(CoreModel $instance, $classpath)
164
    {
165
        $container = $this->container;
166
        $reader = new AnnotationReader($instance, $container);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...onReader::__construct() has too many arguments starting with $container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

166
        $reader = /** @scrutinizer ignore-call */ new AnnotationReader($instance, $container);

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. Please note the @ignore annotation hint above.

Loading history...
167
        $reader->read($classpath);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...nnotationReader::read() has too many arguments starting with $classpath. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

167
        $reader->/** @scrutinizer ignore-call */ 
168
                 read($classpath);

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. Please note the @ignore annotation hint above.

Loading history...
168
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();
169
170
        $factory = new AnnotationDelegatorFactory($injectedAnnotation, $container);
171
        $annotationContainer = new AnnotationContainer();
172
173
        // exceptions
174
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
175
176
        // @Filter
177
        $annotationContainer->filter = $factory->createAnnotationCallable("filter");
0 ignored issues
show
Bug Best Practice introduced by
The property filter does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
178
179
        // @ExceptionHandler
180
        $annotationContainer->exceptionHandler = $factory->createAnnotationCallable("exceptionHandler");
0 ignored issues
show
Bug Best Practice introduced by
The property exceptionHandler does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
181
182
        // @Database
183
        $annotationContainer->database = $factory->createAnnotationCallable("database");
0 ignored issues
show
Bug Best Practice introduced by
The property database does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
184
185
        // @Query
186
        $annotationContainer->query = $factory->createAnnotationCallable("query");
0 ignored issues
show
Bug Best Practice introduced by
The property query does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
187
188
        // @Alias
189
        $annotationContainer->alias = $factory->createAnnotationCallable("alias");
0 ignored issues
show
Bug Best Practice introduced by
The property alias does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
190
191
        // custom annotation
192
        $annotationContainer->customAnnotations = $factory->createCustomAnnotationCallable();
0 ignored issues
show
Bug Best Practice introduced by
The property customAnnotations does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
193
194
        return $annotationContainer;
195
    }
196
197
    /**
198
     * Viewのアノテーション情報をロードする
199
     * @param CoreView インスタンス
200
     * @param string アノテーションクラスパス
201
     * @return Container コンテナ
202
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
203
    private function readView(CoreView $instance, $classpath)
204
    {
205
        $container = $this->container;
206
        $reader = new AnnotationReader($instance, $container);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...onReader::__construct() has too many arguments starting with $container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

206
        $reader = /** @scrutinizer ignore-call */ new AnnotationReader($instance, $container);

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. Please note the @ignore annotation hint above.

Loading history...
207
        $reader->read($classpath);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...nnotationReader::read() has too many arguments starting with $classpath. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

207
        $reader->/** @scrutinizer ignore-call */ 
208
                 read($classpath);

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. Please note the @ignore annotation hint above.

Loading history...
208
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();
209
210
        $factory = new AnnotationDelegatorFactory($injectedAnnotation, $container);
211
        $annotationContainer = new AnnotationContainer();
212
213
        // exceptions
214
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
215
216
        // @Filter
217
        $annotationContainer->filter = $factory->createAnnotationCallable("filter");
0 ignored issues
show
Bug Best Practice introduced by
The property filter does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
218
219
        return $annotationContainer;
220
    }
221
222
    /**
223
     * Helperのアノテーション情報をロードする
224
     * @param CoreHelper インスタンス
225
     * @param string アノテーションクラスパス
226
     * @return Container コンテナ
227
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
228
    private function readHelper(CoreHelper $instance, $classpath)
229
    {
230
        $container = $this->container;
231
        $reader = new AnnotationReader($instance, $container);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...onReader::__construct() has too many arguments starting with $container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

231
        $reader = /** @scrutinizer ignore-call */ new AnnotationReader($instance, $container);

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. Please note the @ignore annotation hint above.

Loading history...
232
        $reader->read($classpath);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...nnotationReader::read() has too many arguments starting with $classpath. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

232
        $reader->/** @scrutinizer ignore-call */ 
233
                 read($classpath);

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. Please note the @ignore annotation hint above.

Loading history...
233
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();
234
235
        $factory = new AnnotationDelegatorFactory($injectedAnnotation, $container);
236
        $annotationContainer = new AnnotationContainer();
237
238
        // exceptions
239
        $annotationContainer->exception = $reader->getException();
0 ignored issues
show
Bug Best Practice introduced by
The property exception does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
240
241
        // @Filter
242
        $annotationContainer->filter = $factory->createAnnotationCallable("filter");
0 ignored issues
show
Bug Best Practice introduced by
The property filter does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
243
244
        // @ExceptionHandler
245
        $annotationContainer->exceptionHandler = $factory->createAnnotationCallable("exceptionHandler");
0 ignored issues
show
Bug Best Practice introduced by
The property exceptionHandler does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
246
247
        // @Alias
248
        $annotationContainer->alias = $factory->createAnnotationCallable("alias");
0 ignored issues
show
Bug Best Practice introduced by
The property alias does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
249
250
        // custom annotation
251
        $annotationContainer->customAnnotations = $factory->createCustomAnnotationCallable();
0 ignored issues
show
Bug Best Practice introduced by
The property customAnnotations does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
252
253
        return $annotationContainer;
254
    }
255
256
    /**
257
     * 他のモジュールのアノテーション情報をロードする
258
     * @param object インスタンス
259
     * @param string アノテーションクラスパス
260
     * @return Container コンテナ
261
     */
0 ignored issues
show
Documentation Bug introduced by
The doc comment インスタンス at position 0 could not be parsed: Unknown type name 'インスタンス' at position 0 in インスタンス.
Loading history...
262
    private function readModule(IAnnotatable $instance, $classpath)
263
    {
264
        $container = $this->container;
265
        $reader = new AnnotationReader($instance, $container);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...onReader::__construct() has too many arguments starting with $container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

265
        $reader = /** @scrutinizer ignore-call */ new AnnotationReader($instance, $container);

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. Please note the @ignore annotation hint above.

Loading history...
266
        $reader->read($classpath);
0 ignored issues
show
Unused Code introduced by
The call to WebStream\Annotation\Rea...nnotationReader::read() has too many arguments starting with $classpath. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

266
        $reader->/** @scrutinizer ignore-call */ 
267
                 read($classpath);

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. Please note the @ignore annotation hint above.

Loading history...
267
        $injectedAnnotation = $reader->getInjectedAnnotationInfo();
268
269
        $factory = new AnnotationDelegatorFactory($injectedAnnotation, $container);
270
        $annotationContainer = new AnnotationContainer();
271
272
        // @Filter
273
        $annotationContainer->filter = $factory->createAnnotationCallable("filter");
0 ignored issues
show
Bug Best Practice introduced by
The property filter does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
274
275
        // @Alias
276
        $annotationContainer->alias = $factory->createAnnotationCallable("alias");
0 ignored issues
show
Bug Best Practice introduced by
The property alias does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
277
278
        // custom annotation
279
        $annotationContainer->customAnnotations = $factory->createCustomAnnotationCallable();
0 ignored issues
show
Bug Best Practice introduced by
The property customAnnotations does not exist on WebStream\Annotation\Container\AnnotationContainer. Since you implemented __set, consider adding a @property annotation.
Loading history...
280
281
        return $annotationContainer;
282
    }
283
}
284