Skip to content

Commit a6dbc39

Browse files
committed
bug symfony#22364 [Dotenv] Throwing an error when loading nothing (sanpii)
This PR was merged into the 3.3-dev branch. Discussion ---------- [Dotenv] Throwing an error when loading nothing | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a This is a quick fix to prevent anoying when you follow a tutorial using another dotenv component. For example, this code uses [vlucas/phpdotenv](https://packagist.org/packages/vlucas/phpdotenv): ```php $dotenv = new Dotenv\Dotenv(__DIR__.'/../'); $dotenv->load(); ``` Silently failed with symfony/dotenv. Commits ------- 911bc68 [Dotenv] Throwing an error when loading nothing
2 parents 35afac0 + 911bc68 commit a6dbc39

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ final class Dotenv
3939
/**
4040
* Loads one or several .env files.
4141
*
42-
* @param ...string A list of files to load
42+
* @param string $path A file to load
43+
* @param ...string $paths A list of additionnal files to load
4344
*
4445
* @throws FormatException when a file has a syntax error
4546
* @throws PathException when a file does not exist or is not readable
4647
*/
47-
public function load(/*...$paths*/)
48+
public function load($path/*, ...$paths*/)
4849
{
4950
// func_get_args() to be replaced by a variadic argument for Symfony 4.0
5051
foreach (func_get_args() as $path) {

0 commit comments

Comments
 (0)