@@ -22,7 +22,7 @@ |
||
22 | 22 | * Executes a task and logs all incoming arguments |
23 | 23 | * |
24 | 24 | * @Loggable |
25 | - * @param mixed $task Some specific argument |
|
25 | + * @param string $task Some specific argument |
|
26 | 26 | */ |
27 | 27 | public function execute($task) |
28 | 28 | { |
@@ -140,7 +140,7 @@ |
||
140 | 140 | * @param Aspect $aspect Instance of aspect |
141 | 141 | * @param ReflectionMethod $refMethod Reflection method of aspect |
142 | 142 | * |
143 | - * @return callable|object |
|
143 | + * @return \Closure |
|
144 | 144 | */ |
145 | 145 | public static function fromAspectReflection(Aspect $aspect, ReflectionMethod $refMethod) |
146 | 146 | { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | if ($useClosure) { |
153 | 153 | return $refMethod->getClosure($aspect); |
154 | 154 | } else { |
155 | - return function () use ($aspect, $refMethod) { |
|
155 | + return function() use ($aspect, $refMethod) { |
|
156 | 156 | return $refMethod->invokeArgs($aspect, func_get_args()); |
157 | 157 | }; |
158 | 158 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | return $adviceCallback; |
176 | 176 | |
177 | 177 | case 'proxy': |
178 | - return function (Joinpoint $joinpoint) use ($aspect, $adviceCallback) { |
|
178 | + return function(Joinpoint $joinpoint) use ($aspect, $adviceCallback) { |
|
179 | 179 | $instance = $joinpoint->getThis(); |
180 | 180 | $isNotObject = $instance !== (object) $instance; |
181 | 181 | $target = $isNotObject ? $instance : get_class($instance); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | }; |
186 | 186 | |
187 | 187 | case 'target': |
188 | - return function (Joinpoint $joinpoint) use ($aspect, $adviceCallback) { |
|
188 | + return function(Joinpoint $joinpoint) use ($aspect, $adviceCallback) { |
|
189 | 189 | $instance = $joinpoint->getThis(); |
190 | 190 | $isNotObject = $instance !== (object) $instance; |
191 | 191 | $target = $isNotObject ? $instance : get_parent_class($instance); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | }; |
196 | 196 | |
197 | 197 | default: |
198 | - return function (Joinpoint $joinpoint) use ($aspect, $adviceCallback, $scope) { |
|
198 | + return function(Joinpoint $joinpoint) use ($aspect, $adviceCallback, $scope) { |
|
199 | 199 | $callback = $adviceCallback->bindTo($aspect, $scope); |
200 | 200 | |
201 | 201 | return $callback($joinpoint); |
@@ -53,6 +53,7 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param string $className Class name |
55 | 55 | * @param $advices array List of advices for this invocation |
56 | + * @param string $type |
|
56 | 57 | */ |
57 | 58 | public function __construct($className, $type, array $advices) |
58 | 59 | { |
@@ -123,7 +124,7 @@ discard block |
||
123 | 124 | /** |
124 | 125 | * Returns the static part of this joinpoint. |
125 | 126 | * |
126 | - * @return object |
|
127 | + * @return null|ReflectionMethod |
|
127 | 128 | */ |
128 | 129 | public function getStaticPart() |
129 | 130 | { |
@@ -90,6 +90,9 @@ |
||
90 | 90 | return $this->nsFilter; |
91 | 91 | } |
92 | 92 | |
93 | + /** |
|
94 | + * @param \Go\Aop\Support\SimpleNamespaceFilter $nsFilter |
|
95 | + */ |
|
93 | 96 | public function setNamespaceFilter($nsFilter) |
94 | 97 | { |
95 | 98 | $this->nsFilter = $nsFilter; |
@@ -11,8 +11,6 @@ |
||
11 | 11 | namespace Go\Aop\Pointcut; |
12 | 12 | |
13 | 13 | use Go\Aop\Pointcut; |
14 | -use Go\Aop\PointFilter; |
|
15 | -use Go\Aop\Support\TruePointFilter; |
|
16 | 14 | |
17 | 15 | /** |
18 | 16 | * Signature method pointcut checks method signature (modifiers and name) to match it |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | /** |
306 | 306 | * Returns callable for converting node(s) to the string |
307 | 307 | * |
308 | - * @return callable |
|
308 | + * @return \Closure |
|
309 | 309 | */ |
310 | 310 | private function getNodeToStringConverter() |
311 | 311 | { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | /** |
327 | 327 | * Returns callable for converting node value for modifiers to the constant value |
328 | 328 | * |
329 | - * @return callable |
|
329 | + * @return \Closure |
|
330 | 330 | */ |
331 | 331 | private function getModifierConverter() |
332 | 332 | { |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | |
41 | 41 | $this('pointcutExpression') |
42 | 42 | ->is('pointcutExpression', '||', 'conjugatedExpression') |
43 | - ->call(function ($first, $_0, $second) { |
|
43 | + ->call(function($first, $_0, $second) { |
|
44 | 44 | return new OrPointcut($first, $second); |
45 | 45 | }) |
46 | 46 | ->is('conjugatedExpression'); |
47 | 47 | |
48 | 48 | $this('conjugatedExpression') |
49 | 49 | ->is('conjugatedExpression', '&&', 'negatedExpression') |
50 | - ->call(function ($first, $_0, $second) { |
|
50 | + ->call(function($first, $_0, $second) { |
|
51 | 51 | return new AndPointcut($first, $second); |
52 | 52 | }) |
53 | 53 | ->is('negatedExpression'); |
54 | 54 | |
55 | 55 | $this('negatedExpression') |
56 | 56 | ->is('!', 'brakedExpression') |
57 | - ->call(function ($_0, $item) { |
|
57 | + ->call(function($_0, $item) { |
|
58 | 58 | return new NotPointcut($item); |
59 | 59 | }) |
60 | 60 | ->is('brakedExpression'); |
61 | 61 | |
62 | 62 | $this('brakedExpression') |
63 | 63 | ->is('(', 'pointcutExpression', ')') |
64 | - ->call(function ($_0, $e, $_1) { |
|
64 | + ->call(function($_0, $e, $_1) { |
|
65 | 65 | return $e; |
66 | 66 | }) |
67 | 67 | ->is('singlePointcut'); |
@@ -81,23 +81,23 @@ discard block |
||
81 | 81 | |
82 | 82 | $this('accessPointcut') |
83 | 83 | ->is('access', '(', 'propertyAccessReference', ')') |
84 | - ->call(function ($_0, $_1, $propertyReference) { |
|
84 | + ->call(function($_0, $_1, $propertyReference) { |
|
85 | 85 | return $propertyReference; |
86 | 86 | }); |
87 | 87 | |
88 | 88 | $this('executionPointcut') |
89 | 89 | ->is('execution', '(', 'methodExecutionReference', ')') |
90 | - ->call(function ($_0, $_1, $methodReference) { |
|
90 | + ->call(function($_0, $_1, $methodReference) { |
|
91 | 91 | return $methodReference; |
92 | 92 | }) |
93 | 93 | ->is('execution', '(', 'functionExecutionReference', ')') |
94 | - ->call(function ($_0, $_1, $functionReference) { |
|
94 | + ->call(function($_0, $_1, $functionReference) { |
|
95 | 95 | return $functionReference; |
96 | 96 | }); |
97 | 97 | |
98 | 98 | $this('withinPointcut') |
99 | 99 | ->is('within', '(', 'classFilter', ')') |
100 | - ->call(function ($_0, $_1, $classFilter) { |
|
100 | + ->call(function($_0, $_1, $classFilter) { |
|
101 | 101 | $pointcut = new TruePointcut(PointFilter::KIND_ALL); |
102 | 102 | $pointcut->setClassFilter($classFilter); |
103 | 103 | |
@@ -106,21 +106,21 @@ discard block |
||
106 | 106 | |
107 | 107 | $this('annotatedAccessPointcut') |
108 | 108 | ->is('annotation', 'access', '(', 'namespaceName', ')') |
109 | - ->call(function ($_0, $_1, $_2, $annotationClassName) use ($annotationReader) { |
|
109 | + ->call(function($_0, $_1, $_2, $annotationClassName) use ($annotationReader) { |
|
110 | 110 | $kindProperty = PointFilter::KIND_PROPERTY; |
111 | 111 | return new AnnotationPointcut($kindProperty, $annotationReader, $annotationClassName); |
112 | 112 | }); |
113 | 113 | |
114 | 114 | $this('annotatedExecutionPointcut') |
115 | 115 | ->is('annotation', 'execution', '(', 'namespaceName', ')') |
116 | - ->call(function ($_0, $_1, $_2, $annotationClassName) use ($annotationReader) { |
|
116 | + ->call(function($_0, $_1, $_2, $annotationClassName) use ($annotationReader) { |
|
117 | 117 | $kindMethod = PointFilter::KIND_METHOD; |
118 | 118 | return new AnnotationPointcut($kindMethod, $annotationReader, $annotationClassName); |
119 | 119 | }); |
120 | 120 | |
121 | 121 | $this('annotatedWithinPointcut') |
122 | 122 | ->is('annotation', 'within', '(', 'namespaceName', ')') |
123 | - ->call(function ($_0, $_1, $_2, $annotationClassName) use ($annotationReader) { |
|
123 | + ->call(function($_0, $_1, $_2, $annotationClassName) use ($annotationReader) { |
|
124 | 124 | $pointcut = new TruePointcut(PointFilter::KIND_ALL); |
125 | 125 | $kindClass = PointFilter::KIND_CLASS; |
126 | 126 | $classFilter = new AnnotationPointcut($kindClass, $annotationReader, $annotationClassName); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | $this('initializationPointcut') |
133 | 133 | ->is('initialization', '(', 'classFilter', ')') |
134 | - ->call(function ($_0, $_1, $classFilter){ |
|
134 | + ->call(function($_0, $_1, $classFilter) { |
|
135 | 135 | $pointcut = new TruePointcut(PointFilter::KIND_INIT + PointFilter::KIND_CLASS); |
136 | 136 | $pointcut->setClassFilter($classFilter); |
137 | 137 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $this('staticInitializationPointcut') |
142 | 142 | ->is('staticinitialization', '(', 'classFilter', ')') |
143 | - ->call(function ($_0, $_1, $classFilter){ |
|
143 | + ->call(function($_0, $_1, $classFilter) { |
|
144 | 144 | $pointcut = new TruePointcut(PointFilter::KIND_STATIC_INIT + PointFilter::KIND_CLASS); |
145 | 145 | $pointcut->setClassFilter($classFilter); |
146 | 146 | |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | |
150 | 150 | $this('cflowbelowPointcut') |
151 | 151 | ->is('cflowbelow', '(', 'executionPointcut', ')') |
152 | - ->call(function ($_0, $_1, $pointcut) { |
|
152 | + ->call(function($_0, $_1, $pointcut) { |
|
153 | 153 | return new CFlowBelowMethodPointcut($pointcut); |
154 | 154 | }); |
155 | 155 | |
156 | 156 | $this('dynamicExecutionPointcut') |
157 | 157 | // ideally, this should be 'dynamic', 'methodExecutionReference' |
158 | 158 | ->is('dynamic', '(', 'memberReference', '(', 'argumentList', ')', ')') |
159 | - ->call(function ($_0, $_1, ClassMemberReference $reference) { |
|
159 | + ->call(function($_0, $_1, ClassMemberReference $reference) { |
|
160 | 160 | $memberFilter = $reference->getVisibilityFilter(); |
161 | 161 | $memberFilter = $memberFilter->merge($reference->getAccessTypeFilter()); |
162 | 162 | $pointcut = new MagicMethodPointcut( |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | |
170 | 170 | $this('pointcutReference') |
171 | 171 | ->is('namespaceName', '->', 'namePatternPart') |
172 | - ->call(function ($className, $_0, $name) use ($container) { |
|
172 | + ->call(function($className, $_0, $name) use ($container) { |
|
173 | 173 | return new PointcutReference($container, "{$className}->{$name}"); |
174 | 174 | }); |
175 | 175 | |
176 | 176 | $this('propertyAccessReference') |
177 | 177 | ->is('memberReference') |
178 | - ->call(function (ClassMemberReference $reference) { |
|
178 | + ->call(function(ClassMemberReference $reference) { |
|
179 | 179 | $memberFilter = $reference->getVisibilityFilter(); |
180 | 180 | $memberFilter = $memberFilter->merge($reference->getAccessTypeFilter()); |
181 | 181 | $pointcut = new SignaturePointcut( |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | $this('methodExecutionReference') |
192 | 192 | ->is('memberReference', '(', 'argumentList', ')') |
193 | - ->call(function (ClassMemberReference $reference) { |
|
193 | + ->call(function(ClassMemberReference $reference) { |
|
194 | 194 | |
195 | 195 | $memberFilter = $reference->getVisibilityFilter(); |
196 | 196 | $memberFilter = $memberFilter->merge($reference->getAccessTypeFilter()); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | $this('functionExecutionReference') |
208 | 208 | ->is('namespacePattern', 'nsSeparator', 'namePatternPart', '(', 'argumentList', ')') |
209 | - ->call(function ($namespacePattern, $_0, $namePattern) { |
|
209 | + ->call(function($namespacePattern, $_0, $namePattern) { |
|
210 | 210 | $nsFilter = new SimpleNamespaceFilter($namespacePattern); |
211 | 211 | $pointcut = new FunctionPointcut($namePattern); |
212 | 212 | $pointcut->setNamespaceFilter($nsFilter); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $this('memberReference') |
218 | 218 | ->is('memberModifiers', 'classFilter', 'memberAccessType', 'namePatternPart') |
219 | - ->call(function ( |
|
219 | + ->call(function( |
|
220 | 220 | ModifierMatcherFilter $memberModifiers, |
221 | 221 | PointFilter $classFilter, |
222 | 222 | ModifierMatcherFilter $memberAccessType, |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | $this('classFilter') |
235 | 235 | ->is('namespacePattern') |
236 | - ->call(function ($pattern) { |
|
236 | + ->call(function($pattern) { |
|
237 | 237 | $truePointFilter = TruePointFilter::getInstance(); |
238 | 238 | |
239 | 239 | return $pattern === '**' |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | : new SignaturePointcut(PointFilter::KIND_CLASS, $pattern, $truePointFilter); |
242 | 242 | }) |
243 | 243 | ->is('namespacePattern', '+') |
244 | - ->call(function ($parentClassName) { |
|
244 | + ->call(function($parentClassName) { |
|
245 | 245 | return new InheritanceClassFilter($parentClassName); |
246 | 246 | }); |
247 | 247 | |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | |
251 | 251 | $this('memberAccessType') |
252 | 252 | ->is('::') |
253 | - ->call(function () { |
|
253 | + ->call(function() { |
|
254 | 254 | return new ModifierMatcherFilter(\ReflectionMethod::IS_STATIC); |
255 | 255 | }) |
256 | 256 | ->is('->') |
257 | - ->call(function () { |
|
257 | + ->call(function() { |
|
258 | 258 | $modifierMatcherFilter = new ModifierMatcherFilter(); |
259 | 259 | $modifierMatcherFilter->notMatch(\ReflectionMethod::IS_STATIC); |
260 | 260 | |
@@ -279,16 +279,16 @@ discard block |
||
279 | 279 | ->is('namespaceName', 'nsSeparator', 'namePart')->call($stringConverter); |
280 | 280 | |
281 | 281 | $this('memberModifiers') |
282 | - ->is('memberModifier','|','memberModifiers') |
|
283 | - ->call(function ($modifier, $_0, ModifierMatcherFilter $matcher) { |
|
282 | + ->is('memberModifier', '|', 'memberModifiers') |
|
283 | + ->call(function($modifier, $_0, ModifierMatcherFilter $matcher) { |
|
284 | 284 | return $matcher->orMatch($modifier); |
285 | 285 | }) |
286 | 286 | ->is('memberModifier', 'memberModifiers') |
287 | - ->call(function ($modifier, ModifierMatcherFilter $matcher) { |
|
287 | + ->call(function($modifier, ModifierMatcherFilter $matcher) { |
|
288 | 288 | return $matcher->andMatch($modifier); |
289 | 289 | }) |
290 | 290 | ->is('memberModifier') |
291 | - ->call(function ($modifier) { |
|
291 | + ->call(function($modifier) { |
|
292 | 292 | return new ModifierMatcherFilter($modifier); |
293 | 293 | }); |
294 | 294 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | private function getNodeToStringConverter() |
311 | 311 | { |
312 | - return function () { |
|
312 | + return function() { |
|
313 | 313 | $value = ''; |
314 | 314 | foreach (func_get_args() as $node) { |
315 | 315 | if (is_scalar($node)) { |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | private function getModifierConverter() |
332 | 332 | { |
333 | - return function (Token $token) { |
|
333 | + return function(Token $token) { |
|
334 | 334 | $name = strtoupper($token->getValue()); |
335 | 335 | |
336 | 336 | return constant("ReflectionMethod::IS_{$name}"); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | /** |
74 | 74 | * Returns an advice to apply |
75 | 75 | * |
76 | - * @return Advice|IntroductionInfo|null |
|
76 | + * @return null|IntroductionInfo |
|
77 | 77 | */ |
78 | 78 | public function getAdvice() |
79 | 79 | { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param Aspect $aspect Instance of aspect |
78 | 78 | * @param ReflectionMethod|ReflectionProperty $reflection |
79 | - * @param $metaInformation |
|
79 | + * @param Annotation\BaseAnnotation $metaInformation |
|
80 | 80 | * |
81 | 81 | * @return TokenStream |
82 | 82 | * @throws \UnexpectedValueException |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * Performs parsing of pointcut |
110 | 110 | * |
111 | 111 | * @param ReflectionMethod|ReflectionProperty $reflection |
112 | - * @param $metaInformation |
|
112 | + * @param Annotation\BaseAnnotation $metaInformation |
|
113 | 113 | * @param TokenStream $stream |
114 | 114 | * @return Pointcut |
115 | 115 | * |
@@ -106,7 +106,7 @@ |
||
106 | 106 | |
107 | 107 | /** |
108 | 108 | * @param string $resource |
109 | - * @return bool|string |
|
109 | + * @return false|string |
|
110 | 110 | */ |
111 | 111 | public function getCachePathForResource($resource) |
112 | 112 | { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | protected $newCacheState = array(); |
59 | 59 | |
60 | - public function __construct (AspectKernel $kernel) |
|
60 | + public function __construct(AspectKernel $kernel) |
|
61 | 61 | { |
62 | 62 | $this->kernel = $kernel; |
63 | 63 | $this->options = $kernel->getOptions(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | throw new \InvalidArgumentException("Cache directory {$this->cacheDir} is not writable"); |
79 | 79 | } |
80 | 80 | |
81 | - if (file_exists($this->cacheDir. self::CACHE_FILE_NAME)) { |
|
81 | + if (file_exists($this->cacheDir . self::CACHE_FILE_NAME)) { |
|
82 | 82 | $this->cacheState = include $this->cacheDir . self::CACHE_FILE_NAME; |
83 | 83 | } |
84 | 84 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return array|null Information or null if no record in the cache |
126 | 126 | */ |
127 | - public function queryCacheState($resource=null) |
|
127 | + public function queryCacheState($resource = null) |
|
128 | 128 | { |
129 | 129 | if (!$resource) { |
130 | 130 | return $this->cacheState; |