Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 06c9d62

Browse filesBrowse files
minor #41980 [Dotenv] Add types to private properties (derrabus)
This PR was merged into the 6.0 branch. Discussion ---------- [Dotenv] Add types to private properties | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Commits ------- f84fcc8 [Dotenv] Add types to private properties
2 parents b6c307f + f84fcc8 commit 06c9d62
Copy full SHA for 06c9d62

File tree

3 files changed

+20
-21
lines changed
Filter options

3 files changed

+20
-21
lines changed

‎src/Symfony/Component/Dotenv/Dotenv.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Dotenv/Dotenv.php
+15-16Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ final class Dotenv
2929
public const STATE_VARNAME = 0;
3030
public const STATE_VALUE = 1;
3131

32-
private $path;
33-
private $cursor;
34-
private $lineno;
35-
private $data;
36-
private $end;
37-
private $values;
38-
private $envKey;
39-
private $debugKey;
40-
private $prodEnvs = ['prod'];
41-
private $usePutenv = false;
32+
private string $path;
33+
private int $cursor;
34+
private int $lineno;
35+
private string $data;
36+
private int $end;
37+
private array $values = [];
38+
private string $envKey;
39+
private string $debugKey;
40+
private array $prodEnvs = ['prod'];
41+
private bool $usePutenv = false;
4242

4343
public function __construct(string $envKey = 'APP_ENV', string $debugKey = 'APP_DEBUG')
4444
{
@@ -89,10 +89,10 @@ public function load(string $path, string ...$extraPaths): void
8989
* .env.local is always ignored in test env because tests should produce the same results for everyone.
9090
* .env.dist is loaded when it exists and .env is not found.
9191
*
92-
* @param string $path A file to load
93-
* @param string $envKey|null The name of the env vars that defines the app env
94-
* @param string $defaultEnv The app env to use when none is defined
95-
* @param array $testEnvs A list of app envs for which .env.local should be ignored
92+
* @param string $path A file to load
93+
* @param string|null $envKey The name of the env vars that defines the app env
94+
* @param string $defaultEnv The app env to use when none is defined
95+
* @param array $testEnvs A list of app envs for which .env.local should be ignored
9696
*
9797
* @throws FormatException when a file has a syntax error
9898
* @throws PathException when a file does not exist or is not readable
@@ -257,8 +257,7 @@ public function parse(string $data, string $path = '.env'): array
257257
return $this->values;
258258
} finally {
259259
$this->values = [];
260-
$this->data = null;
261-
$this->path = null;
260+
unset($this->path, $this->cursor, $this->lineno, $this->data, $this->end);
262261
}
263262
}
264263

‎src/Symfony/Component/Dotenv/Exception/FormatException.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Dotenv/Exception/FormatException.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
final class FormatException extends \LogicException implements ExceptionInterface
2020
{
21-
private $context;
21+
private FormatExceptionContext $context;
2222

2323
public function __construct(string $message, FormatExceptionContext $context, int $code = 0, \Throwable $previous = null)
2424
{

‎src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
*/
1717
final class FormatExceptionContext
1818
{
19-
private $data;
20-
private $path;
21-
private $lineno;
22-
private $cursor;
19+
private string $data;
20+
private string $path;
21+
private int $lineno;
22+
private int $cursor;
2323

2424
public function __construct(string $data, string $path, int $lineno, int $cursor)
2525
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.