1 | <?php |
||
29 | class Selectors extends Selector |
||
30 | { |
||
31 | /** |
||
32 | * @var SelectorFactoryInterface |
||
33 | */ |
||
34 | protected static $factory; |
||
35 | |||
36 | /** |
||
37 | * @var SelectorInterface |
||
38 | */ |
||
39 | private $selector; |
||
40 | |||
41 | /** |
||
42 | * @return \Cubiche\Core\Selector\SelectorFactoryInterface |
||
43 | */ |
||
44 | protected static function factory() |
||
45 | { |
||
46 | if (self::$factory === null) { |
||
47 | self::setFactory(new SelectorFactory(__NAMESPACE__)); |
||
48 | } |
||
49 | |||
50 | return self::$factory; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @param SelectorFactoryInterface $factory |
||
55 | */ |
||
56 | public static function setFactory(SelectorFactoryInterface $factory) |
||
57 | { |
||
58 | self::$factory = $factory; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @param string $selectorClass |
||
63 | * @param string $selectorName |
||
64 | */ |
||
65 | public static function addSelector($selectorClass, $selectorName = null) |
||
66 | { |
||
67 | self::factory()->addSelector($selectorClass, $selectorName); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param string $namespace |
||
72 | */ |
||
73 | public static function addNamespace($namespace) |
||
74 | { |
||
75 | self::factory()->addNamespace($namespace); |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * @param SelectorInterface $selector |
||
80 | */ |
||
81 | protected function __construct(SelectorInterface $selector) |
||
82 | { |
||
83 | $this->selector = $selector; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @param string $method |
||
88 | * @param array $arguments |
||
89 | * |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public static function __callStatic($method, $arguments) |
||
93 | { |
||
94 | return new static(self::factory()->create($method, $arguments)); |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @param string $method |
||
99 | * @param array $args |
||
|
|||
100 | * |
||
101 | * @return mixed |
||
102 | */ |
||
103 | public function __call($method, $arguments) |
||
104 | { |
||
105 | return $this->select(self::factory()->create($method, $arguments)); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | */ |
||
111 | public function apply($value) |
||
112 | { |
||
113 | return $this->selector()->apply($value); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function select(callable $selector) |
||
120 | { |
||
121 | $this->selector = $this->selector()->select($selector); |
||
122 | |||
123 | return $this; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function accept(VisitorInterface $visitor) |
||
130 | { |
||
131 | return $this->delegateAccept($this->selector(), $visitor, \func_get_args()); |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * @return \Cubiche\Core\Selector\SelectorInterface |
||
136 | */ |
||
137 | public function selector() |
||
141 | } |
||
142 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.