Skip to content

Commit

Permalink
fix: Update the typing
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Nov 5, 2024
1 parent 6ccda8a commit ac0b7db
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 27 deletions.
1 change: 0 additions & 1 deletion app/Views/errors/html/error_exception.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
use CodeIgniter\HTTP\Header;
use Config\Services;
use CodeIgniter\CodeIgniter;

$errorId = uniqid('error', true);
Expand Down
18 changes: 0 additions & 18 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -18367,12 +18367,6 @@
'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\\.$#',
Expand All @@ -18385,18 +18379,6 @@
'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\\(\\)\\.$#',
Expand Down
1 change: 0 additions & 1 deletion system/Exceptions/PageNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace CodeIgniter\Exceptions;

use Config\Services;
use OutOfBoundsException;

class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface, HTTPExceptionInterface
Expand Down
2 changes: 1 addition & 1 deletion system/Log/Handlers/ChromeLoggerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected function format($object)
*/
public function sendLogs(?ResponseInterface &$response = null)
{
if ($response instanceof ResponseInterface) {
if (! $response instanceof ResponseInterface) {
$response = service('response', null, true);
}

Expand Down
3 changes: 2 additions & 1 deletion tests/system/Filters/DebugToolbarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

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;
Expand All @@ -31,7 +32,7 @@ final class DebugToolbarTest extends CIUnitTestCase
/**
* @var CLIRequest|IncomingRequest
*/
private $request;
private RequestInterface $request;

private Response $response;

Expand Down
5 changes: 3 additions & 2 deletions tests/system/Filters/HoneypotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
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;
Expand All @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion tests/system/Honeypot/HoneypotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;
Expand All @@ -38,7 +39,7 @@ final class HoneypotTest extends CIUnitTestCase
/**
* @var CLIRequest|IncomingRequest
*/
private $request;
private RequestInterface $request;

private Response $response;

Expand Down
7 changes: 5 additions & 2 deletions tests/system/View/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,12 @@ public function testParseNull(): void
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 [
Expand Down

0 comments on commit ac0b7db

Please sign in to comment.