8000 Deprecated the entire getEnvParameters() method · symfony/symfony@4374128 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4374128

Browse files
committed
Deprecated the entire getEnvParameters() method
1 parent 2b8b6c7 commit 4374128

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ protected function getKernelParameters()
563563
'kernel.charset' => $this->getCharset(),
564564
'kernel.container_class' => $this->getContainerClass(),
565565
),
566-
$this->getEnvParameters()
566+
$this->getEnvParameters(false)
567567
);
568568
}
569569

@@ -573,13 +573,19 @@ protected function getKernelParameters()
573573
* Only the parameters starting with "SYMFONY__" are considered.
574574
*
575575
* @return array An array of parameters
576+
*
577+
* @deprecated since version 3.3, to be removed in 4.0
576578
*/
577579
protected function getEnvParameters()
578580
{
581+
if (0 === func_num_args() || func_get_arg(0)) {
582+
@trigger_error(sprintf('The %s() method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED);
583+
}
584+
579585
$parameters = array();
580586
foreach ($_SERVER as $key => $value) {
581587
if (0 === strpos($key, 'SYMFONY__')) {
582-
@trigger_error(sprintf('The support of special environment variables that start with SYMFONY__ (such as "%s") is deprecated as of 3.3 and will be removed in 4.0. Use the %env()% syntax instead to get the value of environment variables in configuration files.', $key), E_USER_DEPRECATED);
588+
@trigger_error(sprintf('The support of special environment variables that start with SYMFONY__ (such as "%s") is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax instead to get the value of environment variables in configuration files.', $key), E_USER_DEPRECATED);
583589
$parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value;
584590
}
585591
}

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@ public function testKernelRootDirNameStartingWithANumber()
744744

745745
/**
746746
* @group legacy
747+
* @expectedDeprecation The Symfony\Component\HttpKernel\Kernel::getEnvParameters() method is deprecated as of 3.3 and will be removed in 4.0. Use the %s syntax to get the value of any environment variable from configuration files instead.
747748
* @expectedDeprecation The support of special environment variables that start with SYMFONY__ (such as "SYMFONY__FOO__BAR") is deprecated as of 3.3 and will be removed in 4.0. Use the %env()% syntax instead to get the value of environment variables in configuration files.
748749
*/
749750
public function testSymfonyEnvironmentVariables()

0 commit comments

Comments
 (0)
0