diff --git a/UPGRADE.md b/UPGRADE.md index 15cec2d7..f58860fc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,6 +8,15 @@ awareness about deprecated code. # Upgrade to 5.0 +## BC Break: `ObjectRepository::findBy()` `$orderBy` additionally accepts the `SortDirection` enum + +The `$orderBy` parameter of `findBy()` now also accepts the PHP 8.6 `SortDirection` +enum, in addition to the `'asc'`, `'desc'`, `'ASC'` and `'DESC'` strings. The native +signature is unchanged and strings remain accepted. + +Implementations of `ObjectRepository` must accept the enum and cannot declare a +more restrictive type for `$orderBy`. + ## BC Break: `ClassMetadata::getFieldValue()` and `setFieldValue()` are now required The methods `getFieldValue()` and `setFieldValue()` are now required by the diff --git a/composer.json b/composer.json index fb7ff509..a5a92959 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,8 @@ "doctrine/coding-standard": "^14", "phpunit/phpunit": "^10.5.58 || ^12", "symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0", - "symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0" + "symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0", + "symfony/polyfill-php86": "^1.41" }, "autoload": { "psr-4": { diff --git a/src/ObjectRepository.php b/src/ObjectRepository.php index fce86e96..b78920d7 100644 --- a/src/ObjectRepository.php +++ b/src/ObjectRepository.php @@ -4,6 +4,7 @@ namespace Doctrine\Persistence; +use SortDirection; use UnexpectedValueException; /** @@ -38,9 +39,9 @@ public function findAll(): array; * an UnexpectedValueException if certain values of the sorting or limiting details are * not supported. * - * @param array $criteria - * @param array|null $orderBy - * @phpstan-param array|null $orderBy + * @param array $criteria + * @param array|null $orderBy + * @phpstan-param array|null $orderBy * * @return array The objects. * @phpstan-return list