Merge branch '4.4' into 5.2

* 4.4:
  [Contracts] Add missing `@return` annotations
  [FrameworkBundle] Fixed file operations in Sodium vault seal
This commit is contained in:
Nicolas Grekas 2021-07-13 11:34:55 +02:00
commit 8c75b86a0c
7 changed files with 16 additions and 3 deletions

View File

@ -90,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", VarExporter::export($list), \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));
} }
@ -142,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", VarExporter::export($list), \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));

View File

@ -27,6 +27,8 @@ trait CacheTrait
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*
* @return mixed
*/ */
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null) public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{ {

View File

@ -18,6 +18,9 @@ class TestHttpServer
{ {
private static $process = []; private static $process = [];
/**
* @return Process
*/
public static function start(int $port = 8057) public static function start(int $port = 8057)
{ {
if (isset(self::$process[$port])) { if (isset(self::$process[$port])) {

View File

@ -52,6 +52,8 @@ trait ServiceSubscriberTrait
/** /**
* @required * @required
*
* @return ContainerInterface|null
*/ */
public function setContainer(ContainerInterface $container) public function setContainer(ContainerInterface $container)
{ {

View File

@ -17,6 +17,9 @@ use Symfony\Contracts\Service\ServiceLocatorTrait;
abstract class ServiceLocatorTest extends TestCase abstract class ServiceLocatorTest extends TestCase
{ {
/**
* @return ContainerInterface
*/
protected function getServiceLocator(array $factories) protected function getServiceLocator(array $factories)
{ {
return new class($factories) implements ContainerInterface { return new class($factories) implements ContainerInterface {

View File

@ -42,7 +42,7 @@ class ParentTestService
{ {
} }
public function setContainer(ContainerInterface $container) public function setContainer(ContainerInterface $container): ContainerInterface
{ {
return $container; return $container;
} }

View File

@ -43,6 +43,9 @@ class TranslatorTest extends TestCase
\Locale::setDefault($this->defaultLocale); \Locale::setDefault($this->defaultLocale);
} }
/**
* @return TranslatorInterface
*/
public function getTranslator() public function getTranslator()
{ {
return new class() implements TranslatorInterface { return new class() implements TranslatorInterface {