@@ -17,5 +17,5 @@ |
||
17 | 17 | * results. |
18 | 18 | * @return \ReflectionClass[] |
19 | 19 | */ |
20 | - public function getScopedClasses(string $scope, object|string|null $target = null): array; |
|
20 | + public function getScopedClasses(string $scope, object | string | null $target = null): array; |
|
21 | 21 | } |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Argument types. |
16 | 16 | */ |
17 | - public const CONSTANT = 'constant'; //Scalar constant and not variable. |
|
18 | - public const VARIABLE = 'variable'; //PHP variable |
|
17 | + public const CONSTANT = 'constant'; //Scalar constant and not variable. |
|
18 | + public const VARIABLE = 'variable'; //PHP variable |
|
19 | 19 | public const EXPRESSION = 'expression'; //PHP code (expression). |
20 | - public const STRING = 'string'; //Simple scalar string, can be fetched using stringValue(). |
|
20 | + public const STRING = 'string'; //Simple scalar string, can be fetched using stringValue(). |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * New instance of ReflectionArgument. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct( |
29 | 29 | private string $type, |
30 | 30 | private readonly string $value |
31 | - ) { |
|
31 | + ){ |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public function getType(): string |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function stringValue(): string |
50 | 50 | { |
51 | - if ($this->type !== self::STRING) { |
|
51 | + if ($this->type !== self::STRING){ |
|
52 | 52 | throw new ReflectionException( |
53 | 53 | \sprintf("Unable to represent value as string, value type is '%s'", $this->type) |
54 | 54 | ); |
@@ -69,33 +69,33 @@ discard block |
||
69 | 69 | $level = 0; |
70 | 70 | |
71 | 71 | $result = []; |
72 | - foreach ($tokens as $token) { |
|
73 | - if ($token[ReflectionFile::TOKEN_TYPE] === T_WHITESPACE) { |
|
72 | + foreach ($tokens as $token){ |
|
73 | + if ($token[ReflectionFile::TOKEN_TYPE] === T_WHITESPACE){ |
|
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | |
77 | - if (empty($definition)) { |
|
77 | + if (empty($definition)){ |
|
78 | 78 | $definition = ['type' => self::EXPRESSION, 'value' => '', 'tokens' => []]; |
79 | 79 | } |
80 | 80 | |
81 | - if ($token[ReflectionFile::TOKEN_TYPE] === '(' || $token[ReflectionFile::TOKEN_TYPE] === '[') { |
|
81 | + if ($token[ReflectionFile::TOKEN_TYPE] === '(' || $token[ReflectionFile::TOKEN_TYPE] === '['){ |
|
82 | 82 | ++$level; |
83 | 83 | $definition['value'] .= $token[ReflectionFile::TOKEN_CODE]; |
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | |
87 | - if ($token[ReflectionFile::TOKEN_TYPE] === ')' || $token[ReflectionFile::TOKEN_TYPE] === ']') { |
|
87 | + if ($token[ReflectionFile::TOKEN_TYPE] === ')' || $token[ReflectionFile::TOKEN_TYPE] === ']'){ |
|
88 | 88 | --$level; |
89 | 89 | $definition['value'] .= $token[ReflectionFile::TOKEN_CODE]; |
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | |
93 | - if ($level) { |
|
93 | + if ($level){ |
|
94 | 94 | $definition['value'] .= $token[ReflectionFile::TOKEN_CODE]; |
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
98 | - if ($token[ReflectionFile::TOKEN_TYPE] === ',') { |
|
98 | + if ($token[ReflectionFile::TOKEN_TYPE] === ','){ |
|
99 | 99 | $result[] = self::createArgument($definition); |
100 | 100 | $definition = null; |
101 | 101 | continue; |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | //Last argument |
109 | - if (\is_array($definition)) { |
|
109 | + if (\is_array($definition)){ |
|
110 | 110 | $definition = self::createArgument($definition); |
111 | - if (!empty($definition->getType())) { |
|
111 | + if (!empty($definition->getType())){ |
|
112 | 112 | $result[] = $definition; |
113 | 113 | } |
114 | 114 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | $result = new static(self::EXPRESSION, $definition['value']); |
128 | 128 | |
129 | - if (\count($definition['tokens']) == 1) { |
|
129 | + if (\count($definition['tokens']) == 1){ |
|
130 | 130 | $result->type = match ($definition['tokens'][0][0]) { |
131 | 131 | T_VARIABLE => self::VARIABLE, |
132 | 132 | T_LNUMBER, T_DNUMBER => self::CONSTANT, |
@@ -48,7 +48,8 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function stringValue(): string |
50 | 50 | { |
51 | - if ($this->type !== self::STRING) { |
|
51 | + if ($this->type !== self::STRING) |
|
52 | + { |
|
52 | 53 | throw new ReflectionException( |
53 | 54 | \sprintf("Unable to represent value as string, value type is '%s'", $this->type) |
54 | 55 | ); |
@@ -69,33 +70,40 @@ discard block |
||
69 | 70 | $level = 0; |
70 | 71 | |
71 | 72 | $result = []; |
72 | - foreach ($tokens as $token) { |
|
73 | - if ($token[ReflectionFile::TOKEN_TYPE] === T_WHITESPACE) { |
|
73 | + foreach ($tokens as $token) |
|
74 | + { |
|
75 | + if ($token[ReflectionFile::TOKEN_TYPE] === T_WHITESPACE) |
|
76 | + { |
|
74 | 77 | continue; |
75 | 78 | } |
76 | 79 | |
77 | - if (empty($definition)) { |
|
80 | + if (empty($definition)) |
|
81 | + { |
|
78 | 82 | $definition = ['type' => self::EXPRESSION, 'value' => '', 'tokens' => []]; |
79 | 83 | } |
80 | 84 | |
81 | - if ($token[ReflectionFile::TOKEN_TYPE] === '(' || $token[ReflectionFile::TOKEN_TYPE] === '[') { |
|
85 | + if ($token[ReflectionFile::TOKEN_TYPE] === '(' || $token[ReflectionFile::TOKEN_TYPE] === '[') |
|
86 | + { |
|
82 | 87 | ++$level; |
83 | 88 | $definition['value'] .= $token[ReflectionFile::TOKEN_CODE]; |
84 | 89 | continue; |
85 | 90 | } |
86 | 91 | |
87 | - if ($token[ReflectionFile::TOKEN_TYPE] === ')' || $token[ReflectionFile::TOKEN_TYPE] === ']') { |
|
92 | + if ($token[ReflectionFile::TOKEN_TYPE] === ')' || $token[ReflectionFile::TOKEN_TYPE] === ']') |
|
93 | + { |
|
88 | 94 | --$level; |
89 | 95 | $definition['value'] .= $token[ReflectionFile::TOKEN_CODE]; |
90 | 96 | continue; |
91 | 97 | } |
92 | 98 | |
93 | - if ($level) { |
|
99 | + if ($level) |
|
100 | + { |
|
94 | 101 | $definition['value'] .= $token[ReflectionFile::TOKEN_CODE]; |
95 | 102 | continue; |
96 | 103 | } |
97 | 104 | |
98 | - if ($token[ReflectionFile::TOKEN_TYPE] === ',') { |
|
105 | + if ($token[ReflectionFile::TOKEN_TYPE] === ',') |
|
106 | + { |
|
99 | 107 | $result[] = self::createArgument($definition); |
100 | 108 | $definition = null; |
101 | 109 | continue; |
@@ -106,9 +114,11 @@ discard block |
||
106 | 114 | } |
107 | 115 | |
108 | 116 | //Last argument |
109 | - if (\is_array($definition)) { |
|
117 | + if (\is_array($definition)) |
|
118 | + { |
|
110 | 119 | $definition = self::createArgument($definition); |
111 | - if (!empty($definition->getType())) { |
|
120 | + if (!empty($definition->getType())) |
|
121 | + { |
|
112 | 122 | $result[] = $definition; |
113 | 123 | } |
114 | 124 | } |
@@ -126,7 +136,8 @@ discard block |
||
126 | 136 | { |
127 | 137 | $result = new static(self::EXPRESSION, $definition['value']); |
128 | 138 | |
129 | - if (\count($definition['tokens']) == 1) { |
|
139 | + if (\count($definition['tokens']) == 1) |
|
140 | + { |
|
130 | 141 | $result->type = match ($definition['tokens'][0][0]) { |
131 | 142 | T_VARIABLE => self::VARIABLE, |
132 | 143 | T_LNUMBER, T_DNUMBER => self::CONSTANT, |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | private readonly array $arguments, |
30 | 30 | private readonly string $source, |
31 | 31 | private readonly int $level |
32 | - ) { |
|
32 | + ){ |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getArgument(int $index): ReflectionArgument |
115 | 115 | { |
116 | - if (!isset($this->arguments[$index])) { |
|
116 | + if (!isset($this->arguments[$index])){ |
|
117 | 117 | throw new ReflectionException(\sprintf("No such argument with index '%d'", $index)); |
118 | 118 | } |
119 | 119 |
@@ -113,7 +113,8 @@ |
||
113 | 113 | */ |
114 | 114 | public function getArgument(int $index): ReflectionArgument |
115 | 115 | { |
116 | - if (!isset($this->arguments[$index])) { |
|
116 | + if (!isset($this->arguments[$index])) |
|
117 | + { |
|
117 | 118 | throw new ReflectionException(\sprintf("No such argument with index '%d'", $index)); |
118 | 119 | } |
119 | 120 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | public function __construct( |
18 | 18 | private readonly Tokenizer $tokenizer |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct( |
24 | 24 | private readonly TokenizerConfig $config |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | $tokens = \token_get_all(\file_get_contents($filename)); |
64 | 64 | |
65 | 65 | $line = 0; |
66 | - foreach ($tokens as &$token) { |
|
67 | - if (isset($token[self::LINE])) { |
|
66 | + foreach ($tokens as &$token){ |
|
67 | + if (isset($token[self::LINE])){ |
|
68 | 68 | $line = $token[self::LINE]; |
69 | 69 | } |
70 | 70 | |
71 | - if (!\is_array($token)) { |
|
71 | + if (!\is_array($token)){ |
|
72 | 72 | $token = [$token, $token, $line]; |
73 | 73 | } |
74 | 74 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | { |
87 | 87 | $finder = new Finder(); |
88 | 88 | |
89 | - if (empty($directories)) { |
|
89 | + if (empty($directories)){ |
|
90 | 90 | $directories = $this->config->getDirectories(); |
91 | 91 | } |
92 | 92 | |
93 | - if (empty($exclude)) { |
|
93 | + if (empty($exclude)){ |
|
94 | 94 | $exclude = $this->config->getExcludes(); |
95 | 95 | } |
96 | 96 |
@@ -63,12 +63,15 @@ discard block |
||
63 | 63 | $tokens = \token_get_all(\file_get_contents($filename)); |
64 | 64 | |
65 | 65 | $line = 0; |
66 | - foreach ($tokens as &$token) { |
|
67 | - if (isset($token[self::LINE])) { |
|
66 | + foreach ($tokens as &$token) |
|
67 | + { |
|
68 | + if (isset($token[self::LINE])) |
|
69 | + { |
|
68 | 70 | $line = $token[self::LINE]; |
69 | 71 | } |
70 | 72 | |
71 | - if (!\is_array($token)) { |
|
73 | + if (!\is_array($token)) |
|
74 | + { |
|
72 | 75 | $token = [$token, $token, $line]; |
73 | 76 | } |
74 | 77 | |
@@ -86,11 +89,13 @@ discard block |
||
86 | 89 | { |
87 | 90 | $finder = new Finder(); |
88 | 91 | |
89 | - if (empty($directories)) { |
|
92 | + if (empty($directories)) |
|
93 | + { |
|
90 | 94 | $directories = $this->config->getDirectories(); |
91 | 95 | } |
92 | 96 | |
93 | - if (empty($exclude)) { |
|
97 | + if (empty($exclude)) |
|
98 | + { |
|
94 | 99 | $exclude = $this->config->getExcludes(); |
95 | 100 | } |
96 | 101 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | private readonly string $level, |
13 | 13 | private readonly string $message, |
14 | 14 | private readonly array $context = [] |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function getTime(): \DateTimeInterface |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | public function addListener(callable $listener): self |
16 | 16 | { |
17 | - if (!\in_array($listener, $this->listeners, true)) { |
|
17 | + if (!\in_array($listener, $this->listeners, true)){ |
|
18 | 18 | $this->listeners[] = $listener; |
19 | 19 | } |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | public function removeListener(callable $listener): void |
25 | 25 | { |
26 | 26 | $key = \array_search($listener, $this->listeners, true); |
27 | - if ($key !== null) { |
|
27 | + if ($key !== null){ |
|
28 | 28 | unset($this->listeners[$key]); |
29 | 29 | } |
30 | 30 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | public function addListener(callable $listener): self |
16 | 16 | { |
17 | - if (!\in_array($listener, $this->listeners, true)) { |
|
17 | + if (!\in_array($listener, $this->listeners, true)) |
|
18 | + { |
|
18 | 19 | $this->listeners[] = $listener; |
19 | 20 | } |
20 | 21 | |
@@ -24,7 +25,8 @@ discard block |
||
24 | 25 | public function removeListener(callable $listener): void |
25 | 26 | { |
26 | 27 | $key = \array_search($listener, $this->listeners, true); |
27 | - if ($key !== null) { |
|
28 | + if ($key !== null) |
|
29 | + { |
|
28 | 30 | unset($this->listeners[$key]); |
29 | 31 | } |
30 | 32 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function __construct( |
20 | 20 | callable $receptor, |
21 | 21 | private string $channel |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | $this->receptor = $receptor(...); |
24 | 24 | } |
25 | 25 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | public function __construct( |
16 | 16 | private readonly ListenerRegistryInterface $listenedRegistry |
17 | - ) { |
|
17 | + ){ |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | public function getLogger(string $channel): LoggerInterface |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | $e = new LogEvent( |
28 | 28 | new \DateTime(), |
29 | 29 | $channel, |
30 | - (string) $level, |
|
30 | + (string)$level, |
|
31 | 31 | $message, |
32 | 32 | $context |
33 | 33 | ); |
34 | 34 | |
35 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
35 | + foreach ($this->listenedRegistry->getListeners() as $listener){ |
|
36 | 36 | \call_user_func($listener, $e); |
37 | 37 | } |
38 | 38 | } |
@@ -32,7 +32,8 @@ |
||
32 | 32 | $context |
33 | 33 | ); |
34 | 34 | |
35 | - foreach ($this->listenedRegistry->getListeners() as $listener) { |
|
35 | + foreach ($this->listenedRegistry->getListeners() as $listener) |
|
36 | + { |
|
36 | 37 | \call_user_func($listener, $e); |
37 | 38 | } |
38 | 39 | } |