Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/Cookie/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ public function offsetGet($offset): bool|int|string
/**
* Offset to set.
*
* @param string $offset
* @param string|null $offset
* @param bool|int|string $value
*
* @throws LogicException
Expand Down
8 changes: 6 additions & 2 deletions system/I18n/TimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,10 +1239,14 @@ public function __isset($name): bool
/**
* This is called when we unserialize the Time object.
*
* @param array{date: string, timezone: string, timezone_type: int} $data
* @param array<mixed, mixed> $data
*/
public function __unserialize(array $data): void
{
parent::__construct($data['date'], new DateTimeZone($data['timezone']));
$date = $data['date'] ?? null;
$timezone = $data['timezone'] ?? null;
assert(is_string($date) && is_string($timezone));

parent::__construct($date, new DateTimeZone($timezone));
}
}
4 changes: 2 additions & 2 deletions system/Log/Handlers/ChromeLoggerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public function __construct(array $config = [])
* will stop. Any handlers that have not run, yet, will not
* be run.
*
* @param string $level
* @param string $message
* @param string $level
* @param object|string $message
*/
public function handle($level, $message): bool
{
Expand Down
23 changes: 10 additions & 13 deletions tests/system/CodeIgniterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function testRunClosureRoute(): void

// Inject mock router.
$routes = service('routes');
$routes->add('pages/(:segment)', static function ($segment): void {
$routes->add('pages/(:segment)', static function (string $segment = ''): void {
echo 'You want to see "' . esc($segment) . '" page.';
});
$router = service('router', $routes, service('incomingrequest'));
Expand Down Expand Up @@ -231,7 +231,7 @@ public function testControllersCanReturnString(): void
$routes = service('routes');
$routes->add(
'pages/(:segment)',
static fn ($segment): string => 'You want to see "' . esc($segment) . '" page.',
static fn (string $segment = ''): string => 'You want to see "' . esc($segment) . '" page.',
);
$router = service('router', $routes, service('incomingrequest'));
Services::injectMock('router', $router);
Expand All @@ -253,12 +253,10 @@ public function testControllersCanReturnResponseObject(): void

// Inject mock router.
$routes = service('routes');
$routes->add('pages/(:segment)', static function ($segment) {
$response = service('response');
$string = "You want to see 'about' page.";

return $response->setBody($string);
});
$routes->add(
'pages/(:segment)',
static fn () => service('response')->setBody("You want to see 'about' page."),
);
$router = service('router', $routes, service('incomingrequest'));
Services::injectMock('router', $router);

Expand All @@ -282,11 +280,10 @@ public function testControllersCanReturnDownloadResponseObject(): void

// Inject mock router.
$routes = service('routes');
$routes->add('pages/(:segment)', static function ($segment) {
$response = service('response');

return $response->download('some.txt', 'some text', true);
});
$routes->add(
'pages/(:segment)',
static fn () => service('response')->download('some.txt', 'some text', true),
);
$router = service('router', $routes, service('incomingrequest'));
Services::injectMock('router', $router);

Expand Down
2 changes: 1 addition & 1 deletion tests/system/RESTful/ResourceControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function testFormat(): void
$resource = new MockResourceController();
$this->assertSame('json', $resource->getFormat());

$resource->setFormat('Nonsense');
$resource->setFormat('Nonsense'); // @phpstan-ignore argument.type (Testing that an invalid format is silently ignored)
$this->assertSame('json', $resource->getFormat());

$resource->setFormat('xml');
Expand Down
33 changes: 0 additions & 33 deletions utils/phpstan-baseline/argument.type.neon

This file was deleted.

4 changes: 1 addition & 3 deletions utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# total 24 errors
# total 13 errors

includes:
- argument.type.neon
- arguments.count.neon
- assign.propertyType.neon
- deadCode.unreachable.neon
- function.resultUnused.neon
- method.childParameterType.neon
- method.childReturnType.neon
- missingType.iterableValue.neon
- property.defaultValue.neon
Expand Down
28 changes: 0 additions & 28 deletions utils/phpstan-baseline/method.childParameterType.neon

This file was deleted.

Loading