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
3 changes: 2 additions & 1 deletion system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
* - process various callbacks
* - allow intermingling calls to the db connection
*
* @phpstan-type row_array array<int|string, float|int|null|object|string|bool>
* @phpstan-type row_array array<int|string, float|int|null|object|string|bool>
* @psalm-type row_array = array<int|string, float|int|null|object|string|bool>
* @phpstan-type event_data_beforeinsert array{data: row_array}
* @phpstan-type event_data_afterinsert array{id: int|string, data: row_array, result: bool}
* @phpstan-type event_data_beforefind array{id?: int|string, method: string, singleton: bool, limit?: int, offset?: int}
Expand Down
3 changes: 3 additions & 0 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@
* @method $this whereIn(?string $key = null, $values = null, ?bool $escape = null)
* @method $this whereNotIn(?string $key = null, $values = null, ?bool $escape = null)
*
* @phpstan-method $this when($condition, callable(BaseBuilder, mixed): mixed $callback, (callable(BaseBuilder): mixed)|null $defaultCallback = null)
* @phpstan-method $this whenNot($condition, callable(BaseBuilder, mixed): mixed $callback, (callable(BaseBuilder): mixed)|null $defaultCallback = null)
* @phpstan-import-type row_array from BaseModel
* @psalm-import-type row_array from BaseModel
*/
class Model extends BaseModel
{
Expand Down
6 changes: 3 additions & 3 deletions system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public function setAutoRoute(bool $value): RouteCollectionInterface
*
* This setting is passed to the Router class and handled there.
*
* @param callable|string|null $callable
* @param (callable(string): (ResponseInterface|string|void))|string|null $callable
*/
public function set404Override($callable = null): RouteCollectionInterface
{
Expand Down Expand Up @@ -762,8 +762,8 @@ public function getRedirectCode(string $routeKey): int
* $route->resource('users');
* });
*
* @param string $name The name to group/prefix the routes with.
* @param array|callable ...$params
* @param string $name The name to group/prefix the routes with.
* @param array|(callable(self): void) ...$params
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion system/Router/RouteCollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function setAutoRoute(bool $value): self;
*
* This setting is passed to the Router class and handled there.
*
* @param callable|null $callable
* @param (callable(string): (ResponseInterface|string|void))|string|null $callable
*
* @TODO This method is not related to the route collection. So this should
* be removed in the future.
Expand Down
2 changes: 1 addition & 1 deletion system/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ protected function setDefaultController()
}

/**
* @param callable|string $handler
* @param (callable(mixed...): (ResponseInterface|string|void))|string $handler
*/
protected function setMatchedRoute(string $route, $handler): void
{
Expand Down
2 changes: 2 additions & 0 deletions system/View/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@ protected function parsePlugins(string $template)
/**
* Makes a new plugin available during the parsing of the template.
*
* @param (callable(array<int|string, string>): string)|(callable(string, array<int|string, string>): string) $callback
*
* @return $this
*/
public function addPlugin(string $alias, callable $callback, bool $isPair = false)
Expand Down
2 changes: 1 addition & 1 deletion system/View/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Table
/**
* Callback for custom table layout
*
* @var callable|null
* @var (callable(mixed): mixed)|string|null
*/
public $function;

Expand Down
4 changes: 4 additions & 0 deletions tests/system/DataConverter/DataConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,10 @@ public function testNotNullable(): void
$converter->toDataSource($dbData);
}

/**
* @param (Closure(array<string, mixed>): object)|string|null $reconstructor
* @param (Closure(object, bool, bool): array<string, mixed>)|string|null $extractor
*/
private function createDataConverter(
array $types,
array $handlers = [],
Expand Down
7 changes: 1 addition & 6 deletions utils/phpstan-baseline/assign.propertyType.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 29 errors
# total 28 errors

parameters:
ignoreErrors:
Expand Down Expand Up @@ -96,8 +96,3 @@ parameters:
message: '#^Property CodeIgniter\\View\\ParserPluginTest\:\:\$validator \(CodeIgniter\\Validation\\Validation\) does not accept CodeIgniter\\Validation\\ValidationInterface\.$#'
count: 1
path: ../../tests/system/View/ParserPluginTest.php

-
message: '#^Property CodeIgniter\\View\\Table\:\:\$function \(\(callable\(\)\: mixed\)\|null\) does not accept ''ticklemyfancy''\.$#'
count: 1
path: ../../tests/system/View/TableTest.php
3 changes: 1 addition & 2 deletions utils/phpstan-baseline/loader.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 2055 errors
# total 2042 errors

includes:
- argument.type.neon
Expand All @@ -16,7 +16,6 @@ includes:
- method.childParameterType.neon
- method.childReturnType.neon
- method.notFound.neon
- missingType.callable.neon
- missingType.iterableValue.neon
- missingType.parameter.neon
- missingType.property.neon
Expand Down
63 changes: 0 additions & 63 deletions utils/phpstan-baseline/missingType.callable.neon

This file was deleted.

Loading