Browse Source

Another set of phpstan reported errors

antograssiot 9 years ago
parent
commit
fcd46efa12

+ 1 - 3
src/Cache/Engine/FileEngine.php

@@ -193,9 +193,7 @@ class FileEngine extends CacheEngine
         $time = time();
         $cachetime = (int)$this->_File->current();
 
-        if ($cachetime !== false &&
-            ($cachetime < $time || ($time + $this->_config['duration']) < $cachetime)
-        ) {
+        if ($cachetime < $time || ($time + $this->_config['duration']) < $cachetime) {
             if ($this->_config['lock']) {
                 $this->_File->flock(LOCK_UN);
             }

+ 1 - 1
src/Error/Debugger.php

@@ -665,7 +665,7 @@ class Debugger
             return $self->_outputFormat;
         }
 
-        if ($format !== false && !isset($self->_templates[$format])) {
+        if (!isset($self->_templates[$format])) {
             throw new InvalidArgumentException('Invalid Debugger output format.');
         }
         $self->_outputFormat = $format;

+ 1 - 1
src/I18n/Date.php

@@ -48,7 +48,7 @@ class Date extends MutableDate implements JsonSerializable
      * The format to use when formatting a time using `Cake\I18n\Date::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\Date::$wordEnd`
      *
-     * @var string
+     * @var string|array|int
      * @see \Cake\I18n\DateFormatTrait::parseDate()
      */
     public static $wordFormat = [IntlDateFormatter::SHORT, -1];

+ 1 - 1
src/I18n/FrozenDate.php

@@ -50,7 +50,7 @@ class FrozenDate extends ChronosDate implements JsonSerializable
      * The format to use when formatting a time using `Cake\I18n\Date::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\Date::$wordEnd`
      *
-     * @var string
+     * @var string|array|int
      * @see \Cake\I18n\DateFormatTrait::parseDate()
      */
     public static $wordFormat = [IntlDateFormatter::SHORT, -1];

+ 2 - 2
src/I18n/FrozenTime.php

@@ -67,7 +67,7 @@ class FrozenTime extends Chronos implements JsonSerializable
      * The format to use when formatting a time using `Cake\I18n\FrozenTime::timeAgoInWords()`
      * and the difference is more than `Cake\I18n\FrozenTime::$wordEnd`
      *
-     * @var string
+     * @var string|array|int
      * @see \Cake\I18n\FrozenTime::timeAgoInWords()
      */
     public static $wordFormat = [IntlDateFormatter::SHORT, -1];
@@ -110,7 +110,7 @@ class FrozenTime extends Chronos implements JsonSerializable
     public function __construct($time = null, $tz = null)
     {
         if ($time instanceof DateTimeInterface) {
-            $tz = $time->getTimeZone();
+            $tz = $time->getTimezone();
             $time = $time->format('Y-m-d H:i:s');
         }
 

+ 2 - 2
src/ORM/ResultSet.php

@@ -177,11 +177,11 @@ class ResultSet implements ResultSetInterface
     {
         $repository = $query->repository();
         $this->_statement = $statement;
-        $this->_driver = $query->getConnection()->driver();
+        $this->_driver = $query->getConnection()->getDriver();
         $this->_defaultTable = $query->repository();
         $this->_calculateAssociationMap($query);
         $this->_hydrate = $query->isHydrationEnabled();
-        $this->_entityClass = $repository->entityClass();
+        $this->_entityClass = $repository->getEntityClass();
         $this->_useBuffering = $query->isBufferedResultsEnabled();
         $this->_defaultAlias = $this->_defaultTable->alias();
         $this->_calculateColumnMap($query);

+ 2 - 2
src/ORM/Rule/ExistsIn.php

@@ -92,8 +92,8 @@ class ExistsIn
 
         $source = $target = $this->_repository;
         $isAssociation = $target instanceof Association;
-        $bindingKey = $isAssociation ? (array)$target->bindingKey() : (array)$target->getPrimaryKey();
-        $realTarget = $isAssociation ? $target->target() : $target;
+        $bindingKey = $isAssociation ? (array)$target->getBindingKey() : (array)$target->getPrimaryKey();
+        $realTarget = $isAssociation ? $target->getTarget() : $target;
 
         if (!empty($options['_sourceTable']) && $realTarget === $options['_sourceTable']) {
             return true;

+ 1 - 1
src/ORM/Rule/ValidCount.php

@@ -27,7 +27,7 @@ class ValidCount
     /**
      * The field to check
      *
-     * @var array
+     * @var string
      */
     protected $_field;
 

+ 1 - 1
src/Utility/Hash.php

@@ -641,7 +641,7 @@ class Hash
     /**
      * Callback function for filtering.
      *
-     * @param array $var Array to filter.
+     * @param mixed $var Array to filter.
      * @return bool
      */
     protected static function _filter($var)

+ 1 - 1
src/Validation/Validation.php

@@ -592,7 +592,7 @@ class Validation
      * - 1..N => Exactly that many number of decimal places. The '.' is required.
      *
      * @param float $check The value the test for decimal.
-     * @param int|null $places Decimal places.
+     * @param int|bool|null $places Decimal places.
      * @param string|null $regex If a custom regular expression is used, this is the only validation that will occur.
      * @return bool Success
      */

+ 1 - 1
src/View/Helper/RssHelper.php

@@ -282,7 +282,7 @@ class RssHelper extends Helper
      */
     public function time($time)
     {
-        return $this->Time->toRSS($time);
+        return $this->Time->toRss($time);
     }
 
     /**