@@ -65,7 +65,7 @@ public function load(string $path, string ...$extraPaths): void
6565 * @throws FormatException when a file has a syntax error
6666 * @throws PathException when a file does not exist or is not readable
6767 */
68- public function loadEnv (string $ path , string $ varName = 'APP_ENV ' , string $ defaultEnv = 'dev ' , array $ testEnvs = array ( 'test ' ) ): void
68+ public function loadEnv (string $ path , string $ varName = 'APP_ENV ' , string $ defaultEnv = 'dev ' , array $ testEnvs = [ 'test ' ] ): void
6969 {
7070 if (file_exists ($ path ) || !file_exists ($ p = "$ path.dist " )) {
7171 $ this ->load ($ path );
@@ -74,7 +74,7 @@ public function loadEnv(string $path, string $varName = 'APP_ENV', string $defau
7474 }
7575
7676 if (null === $ env = $ _SERVER [$ varName ] ?? $ _ENV [$ varName ] ?? null ) {
77- $ this ->populate (array ( $ varName => $ env = $ defaultEnv) );
77+ $ this ->populate ([ $ varName => $ env = $ defaultEnv] );
7878 }
7979
8080 if (!\in_array ($ env , $ testEnvs , true ) && file_exists ($ p = "$ path.local " )) {
@@ -158,12 +158,12 @@ public function populate(array $values, bool $overrideExistingVars = false): voi
158158 public function parse (string $ data , string $ path = '.env ' ): array
159159 {
160160 $ this ->path = $ path ;
161- $ this ->data = str_replace (array ( "\r\n" , "\r" ) , "\n" , $ data );
161+ $ this ->data = str_replace ([ "\r\n" , "\r" ] , "\n" , $ data );
162162 $ this ->lineno = 1 ;
163163 $ this ->cursor = 0 ;
164164 $ this ->end = \strlen ($ this ->data );
165165 $ this ->state = self ::STATE_VARNAME ;
166- $ this ->values = array () ;
166+ $ this ->values = [] ;
167167 $ name = '' ;
168168
169169 $ this ->skipEmptyLines ();
@@ -189,7 +189,7 @@ public function parse(string $data, string $path = '.env'): array
189189 try {
190190 return $ this ->values ;
191191 } finally {
192- $ this ->values = array () ;
192+ $ this ->values = [] ;
193193 $ this ->data = null ;
194194 $ this ->path = null ;
195195 }
@@ -272,7 +272,7 @@ private function lexValue()
272272 }
273273 }
274274 ++$ this ->cursor ;
275- $ value = str_replace (array ( '\\" ' , '\r ' , '\n ' ), array ( '" ' , "\r" , "\n" ) , $ value );
275+ $ value = str_replace ([ '\\" ' , '\r ' , '\n ' ], [ '" ' , "\r" , "\n" ] , $ value );
276276 $ resolvedValue = $ value ;
277277 $ resolvedValue = $ this ->resolveVariables ($ resolvedValue );
278278 $ resolvedValue = $ this ->resolveCommands ($ resolvedValue );
@@ -281,7 +281,7 @@ private function lexValue()
281281 } else {
282282 $ value = '' ;
283283 $ prevChr = $ this ->data [$ this ->cursor - 1 ];
284- while ($ this ->cursor < $ this ->end && !\in_array ($ this ->data [$ this ->cursor ], array ( "\n" , '" ' , "' " ) , true ) && !((' ' === $ prevChr || "\t" === $ prevChr ) && '# ' === $ this ->data [$ this ->cursor ])) {
284+ while ($ this ->cursor < $ this ->end && !\in_array ($ this ->data [$ this ->cursor ], [ "\n" , '" ' , "' " ] , true ) && !((' ' === $ prevChr || "\t" === $ prevChr ) && '# ' === $ this ->data [$ this ->cursor ])) {
285285 if ('\\' === $ this ->data [$ this ->cursor ] && isset ($ this ->data [$ this ->cursor + 1 ]) && ('" ' === $ this ->data [$ this ->cursor + 1 ] || "' " === $ this ->data [$ this ->cursor + 1 ])) {
286286 ++$ this ->cursor ;
287287 }
0 commit comments