Skip to content

Commit 31b5615

Browse files
author
Robin Chalas
committed
[WebServerBundle] Deprecate relying on --env in server:start and server:run
1 parent 3e7b029 commit 31b5615

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

UPGRADE-4.2.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,9 @@ Validator
231231
* Using the `Bic`, `Country`, `Currency`, `Language` and `Locale` constraints without `symfony/intl` is deprecated
232232
* Using the `Email` constraint without `egulias/email-validator` is deprecated
233233
* Using the `Expression` constraint without `symfony/expression-language` is deprecated
234+
235+
WebServerBundle
236+
---------------
237+
238+
* Omitting the `$environment` argument of the `ServerRunCommand` and
239+
`ServerStartCommand` constructors is deprecated.

UPGRADE-5.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,9 @@ Workflow
222222
* `add` method has been removed use `addWorkflow` method in `Workflow\Registry` instead.
223223
* `SupportStrategyInterface` has been removed, use `WorkflowSupportStrategyInterface` instead.
224224
* `ClassInstanceSupportStrategy` has been removed, use `InstanceOfSupportStrategy` instead.
225+
226+
WebServerBundle
227+
---------------
228+
229+
* Omitting the `$environment` argument of the `ServerRunCommand` and
230+
`ServerStartCommand` constructors now throws a `\TypeError.

src/Symfony/Bundle/WebServerBundle/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
4.2.0
5+
-----
6+
7+
* Deprecated omitting the `$environment` argument of the `ServerRunCommand` and
8+
`ServerStartCommand` constructors
9+
410
3.4.0
511
-----
612

src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class ServerRunCommand extends Command
3636

3737
public function __construct(string $documentRoot = null, string $environment = null)
3838
{
39+
if (!$environment) {
40+
@trigger_error(sprintf('Omitting the $environment argument of the "%s" constructor is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
41+
}
42+
3943
$this->documentRoot = $documentRoot;
4044
$this->environment = $environment;
4145

@@ -99,6 +103,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
99103
$documentRoot = $this->documentRoot;
100104
}
101105

106+
// @deprecated since Symfony 4.2
102107
if (!$env = $this->environment) {
103108
if ($input->hasOption('env') && !$env = $input->getOption('env')) {
104109
$io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.');

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class ServerStartCommand extends Command
3636

3737
public function __construct(string $documentRoot = null, string $environment = null)
3838
{
39+
if (!$environment) {
40+
@trigger_error(sprintf('Omitting the $environment argument of the "%s" constructor is deprecated since Symfony 4.2.', __CLASS__), E_USER_DEPRECATED);
41+
}
42+
3943
$this->documentRoot = $documentRoot;
4044
$this->environment = $environment;
4145

@@ -112,6 +116,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
112116
$documentRoot = $this->documentRoot;
113117
}
114118

119+
// @deprecated since Symfony 4.2
115120
if (!$env = $this->environment) {
116121
if ($input->hasOption('env') && !$env = $input->getOption('env')) {
117122
$io->error('The environment must be either passed as second argument of the constructor or through the "--env" input option.');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy