Browse Source

Fix phpstan issues.

mscherer 6 years ago
parent
commit
9eeb645198

+ 1 - 1
src/Error/ErrorHandlerTrait.php

@@ -105,7 +105,7 @@ trait ErrorHandlerTrait {
 
 	/**
 	 * @param string $class
-	 * @param array $blacklist
+	 * @param string[] $blacklist
 	 * @return bool
 	 */
 	protected function isBlacklisted($class, array $blacklist) {

+ 9 - 9
src/Model/Behavior/BitmaskedBehavior.php

@@ -190,7 +190,7 @@ class BitmaskedBehavior extends Behavior {
 
 	/**
 	 * @param int $value Bitmask.
-	 * @return array Bitmask array (from DB to APP).
+	 * @return int[] Bitmask array (from DB to APP).
 	 */
 	public function decodeBitmask($value) {
 		$res = [];
@@ -205,9 +205,9 @@ class BitmaskedBehavior extends Behavior {
 	}
 
 	/**
-	 * @param array $value Bitmask array.
-	 * @param mixed $defaultValue Default bitmask value.
-	 * @return int Bitmask (from APP to DB).
+	 * @param int[] $value Bitmask array.
+	 * @param mixed|null $defaultValue Default bitmask value.
+	 * @return int|null Bitmask (from APP to DB).
 	 */
 	public function encodeBitmask($value, $defaultValue = null) {
 		$res = 0;
@@ -319,7 +319,7 @@ class BitmaskedBehavior extends Behavior {
 	}
 
 	/**
-	 * @param int|array $bits
+	 * @param int|int[] $bits
 	 * @return array SQL snippet.
 	 */
 	public function isBit($bits) {
@@ -331,7 +331,7 @@ class BitmaskedBehavior extends Behavior {
 	}
 
 	/**
-	 * @param int|array $bits
+	 * @param int|int[] $bits
 	 * @return array SQL snippet.
 	 */
 	public function isNotBit($bits) {
@@ -339,7 +339,7 @@ class BitmaskedBehavior extends Behavior {
 	}
 
 	/**
-	 * @param int|array $bits
+	 * @param int|int[] $bits
 	 * @return array SQL snippet.
 	 */
 	public function containsBit($bits) {
@@ -347,7 +347,7 @@ class BitmaskedBehavior extends Behavior {
 	}
 
 	/**
-	 * @param int|array $bits
+	 * @param int|int[] $bits
 	 * @return array SQL snippet.
 	 */
 	public function containsNotBit($bits) {
@@ -355,7 +355,7 @@ class BitmaskedBehavior extends Behavior {
 	}
 
 	/**
-	 * @param int|array $bits
+	 * @param int|int[] $bits
 	 * @param bool $contain
 	 * @return array SQL snippet.
 	 */

+ 3 - 3
src/Model/Behavior/JsonableBehavior.php

@@ -211,7 +211,7 @@ class JsonableBehavior extends Behavior {
 	/**
 	 * Fields are absolutely necessary to function properly!
 	 *
-	 * @param array|null $val
+	 * @param string|array|null $val
 	 * @return array|null|false
 	 */
 	public function _decode($val) {
@@ -274,7 +274,7 @@ class JsonableBehavior extends Behavior {
 	/**
 	 * array() => value1|value2|value3|...
 	 *
-	 * @param array $val
+	 * @param string[] $val
 	 * @return string
 	 */
 	public function _toList($val) {
@@ -284,7 +284,7 @@ class JsonableBehavior extends Behavior {
 	/**
 	 * @param string $val
 	 *
-	 * @return array
+	 * @return string[]
 	 */
 	public function _fromList($val) {
 		$separator = $this->_config['separator'];

+ 1 - 1
src/Model/Behavior/PasswordableBehavior.php

@@ -95,7 +95,7 @@ class PasswordableBehavior extends Behavior {
 	/**
 	 * Password hasher instance.
 	 *
-	 * @var \Cake\Auth\AbstractPasswordHasher
+	 * @var \Cake\Auth\AbstractPasswordHasher|null
 	 */
 	protected $_passwordHasher;
 

+ 1 - 0
tests/phpstan.neon

@@ -9,6 +9,7 @@ parameters:
         - '#Access to an undefined property .+Table::\$belongsTo#'
         - '#Call to an undefined method .+TimeHelper::.+\(\)#'
         - '#Access to protected property .+ServerRequest::\$.+#'
+        - '#Return type \(bool\) of method .+Email::send\(\) should be compatible with return type \(array\) of method .+Email::send\(\)#'
 
 services:
     -