Test Failed
Pull Request — master (#656)
by Abdul Malik
07:14 queued 15s
created
src/Attributes/src/Internal/NativeAttributeReader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
     private function checkAvailability(): void
88 88
     {
89
-        if (!self::isAvailable()) {
89
+        if (!self::isAvailable()){
90 90
             throw new InitializationException('Requires the PHP >= 8.0');
91 91
         }
92 92
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function format(Reflector $context, iterable $attributes): iterable
100 100
     {
101
-        foreach ($attributes as $attribute) {
101
+        foreach ($attributes as $attribute){
102 102
             $this->assertClassExists($attribute->getName(), $context);
103 103
 
104 104
             yield new ReflectionClass($attribute->getName()) => $attribute->getArguments();
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,8 @@  discard block
 block discarded – undo
86 86
 
87 87
     private function checkAvailability(): void
88 88
     {
89
-        if (!self::isAvailable()) {
89
+        if (!self::isAvailable())
90
+        {
90 91
             throw new InitializationException('Requires the PHP >= 8.0');
91 92
         }
92 93
     }
@@ -98,7 +99,8 @@  discard block
 block discarded – undo
98 99
      */
99 100
     private function format(Reflector $context, iterable $attributes): iterable
100 101
     {
101
-        foreach ($attributes as $attribute) {
102
+        foreach ($attributes as $attribute)
103
+        {
102 104
             $this->assertClassExists($attribute->getName(), $context);
103 105
 
104 106
             yield new ReflectionClass($attribute->getName()) => $attribute->getArguments();
Please login to merge, or discard this patch.
src/Attributes/src/Internal/CachedReader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
      */
131 131
     protected function iterableToArray(iterable $attributes): array
132 132
     {
133
-        if ($attributes instanceof Traversable) {
133
+        if ($attributes instanceof Traversable){
134 134
             return \iterator_to_array($attributes, false);
135 135
         }
136 136
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,8 @@
 block discarded – undo
130 130
      */
131 131
     protected function iterableToArray(iterable $attributes): array
132 132
     {
133
-        if ($attributes instanceof Traversable) {
133
+        if ($attributes instanceof Traversable)
134
+        {
134 135
             return \iterator_to_array($attributes, false);
135 136
         }
136 137
 
Please login to merge, or discard this patch.
Attributes/src/Internal/FallbackAttributeReader/AttributeFinderVisitor.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -140,23 +140,23 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $this->updateContext($node);
142 142
 
143
-        if ($node instanceof ClassLike) {
144
-            foreach ($this->parse($node->attrGroups) as $prototype) {
143
+        if ($node instanceof ClassLike){
144
+            foreach ($this->parse($node->attrGroups) as $prototype){
145 145
                 $this->classes[$node->namespacedName->toString()][] = $prototype;
146 146
             }
147 147
 
148 148
             return null;
149 149
         }
150 150
 
151
-        if ($node instanceof FunctionLike) {
151
+        if ($node instanceof FunctionLike){
152 152
             $line = $node->getEndLine();
153 153
 
154
-            foreach ($this->parse($node->getAttrGroups()) as $prototype) {
154
+            foreach ($this->parse($node->getAttrGroups()) as $prototype){
155 155
                 $this->functions[$line][] = $prototype;
156 156
             }
157 157
 
158
-            foreach ($node->getParams() as $param) {
159
-                foreach ($this->parse($param->attrGroups) as $prototype) {
158
+            foreach ($node->getParams() as $param){
159
+                foreach ($this->parse($param->attrGroups) as $prototype){
160 160
                     assert(\is_string($param->var->name), 'Function parameter name should be an identifier');
161 161
 
162 162
                     $this->parameters[$line][$param->var->name][] = $prototype;
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
             return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
167 167
         }
168 168
 
169
-        if ($node instanceof ClassConst) {
169
+        if ($node instanceof ClassConst){
170 170
             $class = $this->fqn();
171 171
 
172
-            foreach ($this->parse($node->attrGroups) as $prototype) {
173
-                foreach ($node->consts as $const) {
172
+            foreach ($this->parse($node->attrGroups) as $prototype){
173
+                foreach ($node->consts as $const){
174 174
                     $this->constants[$class][$this->name($const->name)][] = $prototype;
175 175
                 }
176 176
             }
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
             return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
179 179
         }
180 180
 
181
-        if ($node instanceof Property) {
181
+        if ($node instanceof Property){
182 182
             $class = $this->fqn();
183 183
 
184
-            foreach ($this->parse($node->attrGroups) as $prototype) {
185
-                foreach ($node->props as $property) {
184
+            foreach ($this->parse($node->attrGroups) as $prototype){
185
+                foreach ($node->props as $property){
186 186
                     $this->properties[$class][$this->name($property->name)][] = $prototype;
187 187
                 }
188 188
             }
@@ -195,27 +195,27 @@  discard block
 block discarded – undo
195 195
 
196 196
     public function leaveNode(Node $node): void
197 197
     {
198
-        if ($node instanceof Namespace_) {
198
+        if ($node instanceof Namespace_){
199 199
             $this->context[AttributeParser::CTX_NAMESPACE] = '';
200 200
 
201 201
             return;
202 202
         }
203 203
 
204
-        if ($node instanceof ClassLike) {
204
+        if ($node instanceof ClassLike){
205 205
             $this->context[AttributeParser::CTX_CLASS] = '';
206 206
             $this->context[AttributeParser::CTX_TRAIT] = '';
207 207
 
208 208
             return;
209 209
         }
210 210
 
211
-        if ($node instanceof FunctionLike) {
211
+        if ($node instanceof FunctionLike){
212 212
             $this->context[AttributeParser::CTX_FUNCTION] = '';
213 213
         }
214 214
     }
215 215
 
216 216
     private function updateContext(Node $node): void
217 217
     {
218
-        switch (true) {
218
+        switch (true){
219 219
             case $node instanceof Namespace_:
220 220
                 $this->context[AttributeParser::CTX_NAMESPACE] = $this->name($node->name);
221 221
                 break;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     private function name($name): string
242 242
     {
243
-        if ($name === null) {
243
+        if ($name === null){
244 244
             return '';
245 245
         }
246 246
 
@@ -262,6 +262,6 @@  discard block
 block discarded – undo
262 262
         $namespace = $this->context[AttributeParser::CTX_NAMESPACE] ?? '';
263 263
         $class = $this->context[AttributeParser::CTX_CLASS] ?? '';
264 264
 
265
-        return \trim($namespace . '\\' . $class, '\\');
265
+        return \trim($namespace.'\\'.$class, '\\');
266 266
     }
267 267
 }
Please login to merge, or discard this patch.
Braces   +34 added lines, -17 removed lines patch added patch discarded remove patch
@@ -140,23 +140,29 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $this->updateContext($node);
142 142
 
143
-        if ($node instanceof ClassLike) {
144
-            foreach ($this->parse($node->attrGroups) as $prototype) {
143
+        if ($node instanceof ClassLike)
144
+        {
145
+            foreach ($this->parse($node->attrGroups) as $prototype)
146
+            {
145 147
                 $this->classes[$node->namespacedName->toString()][] = $prototype;
146 148
             }
147 149
 
148 150
             return null;
149 151
         }
150 152
 
151
-        if ($node instanceof FunctionLike) {
153
+        if ($node instanceof FunctionLike)
154
+        {
152 155
             $line = $node->getEndLine();
153 156
 
154
-            foreach ($this->parse($node->getAttrGroups()) as $prototype) {
157
+            foreach ($this->parse($node->getAttrGroups()) as $prototype)
158
+            {
155 159
                 $this->functions[$line][] = $prototype;
156 160
             }
157 161
 
158
-            foreach ($node->getParams() as $param) {
159
-                foreach ($this->parse($param->attrGroups) as $prototype) {
162
+            foreach ($node->getParams() as $param)
163
+            {
164
+                foreach ($this->parse($param->attrGroups) as $prototype)
165
+                {
160 166
                     assert(\is_string($param->var->name), 'Function parameter name should be an identifier');
161 167
 
162 168
                     $this->parameters[$line][$param->var->name][] = $prototype;
@@ -166,11 +172,14 @@  discard block
 block discarded – undo
166 172
             return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
167 173
         }
168 174
 
169
-        if ($node instanceof ClassConst) {
175
+        if ($node instanceof ClassConst)
176
+        {
170 177
             $class = $this->fqn();
171 178
 
172
-            foreach ($this->parse($node->attrGroups) as $prototype) {
173
-                foreach ($node->consts as $const) {
179
+            foreach ($this->parse($node->attrGroups) as $prototype)
180
+            {
181
+                foreach ($node->consts as $const)
182
+                {
174 183
                     $this->constants[$class][$this->name($const->name)][] = $prototype;
175 184
                 }
176 185
             }
@@ -178,11 +187,14 @@  discard block
 block discarded – undo
178 187
             return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
179 188
         }
180 189
 
181
-        if ($node instanceof Property) {
190
+        if ($node instanceof Property)
191
+        {
182 192
             $class = $this->fqn();
183 193
 
184
-            foreach ($this->parse($node->attrGroups) as $prototype) {
185
-                foreach ($node->props as $property) {
194
+            foreach ($this->parse($node->attrGroups) as $prototype)
195
+            {
196
+                foreach ($node->props as $property)
197
+                {
186 198
                     $this->properties[$class][$this->name($property->name)][] = $prototype;
187 199
                 }
188 200
             }
@@ -195,27 +207,31 @@  discard block
 block discarded – undo
195 207
 
196 208
     public function leaveNode(Node $node): void
197 209
     {
198
-        if ($node instanceof Namespace_) {
210
+        if ($node instanceof Namespace_)
211
+        {
199 212
             $this->context[AttributeParser::CTX_NAMESPACE] = '';
200 213
 
201 214
             return;
202 215
         }
203 216
 
204
-        if ($node instanceof ClassLike) {
217
+        if ($node instanceof ClassLike)
218
+        {
205 219
             $this->context[AttributeParser::CTX_CLASS] = '';
206 220
             $this->context[AttributeParser::CTX_TRAIT] = '';
207 221
 
208 222
             return;
209 223
         }
210 224
 
211
-        if ($node instanceof FunctionLike) {
225
+        if ($node instanceof FunctionLike)
226
+        {
212 227
             $this->context[AttributeParser::CTX_FUNCTION] = '';
213 228
         }
214 229
     }
215 230
 
216 231
     private function updateContext(Node $node): void
217 232
     {
218
-        switch (true) {
233
+        switch (true)
234
+        {
219 235
             case $node instanceof Namespace_:
220 236
                 $this->context[AttributeParser::CTX_NAMESPACE] = $this->name($node->name);
221 237
                 break;
@@ -240,7 +256,8 @@  discard block
 block discarded – undo
240 256
      */
241 257
     private function name($name): string
242 258
     {
243
-        if ($name === null) {
259
+        if ($name === null)
260
+        {
244 261
             return '';
245 262
         }
246 263
 
Please login to merge, or discard this patch.
src/Attributes/src/Internal/FallbackAttributeReader/AttributeParser.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $eval = new ConstExprEvaluator($this->evaluator($file, $context));
112 112
 
113
-        foreach ($groups as $group) {
114
-            foreach ($group->attrs as $attr) {
113
+        foreach ($groups as $group){
114
+            foreach ($group->attrs as $attr){
115 115
                 $arguments = $this->parseAttributeArguments($attr, $file, $eval);
116 116
 
117 117
                 yield new AttributePrototype($attr->name->toString(), $arguments);
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 
129 129
     private function read(string $file): string
130 130
     {
131
-        if (!\is_readable($file)) {
132
-            throw new InvalidArgumentException('Unable to read file "' . $file . '"');
131
+        if (!\is_readable($file)){
132
+            throw new InvalidArgumentException('Unable to read file "'.$file.'"');
133 133
         }
134 134
 
135 135
         return \file_get_contents($file);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     private function evaluator(string $file, array $context): Closure
139 139
     {
140 140
         return static function (Expr $expr) use ($file, $context) {
141
-            switch (\get_class($expr)) {
141
+            switch (\get_class($expr)){
142 142
                 case File::class:
143 143
                     return $file;
144 144
 
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
                     $namespace = $context[self::CTX_NAMESPACE] ?? '';
153 153
                     $function = $context[self::CTX_FUNCTION] ?? '';
154 154
 
155
-                    return \ltrim($namespace . '\\' . $function, '\\');
155
+                    return \ltrim($namespace.'\\'.$function, '\\');
156 156
 
157 157
                 case ClassConstFetch::class:
158 158
                     $constant = $expr->name->toString();
159 159
                     $class = $expr->class->toString();
160 160
 
161
-                    if (\strtolower($constant) === 'class') {
161
+                    if (\strtolower($constant) === 'class'){
162 162
                         return $class;
163 163
                     }
164 164
 
165
-                    $definition = $class . '::' . $constant;
165
+                    $definition = $class.'::'.$constant;
166 166
 
167
-                    if (!\defined($definition)) {
167
+                    if (!\defined($definition)){
168 168
                         $exception = new ParseError(\sprintf(self::ERROR_BAD_CONSTANT, $definition));
169 169
                         throw Exception::withLocation($exception, $file, $expr->getStartLine());
170 170
                     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                     return \constant($definition);
173 173
             }
174 174
 
175
-            if ($expr instanceof MagicConst) {
175
+            if ($expr instanceof MagicConst){
176 176
                 return $context[$expr->getName()] ?? '';
177 177
             }
178 178
 
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
         $hasNamedArguments = false;
191 191
         $arguments = [];
192 192
 
193
-        foreach ($attr->args as $argument) {
193
+        foreach ($attr->args as $argument){
194 194
             $value = $eval->evaluateDirectly($argument->value);
195 195
 
196
-            if ($argument->name === null) {
196
+            if ($argument->name === null){
197 197
                 $arguments[] = $value;
198 198
 
199
-                if ($hasNamedArguments) {
199
+                if ($hasNamedArguments){
200 200
                     $exception = new ParseError(self::ERROR_NAMED_ARGUMENTS_ORDER);
201 201
                     throw Exception::withLocation($exception, $file, $argument->getStartLine());
202 202
                 }
Please login to merge, or discard this patch.
Braces   +22 added lines, -11 removed lines patch added patch discarded remove patch
@@ -110,8 +110,10 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $eval = new ConstExprEvaluator($this->evaluator($file, $context));
112 112
 
113
-        foreach ($groups as $group) {
114
-            foreach ($group->attrs as $attr) {
113
+        foreach ($groups as $group)
114
+        {
115
+            foreach ($group->attrs as $attr)
116
+            {
115 117
                 $arguments = $this->parseAttributeArguments($attr, $file, $eval);
116 118
 
117 119
                 yield new AttributePrototype($attr->name->toString(), $arguments);
@@ -128,7 +130,8 @@  discard block
 block discarded – undo
128 130
 
129 131
     private function read(string $file): string
130 132
     {
131
-        if (!\is_readable($file)) {
133
+        if (!\is_readable($file))
134
+        {
132 135
             throw new InvalidArgumentException('Unable to read file "' . $file . '"');
133 136
         }
134 137
 
@@ -137,8 +140,10 @@  discard block
 block discarded – undo
137 140
 
138 141
     private function evaluator(string $file, array $context): Closure
139 142
     {
140
-        return static function (Expr $expr) use ($file, $context) {
141
-            switch (\get_class($expr)) {
143
+        return static function (Expr $expr) use ($file, $context)
144
+        {
145
+            switch (\get_class($expr))
146
+            {
142 147
                 case File::class:
143 148
                     return $file;
144 149
 
@@ -158,13 +163,15 @@  discard block
 block discarded – undo
158 163
                     $constant = $expr->name->toString();
159 164
                     $class = $expr->class->toString();
160 165
 
161
-                    if (\strtolower($constant) === 'class') {
166
+                    if (\strtolower($constant) === 'class')
167
+                    {
162 168
                         return $class;
163 169
                     }
164 170
 
165 171
                     $definition = $class . '::' . $constant;
166 172
 
167
-                    if (!\defined($definition)) {
173
+                    if (!\defined($definition))
174
+                    {
168 175
                         $exception = new ParseError(\sprintf(self::ERROR_BAD_CONSTANT, $definition));
169 176
                         throw Exception::withLocation($exception, $file, $expr->getStartLine());
170 177
                     }
@@ -172,7 +179,8 @@  discard block
 block discarded – undo
172 179
                     return \constant($definition);
173 180
             }
174 181
 
175
-            if ($expr instanceof MagicConst) {
182
+            if ($expr instanceof MagicConst)
183
+            {
176 184
                 return $context[$expr->getName()] ?? '';
177 185
             }
178 186
 
@@ -190,13 +198,16 @@  discard block
 block discarded – undo
190 198
         $hasNamedArguments = false;
191 199
         $arguments = [];
192 200
 
193
-        foreach ($attr->args as $argument) {
201
+        foreach ($attr->args as $argument)
202
+        {
194 203
             $value = $eval->evaluateDirectly($argument->value);
195 204
 
196
-            if ($argument->name === null) {
205
+            if ($argument->name === null)
206
+            {
197 207
                 $arguments[] = $value;
198 208
 
199
-                if ($hasNamedArguments) {
209
+                if ($hasNamedArguments)
210
+                {
200 211
                     $exception = new ParseError(self::ERROR_NAMED_ARGUMENTS_ORDER);
201 212
                     throw Exception::withLocation($exception, $file, $argument->getStartLine());
202 213
                 }
Please login to merge, or discard this patch.
src/Attributes/src/ReaderInterface.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -20,151 +20,151 @@
 block discarded – undo
20 20
 interface ReaderInterface
21 21
 {
22 22
     /**
23
-    * Gets a list of attributes and/or annotations applied to a class.
24
-    *
25
-    * @template T
26
-    *
23
+     * Gets a list of attributes and/or annotations applied to a class.
24
+     *
25
+     * @template T
26
+     *
27 27
      * @param ReflectionClass $class The reflection instance of the class from
28 28
     which the class annotations should be read.
29
-    * @param class-string<T>|null $name The class name of the annotation
30
-    *      and/or attribute.
31
-    *
32
-    * @return iterable<T> A list of class annotations and/or attributes.
33
-    */
29
+     * @param class-string<T>|null $name The class name of the annotation
30
+     *      and/or attribute.
31
+     *
32
+     * @return iterable<T> A list of class annotations and/or attributes.
33
+     */
34 34
     public function getClassMetadata(ReflectionClass $class, string $name = null): iterable;
35 35
 
36 36
     /**
37
-    * Gets the attribute or annotation applied to a class.
38
-    *
39
-    * @template T
40
-    *
37
+     * Gets the attribute or annotation applied to a class.
38
+     *
39
+     * @template T
40
+     *
41 41
      * @param ReflectionClass $class The reflection instance of the class from
42 42
     which the class annotations should be read.
43
-    * @param class-string<T> $name The class name of the annotation
44
-    *      and/or attribute.
45
-    *
46
-    * @return T|null The annotation/attribute or {@see null}, if the requested
47
-    *      annotation does not exist.
48
-    */
43
+     * @param class-string<T> $name The class name of the annotation
44
+     *      and/or attribute.
45
+     *
46
+     * @return T|null The annotation/attribute or {@see null}, if the requested
47
+     *      annotation does not exist.
48
+     */
49 49
     public function firstClassMetadata(ReflectionClass $class, string $name): ?object;
50 50
 
51 51
     /**
52
-    * Gets a list of attributes and/or annotations applied to a function
53
-    * or method.
54
-    *
55
-    * @template T
56
-    *
52
+     * Gets a list of attributes and/or annotations applied to a function
53
+     * or method.
54
+     *
55
+     * @template T
56
+     *
57 57
      * @param ReflectionFunctionAbstract $function The reflection instance of
58 58
     the function or method from which the function annotations should
59 59
     be read.
60
-    * @param class-string<T>|null $name The class name of the annotation
61
-    *      and/or attribute.
62
-    *
63
-    * @return iterable<T> A list of function annotations and/or attributes.
64
-    */
60
+     * @param class-string<T>|null $name The class name of the annotation
61
+     *      and/or attribute.
62
+     *
63
+     * @return iterable<T> A list of function annotations and/or attributes.
64
+     */
65 65
     public function getFunctionMetadata(ReflectionFunctionAbstract $function, string $name = null): iterable;
66 66
 
67 67
     /**
68
-    * Gets the attribute or annotation applied to a function or method.
69
-    *
70
-    * @template T
71
-    *
68
+     * Gets the attribute or annotation applied to a function or method.
69
+     *
70
+     * @template T
71
+     *
72 72
      * @param ReflectionFunctionAbstract $function The reflection instance of
73 73
     the function or method from which the function annotations should
74 74
     be read.
75
-    * @param class-string<T> $name The class name of the annotation and/or
76
-    *      attribute.
77
-    *
78
-    * @return T|null The annotation/attribute or {@see null}, if the requested
79
-    *      annotation does not exist.
80
-    */
75
+     * @param class-string<T> $name The class name of the annotation and/or
76
+     *      attribute.
77
+     *
78
+     * @return T|null The annotation/attribute or {@see null}, if the requested
79
+     *      annotation does not exist.
80
+     */
81 81
     public function firstFunctionMetadata(ReflectionFunctionAbstract $function, string $name): ?object;
82 82
 
83 83
     /**
84
-    * Gets a list of attributes and/or annotations applied to a class property.
85
-    *
86
-    * @template T
87
-    *
84
+     * Gets a list of attributes and/or annotations applied to a class property.
85
+     *
86
+     * @template T
87
+     *
88 88
      * @param ReflectionProperty $property The reflection instance of the
89 89
     property from which the property annotations should be read.
90
-    * @param class-string<T>|null $name The class name of the annotation
91
-    *      and/or attribute.
92
-    *
93
-    * @return iterable<T> A list of property annotations and/or attributes.
94
-    */
90
+     * @param class-string<T>|null $name The class name of the annotation
91
+     *      and/or attribute.
92
+     *
93
+     * @return iterable<T> A list of property annotations and/or attributes.
94
+     */
95 95
     public function getPropertyMetadata(ReflectionProperty $property, string $name = null): iterable;
96 96
 
97 97
     /**
98
-    * Gets the attribute or annotation applied to a property.
99
-    *
100
-    * @template T
101
-    *
98
+     * Gets the attribute or annotation applied to a property.
99
+     *
100
+     * @template T
101
+     *
102 102
      * @param ReflectionProperty $property The reflection instance of the
103 103
     property from which the property annotations should be read.
104
-    * @param class-string<T> $name The class name of the annotation and/or
105
-    *      attribute.
106
-    *
107
-    * @return T|null The annotation/attribute or {@see null}, if the requested
108
-    *      annotation does not exist.
109
-    */
104
+     * @param class-string<T> $name The class name of the annotation and/or
105
+     *      attribute.
106
+     *
107
+     * @return T|null The annotation/attribute or {@see null}, if the requested
108
+     *      annotation does not exist.
109
+     */
110 110
     public function firstPropertyMetadata(ReflectionProperty $property, string $name): ?object;
111 111
 
112 112
     /**
113
-    * Gets a list of attributes and/or annotations applied to a class constant.
114
-    *
115
-    * @template T
116
-    *
113
+     * Gets a list of attributes and/or annotations applied to a class constant.
114
+     *
115
+     * @template T
116
+     *
117 117
      * @param ReflectionClassConstant $constant The reflection instance of the
118 118
     class constant from which the constant annotations should be read.
119
-    * @param class-string<T>|null $name The class name of the annotation
120
-    *      and/or attribute.
121
-    *
122
-    * @return iterable<T> A list of constant annotations and/or attributes.
123
-    */
119
+     * @param class-string<T>|null $name The class name of the annotation
120
+     *      and/or attribute.
121
+     *
122
+     * @return iterable<T> A list of constant annotations and/or attributes.
123
+     */
124 124
     public function getConstantMetadata(ReflectionClassConstant $constant, string $name = null): iterable;
125 125
 
126 126
     /**
127
-    * Gets the attribute or annotation applied to a class constant.
128
-    *
129
-    * @template T
130
-    *
127
+     * Gets the attribute or annotation applied to a class constant.
128
+     *
129
+     * @template T
130
+     *
131 131
      * @param ReflectionClassConstant $constant The reflection instance of the
132 132
     class constant from which the constant annotations should be read.
133
-    * @param class-string<T> $name The class name of the annotation and/or
134
-    *      attribute.
135
-    *
136
-    * @return T|null The annotation/attribute or {@see null}, if the requested
137
-    *      annotation does not exist.
138
-    */
133
+     * @param class-string<T> $name The class name of the annotation and/or
134
+     *      attribute.
135
+     *
136
+     * @return T|null The annotation/attribute or {@see null}, if the requested
137
+     *      annotation does not exist.
138
+     */
139 139
     public function firstConstantMetadata(ReflectionClassConstant $constant, string $name): ?object;
140 140
 
141 141
     /**
142
-    * Gets a list of attributes and/or annotations applied to a parameter of
143
-    * a function or method.
144
-    *
145
-    * @template T
146
-    *
142
+     * Gets a list of attributes and/or annotations applied to a parameter of
143
+     * a function or method.
144
+     *
145
+     * @template T
146
+     *
147 147
      * @param ReflectionParameter $parameter The reflection instance of the
148 148
     parameter from which the parameter annotations should be read.
149
-    * @param class-string<T>|null $name The class name of the annotation
150
-    *      and/or attribute.
151
-    *
152
-    * @return iterable<T> A list of parameter annotations and/or attributes.
153
-    */
149
+     * @param class-string<T>|null $name The class name of the annotation
150
+     *      and/or attribute.
151
+     *
152
+     * @return iterable<T> A list of parameter annotations and/or attributes.
153
+     */
154 154
     public function getParameterMetadata(ReflectionParameter $parameter, string $name = null): iterable;
155 155
 
156 156
     /**
157
-    * Gets the attribute or annotation applied to a function's parameter.
158
-    *
159
-    * @template T
160
-    *
157
+     * Gets the attribute or annotation applied to a function's parameter.
158
+     *
159
+     * @template T
160
+     *
161 161
      * @param ReflectionParameter $parameter The reflection instance of the
162 162
     parameter from which the parameter annotations should be read.
163
-    * @param class-string<T> $name The class name of the annotation and/or
164
-    *      attribute.
165
-    *
166
-    * @return T|null The annotation/attribute or {@see null}, if the requested
167
-    *      annotation does not exist.
168
-    */
163
+     * @param class-string<T> $name The class name of the annotation and/or
164
+     *      attribute.
165
+     *
166
+     * @return T|null The annotation/attribute or {@see null}, if the requested
167
+     *      annotation does not exist.
168
+     */
169 169
     public function firstParameterMetadata(ReflectionParameter $parameter, string $name): ?object;
170 170
 }
Please login to merge, or discard this patch.
src/Cookies/src/Cookie.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         bool $secure = false,
117 117
         bool $httpOnly = true,
118 118
         ?string $sameSite = null
119
-    ) {
119
+    ){
120 120
         $this->name = $name;
121 121
         $this->value = $value;
122 122
         $this->lifetime = $lifetime;
@@ -221,30 +221,30 @@  discard block
 block discarded – undo
221 221
      */
222 222
     public function createHeader(): string
223 223
     {
224
-        $header = [rawurlencode($this->name) . '=' . rawurlencode((string)$this->value)];
224
+        $header = [rawurlencode($this->name).'='.rawurlencode((string)$this->value)];
225 225
 
226
-        if ($this->lifetime !== null) {
227
-            $header[] = 'Expires=' . gmdate(DateTime::COOKIE, $this->getExpires());
226
+        if ($this->lifetime !== null){
227
+            $header[] = 'Expires='.gmdate(DateTime::COOKIE, $this->getExpires());
228 228
             $header[] = "Max-Age={$this->lifetime}";
229 229
         }
230 230
 
231
-        if (!empty($this->path)) {
231
+        if (!empty($this->path)){
232 232
             $header[] = "Path={$this->path}";
233 233
         }
234 234
 
235
-        if (!empty($this->domain)) {
235
+        if (!empty($this->domain)){
236 236
             $header[] = "Domain={$this->domain}";
237 237
         }
238 238
 
239
-        if ($this->secure) {
239
+        if ($this->secure){
240 240
             $header[] = 'Secure';
241 241
         }
242 242
 
243
-        if ($this->httpOnly) {
243
+        if ($this->httpOnly){
244 244
             $header[] = 'HttpOnly';
245 245
         }
246 246
 
247
-        if ($this->sameSite->get() !== null) {
247
+        if ($this->sameSite->get() !== null){
248 248
             $header[] = "SameSite={$this->sameSite->get()}";
249 249
         }
250 250
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function getExpires(): ?int
260 260
     {
261
-        if ($this->lifetime === null) {
261
+        if ($this->lifetime === null){
262 262
             return null;
263 263
         }
264 264
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -223,28 +223,34 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $header = [rawurlencode($this->name) . '=' . rawurlencode((string)$this->value)];
225 225
 
226
-        if ($this->lifetime !== null) {
226
+        if ($this->lifetime !== null)
227
+        {
227 228
             $header[] = 'Expires=' . gmdate(DateTime::COOKIE, $this->getExpires());
228 229
             $header[] = "Max-Age={$this->lifetime}";
229 230
         }
230 231
 
231
-        if (!empty($this->path)) {
232
+        if (!empty($this->path))
233
+        {
232 234
             $header[] = "Path={$this->path}";
233 235
         }
234 236
 
235
-        if (!empty($this->domain)) {
237
+        if (!empty($this->domain))
238
+        {
236 239
             $header[] = "Domain={$this->domain}";
237 240
         }
238 241
 
239
-        if ($this->secure) {
242
+        if ($this->secure)
243
+        {
240 244
             $header[] = 'Secure';
241 245
         }
242 246
 
243
-        if ($this->httpOnly) {
247
+        if ($this->httpOnly)
248
+        {
244 249
             $header[] = 'HttpOnly';
245 250
         }
246 251
 
247
-        if ($this->sameSite->get() !== null) {
252
+        if ($this->sameSite->get() !== null)
253
+        {
248 254
             $header[] = "SameSite={$this->sameSite->get()}";
249 255
         }
250 256
 
@@ -258,7 +264,8 @@  discard block
 block discarded – undo
258 264
      */
259 265
     public function getExpires(): ?int
260 266
     {
261
-        if ($this->lifetime === null) {
267
+        if ($this->lifetime === null)
268
+        {
262 269
             return null;
263 270
         }
264 271
 
Please login to merge, or discard this patch.
src/Cookies/src/Cookie/SameSite.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     public const NONE   = 'None';
12 12
 
13 13
     private const VALUES  = [self::STRICT, self::LAX, self::NONE];
14
-    private const DEFAULT = self::LAX;
14
+    private const default = self::LAX;
15 15
 
16 16
     private ?string $sameSite = null;
17 17
 
@@ -36,6 +36,6 @@  discard block
 block discarded – undo
36 36
             return null;
37 37
         }
38 38
 
39
-        return ($sameSite === self::NONE && !$secure) ? self::DEFAULT : $sameSite;
39
+        return ($sameSite === self::NONE && !$secure) ? self::default : $sameSite;
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
src/Session/src/Handler/FileHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@
 block discarded – undo
57 57
     #[ReturnTypeWillChange]
58 58
     public function gc($maxlifetime)
59 59
     {
60
-        foreach ($this->files->getFiles($this->directory) as $filename) {
61
-            if ($this->files->time($filename) < time() - $maxlifetime) {
60
+        foreach ($this->files->getFiles($this->directory) as $filename){
61
+            if ($this->files->time($filename) < time() - $maxlifetime){
62 62
                 $this->files->delete($filename);
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,10 @@
 block discarded – undo
57 57
     #[ReturnTypeWillChange]
58 58
     public function gc($maxlifetime)
59 59
     {
60
-        foreach ($this->files->getFiles($this->directory) as $filename) {
61
-            if ($this->files->time($filename) < time() - $maxlifetime) {
60
+        foreach ($this->files->getFiles($this->directory) as $filename)
61
+        {
62
+            if ($this->files->time($filename) < time() - $maxlifetime)
63
+            {
62 64
                 $this->files->delete($filename);
63 65
             }
64 66
         }
Please login to merge, or discard this patch.
src/Session/src/Session.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $this->clientSignature = $clientSignature;
62 62
         $this->lifetime = $lifetime;
63 63
 
64
-        if (!empty($id) && $this->validID($id)) {
64
+        if (!empty($id) && $this->validID($id)){
65 65
             $this->id = $id;
66 66
         }
67 67
     }
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function resume(): void
94 94
     {
95
-        if ($this->isStarted()) {
95
+        if ($this->isStarted()){
96 96
             return;
97 97
         }
98 98
 
99
-        if (!empty($this->id)) {
99
+        if (!empty($this->id)){
100 100
             session_id($this->id);
101
-        } else {
101
+        }else{
102 102
             // always new id
103 103
             session_id(session_create_id());
104 104
         }
105 105
 
106
-        try {
106
+        try{
107 107
             session_start(['use_cookies' => false]);
108
-        } catch (Throwable $e) {
108
+        }catch (Throwable $e){
109 109
             throw new SessionException('Unable to start session', $e->getCode(), $e);
110 110
         }
111 111
 
112
-        if (empty($this->id)) {
112
+        if (empty($this->id)){
113 113
             //Sign newly created session
114 114
             $_SESSION[self::CLIENT_SIGNATURE] = $this->clientSignature;
115 115
             $_SESSION[self::SESSION_CREATED] = time();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $this->started = true;
121 121
 
122 122
         //Ensure that session is valid
123
-        if (!$this->validSession()) {
123
+        if (!$this->validSession()){
124 124
             $this->invalidateSession();
125 125
         }
126 126
     }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function commit(): bool
161 161
     {
162
-        if (!$this->isStarted()) {
162
+        if (!$this->isStarted()){
163 163
             return false;
164 164
         }
165 165
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function abort(): bool
176 176
     {
177
-        if (!$this->isStarted()) {
177
+        if (!$this->isStarted()){
178 178
             return false;
179 179
         }
180 180
 
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
         if (
216 216
             !array_key_exists(self::CLIENT_SIGNATURE, $_SESSION)
217 217
             || !array_key_exists(self::SESSION_CREATED, $_SESSION)
218
-        ) {
218
+        ){
219 219
             //Missing session signature or timestamp!
220 220
             return false;
221 221
         }
222 222
 
223
-        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime) {
223
+        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime){
224 224
             //Session expired
225 225
             return false;
226 226
         }
227 227
 
228
-        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)) {
228
+        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)){
229 229
             //Signatures do not match
230 230
             return false;
231 231
         }
Please login to merge, or discard this patch.
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,7 +61,8 @@  discard block
 block discarded – undo
61 61
         $this->clientSignature = $clientSignature;
62 62
         $this->lifetime = $lifetime;
63 63
 
64
-        if (!empty($id) && $this->validID($id)) {
64
+        if (!empty($id) && $this->validID($id))
65
+        {
65 66
             $this->id = $id;
66 67
         }
67 68
     }
@@ -92,24 +93,32 @@  discard block
 block discarded – undo
92 93
      */
93 94
     public function resume(): void
94 95
     {
95
-        if ($this->isStarted()) {
96
+        if ($this->isStarted())
97
+        {
96 98
             return;
97 99
         }
98 100
 
99
-        if (!empty($this->id)) {
101
+        if (!empty($this->id))
102
+        {
100 103
             session_id($this->id);
101
-        } else {
104
+        }
105
+        else
106
+        {
102 107
             // always new id
103 108
             session_id(session_create_id());
104 109
         }
105 110
 
106
-        try {
111
+        try
112
+        {
107 113
             session_start(['use_cookies' => false]);
108
-        } catch (Throwable $e) {
114
+        }
115
+        catch (Throwable $e)
116
+        {
109 117
             throw new SessionException('Unable to start session', $e->getCode(), $e);
110 118
         }
111 119
 
112
-        if (empty($this->id)) {
120
+        if (empty($this->id))
121
+        {
113 122
             //Sign newly created session
114 123
             $_SESSION[self::CLIENT_SIGNATURE] = $this->clientSignature;
115 124
             $_SESSION[self::SESSION_CREATED] = time();
@@ -120,7 +129,8 @@  discard block
 block discarded – undo
120 129
         $this->started = true;
121 130
 
122 131
         //Ensure that session is valid
123
-        if (!$this->validSession()) {
132
+        if (!$this->validSession())
133
+        {
124 134
             $this->invalidateSession();
125 135
         }
126 136
     }
@@ -159,7 +169,8 @@  discard block
 block discarded – undo
159 169
      */
160 170
     public function commit(): bool
161 171
     {
162
-        if (!$this->isStarted()) {
172
+        if (!$this->isStarted())
173
+        {
163 174
             return false;
164 175
         }
165 176
 
@@ -174,7 +185,8 @@  discard block
 block discarded – undo
174 185
      */
175 186
     public function abort(): bool
176 187
     {
177
-        if (!$this->isStarted()) {
188
+        if (!$this->isStarted())
189
+        {
178 190
             return false;
179 191
         }
180 192
 
@@ -220,12 +232,14 @@  discard block
 block discarded – undo
220 232
             return false;
221 233
         }
222 234
 
223
-        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime) {
235
+        if ($_SESSION[self::SESSION_CREATED] < time() - $this->lifetime)
236
+        {
224 237
             //Session expired
225 238
             return false;
226 239
         }
227 240
 
228
-        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature)) {
241
+        if (!hash_equals($_SESSION[self::CLIENT_SIGNATURE], $this->clientSignature))
242
+        {
229 243
             //Signatures do not match
230 244
             return false;
231 245
         }
Please login to merge, or discard this patch.