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 admin/framework/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"codeigniter/coding-standard": "^1.7",
"fakerphp/faker": "^1.24",
"friendsofphp/php-cs-fixer": "^3.47.1",
"kint-php/kint": "^6.1",
"kint-php/kint": "^6.0",
"mikey179/vfsstream": "^1.6.12",
"nexusphp/cs-config": "^3.6",
"phpunit/phpunit": "^10.5.16 || ^11.2",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require-dev": {
"codeigniter/phpstan-codeigniter": "1.x-dev",
"fakerphp/faker": "^1.24",
"kint-php/kint": "^6.1",
"kint-php/kint": "^6.0",
"mikey179/vfsstream": "^1.6.12",
"nexusphp/tachycardia": "^2.0",
"phpstan/extension-installer": "^1.4",
Expand Down
15 changes: 8 additions & 7 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ abstract protected function doFindColumn(string $columnName);
* @param int|null $limit Limit
* @param int $offset Offset
*
* @return array
* @return array<int,array<int|string,bool|float|int|object|string|null>|object>
*/
abstract protected function doFindAll(?int $limit = null, int $offset = 0);

Expand Down Expand Up @@ -629,7 +629,7 @@ public function find($id = null)
*
* @param string $columnName Column Name
*
* @return array|null The resulting row of data, or null if no data found.
* @return array<int,mixed>|null The resulting row of data, or null if no data found.
*
* @throws DataException
*/
Expand All @@ -650,7 +650,7 @@ public function findColumn(string $columnName)
* @param int $limit Limit
* @param int $offset Offset
*
* @return array
* @return array<mixed>
*/
public function findAll(?int $limit = null, int $offset = 0)
{
Expand Down Expand Up @@ -695,7 +695,7 @@ public function findAll(?int $limit = null, int $offset = 0)
/**
* Returns the first row of the result set.
*
* @return array|object|null
* @return array<string,mixed>|object|null
*/
public function first()
{
Expand Down Expand Up @@ -1593,9 +1593,10 @@ public function getValidationMessages(): array
* currently so that rules don't block updating when only updating
* a partial row.
*
* @param array $rules Array containing field name and rule
* @param array $row Row data (@TODO Remove null in param type)
* @param array<string,string> $rules
* @param array<string,mixed>|null $row
* @phpstan-param row_array $row
* @phpstan-return array<string,string>
*/
protected function cleanValidationRules(array $rules, ?array $row = null): array
{
Expand Down Expand Up @@ -1889,7 +1890,7 @@ protected function transformDataToArray($row, string $type): array
*
* @param string $name Name
*
* @return array|bool|float|int|object|string|null
* @return array<mixed>|bool|float|int|object|string|null
*/
public function __get(string $name)
{
Expand Down
4 changes: 4 additions & 0 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ public static function promptByMultipleKeys(string $text, array $options): array

/**
* Validation for $options in promptByKey() and promptByMultipleKeys(). Return an error if $options is an empty array.
*
* @param array<int,string> $options List of options
*
* @return void
*/
private static function isZeroOptions(array $options): void
{
Expand Down
2 changes: 2 additions & 0 deletions system/Commands/ListCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public function run(array $params)

/**
* Lists the commands with accompanying info.
*
* @param array<string,array<string,string>> $commands Array of commands keyed by name, each with metadata
*
* @return int
*/
Expand Down
9 changes: 9 additions & 0 deletions system/Commands/Translation/LocalizationFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ private function replaceArraySyntax(string $code): string

/**
* Create multidimensional array from another keys
*
* @param array<int,string> $fromKeys List of keys to build nested array
* @param string $lastArrayValue Value to assign at the deepest key
*
* @return array<string,mixed> Multidimensional associative array
*/
private function buildMultiArray(array $fromKeys, string $lastArrayValue = ''): array
{
Expand All @@ -323,6 +328,10 @@ private function buildMultiArray(array $fromKeys, string $lastArrayValue = ''):

/**
* Convert multi arrays to specific CLI table rows (flat array)
*
* @param array<int,mixed> $array Input translations (nested array or strings)
*
* @return array<int,array{0:string,1:string}> Flat list of table rows [langFileNames, value]
*/
private function arrayToTableRows(string $langFileName, array $array): array
{
Expand Down
5 changes: 5 additions & 0 deletions system/Commands/Utilities/Namespaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public function run(array $params)
CLI::table($tbody, $thead);
}

/**
* @param array{m:int,r?:mixed} $params
*
* @return array<int,array{0:string,1:string,2:string}>
*/
private function outputAllNamespaces(array $params): array
{
$maxLength = $params['m'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ public function get(): array
/**
* Adding Filters
*
* @param list<array<string, array|string>> $routes
* @param array<int,array<string,string|array<string>>> $routes List of route definitions
*
* @return array<int,array<string,string|array<string>>> $Updated route definitions with filters
*
* @return list<array<string, array|string>>
*/
private function addFilters(array $routes): array
{
Expand Down
1 change: 1 addition & 0 deletions system/Config/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public static function locator(bool $getShared = true)
* Provides the ability to perform case-insensitive calling of service
* names.
*
* @param array<int,mixed> $arguments
* @return object|null
*/
public static function __callStatic(string $name, array $arguments)
Expand Down
7 changes: 7 additions & 0 deletions system/Modules/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ public function shouldDiscover(string $alias): bool
return in_array(strtolower($alias), $this->aliases, true);
}

/**
* Restores the state of the object when exported with var_export()
*
* @param array<string,mixed> $array Properties and their values
*
* @return static
*/
public static function __set_state(array $array)
{
$obj = new static();
Expand Down
2 changes: 1 addition & 1 deletion system/ThirdParty/Escaper/Escaper.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function escapeCss(string $string)
protected function htmlAttrMatcher($matches)
{
$chr = $matches[0];
$ord = ord($chr);
$ord = ord($chr[0]);

/**
* The following replaces characters undefined in HTML with the
Expand Down
97 changes: 1 addition & 96 deletions utils/phpstan-baseline/missingType.iterableValue.neon
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# total 1375 errors
# total 1197 errors

parameters:
ignoreErrors:
Expand All @@ -7,21 +7,6 @@ parameters:
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:__get\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:cleanValidationRules\(\) has parameter \$rules with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:cleanValidationRules\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:convertToReturnType\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand All @@ -42,11 +27,6 @@ parameters:
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:doFindAll\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:doFindColumn\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -87,21 +67,6 @@ parameters:
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:findAll\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:findColumn\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:first\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\BaseModel\:\:getIdValue\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -177,11 +142,6 @@ parameters:
count: 1
path: ../../system/BaseModel.php

-
message: '#^Method CodeIgniter\\CLI\\CLI\:\:isZeroOptions\(\) has parameter \$options with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/CLI/CLI.php

-
message: '#^Method CodeIgniter\\CLI\\CLI\:\:printKeysAndValues\(\) has parameter \$options with no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -242,36 +202,11 @@ parameters:
count: 1
path: ../../system/CodeIgniter.php

-
message: '#^Method CodeIgniter\\Commands\\ListCommands\:\:listFull\(\) has parameter \$commands with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/ListCommands.php

-
message: '#^Method CodeIgniter\\Commands\\ListCommands\:\:listSimple\(\) has parameter \$commands with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/ListCommands.php

-
message: '#^Method CodeIgniter\\Commands\\Translation\\LocalizationFinder\:\:arrayToTableRows\(\) has parameter \$array with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Translation/LocalizationFinder.php

-
message: '#^Method CodeIgniter\\Commands\\Translation\\LocalizationFinder\:\:arrayToTableRows\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Translation/LocalizationFinder.php

-
message: '#^Method CodeIgniter\\Commands\\Translation\\LocalizationFinder\:\:buildMultiArray\(\) has parameter \$fromKeys with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Translation/LocalizationFinder.php

-
message: '#^Method CodeIgniter\\Commands\\Translation\\LocalizationFinder\:\:buildMultiArray\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Translation/LocalizationFinder.php

-
message: '#^Method CodeIgniter\\Commands\\Translation\\LocalizationFinder\:\:findTranslationsInFile\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand All @@ -282,16 +217,6 @@ parameters:
count: 1
path: ../../system/Commands/Translation/LocalizationFinder.php

-
message: '#^Method CodeIgniter\\Commands\\Utilities\\Namespaces\:\:outputAllNamespaces\(\) has parameter \$params with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Utilities/Namespaces.php

-
message: '#^Method CodeIgniter\\Commands\\Utilities\\Namespaces\:\:outputAllNamespaces\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Utilities/Namespaces.php

-
message: '#^Method CodeIgniter\\Commands\\Utilities\\Namespaces\:\:outputCINamespaces\(\) has parameter \$params with no value type specified in iterable type array\.$#'
count: 1
Expand All @@ -302,16 +227,6 @@ parameters:
count: 1
path: ../../system/Commands/Utilities/Namespaces.php

-
message: '#^Method CodeIgniter\\Commands\\Utilities\\Routes\\AutoRouterImproved\\AutoRouteCollector\:\:addFilters\(\) has parameter \$routes with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php

-
message: '#^Method CodeIgniter\\Commands\\Utilities\\Routes\\AutoRouterImproved\\AutoRouteCollector\:\:addFilters\(\) return type has no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php

-
message: '#^Method CodeIgniter\\Commands\\Utilities\\Routes\\AutoRouterImproved\\AutoRouteCollector\:\:generateSampleUri\(\) has parameter \$route with no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -402,11 +317,6 @@ parameters:
count: 1
path: ../../system/Config/BaseService.php

-
message: '#^Method CodeIgniter\\Config\\BaseService\:\:__callStatic\(\) has parameter \$arguments with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Config/BaseService.php

-
message: '#^Method CodeIgniter\\Config\\BaseService\:\:getSharedInstance\(\) has parameter \$params with no value type specified in iterable type array\.$#'
count: 1
Expand Down Expand Up @@ -4172,11 +4082,6 @@ parameters:
count: 1
path: ../../system/Model.php

-
message: '#^Method CodeIgniter\\Modules\\Modules\:\:__set_state\(\) has parameter \$array with no value type specified in iterable type array\.$#'
count: 1
path: ../../system/Modules/Modules.php

-
message: '#^Method CodeIgniter\\Pager\\Pager\:\:getDetails\(\) return type has no value type specified in iterable type array\.$#'
count: 1
Expand Down