diff --git a/phpstan.neon b/phpstan.neon index 44903ed..efda0f0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,7 +12,7 @@ parameters: checkGenericClassInNonGenericObjectType: false ignoreErrors: # All Yii setters accept `null` but their phpdoc is incorrect. - - message: '~^Parameter #1 \$value of method yii\\web\\Request::set(.*)\(\) expects (.*), null given.$~' + - message: '~^Parameter #1 \$(.+) of method yii\\web\\Request::set(.+)\(\) expects (.+), null given.$~' path: 'src/' - message: '~^Variable \$_COOKIE in isset\(\) always exists and is not nullable.$~' path: 'src/' diff --git a/src/Codeception/Lib/Connector/Yii2.php b/src/Codeception/Lib/Connector/Yii2.php index 2b7064d..b7c7519 100644 --- a/src/Codeception/Lib/Connector/Yii2.php +++ b/src/Codeception/Lib/Connector/Yii2.php @@ -329,9 +329,9 @@ public function doRequest(object $request): \Symfony\Component\BrowserKit\Respon $yiiRequest = $app->getRequest(); if ($request->getContent() !== null) { $yiiRequest->setRawBody($request->getContent()); - $yiiRequest->setBodyParams([]); + $yiiRequest->setBodyParams(null); } else { - $yiiRequest->setRawBody(''); + $yiiRequest->setRawBody(null); $yiiRequest->setBodyParams($_POST); } $yiiRequest->setQueryParams($_GET); diff --git a/src/Codeception/Module/Yii2.php b/src/Codeception/Module/Yii2.php index 06315ca..06d09d8 100644 --- a/src/Codeception/Module/Yii2.php +++ b/src/Codeception/Module/Yii2.php @@ -690,36 +690,6 @@ public function amOnRoute(string $route, array $params = []): void $this->amOnPage(Url::to($params)); } - /** - * Opens the page for the given relative URI or route. - * - * ``` php - * amOnPage('/'); - * // opens /register page - * $I->amOnPage('/register'); - * ``` - * - * @param string $page the page URI - */ - public function amOnPage(string $page): void - { - parent::amOnPage($page); - } - - /** - * To support to use the behavior of urlManager component - * for the methods like this: amOnPage(), sendAjaxRequest() and etc. - * @param array $parameters - * @param array $files - * @param array $server - */ - protected function clientRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): SymfonyCrawler - { - return parent::clientRequest($method, \Yii::$app->urlManager->createUrl($uri), $parameters, $files, $server, $content, $changeHistory); - } - /** * Gets a component from the Yii container. Throws an exception if the * component is not available @@ -729,12 +699,10 @@ protected function clientRequest(string $method, string $uri, array $parameters * $mailer = $I->grabComponent('mailer'); * ``` * - * @param $component - * @return mixed * @throws \Codeception\Exception\ModuleException * @deprecated in your tests you can use \Yii::$app directly. */ - public function grabComponent(mixed $component) + public function grabComponent(string $component): null|object { try { return $this->getClient()->getComponent($component);