Skip to content

Commit 7740173

Browse files
committed
refactor: remove PHPStan callable signature baseline
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
1 parent 6c4acef commit 7740173

10 files changed

Lines changed: 15 additions & 78 deletions

File tree

system/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
* @method $this selectMax(string $select = '', string $alias = '')
7979
* @method $this selectMin(string $select = '', string $alias = '')
8080
* @method $this selectSum(string $select = '', string $alias = '')
81-
* @method $this when($condition, callable $callback, ?callable $defaultCallback = null)
82-
* @method $this whenNot($condition, callable $callback, ?callable $defaultCallback = null)
81+
* @method $this when($condition, callable(BaseBuilder, mixed): mixed $callback, (callable(BaseBuilder): mixed)|null $defaultCallback = null)
82+
* @method $this whenNot($condition, callable(BaseBuilder, mixed): mixed $callback, (callable(BaseBuilder): mixed)|null $defaultCallback = null)
8383
* @method $this where($key, $value = null, ?bool $escape = null)
8484
* @method $this whereIn(?string $key = null, $values = null, ?bool $escape = null)
8585
* @method $this whereNotIn(?string $key = null, $values = null, ?bool $escape = null)

system/Router/RouteCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ public function setAutoRoute(bool $value): RouteCollectionInterface
479479
*
480480
* This setting is passed to the Router class and handled there.
481481
*
482-
* @param callable|string|null $callable
482+
* @param (callable(string): (ResponseInterface|string|void))|string|null $callable
483483
*/
484484
public function set404Override($callable = null): RouteCollectionInterface
485485
{
@@ -763,7 +763,7 @@ public function getRedirectCode(string $routeKey): int
763763
* });
764764
*
765765
* @param string $name The name to group/prefix the routes with.
766-
* @param array|callable ...$params
766+
* @param array|(callable(self): void) ...$params
767767
*
768768
* @return void
769769
*/

system/Router/RouteCollectionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function setAutoRoute(bool $value): self;
117117
*
118118
* This setting is passed to the Router class and handled there.
119119
*
120-
* @param callable|null $callable
120+
* @param (callable(string): (ResponseInterface|string|void))|string|null $callable
121121
*
122122
* @TODO This method is not related to the route collection. So this should
123123
* be removed in the future.

system/Router/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ protected function setDefaultController()
745745
}
746746

747747
/**
748-
* @param callable|string $handler
748+
* @param (callable(mixed...): (ResponseInterface|string|void))|string $handler
749749
*/
750750
protected function setMatchedRoute(string $route, $handler): void
751751
{

system/View/Parser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,8 @@ protected function parsePlugins(string $template)
721721
/**
722722
* Makes a new plugin available during the parsing of the template.
723723
*
724+
* @param (callable(array<int|string, string>): string)|(callable(string, array<int|string, string>): string) $callback
725+
*
724726
* @return $this
725727
*/
726728
public function addPlugin(string $alias, callable $callback, bool $isPair = false)

system/View/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Table
8383
/**
8484
* Callback for custom table layout
8585
*
86-
* @var callable|null
86+
* @var (callable(mixed): mixed)|string|null
8787
*/
8888
public $function;
8989

tests/system/DataConverter/DataConverterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,10 @@ public function testNotNullable(): void
705705
$converter->toDataSource($dbData);
706706
}
707707

708+
/**
709+
* @param (Closure(array<string, mixed>): object)|string|null $reconstructor
710+
* @param (Closure(object, bool, bool): array<string, mixed>)|string|null $extractor
711+
*/
708712
private function createDataConverter(
709713
array $types,
710714
array $handlers = [],

utils/phpstan-baseline/assign.propertyType.neon

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 29 errors
1+
# total 28 errors
22

33
parameters:
44
ignoreErrors:
@@ -96,8 +96,3 @@ parameters:
9696
message: '#^Property CodeIgniter\\View\\ParserPluginTest\:\:\$validator \(CodeIgniter\\Validation\\Validation\) does not accept CodeIgniter\\Validation\\ValidationInterface\.$#'
9797
count: 1
9898
path: ../../tests/system/View/ParserPluginTest.php
99-
100-
-
101-
message: '#^Property CodeIgniter\\View\\Table\:\:\$function \(\(callable\(\)\: mixed\)\|null\) does not accept ''ticklemyfancy''\.$#'
102-
count: 1
103-
path: ../../tests/system/View/TableTest.php

utils/phpstan-baseline/loader.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# total 2055 errors
1+
# total 2042 errors
22

33
includes:
44
- argument.type.neon
@@ -16,7 +16,6 @@ includes:
1616
- method.childParameterType.neon
1717
- method.childReturnType.neon
1818
- method.notFound.neon
19-
- missingType.callable.neon
2019
- missingType.iterableValue.neon
2120
- missingType.parameter.neon
2221
- missingType.property.neon

utils/phpstan-baseline/missingType.callable.neon

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)