[FrameworkBundle] Replace var_export with VarExporter to use array short syntax
This commit is contained in:
parent
8445564d02
commit
7f1c76212f
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Secrets;
|
namespace Symfony\Bundle\FrameworkBundle\Secrets;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
|
use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
|
||||||
|
use Symfony\Component\VarExporter\VarExporter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Tobias Schultze <http://tobion.de>
|
* @author Tobias Schultze <http://tobion.de>
|
||||||
@ -89,7 +90,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
|
|||||||
$list = $this->list();
|
$list = $this->list();
|
||||||
$list[$name] = null;
|
$list[$name] = null;
|
||||||
uksort($list, 'strnatcmp');
|
uksort($list, 'strnatcmp');
|
||||||
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", var_export($list, true), \LOCK_EX));
|
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
|
||||||
|
|
||||||
$this->lastMessage = sprintf('Secret "%s" encrypted in "%s"; you can commit it.', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
|
$this->lastMessage = sprintf('Secret "%s" encrypted in "%s"; you can commit it.', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
|
||||||
}
|
}
|
||||||
@ -141,7 +142,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
|
|||||||
|
|
||||||
$list = $this->list();
|
$list = $this->list();
|
||||||
unset($list[$name]);
|
unset($list[$name]);
|
||||||
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", var_export($list, true), \LOCK_EX));
|
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
|
||||||
|
|
||||||
$this->lastMessage = sprintf('Secret "%s" removed from "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
|
$this->lastMessage = sprintf('Secret "%s" removed from "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user