From b2afd326668dcf13d282c927d0c4f15dc6d14dc7 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Mon, 29 Jan 2024 14:26:27 +0100 Subject: [PATCH] Provide more precise phpdoc for FileLocatorInterface::locate --- src/Symfony/Component/Config/FileLocator.php | 4 +++- src/Symfony/Component/Config/FileLocatorInterface.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Config/FileLocator.php b/src/Symfony/Component/Config/FileLocator.php index 486c002afa4a6..99c35bd265430 100644 --- a/src/Symfony/Component/Config/FileLocator.php +++ b/src/Symfony/Component/Config/FileLocator.php @@ -31,7 +31,9 @@ public function __construct(string|array $paths = []) } /** - * @return string|array + * @return string|string[] + * + * @psalm-return ($first is true ? string : string[]) */ public function locate(string $name, ?string $currentPath = null, bool $first = true) { diff --git a/src/Symfony/Component/Config/FileLocatorInterface.php b/src/Symfony/Component/Config/FileLocatorInterface.php index 97b5ff39357ba..755cf018af2b9 100644 --- a/src/Symfony/Component/Config/FileLocatorInterface.php +++ b/src/Symfony/Component/Config/FileLocatorInterface.php @@ -25,10 +25,12 @@ interface FileLocatorInterface * @param string|null $currentPath The current path * @param bool $first Whether to return the first occurrence or an array of filenames * - * @return string|array The full path to the file or an array of file paths + * @return string|string[] The full path to the file or an array of file paths * * @throws \InvalidArgumentException If $name is empty * @throws FileLocatorFileNotFoundException If a file is not found + * + * @psalm-return ($first is true ? string : string[]) */ public function locate(string $name, ?string $currentPath = null, bool $first = true); }