Skip to content

Commit 9ea5b45

Browse files
santysisinicolas-grekas
authored andcommitted
[Routing] Remove deprecated getEnv and setEnv methods
1 parent 63504c1 commit 9ea5b45

File tree

3 files changed

+2
-27
lines changed

3 files changed

+2
-27
lines changed

UPGRADE-8.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ Routing
343343

344344
* Providing a non-array `_query` parameter to `UrlGenerator` causes an `InvalidParameterException`
345345
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
346+
* Remove `getEnv()` and `setEnv()` methods of the `Route` attribute; use the plurialized `getEnvs()` and `setEnvs()` methods instead
346347

347348
Security
348349
--------

src/Symfony/Component/Routing/Attribute/Route.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\Component\Routing\Attribute;
1313

14-
use Symfony\Component\Routing\Exception\LogicException;
15-
1614
/**
1715
* @author Fabien Potencier <fabien@symfony.com>
1816
* @author Alexander M. Turek <me@derrabus.de>
@@ -204,31 +202,6 @@ public function getPriority(): ?int
204202
return $this->priority;
205203
}
206204

207-
/**
208-
* @deprecated since Symfony 7.4, use the {@see setEnvs()} method instead
209-
*/
210-
public function setEnv(?string $env): void
211-
{
212-
trigger_deprecation('symfony/routing', '7.4', 'The "%s()" method is deprecated, use "setEnvs()" instead.', __METHOD__);
213-
$this->env = (array) $env;
214-
}
215-
216-
/**
217-
* @deprecated since Symfony 7.4, use {@see getEnvs()} method instead
218-
*/
219-
public function getEnv(): ?string
220-
{
221-
trigger_deprecation('symfony/routing', '7.4', 'The "%s()" method is deprecated, use "getEnvs()" instead.', __METHOD__);
222-
if (!$this->env) {
223-
return null;
224-
}
225-
if (\count($this->env) > 1) {
226-
throw new LogicException(\sprintf('The "env" property has %d environments. Use "getEnvs()" to get all of them.', \count($this->env)));
227-
}
228-
229-
return $this->env[0];
230-
}
231-
232205
public function setEnvs(array|string $env): void
233206
{
234207
$this->env = (array) $env;

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Providing a non-array `_query` parameter to `UrlGenerator` causes an `InvalidParameterException`
88
* Remove the protected `AttributeClassLoader::$routeAnnotationClass` property and the `setRouteAnnotationClass()` method, use `AttributeClassLoader::setRouteAttributeClass()` instead
9+
* Remove `getEnv()` and `setEnv()` methods of the `Route` attribute; use the plurialized `getEnvs()` and `setEnvs()` methods instead
910

1011
7.4
1112
---

0 commit comments

Comments
 (0)