Skip to content

Commit

Permalink
Fix more errors reported by phpstan.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Dec 18, 2017
1 parent aa23283 commit 578d2b0
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Auth/Storage/SessionStorage.php
Expand Up @@ -34,7 +34,7 @@ class SessionStorage implements StorageInterface
* Stores user record array if fetched from session or false if session
* does not have user record.
*
* @var \ArrayAccess|array|bool
* @var \ArrayAccess|array|false
*/
protected $_user;

Expand Down
2 changes: 1 addition & 1 deletion src/Auth/Storage/StorageInterface.php
Expand Up @@ -23,7 +23,7 @@ interface StorageInterface
/**
* Read user record.
*
* @return array|null
* @return \ArrayAccess|array|null
*/
public function read();

Expand Down
2 changes: 1 addition & 1 deletion src/Database/Type/DateTimeType.php
Expand Up @@ -148,7 +148,7 @@ public function toPHP($value, Driver $driver)
* Convert request data into a datetime object.
*
* @param mixed $value Request data
* @return \DateTimeInterface
* @return \DateTimeInterface|null
*/
public function marshal($value)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Filesystem/Folder.php
Expand Up @@ -172,7 +172,7 @@ public function pwd()
public function cd($path)
{
$path = $this->realpath($path);
if (is_dir($path)) {
if ($path !== false && is_dir($path)) {
return $this->path = $path;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Http/ServerRequest.php
Expand Up @@ -56,7 +56,7 @@ class ServerRequest implements ArrayAccess, ServerRequestInterface
* In PUT/PATCH/DELETE requests this property will contain the form-urlencoded
* data.
*
* @var array
* @var null|array|object
* @deprecated 3.4.0 This public property will be removed in 4.0.0. Use getData() instead.
*/
public $data = [];
Expand Down
5 changes: 3 additions & 2 deletions src/ORM/Association/Loader/SelectLoader.php
Expand Up @@ -116,7 +116,7 @@ public function __construct(array $options)
* iterator. The options accepted by this method are the same as `Association::eagerLoader()`
*
* @param array $options Same options as `Association::eagerLoader()`
* @return callable
* @return \Closure
*/
public function buildEagerLoader(array $options)
{
Expand Down Expand Up @@ -294,13 +294,14 @@ protected function _addFilteringJoin($query, $key, $subquery)
}
$subquery->select($filter, true);

$conditions = null;
if (is_array($key)) {
$conditions = $this->_createTupleCondition($query, $key, $filter, '=');
} else {
$filter = current($filter);
}

$conditions = isset($conditions) ? $conditions : $query->newExpr([$key => $filter]);
$conditions = $conditions ?: $query->newExpr([$key => $filter]);

return $query->innerJoin(
[$aliasedTable => $subquery],
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Locator/TableLocator.php
Expand Up @@ -227,7 +227,7 @@ public function get($alias, array $options = [])
*
* @param string $alias The alias name you want to get.
* @param array $options Table options array.
* @return string
* @return string|false
*/
protected function _getClassName($alias, array $options = [])
{
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/Inflector.php
Expand Up @@ -417,7 +417,7 @@ class Inflector
* @param string $type Inflection type
* @param string $key Original value
* @param string|bool $value Inflected value
* @return string|bool Inflected value on cache hit or false on cache miss.
* @return string|false Inflected value on cache hit or false on cache miss.
*/
protected static function _cache($type, $key, $value = false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/TimeHelper.php
Expand Up @@ -363,7 +363,7 @@ public function format($date, $format = null, $invalid = false, $timezone = null
* @param string|null $format Intl compatible format string.
* @param bool|string $invalid Default value to display on invalid dates
* @param string|\DateTimeZone|null $timezone User's timezone string or DateTimeZone object
* @return string Formatted and translated date string
* @return string|false Formatted and translated date string or value for `$invalid` on failure.
* @throws \Exception When the date cannot be parsed
* @see \Cake\I18n\Time::i18nFormat()
*/
Expand Down
1 change: 1 addition & 0 deletions src/View/Helper/UrlHelper.php
Expand Up @@ -52,6 +52,7 @@ public function build($url = null, $options = false)
}
$options += $defaults;

/** @var string $url */
$url = Router::url($url, $options['fullBase']);
if ($options['escape']) {
$url = h($url);
Expand Down
4 changes: 2 additions & 2 deletions src/View/ViewBuilder.php
Expand Up @@ -48,14 +48,14 @@ class ViewBuilder implements JsonSerializable, Serializable
/**
* The plugin name to use.
*
* @var string
* @var string|null|false
*/
protected $_plugin;

/**
* The theme name to use.
*
* @var string
* @var string|null|false
*/
protected $_theme;

Expand Down

0 comments on commit 578d2b0

Please sign in to comment.