Phpstan fixes

This commit is contained in:
Matias Griese 2021-03-31 22:11:55 +03:00
parent e97fe9de86
commit 67f172b741
6 changed files with 15 additions and 8 deletions

View File

@ -176,11 +176,10 @@ abstract class BaseAsset extends PropertyObject
/**
* Receive asset location and return the SRI integrity hash
*
* @param $input
*
* @param string $input
* @return string
*/
public static function integrityHash( $input )
public static function integrityHash($input)
{
$grav = Grav::instance();

View File

@ -127,7 +127,6 @@ class Cache extends Getters
*/
public function init(Grav $grav)
{
/** @var Config $config */
$this->config = $grav['config'];
$this->now = time();

View File

@ -524,8 +524,12 @@ class Blueprint extends BlueprintForm
* @param string $op
* @return bool
*/
protected function resolveActions(UserInterface $user, array $actions, string $op = 'and')
protected function resolveActions(?UserInterface $user, array $actions, string $op = 'and')
{
if (null === $user) {
return false;
}
$c = $i = count($actions);
foreach ($actions as $key => $action) {
if (!is_int($key) && is_array($actions)) {

View File

@ -128,12 +128,12 @@ class Session extends \Grav\Framework\Session\Session
/** @var Uri $uri */
$uri = $grav['uri'];
/** @var Forms|null $form */
$form = $grav['forms']->getActiveForm();
$form = $grav['forms']->getActiveForm(); // @phpstan-ignore-line
$sessionField = base64_encode($uri->url);
/** @var FormFlash|null $flash */
$flash = $form ? $form->getFlash() : null;
$flash = $form ? $form->getFlash() : null; // @phpstan-ignore-line
$object = $flash && method_exists($flash, 'getLegacyFiles') ? [$sessionField => $flash->getLegacyFiles()] : null;
}
}

View File

@ -384,7 +384,7 @@ trait FlexMediaTrait
$updated = true;
if ($medium) {
$media->add($filename, $medium);
} else {
} elseif (is_callable([$media, 'hide'])) {
$media->hide($filename);
}
}

View File

@ -161,3 +161,8 @@ parameters:
- '#Call to deprecated method stopPropagation\(\) of class Symfony\\Component\\EventDispatcher\\Event#'
- '#Parameter \#2 \$listener of method Symfony\\Component\\EventDispatcher\\EventDispatcher::addListener\(\)#'
- '#Parameter \#2 \$listener of method Symfony\\Component\\EventDispatcher\\EventDispatcher::removeListener\(\)#'
# Installer updates
-
message: '#Variable \$this in PHPDoc tag @var does not exist#'
path: '*/system/src/Grav/Installer/updates/*'