Completed
Pull Request — master (#1)
by David
04:52
created
src/Rules/Exceptions/DoNotThrowExceptionBaseClassRule.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,9 +5,7 @@
 block discarded – undo
5 5
 
6 6
 
7 7
 use PhpParser\Node;
8
-use PhpParser\Node\Stmt\Catch_;
9 8
 use PHPStan\Analyser\Scope;
10
-use PHPStan\Broker\Broker;
11 9
 use PHPStan\Rules\Rule;
12 10
 
13 11
 /**
Please login to merge, or discard this patch.
src/Rules/Exceptions/EmptyExceptionRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use PhpParser\Node;
8 8
 use PhpParser\Node\Stmt\Catch_;
9 9
 use PHPStan\Analyser\Scope;
10
-use PHPStan\Broker\Broker;
11 10
 use PHPStan\Rules\Rule;
12 11
 
13 12
 class EmptyExceptionRule implements Rule
Please login to merge, or discard this patch.
src/Rules/Exceptions/ThrowMustBundlePreviousExceptionRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use PhpParser\NodeTraverser;
10 10
 use PhpParser\NodeVisitorAbstract;
11 11
 use PHPStan\Analyser\Scope;
12
-use PHPStan\Broker\Broker;
13 12
 use PHPStan\Rules\Rule;
14 13
 
15 14
 /**
Please login to merge, or discard this patch.
src/Rules/TypeHints/AbstractMissingTypeHintRule.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace TheCodingMachine\PHPStan\Rules\TypeHints;
5 5
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      * @param ReflectionParameter $parameter
89 89
      * @return null|string
90 90
      */
91
-    private function analyzeParameter(ReflectionParameter $parameter): ?string
91
+    private function analyzeParameter(ReflectionParameter $parameter): ? string
92 92
     {
93 93
         $phpTypeHint = $parameter->getTypeHint();
94 94
         $docBlockTypeHints = $parameter->getDocBlockTypes();
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      * @param ReflectionFunction|ReflectionMethod $function
106 106
      * @return null|string
107 107
      */
108
-    private function analyzeReturnType($function): ?string
108
+    private function analyzeReturnType($function): ? string
109 109
     {
110 110
         $reflectionPhpTypeHint = $function->getReturnType();
111 111
         $phpTypeHint = null;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      * @param Type[] $docBlockTypeHints
129 129
      * @return null|string
130 130
      */
131
-    private function analyzeWithTypehint($context, Type $phpTypeHint, array $docBlockTypeHints): ?string
131
+    private function analyzeWithTypehint($context, Type $phpTypeHint, array $docBlockTypeHints): ? string
132 132
     {
133 133
         $docblockWithoutNullable = $this->typesWithoutNullable($docBlockTypeHints);
134 134
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
             foreach ($docblockWithoutNullable as $docblockTypehint) {
158 158
                 if (!$docblockTypehint instanceof Array_) {
159 159
                     if ($context instanceof ReflectionParameter) {
160
-                        return sprintf('%s, mismatching type-hints for parameter %s. PHP type hint is "array" and docblock type hint is %s.', $this->getContext($context), $context->getName(), (string)$docblockTypehint);
160
+                        return sprintf('%s, mismatching type-hints for parameter %s. PHP type hint is "array" and docblock type hint is %s.', $this->getContext($context), $context->getName(), (string) $docblockTypehint);
161 161
                     } else {
162
-                        return sprintf('%s, mismatching type-hints for return type. PHP type hint is "array" and docblock declared return type is %s.', $this->getContext($context), (string)$docblockTypehint);
162
+                        return sprintf('%s, mismatching type-hints for return type. PHP type hint is "array" and docblock declared return type is %s.', $this->getContext($context), (string) $docblockTypehint);
163 163
                     }
164 164
                 }
165 165
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      * @param Type[] $docBlockTypeHints
182 182
      * @return null|string
183 183
      */
184
-    private function analyzeWithoutTypehint($context, array $docBlockTypeHints): ?string
184
+    private function analyzeWithoutTypehint($context, array $docBlockTypeHints): ? string
185 185
     {
186 186
         if (empty($docBlockTypeHints)) {
187 187
             if ($context instanceof ReflectionParameter) {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      * @param Type[] $docBlockTypeHints
209 209
      * @return string|null
210 210
      */
211
-    private function isNativelyTypehintable(array $docBlockTypeHints): ?string
211
+    private function isNativelyTypehintable(array $docBlockTypeHints): ? string
212 212
     {
213 213
         if (count($docBlockTypeHints) > 2) {
214 214
             return null;
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
         $type = $types[0];
228 228
 
229 229
         if ($this->isNativeType($type)) {
230
-            return ($isNullable?'?':'').((string)$type);
230
+            return ($isNullable ? '?' : '').((string) $type);
231 231
         }
232 232
 
233 233
         if ($type instanceof Array_) {
234
-            return ($isNullable?'?':'').'array';
234
+            return ($isNullable ? '?' : '').'array';
235 235
         }
236 236
 
237 237
         // TODO: more definitions to add here
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         // Manage array of things => (cast to array)
240 240
 
241 241
         if ($type instanceof Object_) {
242
-            return ($isNullable?'?':'').((string)$type);
242
+            return ($isNullable ? '?' : '').((string) $type);
243 243
         }
244 244
 
245 245
         return null;
Please login to merge, or discard this patch.
src/BetterReflection/FindReflectionOnLine.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
      */
55 55
     public function __invoke($filename, $lineNumber)
56 56
     {
57
-        $lineNumber = (int)$lineNumber;
57
+        $lineNumber = (int) $lineNumber;
58 58
         $reflections = $this->computeReflections($filename);
59 59
 
60 60
         foreach ($reflections as $reflection) {
Please login to merge, or discard this patch.