@@ -26,7 +26,7 @@ |
||
26 | 26 | string $clientFilename = null, |
27 | 27 | string $clientMediaType = null |
28 | 28 | ): UploadedFileInterface { |
29 | - if ($size === null) { |
|
29 | + if ($size === null){ |
|
30 | 30 | $size = $stream->getSize(); |
31 | 31 | } |
32 | 32 |
@@ -26,7 +26,8 @@ |
||
26 | 26 | string $clientFilename = null, |
27 | 27 | string $clientMediaType = null |
28 | 28 | ): UploadedFileInterface { |
29 | - if ($size === null) { |
|
29 | + if ($size === null) |
|
30 | + { |
|
30 | 31 | $size = $stream->getSize(); |
31 | 32 | } |
32 | 33 |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | $http->setHandler( |
46 | 46 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
47 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
47 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
48 | 48 | echo 'no token'; |
49 | - } else { |
|
49 | + }else{ |
|
50 | 50 | echo $request->getAttribute('authContext')->getToken()->getID(); |
51 | 51 | echo ':'; |
52 | 52 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | |
77 | 77 | $http->setHandler( |
78 | 78 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
79 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
79 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
80 | 80 | echo 'no token'; |
81 | - } else { |
|
81 | + }else{ |
|
82 | 82 | echo $request->getAttribute('authContext')->getToken()->getID(); |
83 | 83 | echo ':'; |
84 | 84 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | ); |
192 | 192 | |
193 | 193 | self::assertSame( |
194 | - 'Expires=' . gmdate(DATE_COOKIE, time() + 3600), |
|
194 | + 'Expires='.gmdate(DATE_COOKIE, time() + 3600), |
|
195 | 195 | $cookie[1] |
196 | 196 | ); |
197 | 197 |
@@ -43,9 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | $http->setHandler( |
45 | 45 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
46 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
46 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
47 | + { |
|
47 | 48 | echo 'no token'; |
48 | - } else { |
|
49 | + } |
|
50 | + else |
|
51 | + { |
|
49 | 52 | echo $request->getAttribute('authContext')->getToken()->getID(); |
50 | 53 | echo ':'; |
51 | 54 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -67,9 +70,12 @@ discard block |
||
67 | 70 | |
68 | 71 | $http->setHandler( |
69 | 72 | static function (ServerRequestInterface $request, ResponseInterface $response): void { |
70 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
73 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
74 | + { |
|
71 | 75 | echo 'no token'; |
72 | - } else { |
|
76 | + } |
|
77 | + else |
|
78 | + { |
|
73 | 79 | echo $request->getAttribute('authContext')->getToken()->getID(); |
74 | 80 | echo ':'; |
75 | 81 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | public function getActor(TokenInterface $token): ?object |
20 | 20 | { |
21 | - if ($token->getPayload()['ok']) { |
|
21 | + if ($token->getPayload()['ok']){ |
|
22 | 22 | return new \stdClass(); |
23 | 23 | } |
24 | 24 |
@@ -18,7 +18,8 @@ |
||
18 | 18 | { |
19 | 19 | public function getActor(TokenInterface $token): ?object |
20 | 20 | { |
21 | - if ($token->getPayload()['ok']) { |
|
21 | + if ($token->getPayload()['ok']) |
|
22 | + { |
|
22 | 23 | return new \stdClass(); |
23 | 24 | } |
24 | 25 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | public function getActor(TokenInterface $token): ?object |
20 | 20 | { |
21 | - if ($token->getID() === 'ok') { |
|
21 | + if ($token->getID() === 'ok'){ |
|
22 | 22 | return new \stdClass(); |
23 | 23 | } |
24 | 24 |
@@ -18,7 +18,8 @@ |
||
18 | 18 | { |
19 | 19 | public function getActor(TokenInterface $token): ?object |
20 | 20 | { |
21 | - if ($token->getID() === 'ok') { |
|
21 | + if ($token->getID() === 'ok') |
|
22 | + { |
|
22 | 23 | return new \stdClass(); |
23 | 24 | } |
24 | 25 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | public function load(string $id): ?TokenInterface |
20 | 20 | { |
21 | - if ($id === 'bad') { |
|
21 | + if ($id === 'bad'){ |
|
22 | 22 | return null; |
23 | 23 | } |
24 | 24 |
@@ -18,7 +18,8 @@ |
||
18 | 18 | { |
19 | 19 | public function load(string $id): ?TokenInterface |
20 | 20 | { |
21 | - if ($id === 'bad') { |
|
21 | + if ($id === 'bad') |
|
22 | + { |
|
22 | 23 | return null; |
23 | 24 | } |
24 | 25 |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function getClasses($target = null): array |
25 | 25 | { |
26 | - if (!empty($target) && (is_object($target) || is_string($target))) { |
|
26 | + if (!empty($target) && (is_object($target) || is_string($target))){ |
|
27 | 27 | $target = new \ReflectionClass($target); |
28 | 28 | } |
29 | 29 | |
30 | 30 | $result = []; |
31 | - foreach ($this->availableClasses() as $class) { |
|
32 | - try { |
|
31 | + foreach ($this->availableClasses() as $class){ |
|
32 | + try{ |
|
33 | 33 | $reflection = $this->classReflection($class); |
34 | - } catch (LocatorException $e) { |
|
34 | + }catch (LocatorException $e){ |
|
35 | 35 | //Ignoring |
36 | 36 | continue; |
37 | 37 | } |
38 | 38 | |
39 | - if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) { |
|
39 | + if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()){ |
|
40 | 40 | continue; |
41 | 41 | } |
42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $classes = []; |
57 | 57 | |
58 | - foreach ($this->availableReflections() as $reflection) { |
|
58 | + foreach ($this->availableReflections() as $reflection){ |
|
59 | 59 | $classes = array_merge($classes, $reflection->getClasses()); |
60 | 60 | } |
61 | 61 | |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool |
73 | 73 | { |
74 | - if (empty($target)) { |
|
74 | + if (empty($target)){ |
|
75 | 75 | return true; |
76 | 76 | } |
77 | 77 | |
78 | - if (!$target->isTrait()) { |
|
78 | + if (!$target->isTrait()){ |
|
79 | 79 | //Target is interface or class |
80 | 80 | return $class->isSubclassOf($target) || $class->getName() == $target->getName(); |
81 | 81 | } |
@@ -23,20 +23,26 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function getClasses($target = null): array |
25 | 25 | { |
26 | - if (!empty($target) && (is_object($target) || is_string($target))) { |
|
26 | + if (!empty($target) && (is_object($target) || is_string($target))) |
|
27 | + { |
|
27 | 28 | $target = new \ReflectionClass($target); |
28 | 29 | } |
29 | 30 | |
30 | 31 | $result = []; |
31 | - foreach ($this->availableClasses() as $class) { |
|
32 | - try { |
|
32 | + foreach ($this->availableClasses() as $class) |
|
33 | + { |
|
34 | + try |
|
35 | + { |
|
33 | 36 | $reflection = $this->classReflection($class); |
34 | - } catch (LocatorException $e) { |
|
37 | + } |
|
38 | + catch (LocatorException $e) |
|
39 | + { |
|
35 | 40 | //Ignoring |
36 | 41 | continue; |
37 | 42 | } |
38 | 43 | |
39 | - if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) { |
|
44 | + if (!$this->isTargeted($reflection, $target) || $reflection->isInterface()) |
|
45 | + { |
|
40 | 46 | continue; |
41 | 47 | } |
42 | 48 | |
@@ -55,7 +61,8 @@ discard block |
||
55 | 61 | { |
56 | 62 | $classes = []; |
57 | 63 | |
58 | - foreach ($this->availableReflections() as $reflection) { |
|
64 | + foreach ($this->availableReflections() as $reflection) |
|
65 | + { |
|
59 | 66 | $classes = array_merge($classes, $reflection->getClasses()); |
60 | 67 | } |
61 | 68 | |
@@ -71,11 +78,13 @@ discard block |
||
71 | 78 | */ |
72 | 79 | protected function isTargeted(\ReflectionClass $class, \ReflectionClass $target = null): bool |
73 | 80 | { |
74 | - if (empty($target)) { |
|
81 | + if (empty($target)) |
|
82 | + { |
|
75 | 83 | return true; |
76 | 84 | } |
77 | 85 | |
78 | - if (!$target->isTrait()) { |
|
86 | + if (!$target->isTrait()) |
|
87 | + { |
|
79 | 88 | //Target is interface or class |
80 | 89 | return $class->isSubclassOf($target) || $class->getName() == $target->getName(); |
81 | 90 | } |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function createInjection(\ReflectionClass $class, string $context = null) |
79 | 79 | { |
80 | - if ($class->isSubclassOf(ClassesInterface::class)) { |
|
80 | + if ($class->isSubclassOf(ClassesInterface::class)){ |
|
81 | 81 | return $this->classLocator(); |
82 | - } elseif ($class->isSubclassOf(InvocationsInterface::class)) { |
|
82 | + } elseif ($class->isSubclassOf(InvocationsInterface::class)){ |
|
83 | 83 | return $this->invocationLocator(); |
84 | 84 | } |
85 | 85 | |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | $tokens = token_get_all(file_get_contents($filename)); |
98 | 98 | |
99 | 99 | $line = 0; |
100 | - foreach ($tokens as &$token) { |
|
101 | - if (isset($token[self::LINE])) { |
|
100 | + foreach ($tokens as &$token){ |
|
101 | + if (isset($token[self::LINE])){ |
|
102 | 102 | $line = $token[self::LINE]; |
103 | 103 | } |
104 | 104 | |
105 | - if (!is_array($token)) { |
|
105 | + if (!is_array($token)){ |
|
106 | 106 | $token = [$token, $token, $line]; |
107 | 107 | } |
108 | 108 | |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | { |
123 | 123 | $finder = new Finder(); |
124 | 124 | |
125 | - if (empty($directories)) { |
|
125 | + if (empty($directories)){ |
|
126 | 126 | $directories = $this->config->getDirectories(); |
127 | 127 | } |
128 | 128 | |
129 | - if (empty($exclude)) { |
|
129 | + if (empty($exclude)){ |
|
130 | 130 | $exclude = $this->config->getExcludes(); |
131 | 131 | } |
132 | 132 |
@@ -77,9 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function createInjection(\ReflectionClass $class, string $context = null) |
79 | 79 | { |
80 | - if ($class->isSubclassOf(ClassesInterface::class)) { |
|
80 | + if ($class->isSubclassOf(ClassesInterface::class)) |
|
81 | + { |
|
81 | 82 | return $this->classLocator(); |
82 | - } elseif ($class->isSubclassOf(InvocationsInterface::class)) { |
|
83 | + } |
|
84 | + elseif ($class->isSubclassOf(InvocationsInterface::class)) |
|
85 | + { |
|
83 | 86 | return $this->invocationLocator(); |
84 | 87 | } |
85 | 88 | |
@@ -97,12 +100,15 @@ discard block |
||
97 | 100 | $tokens = token_get_all(file_get_contents($filename)); |
98 | 101 | |
99 | 102 | $line = 0; |
100 | - foreach ($tokens as &$token) { |
|
101 | - if (isset($token[self::LINE])) { |
|
103 | + foreach ($tokens as &$token) |
|
104 | + { |
|
105 | + if (isset($token[self::LINE])) |
|
106 | + { |
|
102 | 107 | $line = $token[self::LINE]; |
103 | 108 | } |
104 | 109 | |
105 | - if (!is_array($token)) { |
|
110 | + if (!is_array($token)) |
|
111 | + { |
|
106 | 112 | $token = [$token, $token, $line]; |
107 | 113 | } |
108 | 114 | |
@@ -122,11 +128,13 @@ discard block |
||
122 | 128 | { |
123 | 129 | $finder = new Finder(); |
124 | 130 | |
125 | - if (empty($directories)) { |
|
131 | + if (empty($directories)) |
|
132 | + { |
|
126 | 133 | $directories = $this->config->getDirectories(); |
127 | 134 | } |
128 | 135 | |
129 | - if (empty($exclude)) { |
|
136 | + if (empty($exclude)) |
|
137 | + { |
|
130 | 138 | $exclude = $this->config->getExcludes(); |
131 | 139 | } |
132 | 140 |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var SplFileInfo |
52 | 52 | */ |
53 | - foreach ($this->finder->getIterator() as $file) { |
|
53 | + foreach ($this->finder->getIterator() as $file){ |
|
54 | 54 | $reflection = new ReflectionFile((string)$file); |
55 | 55 | |
56 | - if ($reflection->hasIncludes()) { |
|
56 | + if ($reflection->hasIncludes()){ |
|
57 | 57 | //We are not analyzing files which has includes, it's not safe to require such reflections |
58 | 58 | $this->getLogger()->warning( |
59 | 59 | sprintf("File `%s` has includes and excluded from analysis", $file), |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | */ |
81 | 81 | protected function classReflection(string $class): \ReflectionClass |
82 | 82 | { |
83 | - $loader = function ($class) { |
|
84 | - if ($class == LocatorException::class) { |
|
83 | + $loader = function ($class){ |
|
84 | + if ($class == LocatorException::class){ |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | //To suspend class dependency exception |
92 | 92 | spl_autoload_register($loader); |
93 | 93 | |
94 | - try { |
|
94 | + try{ |
|
95 | 95 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, |
96 | 96 | //we are going to handle such exception and convert it soft exception |
97 | 97 | return new \ReflectionClass($class); |
98 | - } catch (\Throwable $e) { |
|
99 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
98 | + }catch (\Throwable $e){ |
|
99 | + if ($e instanceof LocatorException && $e->getPrevious() != null){ |
|
100 | 100 | $e = $e->getPrevious(); |
101 | 101 | } |
102 | 102 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ); |
113 | 113 | |
114 | 114 | throw new LocatorException($e->getMessage(), $e->getCode(), $e); |
115 | - } finally { |
|
115 | + }finally{ |
|
116 | 116 | spl_autoload_unregister($loader); |
117 | 117 | } |
118 | 118 | } |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | { |
129 | 129 | $traits = []; |
130 | 130 | |
131 | - while ($class) { |
|
131 | + while ($class){ |
|
132 | 132 | $traits = array_merge(class_uses($class), $traits); |
133 | 133 | $class = get_parent_class($class); |
134 | 134 | } |
135 | 135 | |
136 | 136 | //Traits from traits |
137 | - foreach (array_flip($traits) as $trait) { |
|
137 | + foreach (array_flip($traits) as $trait){ |
|
138 | 138 | $traits = array_merge(class_uses($trait), $traits); |
139 | 139 | } |
140 | 140 |
@@ -50,10 +50,12 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @var SplFileInfo |
52 | 52 | */ |
53 | - foreach ($this->finder->getIterator() as $file) { |
|
53 | + foreach ($this->finder->getIterator() as $file) |
|
54 | + { |
|
54 | 55 | $reflection = new ReflectionFile((string)$file); |
55 | 56 | |
56 | - if ($reflection->hasIncludes()) { |
|
57 | + if ($reflection->hasIncludes()) |
|
58 | + { |
|
57 | 59 | //We are not analyzing files which has includes, it's not safe to require such reflections |
58 | 60 | $this->getLogger()->warning( |
59 | 61 | sprintf("File `%s` has includes and excluded from analysis", $file), |
@@ -80,8 +82,10 @@ discard block |
||
80 | 82 | */ |
81 | 83 | protected function classReflection(string $class): \ReflectionClass |
82 | 84 | { |
83 | - $loader = function ($class) { |
|
84 | - if ($class == LocatorException::class) { |
|
85 | + $loader = function ($class) |
|
86 | + { |
|
87 | + if ($class == LocatorException::class) |
|
88 | + { |
|
85 | 89 | return; |
86 | 90 | } |
87 | 91 | |
@@ -91,12 +95,16 @@ discard block |
||
91 | 95 | //To suspend class dependency exception |
92 | 96 | spl_autoload_register($loader); |
93 | 97 | |
94 | - try { |
|
98 | + try |
|
99 | + { |
|
95 | 100 | //In some cases reflection can thrown an exception if class invalid or can not be loaded, |
96 | 101 | //we are going to handle such exception and convert it soft exception |
97 | 102 | return new \ReflectionClass($class); |
98 | - } catch (\Throwable $e) { |
|
99 | - if ($e instanceof LocatorException && $e->getPrevious() != null) { |
|
103 | + } |
|
104 | + catch (\Throwable $e) |
|
105 | + { |
|
106 | + if ($e instanceof LocatorException && $e->getPrevious() != null) |
|
107 | + { |
|
100 | 108 | $e = $e->getPrevious(); |
101 | 109 | } |
102 | 110 | |
@@ -112,7 +120,9 @@ discard block |
||
112 | 120 | ); |
113 | 121 | |
114 | 122 | throw new LocatorException($e->getMessage(), $e->getCode(), $e); |
115 | - } finally { |
|
123 | + } |
|
124 | + finally |
|
125 | + { |
|
116 | 126 | spl_autoload_unregister($loader); |
117 | 127 | } |
118 | 128 | } |
@@ -128,13 +138,15 @@ discard block |
||
128 | 138 | { |
129 | 139 | $traits = []; |
130 | 140 | |
131 | - while ($class) { |
|
141 | + while ($class) |
|
142 | + { |
|
132 | 143 | $traits = array_merge(class_uses($class), $traits); |
133 | 144 | $class = get_parent_class($class); |
134 | 145 | } |
135 | 146 | |
136 | 147 | //Traits from traits |
137 | - foreach (array_flip($traits) as $trait) { |
|
148 | + foreach (array_flip($traits) as $trait) |
|
149 | + { |
|
138 | 150 | $traits = array_merge(class_uses($trait), $traits); |
139 | 151 | } |
140 | 152 |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | public function getInvocations(\ReflectionFunctionAbstract $function): array |
29 | 29 | { |
30 | 30 | $result = []; |
31 | - foreach ($this->availableInvocations($function->getName()) as $invocation) { |
|
32 | - if ($this->isTargeted($invocation, $function)) { |
|
31 | + foreach ($this->availableInvocations($function->getName()) as $invocation){ |
|
32 | + if ($this->isTargeted($invocation, $function)){ |
|
33 | 33 | $result[] = $invocation; |
34 | 34 | } |
35 | 35 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | protected function availableInvocations(string $signature = ''): \Generator |
47 | 47 | { |
48 | 48 | $signature = strtolower(trim($signature, '\\')); |
49 | - foreach ($this->availableReflections() as $reflection) { |
|
50 | - foreach ($reflection->getInvocations() as $invocation) { |
|
49 | + foreach ($this->availableReflections() as $reflection){ |
|
50 | + foreach ($reflection->getInvocations() as $invocation){ |
|
51 | 51 | if ( |
52 | 52 | !empty($signature) |
53 | 53 | && strtolower(trim($invocation->getName(), '\\')) != $signature |
54 | - ) { |
|
54 | + ){ |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function isTargeted(ReflectionInvocation $invocation, \ReflectionFunctionAbstract $function): bool |
70 | 70 | { |
71 | - if ($function instanceof \ReflectionFunction) { |
|
71 | + if ($function instanceof \ReflectionFunction){ |
|
72 | 72 | return !$invocation->isMethod(); |
73 | 73 | } |
74 | 74 | |
75 | - try { |
|
75 | + try{ |
|
76 | 76 | $reflection = $this->classReflection($invocation->getClass()); |
77 | - } catch (LocatorException $e) { |
|
77 | + }catch (LocatorException $e){ |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | $target = $function->getDeclaringClass(); |
85 | 85 | |
86 | - if ($target->isTrait()) { |
|
86 | + if ($target->isTrait()){ |
|
87 | 87 | //Let's compare traits |
88 | 88 | return in_array($target->getName(), $this->fetchTraits($invocation->getClass())); |
89 | 89 | } |
@@ -28,8 +28,10 @@ discard block |
||
28 | 28 | public function getInvocations(\ReflectionFunctionAbstract $function): array |
29 | 29 | { |
30 | 30 | $result = []; |
31 | - foreach ($this->availableInvocations($function->getName()) as $invocation) { |
|
32 | - if ($this->isTargeted($invocation, $function)) { |
|
31 | + foreach ($this->availableInvocations($function->getName()) as $invocation) |
|
32 | + { |
|
33 | + if ($this->isTargeted($invocation, $function)) |
|
34 | + { |
|
33 | 35 | $result[] = $invocation; |
34 | 36 | } |
35 | 37 | } |
@@ -46,8 +48,10 @@ discard block |
||
46 | 48 | protected function availableInvocations(string $signature = ''): \Generator |
47 | 49 | { |
48 | 50 | $signature = strtolower(trim($signature, '\\')); |
49 | - foreach ($this->availableReflections() as $reflection) { |
|
50 | - foreach ($reflection->getInvocations() as $invocation) { |
|
51 | + foreach ($this->availableReflections() as $reflection) |
|
52 | + { |
|
53 | + foreach ($reflection->getInvocations() as $invocation) |
|
54 | + { |
|
51 | 55 | if ( |
52 | 56 | !empty($signature) |
53 | 57 | && strtolower(trim($invocation->getName(), '\\')) != $signature |
@@ -68,13 +72,17 @@ discard block |
||
68 | 72 | */ |
69 | 73 | protected function isTargeted(ReflectionInvocation $invocation, \ReflectionFunctionAbstract $function): bool |
70 | 74 | { |
71 | - if ($function instanceof \ReflectionFunction) { |
|
75 | + if ($function instanceof \ReflectionFunction) |
|
76 | + { |
|
72 | 77 | return !$invocation->isMethod(); |
73 | 78 | } |
74 | 79 | |
75 | - try { |
|
80 | + try |
|
81 | + { |
|
76 | 82 | $reflection = $this->classReflection($invocation->getClass()); |
77 | - } catch (LocatorException $e) { |
|
83 | + } |
|
84 | + catch (LocatorException $e) |
|
85 | + { |
|
78 | 86 | return false; |
79 | 87 | } |
80 | 88 | |
@@ -83,7 +91,8 @@ discard block |
||
83 | 91 | */ |
84 | 92 | $target = $function->getDeclaringClass(); |
85 | 93 | |
86 | - if ($target->isTrait()) { |
|
94 | + if ($target->isTrait()) |
|
95 | + { |
|
87 | 96 | //Let's compare traits |
88 | 97 | return in_array($target->getName(), $this->fetchTraits($invocation->getClass())); |
89 | 98 | } |