refactor!: require PHP 8.4
Tests / PHP 8.4 (push) Failing after 5m34s

Drop support for PHP 8.3 and lower. The package now declares >=8.4, and CI runs
only on 8.4.

- composer.json: require php >=8.4.
- mago.toml: php-version = "8.4", matching the minimum supported version.
- phpstan.neon: phpVersion 80400.
- Upgrade phpstan/phpstan to ^2.3: 1.x cannot parse `new Foo()->bar()`, which the
  8.4 formatter now emits.
- Fix the type errors PHPStan 2 reports: class-string<static> variance,
  optional array offsets in fromEnvironment, list vs array for PdoConnection::$lru,
  ReflectionClass<Model> docblocks, Repository made covariant in T, and a redundant
  null comparison in validateRelationPath.
- CI: single PHP 8.4 job using the php:8.4-cli container instead of setup-php,
  which failed with a TLS handshake timeout on the runner.

BREAKING CHANGE: PHP 8.4 is now required.
This commit is contained in:
dgarcia committed 2026-11-15 10:58:11 -03:00
1 parent c15015d809
commit 0e756e45c7
20 files changed
+97 -107

No files matched your search

+5 -9
View File
@@ -25,7 +25,7 @@ use Camelia\Orm\Support\TypeCaster;
* Public read and write API for one model class.
*
* @api
* @template T of Model
* @template-covariant T of Model
*/
final class Repository
{
@@ -34,7 +34,7 @@ final class Repository
private readonly QueryBuilder $builder;
/**
* @param class-string<T> $class
* @param class-string<T> $class Not a field of the covariant template; kept for IDE inference.
*/
public function __construct(
private readonly Connection $connection,
@@ -726,7 +726,9 @@ final class Repository
throw ConfigurationException::relationDepthExceeded(self::MAX_RELATION_DEPTH);
}
if (!$metadata->hasProperty($name) || $metadata->properties()[$name]->relation === null) {
$relation = $metadata->hasProperty($name) ? $metadata->properties()[$name]->relation : null;
if ($relation === null) {
throw MetadataException::unknownRelation($metadata->class, $name);
}
@@ -734,12 +736,6 @@ final class Repository
return;
}
$relation = $metadata->properties()[$name]->relation;
if ($relation === null) {
return;
}
$next = $this->relatedRepository($relation->relatedClass)->metadata();
foreach ($nested as $key => $value) {