Fix PHPStan errors (#20523)

This commit is contained in:
Maksim Spirkov
2025-09-16 00:38:06 +04:00
committed by GitHub
parent 04202f04f5
commit 53bdfc3b2c
6 changed files with 14 additions and 3 deletions

View File

@ -436,7 +436,7 @@ class ReleaseController extends Controller
$this->stdout("done.\n", Console::FG_GREEN, Console::BOLD); $this->stdout("done.\n", Console::FG_GREEN, Console::BOLD);
$this->stdout('updating mimetype magic file and mime aliases...', Console::BOLD); $this->stdout('updating mimetype magic file and mime aliases...', Console::BOLD);
$this->dryRun || Yii::$app->runAction('mime-type', ["$frameworkPath/helpers/mimeTypes.php"], ["$frameworkPath/helpers/mimeAliases.php"]); $this->dryRun || Yii::$app->runAction('mime-type', ["$frameworkPath/helpers/mimeTypes.php"]);
$this->stdout("done.\n", Console::FG_GREEN, Console::BOLD); $this->stdout("done.\n", Console::FG_GREEN, Console::BOLD);
$this->stdout("fixing various PHPDoc style issues...\n", Console::BOLD); $this->stdout("fixing various PHPDoc style issues...\n", Console::BOLD);

View File

@ -8,6 +8,10 @@ use yii\helpers\Html;
* @var string $sourcePath * @var string $sourcePath
* @var string $translationPath * @var string $translationPath
* @var array $results * @var array $results
*
* @phpstan-var \yii\web\View&object{
* context: \yii\build\controllers\TranslationController,
* } $this
*/ */
?><!doctype html> ?><!doctype html>

View File

@ -675,6 +675,7 @@ class Container extends Component
$class = $param->getType(); $class = $param->getType();
if ($class instanceof \ReflectionUnionType || (PHP_VERSION_ID >= 80100 && $class instanceof \ReflectionIntersectionType)) { if ($class instanceof \ReflectionUnionType || (PHP_VERSION_ID >= 80100 && $class instanceof \ReflectionIntersectionType)) {
$isClass = false; $isClass = false;
/** @var ReflectionNamedType $type */
foreach ($class->getTypes() as $type) { foreach ($class->getTypes() as $type) {
if (!$type->isBuiltin()) { if (!$type->isBuiltin()) {
$class = $type; $class = $type;
@ -683,6 +684,7 @@ class Container extends Component
} }
} }
} else { } else {
/** @var ReflectionNamedType|null $class */
$isClass = $class !== null && !$class->isBuiltin(); $isClass = $class !== null && !$class->isBuiltin();
} }
} else { } else {

View File

@ -319,6 +319,8 @@ class YiiRequirementChecker
} else { } else {
require $_viewFile_; require $_viewFile_;
} }
return null;
} }
/** /**

View File

@ -67,7 +67,7 @@ class InlineValidator extends Validator
if (is_string($method)) { if (is_string($method)) {
$method = [$model, $method]; $method = [$model, $method];
} elseif ($method instanceof \Closure) { } elseif ($method instanceof \Closure) {
$method = $this->method->bindTo($model); $method = $method->bindTo($model);
} }
$current = $this->current; $current = $this->current;

View File

@ -52,7 +52,10 @@ class Controller extends \yii\base\Controller
*/ */
public function renderAjax($view, $params = []) public function renderAjax($view, $params = [])
{ {
return $this->getView()->renderAjax($view, $params, $this); /** @var View */
$viewComponent = $this->getView();
return $viewComponent->renderAjax($view, $params, $this);
} }
/** /**