mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Fixed some more phpstan level 2 issues
This commit is contained in:
parent
2433e0d2cd
commit
b0b6c1dd17
|
|
@ -60,6 +60,7 @@
|
|||
"victorjonsson/markdowndocs": "dev-master"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zend-opcache": "Recommended for better performance",
|
||||
"ext-intl": "Recommended for multi-language sites",
|
||||
"ext-memcache": "Needed to support Memcache servers",
|
||||
"ext-memcached": "Needed to support Memcached servers",
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class Assets extends PropertyObject
|
|||
* It automatically detects the asset type (JavaScript, CSS or collection).
|
||||
* You may add more than one asset passing an array as argument.
|
||||
*
|
||||
* @param $asset
|
||||
* @param array|string $asset
|
||||
* @return $this
|
||||
*/
|
||||
public function add($asset)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ abstract class BaseAsset extends PropertyObject
|
|||
* Build local links including grav asset shortcodes
|
||||
*
|
||||
* @param string $asset the asset string reference
|
||||
* @param bool $absolute build absolute asset link
|
||||
*
|
||||
* @return string the final link url to the asset
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ use Grav\Common\Assets;
|
|||
trait LegacyAssetsTrait
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $args
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
protected function unifyLegacyArguments($args, $type = Assets::CSS_TYPE)
|
||||
{
|
||||
// First argument is always the asset
|
||||
|
|
@ -77,10 +82,10 @@ trait LegacyAssetsTrait
|
|||
/**
|
||||
* Convenience wrapper for async loading of JavaScript
|
||||
*
|
||||
* @param $asset
|
||||
* @param int $priority
|
||||
* @param bool $pipeline
|
||||
* @param string $group name of the group
|
||||
* @param string|array $asset
|
||||
* @param int $priority
|
||||
* @param bool $pipeline
|
||||
* @param string $group name of the group
|
||||
*
|
||||
* @return \Grav\Common\Assets
|
||||
* @deprecated Please use dynamic method with ['loading' => 'async'].
|
||||
|
|
@ -95,10 +100,10 @@ trait LegacyAssetsTrait
|
|||
/**
|
||||
* Convenience wrapper for deferred loading of JavaScript
|
||||
*
|
||||
* @param $asset
|
||||
* @param int $priority
|
||||
* @param bool $pipeline
|
||||
* @param string $group name of the group
|
||||
* @param string|array $asset
|
||||
* @param int $priority
|
||||
* @param bool $pipeline
|
||||
* @param string $group name of the group
|
||||
*
|
||||
* @return \Grav\Common\Assets
|
||||
* @deprecated Please use dynamic method with ['loading' => 'defer'].
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ trait TestingAssetsTrait
|
|||
/**
|
||||
* Determines if an asset exists as a collection, CSS or JS reference
|
||||
*
|
||||
* @param $asset
|
||||
* @param string $asset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
|
@ -38,7 +38,7 @@ trait TestingAssetsTrait
|
|||
/**
|
||||
* Set the array of collections explicitly
|
||||
*
|
||||
* @param $collections
|
||||
* @param array $collections
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
@ -90,7 +90,7 @@ trait TestingAssetsTrait
|
|||
/**
|
||||
* Set the whole array of CSS assets
|
||||
*
|
||||
* @param $css
|
||||
* @param array $css
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
@ -104,7 +104,7 @@ trait TestingAssetsTrait
|
|||
/**
|
||||
* Set the whole array of JS assets
|
||||
*
|
||||
* @param $js
|
||||
* @param array $js
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
@ -219,7 +219,7 @@ trait TestingAssetsTrait
|
|||
/**
|
||||
* Explicitly set's a timestamp for assets
|
||||
*
|
||||
* @param $value
|
||||
* @param string|int $value
|
||||
*/
|
||||
public function setTimestamp($value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class Cache extends Getters
|
|||
/**
|
||||
* Public accessor to set the enabled state of the cache
|
||||
*
|
||||
* @param $enabled
|
||||
* @param bool|int $enabled
|
||||
*/
|
||||
public function setEnabled($enabled)
|
||||
{
|
||||
|
|
@ -561,7 +561,7 @@ class Cache extends Getters
|
|||
/**
|
||||
* is this driver a volatile driver in that it resides in PHP process memory
|
||||
*
|
||||
* @param $setting
|
||||
* @param string $setting
|
||||
* @return bool
|
||||
*/
|
||||
public function isVolatileDriver($setting)
|
||||
|
|
@ -588,7 +588,7 @@ class Cache extends Getters
|
|||
/**
|
||||
* Static function to call as a scheduled Job to clear Grav cache
|
||||
*
|
||||
* @param $type
|
||||
* @param string $type
|
||||
*/
|
||||
public static function clearJob($type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Validation
|
|||
/**
|
||||
* Validate value against a blueprint field definition.
|
||||
*
|
||||
* @param $value
|
||||
* @param mixed $value
|
||||
* @param array $field
|
||||
* @return array
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
namespace Grav\Common;
|
||||
|
||||
use DebugBar\DataCollector\ConfigCollector;
|
||||
use DebugBar\DataCollector\DataCollectorInterface;
|
||||
use DebugBar\DataCollector\ExceptionsCollector;
|
||||
use DebugBar\DataCollector\MemoryCollector;
|
||||
use DebugBar\DataCollector\MessagesCollector;
|
||||
|
|
@ -181,7 +182,7 @@ class Debugger
|
|||
/**
|
||||
* Adds a data collector
|
||||
*
|
||||
* @param $collector
|
||||
* @param DataCollectorInterface $collector
|
||||
*
|
||||
* @return $this
|
||||
* @throws \DebugBar\DebugBarException
|
||||
|
|
@ -196,9 +197,9 @@ class Debugger
|
|||
/**
|
||||
* Returns a data collector
|
||||
*
|
||||
* @param $collector
|
||||
* @param DataCollectorInterface $collector
|
||||
*
|
||||
* @return \DebugBar\DataCollector\DataCollectorInterface
|
||||
* @return DataCollectorInterface
|
||||
* @throws \DebugBar\DebugBarException
|
||||
*/
|
||||
public function getCollector($collector)
|
||||
|
|
@ -297,7 +298,7 @@ class Debugger
|
|||
/**
|
||||
* Dump variables into the Messages tab of the Debug Bar
|
||||
*
|
||||
* @param $message
|
||||
* @param mixed $message
|
||||
* @param string $label
|
||||
* @param bool $isString
|
||||
*
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class Errors
|
|||
} catch (\Exception $e) {
|
||||
echo $e;
|
||||
}
|
||||
}, 'log');
|
||||
});
|
||||
}
|
||||
|
||||
$whoops->register();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class SimplePageHandler extends Handler
|
|||
}
|
||||
|
||||
/**
|
||||
* @param $resource
|
||||
* @param string $resource
|
||||
*
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ abstract class Folder
|
|||
/**
|
||||
* Recursively find the last modified time under given path by file.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $path
|
||||
* @param string $extensions which files to search for specifically
|
||||
*
|
||||
* @return int
|
||||
|
|
@ -87,7 +87,7 @@ abstract class Folder
|
|||
/**
|
||||
* Recursively md5 hash all files in a path
|
||||
*
|
||||
* @param $path
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
public static function hashAllFiles($path)
|
||||
|
|
@ -437,8 +437,8 @@ abstract class Folder
|
|||
/**
|
||||
* Recursive copy of one directory to another
|
||||
*
|
||||
* @param $src
|
||||
* @param $dest
|
||||
* @param string $src
|
||||
* @param string $dest
|
||||
*
|
||||
* @return bool
|
||||
* @throws \RuntimeException
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class RecursiveDirectoryFilterIterator extends \RecursiveFilterIterator
|
|||
*/
|
||||
public function accept()
|
||||
{
|
||||
/** @var $file \SplFileInfo */
|
||||
/** @var \SplFileInfo $file */
|
||||
$file = $this->current();
|
||||
$filename = $file->getFilename();
|
||||
$relative_filename = str_replace($this::$root . '/', '', $file->getPathname());
|
||||
|
|
@ -57,7 +57,11 @@ class RecursiveDirectoryFilterIterator extends \RecursiveFilterIterator
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getChildren() {
|
||||
return new self($this->getInnerIterator()->getChildren(), $this::$root, $this::$ignore_folders, $this::$ignore_files);
|
||||
public function getChildren()
|
||||
{
|
||||
/** @var RecursiveDirectoryFilterIterator $iterator */
|
||||
$iterator = $this->getInnerIterator();
|
||||
|
||||
return new self($iterator->getChildren(), $this::$root, $this::$ignore_folders, $this::$ignore_files);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class RecursiveFolderFilterIterator extends \RecursiveFilterIterator
|
|||
*/
|
||||
public function accept()
|
||||
{
|
||||
/** @var $current \SplFileInfo */
|
||||
/** @var \SplFileInfo $current */
|
||||
$current = $this->current();
|
||||
|
||||
return $current->isDir() && !in_array($current->getFilename(), $this::$ignore_folders, true);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class GPM extends Iterator
|
|||
|
||||
/**
|
||||
* Internal cache
|
||||
* @var
|
||||
* @var array
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
|
|
@ -55,6 +55,7 @@ class GPM extends Iterator
|
|||
public function __construct($refresh = false, $callback = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->cache = [];
|
||||
$this->installed = new Local\Packages();
|
||||
try {
|
||||
$this->repository = new Remote\Packages($refresh, $callback);
|
||||
|
|
@ -263,7 +264,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Get the latest release of a package from the GPM
|
||||
*
|
||||
* @param $package_name
|
||||
* @param string $package_name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
|
@ -352,7 +353,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Get the release type of a package (stable / testing)
|
||||
*
|
||||
* @param $package_name
|
||||
* @param string $package_name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
|
|
@ -375,7 +376,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Returns true if the package latest release is stable
|
||||
*
|
||||
* @param $package_name
|
||||
* @param string $package_name
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
|
@ -387,7 +388,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Returns true if the package latest release is testing
|
||||
*
|
||||
* @param $package_name
|
||||
* @param string $package_name
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
|
@ -504,8 +505,8 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Download the zip package via the URL
|
||||
*
|
||||
* @param $package_file
|
||||
* @param $tmp
|
||||
* @param string $package_file
|
||||
* @param string $tmp
|
||||
* @return null|string
|
||||
*/
|
||||
public static function downloadPackage($package_file, $tmp)
|
||||
|
|
@ -531,8 +532,8 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Copy the local zip package to tmp
|
||||
*
|
||||
* @param $package_file
|
||||
* @param $tmp
|
||||
* @param string $package_file
|
||||
* @param string $tmp
|
||||
* @return null|string
|
||||
*/
|
||||
public static function copyPackage($package_file, $tmp)
|
||||
|
|
@ -552,7 +553,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Try to guess the package type from the source files
|
||||
*
|
||||
* @param $source
|
||||
* @param string $source
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function getPackageType($source)
|
||||
|
|
@ -597,7 +598,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Try to guess the package name from the source files
|
||||
*
|
||||
* @param $source
|
||||
* @param string $source
|
||||
* @return bool|string
|
||||
*/
|
||||
public static function getPackageName($source)
|
||||
|
|
@ -637,8 +638,8 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Get the install path for a name and a particular type of package
|
||||
*
|
||||
* @param $type
|
||||
* @param $name
|
||||
* @param string $type
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public static function getInstallPath($type, $name)
|
||||
|
|
@ -807,7 +808,7 @@ class GPM extends Iterator
|
|||
/**
|
||||
* Check the passed packages list can be updated
|
||||
*
|
||||
* @param $packages_names_list
|
||||
* @param array $packages_names_list
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,23 +26,23 @@ parameters:
|
|||
- '#PHPDoc tag \@throws with type Psr\\SimpleCache\\(CacheException|InvalidArgumentException) is not subtype of Throwable#'
|
||||
|
||||
# Those errors are about plugins (need to find a better solution)
|
||||
|
||||
-
|
||||
message: '#Call to static method sendEmail\(\) on an unknown class Grav\\Plugin\\Email\\Utils.#'
|
||||
path: 'system/src/Grav/Common/Scheduler/Job.php'
|
||||
|
||||
# Can be ignored, after fopen there's always an $http_response_header locally available
|
||||
|
||||
-
|
||||
message: '#Variable \$http_response_header in isset\(\) always exists and is not nullable.#'
|
||||
path: 'system/src/Grav/Common/GPM/Response.php'
|
||||
|
||||
|
||||
# Those errors can be ignored (they depends on installed extensions)
|
||||
|
||||
-
|
||||
message: '#Instantiated class (Memcache|Memcached|Redis|RedisException) not found#'
|
||||
path: 'system/src/Grav/Common/Cache.php'
|
||||
-
|
||||
message: '#on an unknown class (Memcache|Memcached|Redis|RedisException)#'
|
||||
path: 'system/src/Grav/Common/Cache.php'
|
||||
-
|
||||
message: '#on an unknown class Collator#'
|
||||
path: 'system/src/Grav/Common/Page/Pages.php'
|
||||
Loading…
Reference in New Issue
Block a user