Completed
Push — master ( 985ca9...e0892e )
by David
18s
created
src/Rules/TypeHints/MissingTypeHintInMethodRule.php 1 patch
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,6 @@
 block discarded – undo
9 9
 use PHPStan\Reflection\ParametersAcceptorSelector;
10 10
 use PHPStan\Reflection\ParametersAcceptorWithPhpDocs;
11 11
 use PHPStan\Reflection\Php\PhpMethodReflection;
12
-use Roave\BetterReflection\Reflection\ReflectionFunction;
13
-use Roave\BetterReflection\Reflection\ReflectionFunctionAbstract;
14
-use Roave\BetterReflection\Reflection\ReflectionMethod;
15
-use Roave\BetterReflection\Reflection\ReflectionParameter;
16 12
 use PhpParser\Node;
17 13
 use PHPStan\Reflection\MethodReflection;
18 14
 
Please login to merge, or discard this patch.
src/Rules/TypeHints/ParameterDebugContext.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
             }
43 43
 
44 44
             return sprintf('In method "%s::%s", parameter $%s', $this->scope->getClassReflection()->getDisplayName(), $this->function->name->name, $this->parameter->getName());
45
-        }
46
-        elseif ($this->function instanceof Function_) {
45
+        } elseif ($this->function instanceof Function_) {
47 46
             return sprintf('In function "%s", parameter $%s', $this->function->name->name, $this->parameter->getName());
48 47
         }
49 48
         return 'Should not happen';
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,6 @@
 block discarded – undo
5 5
 
6 6
 
7 7
 use PhpParser\Node\FunctionLike;
8
-use PhpParser\Node\Name;
9 8
 use PhpParser\Node\Stmt\ClassMethod;
10 9
 use PhpParser\Node\Stmt\Function_;
11 10
 use PHPStan\Analyser\Scope;
Please login to merge, or discard this patch.
src/Rules/TypeHints/AbstractMissingTypeHintRule.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -287,15 +287,15 @@  discard block
 block discarded – undo
287 287
         }
288 288
 
289 289
         if ($type instanceof ObjectType) {
290
-            return ($isNullable?'?':'').'\\'.$type->describe(VerbosityLevel::typeOnly());
290
+            return ($isNullable ? '?' : '').'\\'.$type->describe(VerbosityLevel::typeOnly());
291 291
         }
292 292
 
293 293
         if ($type instanceof ArrayType) {
294
-            return ($isNullable?'?':'').'array';
294
+            return ($isNullable ? '?' : '').'array';
295 295
         }
296 296
 
297 297
         if ($this->isNativeType($type)) {
298
-            return ($isNullable?'?':'').$type->describe(VerbosityLevel::typeOnly());
298
+            return ($isNullable ? '?' : '').$type->describe(VerbosityLevel::typeOnly());
299 299
         }
300 300
 
301 301
         // TODO: more definitions to add here
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     private function typesWithoutNullable(Type $docBlockTypeHints): Type
346 346
     {
347 347
         if ($docBlockTypeHints instanceof UnionType) {
348
-            $filteredTypes = array_values(array_filter($docBlockTypeHints->getTypes(), function (Type $item) {
348
+            $filteredTypes = array_values(array_filter($docBlockTypeHints->getTypes(), function(Type $item) {
349 349
                 return !$item instanceof NullType;
350 350
             }));
351 351
             if (\count($filteredTypes) === 1) {
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,6 @@
 block discarded – undo
3 3
 
4 4
 namespace TheCodingMachine\PHPStan\Rules\TypeHints;
5 5
 
6
-use PHPStan\Reflection\Php\PhpFunctionReflection;
7
-use PHPStan\Reflection\Php\PhpMethodReflection;
8 6
 use PHPStan\Type\ArrayType;
9 7
 use PHPStan\Type\BooleanType;
10 8
 use PHPStan\Type\CallableType;
Please login to merge, or discard this patch.
src/Rules/TypeHints/FunctionDebugContext.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@
 block discarded – undo
37 37
             }
38 38
 
39 39
             return sprintf('In method "%s::%s",', $this->scope->getClassReflection()->getDisplayName(), $this->function->name->name);
40
-        }
41
-        elseif ($this->function instanceof Function_) {
40
+        } elseif ($this->function instanceof Function_) {
42 41
             return sprintf('In function "%s",', $this->function->name->name);
43 42
         }
44 43
         return 'Should not happen';
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,11 +5,9 @@
 block discarded – undo
5 5
 
6 6
 
7 7
 use PhpParser\Node\FunctionLike;
8
-use PhpParser\Node\Name;
9 8
 use PhpParser\Node\Stmt\ClassMethod;
10 9
 use PhpParser\Node\Stmt\Function_;
11 10
 use PHPStan\Analyser\Scope;
12
-use PHPStan\Reflection\Php\PhpParameterReflection;
13 11
 
14 12
 class FunctionDebugContext implements DebugContextInterface
15 13
 {
Please login to merge, or discard this patch.