10000 Merge branch '4.4' into 5.1 · fancyweb/symfony@4ee591b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ee591b

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: fix merge drop logger mock in favor of using the BufferingLogger catch ValueError thrown on PHP 8 [Yaml Parser] Fix edge cases when parsing multiple documents fix parsing comments not prefixed by a space [Translator] Make sure a null locale is handled properly deal with errors being thrown on PHP 8 [Cache] Allow cache tags to be objects implementing __toString() [HttpKernel] Do not override max_redirects option in HttpClientKernel remove superfluous cast [HttpClient] Support for CURLOPT_LOCALPORT. Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3). Fixed exception message formatting [FrameworkBundle] Fix error in xsd which prevent to register more than one metadata [Console] work around disabled putenv() [PhpUnitBridge] Fix error with ReflectionClass [HttpClient][HttpClientTrait] don't calculate alternatives if option is auth_ntlm Change 'cache_key' to AbstractRendererEngine::CACHE_KEY_VAR Upgrade PHPUnit to 8.5 (php 7.2) and 9.3 (php >= 7.3).
2 parents 2384f08 + 50f37f0 commit 4ee591b

File tree

29 files changed

+313
-42
lines changed

29 files changed

+313
-42
lines changed

phpunit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
1212
if (false === getenv('SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT') && false !== strpos(@file_get_contents(__DIR__.'/src/Symfony/Component/HttpKernel/Kernel.php'), 'const MAJOR_VERSION = 3;')) {
1313
putenv('SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1');
1414
}
15-
if (\PHP_VERSION_ID >= 80000) {
16-
putenv('SYMFONY_PHPUNIT_VERSION=9.3');
15+
if (\PHP_VERSION_ID < 70300) {
16+
putenv('SYMFONY_PHPUNIT_VERSION=8.5');
1717
} else {
18-
putenv('SYMFONY_PHPUNIT_VERSION=8.3');
18+
putenv('SYMFONY_PHPUNIT_VERSION=9.3');
1919
}
2020
} elseif (\PHP_VERSION_ID >= 70000) {
2121
putenv('SYMFONY_PHPUNIT_VERSION=6.5');

src/Symfony/Bridge/PhpUnit/Legacy/CoverageListenerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private function addCoversForDocBlockInsideRegistry($test, $covers)
109109

110110
// Exclude internal classes; PHPUnit 9.1+ is picky about tests covering, say, a \RuntimeException
111111
$covers = array_filter($covers, function ($class) {
112-
$reflector = new ReflectionClass($class);
112+
$reflector = new \ReflectionClass($class);
113113

114114
return $reflector->isUserDefined();
115115
});

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ function ($a) {
11971197
return $middleware;
11981198
}
11991199
if (1 < \count($middleware)) {
1200-
throw new \InvalidArgumentException(sprintf('Invalid middleware at path "framework.messenger": a map with a single factory id as key and its arguments as value was expected, %s given.', json_encode($middleware)));
1200+
throw new \InvalidArgumentException('Invalid middleware at path "framework.messenger": a map with a single factory id as key and its arguments as value was expected, '.json_encode($middleware).' given.');
12011201
}
12021202

12031203
return [

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@
331331

332332
<xsd:complexType name="metadata">
333333
<xsd:sequence>
334-
<xsd:any minOccurs="0" processContents="lax"/>
334+
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
335335
</xsd:sequence>
336336
</xsd:complexType>
337337

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/workflows.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
FrameworkExtensionTest::class,
1111
],
1212
'initial_marking' => ['draft'],
13+
'metadata' => [
14+
'title' => 'article workflow',
15+
'description' => 'workflow for articles'
16+
],
1317
'places' => [
1418
'draft',
1519
'wait_for_journalist',

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/workflows.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<framework:from>approved_by_spellchecker</framework:from>
3636
<framework:to>published</framework:to>
3737
</framework:transition>
38+
<framework:metadata>
39+
<framework:title>article workflow</framework:title>
40+
<framework:description>workflow for articles</framework:description>
41+
</framework:metadata>
3842
</framework:workflow>
3943

4044
<framework:workflow name="pull_request">

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/workflows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ framework:
55
supports:
66
- Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest
77
initial_marking: [draft]
8+
metadata:
9+
title: article workflow
10+
description: workflow for articles
811
places:
912
# simple format
1013
- draft

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;
5555
use Symfony\Component\Validator\Mapping\Loader\PropertyInfoLoader;
5656
use Symfony\Component\Workflow;
57+
use Symfony\Component\Workflow\Metadata\InMemoryMetadataStore;
5758

5859
abstract class FrameworkExtensionTest extends TestCase
5960
{
@@ -231,6 +232,12 @@ public function testWorkflows()
231232
);
232233
$this->assertCount(4, $workflowDefinition->getArgument(1));
233234
$this->assertSame(['draft'], $workflowDefinition->getArgument(2));
235+
$metadataStoreDefinition = $workflowDefinition->getArgument(3);
236+
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
237+
$this->assertSame([
238+
'title' => 'article workflow',
239+
'description' => 'workflow for articles',
240+
], $metadataStoreDefinition->getArgument(0));
234241

235242
$this->assertTrue($container->hasDefinition('state_machine.pull_request'), 'State machine is registered as a service');
236243
$this->assertSame('state_machine.abstract', $container->getDefinition('state_machine.pull_request')->getParent());
@@ -255,7 +262,7 @@ public function testWorkflows()
255262

256263
$metadataStoreDefinition = $stateMachineDefinition->getArgument(3);
257264
$this->assertInstanceOf(Definition::class, $metadataStoreDefinition);
258-
$this->assertSame(Workflow\Metadata\InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
265+
$this->assertSame(InMemoryMetadataStore::class, $metadataStoreDefinition->getClass());
259266

260267
$workflowMetadata = $metadataStoreDefinition->getArgument(0);
261268
$this->assertSame(['title' => 'workflow title'], $workflowMetadata);

src/Symfony/Component/Cache/CacheItem.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ public function tag($tags): ItemInterface
119119
$tags = [$tags];
120120
}
121121
foreach ($tags as $tag) {
122-
if (!\is_string($tag)) {
123-
throw new InvalidArgumentException(sprintf('Cache tag must be string, "%s" given.', get_debug_type($tag)));
122+
if (!\is_string($tag) && !(\is_object($tag) && method_exists($tag, '__toString'))) {
123+
throw new InvalidArgumentException(sprintf('Cache tag must be string or object that implements __toString(), "%s" given.', \is_object($tag) ? \get_class($tag) : \gettype($tag)));
124124
}
125+
$tag = (string) $tag;
125126
if (isset($this->newMetadata[self::METADATA_TAGS][$tag])) {
126127
continue;
127128
}

src/Symfony/Component/Cache/Tests/CacheItemTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Cache\CacheItem;
16+
use Symfony\Component\Cache\Tests\Fixtures\StringableTag;
1617

1718
class CacheItemTest extends TestCase
1819
{
@@ -61,9 +62,11 @@ public function testTag()
6162

6263
$this->assertSame($item, $item->tag('foo'));
6364
$this->assertSame($item, $item->tag(['bar', 'baz']));
65+
$this->assertSame($item, $item->tag(new StringableTag('qux')));
66+
$this->assertSame($item, $item->tag([new StringableTag('quux'), new StringableTag('quuux')]));
6467

6568
(\Closure::bind(function () use ($item) {
66-
$this->assertSame(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz'], $item->newMetadata[CacheItem::METADATA_TAGS]);
69+
$this->assertSame(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz', 'qux' => 'qux', 'quux' => 'quux', 'quuux' => 'quuux'], $item->newMetadata[CacheItem::METADATA_TAGS]);
6770
}, $this, CacheItem::class))();
6871
}
6972

0 commit comments

Comments
 (0)
0