Browse Source

fix undefined property warning

Kevin Pfeifer 2 years ago
parent
commit
2512527ca1
2 changed files with 6 additions and 1 deletions
  1. 5 0
      phpstan-baseline.neon
  2. 1 1
      src/Console/ConsoleInput.php

+ 5 - 0
phpstan-baseline.neon

@@ -11,6 +11,11 @@ parameters:
 			path: src/Collection/Iterator/NoChildrenIterator.php
 
 		-
+			message: "#^Property Cake\\\\Console\\\\ConsoleInput\\:\\:\\$_input \\(resource\\) in isset\\(\\) is not nullable\\.$#"
+			count: 1
+			path: src/Console/ConsoleInput.php
+
+		-
 			message: "#^Unsafe usage of new static\\(\\)\\.$#"
 			count: 2
 			path: src/Console/ConsoleOptionParser.php

+ 1 - 1
src/Console/ConsoleInput.php

@@ -66,7 +66,7 @@ class ConsoleInput
     public function __destruct()
     {
         /** @psalm-suppress RedundantCondition */
-        if (is_resource($this->_input)) {
+        if (isset($this->_input) && is_resource($this->_input)) {
             fclose($this->_input);
         }
         unset($this->_input);