Skip to content

Commit

Permalink
Merge changes from 3.14.8
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralbot committed Dec 11, 2024
1 parent 62a76b3 commit a9d8cfe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
],
"require": {
"php": ">=8.1",
"spiral/core": "^3.14.8",
"spiral/files": "^3.14.8",
"spiral/config": "^3.14.8",
"spiral/debug": "^3.14.8",
"spiral/exceptions": "^3.14.8",
"spiral/core": "^3.15",
"spiral/files": "^3.15",
"spiral/config": "^3.15",
"spiral/debug": "^3.15",
"spiral/exceptions": "^3.15",
"spiral/attributes": "^2.8|^3.0",
"spiral/events": "^3.14.8"
"spiral/events": "^3.15"
},
"require-dev": {
"phpunit/phpunit": "^10.1",
Expand Down
7 changes: 7 additions & 0 deletions src/Environment/AppEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public static function detect(EnvironmentInterface $environment): self
{
$value = $environment->get('APP_ENV');

// Aliases
$value = match ($value) {
'production' => self::Production->value,
'test' => self::Testing->value,
default => $value,
};

return \is_string($value)
? (self::tryFrom($value) ?? self::Local)
: self::Local;
Expand Down
4 changes: 4 additions & 0 deletions tests/Environment/AppEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ public static function envVariablesDataProvider(): \Traversable
{
yield ['wrong', AppEnvironment::Local];
yield ['prod', AppEnvironment::Production];
yield ['production', AppEnvironment::Production];
yield ['stage', AppEnvironment::Stage];
yield ['local', AppEnvironment::Local];
yield ['dev', AppEnvironment::Local];
yield ['development', AppEnvironment::Local];
yield ['testing', AppEnvironment::Testing];
yield ['test', AppEnvironment::Testing];
}

public function testClassMethods(): void
Expand Down

0 comments on commit a9d8cfe

Please sign in to comment.