Merge branch '3.4' into 4.3

* 3.4:
  [Filesystem] [Serializer] fixes English grammar typo
  [Monolog Bridge] Fixed accessing static property as non static.
  Improve Symfony description
  [Validator] Add Japanese translation
  Remove some unused methods parameters
  Avoid empty \"If-Modified-Since\" header in validation request
  [Validator] ConstraintValidatorTestCase: add missing return value to mocked validate method calls
This commit is contained in:
Fabien Potencier 2019-11-26 04:44:44 +01:00
commit 4daa83e8fc
13 changed files with 29 additions and 21 deletions

View File

@ -2,7 +2,7 @@
<img src="https://symfony.com/logos/symfony_black_02.svg">
</a></p>
[Symfony][1] is a **PHP framework** for web applications and a set of reusable
[Symfony][1] is a **PHP framework** for web and console applications and a set of reusable
**PHP components**. Symfony is used by thousands of web applications (including
BlaBlaCar.com and Spotify.com) and most of the [popular PHP projects][2] (including
Drupal and Magento).

View File

@ -41,7 +41,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
}
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
$this->sendHeaders = false;
self::$sendHeaders = false;
$this->headers = [];
return;
@ -59,7 +59,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
*/
protected function sendHeader($header, $content)
{
if (!$this->sendHeaders) {
if (!self::$sendHeaders) {
return;
}

View File

@ -167,7 +167,7 @@ class JsonDescriptor extends Descriptor
*/
protected function describeCallable($callable, array $options = [])
{
$this->writeData($this->getCallableData($callable, $options), $options);
$this->writeData($this->getCallableData($callable), $options);
}
/**
@ -315,7 +315,7 @@ class JsonDescriptor extends Descriptor
return $data;
}
private function getCallableData($callable, array $options = []): array
private function getCallableData($callable): array
{
$data = [];

View File

@ -523,7 +523,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
{
$encoderMap = [];
foreach ($encoders as $class => $encoder) {
$encoderMap[$class] = $this->createEncoder($encoder, $container);
$encoderMap[$class] = $this->createEncoder($encoder);
}
$container
@ -532,7 +532,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
;
}
private function createEncoder($config, ContainerBuilder $container)
private function createEncoder($config)
{
// a custom encoder service
if (isset($config['id'])) {

View File

@ -114,7 +114,7 @@ EOF
continue;
}
$this->displayLog($input, $output, $clientId, $record);
$this->displayLog($output, $clientId, $record);
}
}
@ -141,7 +141,7 @@ EOF
}
}
private function displayLog(InputInterface $input, OutputInterface $output, $clientId, array $record)
private function displayLog(OutputInterface $output, $clientId, array $record)
{
if ($this->handler->isHandling($record)) {
if (isset($record['log_id'])) {

View File

@ -304,7 +304,7 @@ class XmlFileLoader extends FileLoader
$definition->setDeprecated(true, $deprecated[0]->nodeValue ?: null);
}
$definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, false, $definition instanceof ChildDefinition));
$definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, $definition instanceof ChildDefinition));
$definition->setProperties($this->getArgumentsAsPhp($service, 'property', $file));
if ($factories = $this->getChildren($service, 'factory')) {
@ -468,11 +468,10 @@ class XmlFileLoader extends FileLoader
*
* @param string $name
* @param string $file
* @param bool $lowercase
*
* @return mixed
*/
private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase = true, $isChildDefinition = false)
private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $isChildDefinition = false)
{
$arguments = [];
foreach ($this->getChildren($node, $name) as $arg) {
@ -519,10 +518,10 @@ class XmlFileLoader extends FileLoader
$arguments[$key] = new Expression($arg->nodeValue);
break;
case 'collection':
$arguments[$key] = $this->getArgumentsAsPhp($arg, $name, $file, false);
$arguments[$key] = $this->getArgumentsAsPhp($arg, $name, $file);
break;
case 'iterator':
$arg = $this->getArgumentsAsPhp($arg, $name, $file, false);
$arg = $this->getArgumentsAsPhp($arg, $name, $file);
try {
$arguments[$key] = new IteratorArgument($arg);
} catch (InvalidArgumentException $e) {

View File

@ -797,7 +797,7 @@ class FilesystemTest extends FilesystemTestCase
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
// $file does not exists right now: creating "broken" links is a wanted feature
// $file does not exist right now: creating "broken" links is a wanted feature
$this->filesystem->symlink($file, $link);
$this->assertTrue(is_link($link));

View File

@ -382,7 +382,9 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
}
// add our cached last-modified validator
$subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
if ($entry->headers->has('Last-Modified')) {
$subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
}
// Add our cached etag validator to the environment.
// We keep the etags from the client to handle the case when the client

View File

@ -859,6 +859,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
{
$this->setNextResponse(200, [], 'Hello World', function ($request, $response) {
$this->assertFalse($request->headers->has('If-Modified-Since'));
$response->headers->set('Cache-Control', 'public');
$response->headers->set('ETag', '"12345"');
if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) {

View File

@ -29,7 +29,7 @@ trait ClassResolverTrait
*
* @return string
*
* @throws InvalidArgumentException If the class does not exists
* @throws InvalidArgumentException If the class does not exist
*/
private function getClass($value)
{

View File

@ -41,7 +41,7 @@ class XliffFileDumper extends FileDumper
return $this->dumpXliff1($defaultLocale, $messages, $domain, $options);
}
if ('2.0' === $xliffVersion) {
return $this->dumpXliff2($defaultLocale, $messages, $domain, $options);
return $this->dumpXliff2($defaultLocale, $messages, $domain);
}
throw new InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
@ -129,7 +129,7 @@ class XliffFileDumper extends FileDumper
return $dom->saveXML();
}
private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, array $options = [])
private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain)
{
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;

View File

@ -362,6 +362,10 @@
<source>This password has been leaked in a data breach, it must not be used. Please use another password.</source>
<target>このパスワードは漏洩している為使用できません。</target>
</trans-unit>
<trans-unit id="94">
<source>This value should be between {{ min }} and {{ max }}.</source>
<target>{{ min }}以上{{ max }}以下でなければなりません。</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -178,7 +178,8 @@ abstract class ConstraintValidatorTestCase extends TestCase
->willReturn($validator);
$validator->expects($this->at(2 * $i + 1))
->method('validate')
->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group);
->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group)
->willReturn($validator);
}
protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null)
@ -190,7 +191,8 @@ abstract class ConstraintValidatorTestCase extends TestCase
->willReturn($contextualValidator);
$contextualValidator->expects($this->at(2 * $i + 1))
->method('validate')
->with($value, $constraints, $group);
->with($value, $constraints, $group)
->willReturn($contextualValidator);
}
protected function assertNoViolation()