Skip to content

Commit 206482f

Browse files
Provide more precise phpdoc for FileLocatorInterface::locate
1 parent e572736 commit 206482f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

FileLocator.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public function __construct(string|array $paths = [])
3131
}
3232

3333
/**
34-
* @return string|array
34+
* @return string|string[]
35+
*
36+
* @psalm-return ($first is true ? string : string[])
3537
*/
3638
public function locate(string $name, ?string $currentPath = null, bool $first = true)
3739
{

FileLocatorInterface.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ interface FileLocatorInterface
2525
* @param string|null $currentPath The current path
2626
* @param bool $first Whether to return the first occurrence or an array of filenames
2727
*
28-
* @return string|array The full path to the file or an array of file paths
28+
* @return string|string[] The full path to the file or an array of file paths
2929
*
3030
* @throws \InvalidArgumentException If $name is empty
3131
* @throws FileLocatorFileNotFoundException If a file is not found
32+
*
33+
* @psalm-return ($first is true ? string : string[])
3234
*/
3335
public function locate(string $name, ?string $currentPath = null, bool $first = true);
3436
}

0 commit comments

Comments
 (0)