diff --git a/psalm.xml b/psalm.xml index d6033313a621..6b9ccb30f513 100644 --- a/psalm.xml +++ b/psalm.xml @@ -30,6 +30,19 @@ + + + + + + + + + + + + + diff --git a/system/DataCaster/Cast/ArrayCast.php b/system/DataCaster/Cast/ArrayCast.php index 1deddea6fc8e..81f343b3e4a8 100644 --- a/system/DataCaster/Cast/ArrayCast.php +++ b/system/DataCaster/Cast/ArrayCast.php @@ -14,12 +14,12 @@ namespace CodeIgniter\DataCaster\Cast; /** - * Class ArrayCast - * * (PHP) [array --> string] --> (DB driver) --> (DB column) string * [ <-- string] <-- (DB driver) <-- (DB column) string + * + * @extends BaseCast, string> */ -class ArrayCast extends BaseCast implements CastInterface +class ArrayCast extends BaseCast { public static function get( mixed $value, diff --git a/system/DataCaster/Cast/BaseCast.php b/system/DataCaster/Cast/BaseCast.php index 06fb0eb4fa69..e6cc5ae98f1c 100644 --- a/system/DataCaster/Cast/BaseCast.php +++ b/system/DataCaster/Cast/BaseCast.php @@ -15,6 +15,12 @@ use CodeIgniter\Exceptions\InvalidArgumentException; +/** + * @template TPhpNativeValue + * @template TDataSourceValue + * + * @implements CastInterface + */ abstract class BaseCast implements CastInterface { public static function get( diff --git a/system/DataCaster/Cast/BooleanCast.php b/system/DataCaster/Cast/BooleanCast.php index 6554081e155d..79b9dfe6d8d9 100644 --- a/system/DataCaster/Cast/BooleanCast.php +++ b/system/DataCaster/Cast/BooleanCast.php @@ -14,10 +14,10 @@ namespace CodeIgniter\DataCaster\Cast; /** - * Class BooleanCast - * * (PHP) [bool --> bool ] --> (DB driver) --> (DB column) bool|int(0/1) * [ <-- string|int] <-- (DB driver) <-- (DB column) bool|int(0/1) + * + * @extends BaseCast */ class BooleanCast extends BaseCast { diff --git a/system/DataCaster/Cast/CSVCast.php b/system/DataCaster/Cast/CSVCast.php index d77c64c87b57..3c09e1cc6103 100644 --- a/system/DataCaster/Cast/CSVCast.php +++ b/system/DataCaster/Cast/CSVCast.php @@ -14,10 +14,10 @@ namespace CodeIgniter\DataCaster\Cast; /** - * Class CSVCast - * * (PHP) [array --> string] --> (DB driver) --> (DB column) string * [ <-- string] <-- (DB driver) <-- (DB column) string + * + * @extends BaseCast, string> */ class CSVCast extends BaseCast { diff --git a/system/DataCaster/Cast/CastInterface.php b/system/DataCaster/Cast/CastInterface.php index 7f5b05102a7d..6f2a38d75c9e 100644 --- a/system/DataCaster/Cast/CastInterface.php +++ b/system/DataCaster/Cast/CastInterface.php @@ -13,35 +13,31 @@ namespace CodeIgniter\DataCaster\Cast; +/** + * @template TPhpNativeValue + * @template TDataSourceValue + */ interface CastInterface { /** - * Takes a value from DataSource, returns its value for PHP. + * Takes a value from a data source, returns its value for PHP. * - * @param mixed $value Data from database driver + * @param TDataSourceValue $value Data from database driver * @param array $params Additional param * @param object|null $helper Helper object. E.g., database connection * - * @return mixed PHP native value + * @return TPhpNativeValue */ - public static function get( - mixed $value, - array $params = [], - ?object $helper = null, - ): mixed; + public static function get(mixed $value, array $params = [], ?object $helper = null): mixed; /** - * Takes a PHP value, returns its value for DataSource. + * Takes a PHP value, returns its value for a data source. * - * @param mixed $value PHP native value + * @param TPhpNativeValue $value PHP native value * @param array $params Additional param * @param object|null $helper Helper object. E.g., database connection * - * @return mixed Data to pass to database driver + * @return TDataSourceValue */ - public static function set( - mixed $value, - array $params = [], - ?object $helper = null, - ): mixed; + public static function set(mixed $value, array $params = [], ?object $helper = null): mixed; } diff --git a/system/DataCaster/Cast/DatetimeCast.php b/system/DataCaster/Cast/DatetimeCast.php index 398fdc7beed7..043b7ccd81ea 100644 --- a/system/DataCaster/Cast/DatetimeCast.php +++ b/system/DataCaster/Cast/DatetimeCast.php @@ -18,10 +18,10 @@ use CodeIgniter\I18n\Time; /** - * Class DatetimeCast - * * (PHP) [Time --> string] --> (DB driver) --> (DB column) datetime * [ <-- string] <-- (DB driver) <-- (DB column) datetime + * + * @extends BaseCast */ class DatetimeCast extends BaseCast { diff --git a/system/DataCaster/Cast/EnumCast.php b/system/DataCaster/Cast/EnumCast.php index 454251dcba6b..fcf611fe63d2 100644 --- a/system/DataCaster/Cast/EnumCast.php +++ b/system/DataCaster/Cast/EnumCast.php @@ -19,14 +19,14 @@ use UnitEnum; /** - * Class EnumCast - * * Handles casting for PHP enums (both backed and unit enums) * * (PHP) [enum --> value/name] --> (DB driver) --> (DB column) int|string * [ <-- value/name] <-- (DB driver) <-- (DB column) int|string + * + * @extends BaseCast */ -class EnumCast extends BaseCast implements CastInterface +class EnumCast extends BaseCast { public static function get( mixed $value, @@ -49,9 +49,7 @@ public static function get( $reflection = new ReflectionEnum($enumClass); - // Unit enum - if (! $reflection->isBacked()) { - // Unit enum - match by name + if (! is_a($enumClass, BackedEnum::class, true)) { foreach ($enumClass::cases() as $case) { if ($case->name === $value) { return $case; @@ -61,10 +59,8 @@ public static function get( throw CastException::forInvalidEnumCaseName($enumClass, $value); } - // Backed enum - validate and cast the value to proper type $backingType = $reflection->getBackingType(); - // Cast to proper type (int or string) if ($backingType->getName() === 'int') { $value = (int) $value; } elseif ($backingType->getName() === 'string') { @@ -89,7 +85,6 @@ public static function set( self::invalidTypeValueError($value); } - // Get the expected enum class $enumClass = $params[0] ?? null; if ($enumClass === null) { @@ -100,21 +95,14 @@ public static function set( throw CastException::forNotEnum($enumClass); } - // Validate that the enum is of the expected type if (! $value instanceof $enumClass) { throw CastException::forInvalidEnumType($enumClass, $value::class); } - $reflection = new ReflectionEnum($value::class); - - // Backed enum - return the properly typed backing value - if ($reflection->isBacked()) { - /** @var BackedEnum $value */ + if ($value instanceof BackedEnum) { return $value->value; } - // Unit enum - return the case name - /** @var UnitEnum $value */ return $value->name; } } diff --git a/system/DataCaster/Cast/FloatCast.php b/system/DataCaster/Cast/FloatCast.php index d2173826265a..72d7db968e5f 100644 --- a/system/DataCaster/Cast/FloatCast.php +++ b/system/DataCaster/Cast/FloatCast.php @@ -14,10 +14,10 @@ namespace CodeIgniter\DataCaster\Cast; /** - * Class FloatCast - * * (PHP) [float --> float ] --> (DB driver) --> (DB column) float * [ <-- float|string] <-- (DB driver) <-- (DB column) float + * + * @extends BaseCast */ class FloatCast extends BaseCast { diff --git a/system/DataCaster/Cast/IntBoolCast.php b/system/DataCaster/Cast/IntBoolCast.php index 5aa1f2b2eb93..ec6766381b81 100644 --- a/system/DataCaster/Cast/IntBoolCast.php +++ b/system/DataCaster/Cast/IntBoolCast.php @@ -18,6 +18,8 @@ * * (PHP) [bool --> int ] --> (DB driver) --> (DB column) int(0/1) * [ <-- int|string] <-- (DB driver) <-- (DB column) int(0/1) + * + * @extends BaseCast */ final class IntBoolCast extends BaseCast { diff --git a/system/DataCaster/Cast/IntegerCast.php b/system/DataCaster/Cast/IntegerCast.php index f65baf83150f..9b02cf6fbbb9 100644 --- a/system/DataCaster/Cast/IntegerCast.php +++ b/system/DataCaster/Cast/IntegerCast.php @@ -14,10 +14,10 @@ namespace CodeIgniter\DataCaster\Cast; /** - * Class IntegerCast - * * (PHP) [int --> int ] --> (DB driver) --> (DB column) int * [ <-- int|string] <-- (DB driver) <-- (DB column) int + * + * @extends BaseCast */ class IntegerCast extends BaseCast { diff --git a/system/DataCaster/Cast/JsonCast.php b/system/DataCaster/Cast/JsonCast.php index 5ca10b385ba6..2a3fd5a729dd 100644 --- a/system/DataCaster/Cast/JsonCast.php +++ b/system/DataCaster/Cast/JsonCast.php @@ -18,10 +18,10 @@ use stdClass; /** - * Class JsonCast - * * (PHP) [array|stdClass --> string] --> (DB driver) --> (DB column) string * [ <-- string] <-- (DB driver) <-- (DB column) string + * + * @extends BaseCast|stdClass, string> */ class JsonCast extends BaseCast { diff --git a/system/DataCaster/Cast/TimestampCast.php b/system/DataCaster/Cast/TimestampCast.php index aa94266001ef..c878fffcc43a 100644 --- a/system/DataCaster/Cast/TimestampCast.php +++ b/system/DataCaster/Cast/TimestampCast.php @@ -16,10 +16,10 @@ use CodeIgniter\I18n\Time; /** - * Class TimestampCast - * * (PHP) [Time --> int ] --> (DB driver) --> (DB column) int * [ <-- int|string] <-- (DB driver) <-- (DB column) int + * + * @extends BaseCast */ class TimestampCast extends BaseCast { diff --git a/system/DataCaster/Cast/URICast.php b/system/DataCaster/Cast/URICast.php index f9e2f561a2b2..f9f9487e42fb 100644 --- a/system/DataCaster/Cast/URICast.php +++ b/system/DataCaster/Cast/URICast.php @@ -16,10 +16,10 @@ use CodeIgniter\HTTP\URI; /** - * Class URICast - * * (PHP) [URI --> string] --> (DB driver) --> (DB column) string * [ <-- string] <-- (DB driver) <-- (DB column) string + * + * @extends BaseCast */ class URICast extends BaseCast { diff --git a/system/Entity/Cast/ArrayCast.php b/system/Entity/Cast/ArrayCast.php index 6860b41416b6..dc1d5d7e20d2 100644 --- a/system/Entity/Cast/ArrayCast.php +++ b/system/Entity/Cast/ArrayCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast, string> + */ class ArrayCast extends BaseCast { public static function get($value, array $params = []): array diff --git a/system/Entity/Cast/BaseCast.php b/system/Entity/Cast/BaseCast.php index c93e32c0537c..68bd544a071f 100644 --- a/system/Entity/Cast/BaseCast.php +++ b/system/Entity/Cast/BaseCast.php @@ -13,6 +13,12 @@ namespace CodeIgniter\Entity\Cast; +/** + * @template TPhpNativeValue + * @template TEntityStoredValue + * + * @implements CastInterface + */ abstract class BaseCast implements CastInterface { public static function get($value, array $params = []) diff --git a/system/Entity/Cast/BooleanCast.php b/system/Entity/Cast/BooleanCast.php index 7ac9f0ba37ee..a8bdb8ac1e7d 100644 --- a/system/Entity/Cast/BooleanCast.php +++ b/system/Entity/Cast/BooleanCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast + */ class BooleanCast extends BaseCast { public static function get($value, array $params = []): bool diff --git a/system/Entity/Cast/CSVCast.php b/system/Entity/Cast/CSVCast.php index c78a1315111a..6c4a65f816ab 100644 --- a/system/Entity/Cast/CSVCast.php +++ b/system/Entity/Cast/CSVCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast, string> + */ class CSVCast extends BaseCast { public static function get($value, array $params = []): array diff --git a/system/Entity/Cast/CastInterface.php b/system/Entity/Cast/CastInterface.php index 9f5552826859..31b85f4ef4e9 100644 --- a/system/Entity/Cast/CastInterface.php +++ b/system/Entity/Cast/CastInterface.php @@ -17,26 +17,29 @@ * The methods work at (1)(4) only. * [App Code] --- (1) --> [Entity] --- (2) --> [Database] * [App Code] <-- (4) --- [Entity] <-- (3) --- [Database] + * + * @template TPhpNativeValue + * @template TEntityStoredValue */ interface CastInterface { /** * Takes a raw value from Entity, returns its value for PHP. * - * @param mixed $value Data + * @param TEntityStoredValue $value * @param array $params Additional param * - * @return mixed + * @return TPhpNativeValue */ public static function get($value, array $params = []); /** * Takes a PHP value, returns its raw value for Entity. * - * @param mixed $value Data + * @param TPhpNativeValue $value * @param array $params Additional param * - * @return mixed + * @return TEntityStoredValue */ public static function set($value, array $params = []); } diff --git a/system/Entity/Cast/DatetimeCast.php b/system/Entity/Cast/DatetimeCast.php index e49df121987e..332de01a99cf 100644 --- a/system/Entity/Cast/DatetimeCast.php +++ b/system/Entity/Cast/DatetimeCast.php @@ -15,17 +15,12 @@ use CodeIgniter\I18n\Time; use DateTimeInterface; -use Exception; +/** + * @extends BaseCast + */ class DatetimeCast extends BaseCast { - /** - * {@inheritDoc} - * - * @return Time - * - * @throws Exception - */ public static function get($value, array $params = []) { if ($value instanceof Time) { diff --git a/system/Entity/Cast/EnumCast.php b/system/Entity/Cast/EnumCast.php index 7ea82d6f24a5..caf6b1289294 100644 --- a/system/Entity/Cast/EnumCast.php +++ b/system/Entity/Cast/EnumCast.php @@ -18,6 +18,9 @@ use ReflectionEnum; use UnitEnum; +/** + * @extends BaseCast + */ class EnumCast extends BaseCast { public static function get($value, array $params = []): BackedEnum|UnitEnum @@ -34,11 +37,9 @@ public static function get($value, array $params = []): BackedEnum|UnitEnum $reflection = new ReflectionEnum($enumClass); - // Backed enum - validate and cast the value to proper type - if ($reflection->isBacked()) { + if (is_a($enumClass, BackedEnum::class, true)) { $backingType = $reflection->getBackingType(); - // Cast to proper type (int or string) if ($backingType->getName() === 'int') { $value = (int) $value; } elseif ($backingType->getName() === 'string') { @@ -54,7 +55,6 @@ public static function get($value, array $params = []): BackedEnum|UnitEnum return $enum; } - // Unit enum - match by name foreach ($enumClass::cases() as $case) { if ($case->name === $value) { return $case; @@ -64,9 +64,11 @@ public static function get($value, array $params = []): BackedEnum|UnitEnum throw CastException::forInvalidEnumCaseName($enumClass, $value); } + /** + * @param mixed $value + */ public static function set($value, array $params = []): int|string { - // Get the expected enum class $enumClass = $params[0] ?? null; if ($enumClass === null) { @@ -77,33 +79,23 @@ public static function set($value, array $params = []): int|string throw CastException::forNotEnum($enumClass); } - // If it's already an enum object, validate and extract its value if (is_object($value) && enum_exists($value::class)) { - // Validate that the enum is of the expected type if (! $value instanceof $enumClass) { throw CastException::forInvalidEnumType($enumClass, $value::class); } - $reflection = new ReflectionEnum($value::class); - - // Backed enum - return the properly typed backing value - if ($reflection->isBacked()) { - /** @var BackedEnum $value */ + if ($value instanceof BackedEnum) { return $value->value; } - // Unit enum - return the case name - /** @var UnitEnum $value */ return $value->name; } $reflection = new ReflectionEnum($enumClass); - // Validate backed enum values - if ($reflection->isBacked()) { + if (is_a($enumClass, BackedEnum::class, true)) { $backingType = $reflection->getBackingType(); - // Cast to proper type (int or string) if ($backingType->getName() === 'int') { $value = (int) $value; } elseif ($backingType->getName() === 'string') { @@ -117,7 +109,6 @@ public static function set($value, array $params = []): int|string return $value; } - // Validate unit enum case names - must be a string $value = (string) $value; foreach ($enumClass::cases() as $case) { diff --git a/system/Entity/Cast/FloatCast.php b/system/Entity/Cast/FloatCast.php index 1a767c0953f0..f629fe54016e 100644 --- a/system/Entity/Cast/FloatCast.php +++ b/system/Entity/Cast/FloatCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast + */ class FloatCast extends BaseCast { public static function get($value, array $params = []): float diff --git a/system/Entity/Cast/IntBoolCast.php b/system/Entity/Cast/IntBoolCast.php index 94e65df8dde0..21e03c04a98a 100644 --- a/system/Entity/Cast/IntBoolCast.php +++ b/system/Entity/Cast/IntBoolCast.php @@ -15,20 +15,16 @@ /** * DB column: int (0/1) <--> Class property: bool + * + * @extends BaseCast */ final class IntBoolCast extends BaseCast { - /** - * @param int $value - */ public static function get($value, array $params = []): bool { return (bool) $value; } - /** - * @param bool|int|string $value - */ public static function set($value, array $params = []): int { return (int) $value; diff --git a/system/Entity/Cast/IntegerCast.php b/system/Entity/Cast/IntegerCast.php index 84bf09211c0f..dad299ef74c1 100644 --- a/system/Entity/Cast/IntegerCast.php +++ b/system/Entity/Cast/IntegerCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast + */ class IntegerCast extends BaseCast { public static function get($value, array $params = []): int diff --git a/system/Entity/Cast/JsonCast.php b/system/Entity/Cast/JsonCast.php index 245de29f3956..c94e4d6f34a8 100644 --- a/system/Entity/Cast/JsonCast.php +++ b/system/Entity/Cast/JsonCast.php @@ -17,6 +17,9 @@ use JsonException; use stdClass; +/** + * @extends BaseCast + */ class JsonCast extends BaseCast { public static function get($value, array $params = []) @@ -43,9 +46,6 @@ public static function get($value, array $params = []) return $tmp; } - /** - * {@inheritDoc} - */ public static function set($value, array $params = []): string { if (function_exists('json_encode')) { diff --git a/system/Entity/Cast/ObjectCast.php b/system/Entity/Cast/ObjectCast.php index 10affad4c80c..c2c1499a3af0 100644 --- a/system/Entity/Cast/ObjectCast.php +++ b/system/Entity/Cast/ObjectCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast + */ class ObjectCast extends BaseCast { public static function get($value, array $params = []): object diff --git a/system/Entity/Cast/StringCast.php b/system/Entity/Cast/StringCast.php index d538f4332dca..7c01c2c4a617 100644 --- a/system/Entity/Cast/StringCast.php +++ b/system/Entity/Cast/StringCast.php @@ -13,6 +13,9 @@ namespace CodeIgniter\Entity\Cast; +/** + * @extends BaseCast + */ class StringCast extends BaseCast { public static function get($value, array $params = []): string diff --git a/system/Entity/Cast/TimestampCast.php b/system/Entity/Cast/TimestampCast.php index 44bdf78864d1..b48211f221df 100644 --- a/system/Entity/Cast/TimestampCast.php +++ b/system/Entity/Cast/TimestampCast.php @@ -15,6 +15,9 @@ use CodeIgniter\Entity\Exceptions\CastException; +/** + * @extends BaseCast + */ class TimestampCast extends BaseCast { public static function get($value, array $params = []) diff --git a/system/Entity/Cast/URICast.php b/system/Entity/Cast/URICast.php index a66bfba3ef45..ef4346d1a5eb 100644 --- a/system/Entity/Cast/URICast.php +++ b/system/Entity/Cast/URICast.php @@ -15,6 +15,9 @@ use CodeIgniter\HTTP\URI; +/** + * @extends BaseCast + */ class URICast extends BaseCast { public static function get($value, array $params = []): URI diff --git a/tests/_support/Entity/Cast/CastBase64.php b/tests/_support/Entity/Cast/CastBase64.php index 5bf086d77685..1735d73d6f9d 100644 --- a/tests/_support/Entity/Cast/CastBase64.php +++ b/tests/_support/Entity/Cast/CastBase64.php @@ -15,6 +15,9 @@ use CodeIgniter\Entity\Cast\BaseCast; +/** + * @extends BaseCast + */ class CastBase64 extends BaseCast { /** diff --git a/tests/_support/Entity/Cast/CastBinaryUUID.php b/tests/_support/Entity/Cast/CastBinaryUUID.php index 230f3a31eaf0..10b111d95c34 100644 --- a/tests/_support/Entity/Cast/CastBinaryUUID.php +++ b/tests/_support/Entity/Cast/CastBinaryUUID.php @@ -15,6 +15,9 @@ use CodeIgniter\Entity\Cast\BaseCast; +/** + * @extends BaseCast + */ class CastBinaryUUID extends BaseCast { /** diff --git a/tests/_support/Entity/Cast/CastPassParameters.php b/tests/_support/Entity/Cast/CastPassParameters.php index 3f304e3622a0..d09521a228a7 100644 --- a/tests/_support/Entity/Cast/CastPassParameters.php +++ b/tests/_support/Entity/Cast/CastPassParameters.php @@ -15,6 +15,9 @@ use CodeIgniter\Entity\Cast\BaseCast; +/** + * @extends BaseCast + */ class CastPassParameters extends BaseCast { /** diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index 32ad4dacc2f5..e94a496fd0ed 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 1808 errors +# total 1795 errors includes: - argument.type.neon diff --git a/utils/phpstan-baseline/method.childParameterType.neon b/utils/phpstan-baseline/method.childParameterType.neon index f4316313dd85..aa135b562c3e 100644 --- a/utils/phpstan-baseline/method.childParameterType.neon +++ b/utils/phpstan-baseline/method.childParameterType.neon @@ -1,4 +1,4 @@ -# total 10 errors +# total 6 errors parameters: ignoreErrors: @@ -12,26 +12,6 @@ parameters: count: 1 path: ../../system/Database/BaseResult.php - - - message: '#^Parameter \#1 \$value \(bool\|int\|string\) of method CodeIgniter\\Entity\\Cast\\IntBoolCast\:\:set\(\) should be contravariant with parameter \$value \(mixed\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:set\(\)$#' - count: 1 - path: ../../system/Entity/Cast/IntBoolCast.php - - - - message: '#^Parameter \#1 \$value \(bool\|int\|string\) of method CodeIgniter\\Entity\\Cast\\IntBoolCast\:\:set\(\) should be contravariant with parameter \$value \(mixed\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:set\(\)$#' - count: 1 - path: ../../system/Entity/Cast/IntBoolCast.php - - - - message: '#^Parameter \#1 \$value \(int\) of method CodeIgniter\\Entity\\Cast\\IntBoolCast\:\:get\(\) should be contravariant with parameter \$value \(mixed\) of method CodeIgniter\\Entity\\Cast\\BaseCast\:\:get\(\)$#' - count: 1 - path: ../../system/Entity/Cast/IntBoolCast.php - - - - message: '#^Parameter \#1 \$value \(int\) of method CodeIgniter\\Entity\\Cast\\IntBoolCast\:\:get\(\) should be contravariant with parameter \$value \(mixed\) of method CodeIgniter\\Entity\\Cast\\CastInterface\:\:get\(\)$#' - count: 1 - path: ../../system/Entity/Cast/IntBoolCast.php - - message: '#^Parameter \#1 \$data \(array\{date\: string, timezone\: string, timezone_type\: int\}\) of method CodeIgniter\\I18n\\Time\:\:__unserialize\(\) should be contravariant with parameter \$data \(array\) of method DateTimeImmutable\:\:__unserialize\(\)$#' count: 1 diff --git a/utils/phpstan-baseline/missingType.iterableValue.neon b/utils/phpstan-baseline/missingType.iterableValue.neon index 28aeaabd8f58..e3ed378cbde4 100644 --- a/utils/phpstan-baseline/missingType.iterableValue.neon +++ b/utils/phpstan-baseline/missingType.iterableValue.neon @@ -1,4 +1,4 @@ -# total 1139 errors +# total 1134 errors parameters: ignoreErrors: @@ -312,21 +312,6 @@ parameters: count: 1 path: ../../system/Cookie/CookieStore.php - - - message: '#^Method CodeIgniter\\DataCaster\\Cast\\ArrayCast\:\:get\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/DataCaster/Cast/ArrayCast.php - - - - message: '#^Method CodeIgniter\\DataCaster\\Cast\\CSVCast\:\:get\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/DataCaster/Cast/CSVCast.php - - - - message: '#^Method CodeIgniter\\DataCaster\\Cast\\JsonCast\:\:get\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/DataCaster/Cast/JsonCast.php - - message: '#^Method CodeIgniter\\DataConverter\\DataConverter\:\:fromDataSource\(\) return type has no value type specified in iterable type array\.$#' count: 1 @@ -2052,16 +2037,6 @@ parameters: count: 1 path: ../../system/Encryption/KeyRotationDecorator.php - - - message: '#^Method CodeIgniter\\Entity\\Cast\\ArrayCast\:\:get\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Entity/Cast/ArrayCast.php - - - - message: '#^Method CodeIgniter\\Entity\\Cast\\CSVCast\:\:get\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Entity/Cast/CSVCast.php - - message: '#^Method CodeIgniter\\Exceptions\\PageNotFoundException\:\:lang\(\) has parameter \$args with no value type specified in iterable type array\.$#' count: 1 diff --git a/utils/phpstan-baseline/return.type.neon b/utils/phpstan-baseline/return.type.neon index 258159a982c6..acfc78a3c171 100644 --- a/utils/phpstan-baseline/return.type.neon +++ b/utils/phpstan-baseline/return.type.neon @@ -1,4 +1,4 @@ -# total 3 errors +# total 2 errors parameters: ignoreErrors: @@ -7,11 +7,6 @@ parameters: count: 1 path: ../../system/Database/BaseBuilder.php - - - message: '#^Method CodeIgniter\\Entity\\Cast\\DatetimeCast\:\:get\(\) should return CodeIgniter\\I18n\\Time but returns mixed\.$#' - count: 1 - path: ../../system/Entity/Cast/DatetimeCast.php - - message: '#^Method CodeIgniter\\Router\\Router\:\:getRouteAttributes\(\) should return array\{class\: list\, method\: list\\} but returns array\{class\: list\, method\: list\\}\.$#' count: 1 diff --git a/utils/phpstan-baseline/staticMethod.notFound.neon b/utils/phpstan-baseline/staticMethod.notFound.neon index ad04f6d249a3..3ad7dfbbd356 100644 --- a/utils/phpstan-baseline/staticMethod.notFound.neon +++ b/utils/phpstan-baseline/staticMethod.notFound.neon @@ -1,17 +1,7 @@ -# total 21 errors +# total 18 errors parameters: ignoreErrors: - - - message: '#^Call to an undefined static method UnitEnum\:\:tryFrom\(\)\.$#' - count: 1 - path: ../../system/DataCaster/Cast/EnumCast.php - - - - message: '#^Call to an undefined static method UnitEnum\:\:tryFrom\(\)\.$#' - count: 2 - path: ../../system/Entity/Cast/EnumCast.php - - message: '#^Call to an undefined static method CodeIgniter\\Config\\Factories\:\:cells\(\)\.$#' count: 1