diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index d99413a250d..cd77aa532b8 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -537,12 +537,11 @@ protected function registerManaged(ClassMetadata $class, object $entity, array $ } /** - * @param mixed $value * @param class-string $enumType * * @return BackedEnum|array */ - final protected function buildEnum($value, string $enumType) + final protected function buildEnum(mixed $value, string $enumType): BackedEnum|array { if (is_array($value)) { return array_map( diff --git a/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php b/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php index 56f654a27e6..86df5209054 100644 --- a/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php +++ b/lib/Doctrine/ORM/Mapping/DefaultQuoteStrategy.php @@ -115,11 +115,9 @@ public function getIdentifierColumnNames(ClassMetadata $class, AbstractPlatform // Association defined as Id field $joinColumns = $class->associationMappings[$fieldName]['joinColumns']; $assocQuotedColumnNames = array_map( - static function ($joinColumn) use ($platform) { - return isset($joinColumn['quoted']) - ? $platform->quoteIdentifier($joinColumn['name']) - : $joinColumn['name']; - }, + static fn (array $joinColumn) => isset($joinColumn['quoted']) + ? $platform->quoteIdentifier($joinColumn['name']) + : $joinColumn['name'], $joinColumns, ); diff --git a/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php b/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php index c77f2d04ce9..93680eee10f 100644 --- a/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php +++ b/lib/Doctrine/ORM/Mapping/ReflectionEnumProperty.php @@ -9,7 +9,6 @@ use ValueError; use function array_map; -use function get_class; use function is_array; final class ReflectionEnumProperty extends ReflectionProperty @@ -55,9 +54,7 @@ public function setValue(mixed $object, mixed $value = null): void { if ($value !== null) { if (is_array($value)) { - $value = array_map(function ($item) use ($object): BackedEnum { - return $this->initializeEnumValue($object, $item); - }, $value); + $value = array_map(fn (int|string|BackedEnum $item): BackedEnum => $this->initializeEnumValue($object, $item), $value); } else { $value = $this->initializeEnumValue($object, $value); } @@ -78,7 +75,7 @@ private function initializeEnumValue(object $object, int|string|BackedEnum $valu return $enumType::from($value); } catch (ValueError $e) { throw MappingException::invalidEnumValue( - get_class($object), + $object::class, $this->originalReflectionProperty->getName(), (string) $value, $enumType, diff --git a/lib/Doctrine/ORM/Query/FilterCollection.php b/lib/Doctrine/ORM/Query/FilterCollection.php index d08c63532f2..6a3e1295e17 100644 --- a/lib/Doctrine/ORM/Query/FilterCollection.php +++ b/lib/Doctrine/ORM/Query/FilterCollection.php @@ -29,7 +29,7 @@ class FilterCollection */ public const FILTERS_STATE_DIRTY = 2; - private Configuration $config; + private readonly Configuration $config; /** * Instances of enabled filters. diff --git a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php index 6069488b351..073b8ec8639 100644 --- a/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php +++ b/lib/Doctrine/ORM/Query/ResultSetMappingBuilder.php @@ -10,6 +10,7 @@ use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Utility\PersisterHelper; use InvalidArgumentException; +use Stringable; use function in_array; use function sprintf; @@ -17,7 +18,7 @@ /** * A ResultSetMappingBuilder uses the EntityManager to automatically populate entity fields. */ -class ResultSetMappingBuilder extends ResultSetMapping +class ResultSetMappingBuilder extends ResultSetMapping implements Stringable { use SQLResultCasing; diff --git a/lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php b/lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php index 0ee370a0409..50bdf8a14c8 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php @@ -146,8 +146,9 @@ private function convertWhereInIdentifiersToDatabaseValue(string $type): void ->getEntityManager() ->getConnection(); - $query->setParameter(self::PAGINATOR_ID_ALIAS, array_map(static function ($id) use ($connection, $type) { - return $connection->convertToDatabaseValue($id, $type); - }, $identifiers)); + $query->setParameter( + self::PAGINATOR_ID_ALIAS, + array_map(static fn (mixed $id): mixed => $connection->convertToDatabaseValue($id, $type), $identifiers), + ); } }