fix: Update the typing

This commit is contained in:
neznaika0 2024-11-05 21:33:01 +03:00
parent 583e7b61da
commit ea3894755d
No known key found for this signature in database
GPG Key ID: CEB9213A41AAA3EB
8 changed files with 13 additions and 27 deletions

View File

@ -1,6 +1,5 @@
<?php
use CodeIgniter\HTTP\Header;
use Config\Services;
use CodeIgniter\CodeIgniter;
$errorId = uniqid('error', true);

View File

@ -18361,12 +18361,6 @@ $ignoreErrors[] = [
'count' => 1,
'path' => __DIR__ . '/tests/system/View/ParserTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.iterableValue
'message' => '#^Method class@anonymous/tests/system/View/ParserTest\\.php\\:340\\:\\:toArray\\(\\) return type has no value type specified in iterable type array\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/View/ParserTest.php',
];
$ignoreErrors[] = [
// identifier: argument.type
'message' => '#^Parameter \\#2 \\$context of method CodeIgniter\\\\View\\\\Parser\\:\\:setData\\(\\) expects \'attr\'\\|\'css\'\\|\'html\'\\|\'js\'\\|\'raw\'\\|\'url\'\\|null, \'unknown\' given\\.$#',
@ -18379,18 +18373,6 @@ $ignoreErrors[] = [
'count' => 1,
'path' => __DIR__ . '/tests/system/View/ParserTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:340\\:\\:\\$bar has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/View/ParserTest.php',
];
$ignoreErrors[] = [
// identifier: missingType.property
'message' => '#^Property class@anonymous/tests/system/View/ParserTest\\.php\\:340\\:\\:\\$foo has no type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/tests/system/View/ParserTest.php',
];
$ignoreErrors[] = [
// identifier: method.notFound
'message' => '#^Call to an undefined method CodeIgniter\\\\View\\\\Table\\:\\:compileTemplate\\(\\)\\.$#',

View File

@ -13,7 +13,6 @@ declare(strict_types=1);
namespace CodeIgniter\Exceptions;
use Config\Services;
use OutOfBoundsException;
class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface, HTTPExceptionInterface

View File

@ -155,7 +155,7 @@ class ChromeLoggerHandler extends BaseHandler
*/
public function sendLogs(?ResponseInterface &$response = null)
{
if ($response instanceof ResponseInterface) {
if (! $response instanceof ResponseInterface) {
$response = service('response', null, true);
}

View File

@ -15,6 +15,7 @@ namespace CodeIgniter\Filters;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\Response;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Filters as FilterConfig;
@ -31,7 +32,7 @@ final class DebugToolbarTest extends CIUnitTestCase
/**
* @var CLIRequest|IncomingRequest
*/
private $request;
private RequestInterface $request;
private Response $response;

View File

@ -16,6 +16,7 @@ namespace CodeIgniter\Filters;
use CodeIgniter\Honeypot\Exceptions\HoneypotException;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\Response;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Honeypot;
@ -36,9 +37,9 @@ final class HoneypotTest extends CIUnitTestCase
private Honeypot $honey;
/**
* @var CLIRequest|IncomingRequest|null
* @var CLIRequest|IncomingRequest
*/
private $request;
private RequestInterface $request;
private ?Response $response = null;

View File

@ -18,6 +18,7 @@ use CodeIgniter\Filters\Filters;
use CodeIgniter\Honeypot\Exceptions\HoneypotException;
use CodeIgniter\HTTP\CLIRequest;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\Response;
use CodeIgniter\Test\CIUnitTestCase;
use Config\App;
@ -38,7 +39,7 @@ final class HoneypotTest extends CIUnitTestCase
/**
* @var CLIRequest|IncomingRequest
*/
private $request;
private RequestInterface $request;
private Response $response;

View File

@ -337,9 +337,12 @@ final class ParserTest extends CIUnitTestCase
public function testParseLoopEntityProperties(): void
{
$power = new class () extends Entity {
public $foo = 'bar';
protected $bar = 'baz';
public string $foo = 'bar';
protected string $bar = 'baz';
/**
* @return array<string, mixed>
*/
public function toArray(bool $onlyChanged = false, bool $cast = true, bool $recursive = false): array
{
return [