Browse Source

Merge pull request #13274 from cakephp/4.x-psalm

Update psalm's baseline
Mark Sch 6 years ago
parent
commit
5269cc2a3c

+ 0 - 27
psalm-baseline.xml

@@ -270,7 +270,6 @@
     </MissingConstructor>
     <MoreSpecificImplementedParamType occurrences="1">
       <code>$class</code>
-      <code>$class</code>
     </MoreSpecificImplementedParamType>
   </file>
   <file src="src/Console/Shell.php">
@@ -305,7 +304,6 @@
   <file src="src/Console/TaskRegistry.php">
     <MoreSpecificImplementedParamType occurrences="1">
       <code>$class</code>
-      <code>$class</code>
     </MoreSpecificImplementedParamType>
   </file>
   <file src="src/Controller/Component/AuthComponent.php">
@@ -390,7 +388,6 @@
   <file src="src/Controller/ComponentRegistry.php">
     <MoreSpecificImplementedParamType occurrences="1">
       <code>$class</code>
-      <code>$class</code>
     </MoreSpecificImplementedParamType>
     <PropertyNotSetInConstructor occurrences="1">
       <code>ComponentRegistry</code>
@@ -419,27 +416,6 @@
       <code>ErrorController</code>
     </PropertyNotSetInConstructor>
   </file>
-  <file src="src/Controller/Exception/AuthSecurityException.php">
-    <PropertyNotSetInConstructor occurrences="1">
-      <code>AuthSecurityException</code>
-    </PropertyNotSetInConstructor>
-  </file>
-  <file src="src/Controller/Exception/SecurityException.php">
-    <PossiblyNullPropertyAssignmentValue occurrences="1">
-      <code>$reason</code>
-    </PossiblyNullPropertyAssignmentValue>
-    <PropertyNotSetInConstructor occurrences="1">
-      <code>$_reason</code>
-    </PropertyNotSetInConstructor>
-  </file>
-  <file src="src/Core/App.php">
-    <PossiblyFalseArgument occurrences="1">
-      <code>$pos</code>
-    </PossiblyFalseArgument>
-    <PossiblyFalseOperand occurrences="1">
-      <code>$pos</code>
-    </PossiblyFalseOperand>
-  </file>
   <file src="src/Core/BasePlugin.php">
     <PropertyNotSetInConstructor occurrences="5">
       <code>$path</code>
@@ -1647,7 +1623,6 @@
   <file src="src/Mailer/TransportRegistry.php">
     <MoreSpecificImplementedParamType occurrences="1">
       <code>$class</code>
-      <code>$class</code>
     </MoreSpecificImplementedParamType>
   </file>
   <file src="src/Network/Socket.php">
@@ -1858,7 +1833,6 @@
   <file src="src/ORM/BehaviorRegistry.php">
     <MoreSpecificImplementedParamType occurrences="1">
       <code>$class</code>
-      <code>$class</code>
     </MoreSpecificImplementedParamType>
     <PropertyNotSetInConstructor occurrences="2">
       <code>$_table</code>
@@ -2735,7 +2709,6 @@
   <file src="src/View/HelperRegistry.php">
     <MoreSpecificImplementedParamType occurrences="1">
       <code>$class</code>
-      <code>$class</code>
     </MoreSpecificImplementedParamType>
   </file>
   <file src="src/View/JsonView.php">

+ 7 - 5
src/Controller/Exception/SecurityException.php

@@ -30,7 +30,7 @@ class SecurityException extends BadRequestException
     /**
      * Reason for request blackhole
      *
-     * @var string
+     * @var string|null
      */
     protected $_reason;
 
@@ -59,19 +59,21 @@ class SecurityException extends BadRequestException
      * Set Reason
      *
      * @param string|null $reason Reason details
-     * @return void
+     * @return $this
      */
-    public function setReason(?string $reason = null): void
+    public function setReason(?string $reason = null)
     {
         $this->_reason = $reason;
+
+        return $this;
     }
 
     /**
      * Get Reason
      *
-     * @return string
+     * @return string|null
      */
-    public function getReason(): string
+    public function getReason(): ?string
     {
         return $this->_reason;
     }

+ 4 - 0
src/Core/App.php

@@ -121,6 +121,10 @@ class App
         $type = '/' . $type . '/';
 
         $pos = strrpos($class, $type);
+        if ($pos === false) {
+            return $class;
+        }
+
         $pluginName = substr($class, 0, $pos);
         $name = substr($class, $pos + strlen($type));
 

+ 1 - 0
src/Core/StaticConfigTrait.php

@@ -136,6 +136,7 @@ trait StaticConfigTrait
             return false;
         }
         if (isset(static::$_registry)) {
+            /** @var \Cake\Core\ObjectRegistry $_registry */
             static::$_registry->unload($config);
         }
         unset(static::$_config[$config]);