Skip to content

Commit c28c9e7

Browse files
Merge branch '7.0' into 7.1
* 7.0: Sync .github/expected-missing-return-types.diff [WebProfilerBundle] Fix the design of the compact toolbar button [AssetMapper] Improve link generation script fix merge consistently use dates in UTC in Doctrine connection tests Add missing Chinese(zh_TW) translations [Intl] [Emoji] Fix emoji files (remove wrong characters / add missing data) [Translation] Crowdin Bridge: use the project language mapping [VarExporter] Nitpicking in README.md [DoctrineBridge] Adapt deprecation message to include ODM bundle attribute name Added missing Serbian (sr_Cyrl) translation [Validator] Add missing Serbian translation [Validator] Add missing arabic translation [Validator] updated Albanian translation [Clock] Fix calling `mockTime()` in `setUpBeforeClass()`
2 parents 8499c81 + 6f9b60d commit c28c9e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+44804
-20485
lines changed

.github/expected-missing-return-types.diff

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,35 @@ git checkout composer.json src/
1010
diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php
1111
--- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php
1212
+++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php
13-
@@ -411,5 +411,5 @@ abstract class AbstractBrowser
13+
@@ -407,5 +407,5 @@ abstract class AbstractBrowser
1414
* @throws \RuntimeException When processing returns exit code
1515
*/
1616
- protected function doRequestInProcess(object $request)
1717
+ protected function doRequestInProcess(object $request): object
1818
{
1919
$deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec');
20-
@@ -444,5 +444,5 @@ abstract class AbstractBrowser
20+
@@ -440,5 +440,5 @@ abstract class AbstractBrowser
2121
* @return object
2222
*/
2323
- abstract protected function doRequest(object $request);
2424
+ abstract protected function doRequest(object $request): object;
2525

2626
/**
27-
@@ -455,5 +455,5 @@ abstract class AbstractBrowser
27+
@@ -451,5 +451,5 @@ abstract class AbstractBrowser
2828
* @throws LogicException When this abstract class is not implemented
2929
*/
3030
- protected function getScript(object $request)
3131
+ protected function getScript(object $request): string
3232
{
3333
throw new LogicException('To insulate requests, you need to override the getScript() method.');
34-
@@ -465,5 +465,5 @@ abstract class AbstractBrowser
34+
@@ -461,5 +461,5 @@ abstract class AbstractBrowser
3535
* @return object
3636
*/
3737
- protected function filterRequest(Request $request)
3838
+ protected function filterRequest(Request $request): object
3939
{
4040
return $request;
41-
@@ -475,5 +475,5 @@ abstract class AbstractBrowser
41+
@@ -471,5 +471,5 @@ abstract class AbstractBrowser
4242
* @return Response
4343
*/
4444
- protected function filterResponse(object $response)
@@ -402,14 +402,14 @@ diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/
402402
diff --git a/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php b/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php
403403
--- a/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php
404404
+++ b/src/Symfony/Component/Routing/Loader/AttributeClassLoader.php
405-
@@ -226,5 +226,5 @@ abstract class AttributeClassLoader implements LoaderInterface
405+
@@ -234,5 +234,5 @@ abstract class AttributeClassLoader implements LoaderInterface
406406
* @return string
407407
*/
408408
- protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
409409
+ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method): string
410410
{
411411
$name = str_replace('\\', '_', $class->name).'_'.$method->name;
412-
@@ -325,5 +325,5 @@ abstract class AttributeClassLoader implements LoaderInterface
412+
@@ -333,5 +333,5 @@ abstract class AttributeClassLoader implements LoaderInterface
413413
* @return void
414414
*/
415415
- abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot);

.github/patch-types.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
case false !== strpos($file, '/vendor/'):
2626
case false !== strpos($file, '/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php'):
2727
case false !== strpos($file, '/src/Symfony/Bridge/Doctrine/Middleware/Debug/'):
28+
case false !== strpos($file, '/src/Symfony/Bridge/Doctrine/Tests/Fixtures/LegacyQueryMock.php'):
2829
case false !== strpos($file, '/src/Symfony/Bridge/PhpUnit/'):
2930
case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'):
3031
case false !== strpos($file, '/src/Symfony/Component/Cache/Tests/Fixtures/DriverWrapper.php'):

src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function initializeSubscribers(): void
200200
continue;
201201
}
202202

203-
throw new \InvalidArgumentException(sprintf('Using Doctrine subscriber "%s" is not allowed, declare it as a listener instead.', get_debug_type($listener)));
203+
throw new \InvalidArgumentException(sprintf('Using Doctrine subscriber "%s" is not allowed. Register it as a listener instead, using e.g. the #[AsDoctrineListener] or #[AsDocumentListener] attribute.', \is_object($listener) ? get_debug_type($listener) : $listener));
204204
}
205205
}
206206

src/Symfony/Bridge/Doctrine/Tests/ContainerAwareEventManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testUsingDoctrineSubscribersThrows()
4242
$this->evm = new ContainerAwareEventManager($this->container, [new MySubscriber(['foo'])]);
4343

4444
$this->expectException(\InvalidArgumentException::class);
45-
$this->expectExceptionMessage('Using Doctrine subscriber "Symfony\Bridge\Doctrine\Tests\MySubscriber" is not allowed, declare it as a listener instead.');
45+
$this->expectExceptionMessage('Using Doctrine subscriber "Symfony\Bridge\Doctrine\Tests\MySubscriber" is not allowed. Register it as a listener instead, using e.g. the #[AsDoctrineListener] or #[AsDocumentListener] attribute.');
4646
$this->evm->getListeners('foo');
4747
}
4848

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
}
4848

4949
.sf-minitoolbar {
50+
--sf-toolbar-gray-800: #262626;
51+
5052
background-color: var(--sf-toolbar-gray-800);
5153
border-top-left-radius: 4px;
5254
bottom: 0;
@@ -66,6 +68,8 @@
6668
}
6769
.sf-minitoolbar svg,
6870
.sf-minitoolbar img {
71+
--sf-toolbar-gray-200: #e5e5e5;
72+
6973
color: var(--sf-toolbar-gray-200);
7074
max-height: 24px;
7175
max-width: 24px;

src/Symfony/Component/AssetMapper/ImportMap/ImportMapRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function render(string|array $entryPoint, array $attributes = []): string
7878
// importmap entry is a noop
7979
$importMap[$importName] = 'data:application/javascript,';
8080
} else {
81-
$importMap[$importName] = 'data:application/javascript,'.rawurlencode(sprintf('const d=document,l=d.createElement("link");l.rel="stylesheet",l.href="%s",(d.head||d.getElementsByTagName("head")[0]).appendChild(l)', $path));
81+
$importMap[$importName] = 'data:application/javascript,'.rawurlencode(sprintf('document.head.appendChild(Object.assign(document.createElement("link"),{rel:"stylesheet",href:"%s"}))', addslashes($path)));
8282
}
8383
}
8484

src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapRendererTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testBasicRender()
9292
$this->assertStringContainsString('"app_css_preload": "data:application/javascript,', $html);
9393
$this->assertStringContainsString('<link rel="stylesheet" href="/subdirectory/assets/styles/app-preload-d1g35t.css">', $html);
9494
// non-preloaded CSS file
95-
$this->assertStringContainsString('"app_css_no_preload": "data:application/javascript,const%20d%3Ddocument%2Cl%3Dd.createElement%28%22link%22%29%3Bl.rel%3D%22stylesheet%22%2Cl.href%3D%22%2Fsubdirectory%2Fassets%2Fstyles%2Fapp-nopreload-d1g35t.css%22%2C%28d.head%7C%7Cd.getElementsByTagName%28%22head%22%29%5B0%5D%29.appendChild%28l%29', $html);
95+
$this->assertStringContainsString('"app_css_no_preload": "data:application/javascript,document.head.appendChild%28Object.assign%28document.createElement%28%22link%22%29%2C%7Brel%3A%22stylesheet%22%2Chref%3A%22%2Fsubdirectory%2Fassets%2Fstyles%2Fapp-nopreload-d1g35t.css%22%7D', $html);
9696
$this->assertStringNotContainsString('<link rel="stylesheet" href="/subdirectory/assets/styles/app-nopreload-d1g35t.css">', $html);
9797
// remote js
9898
$this->assertStringContainsString('"remote_js": "https://cdn.example.com/assets/remote-d1g35t.js"', $html);

src/Symfony/Component/Clock/Test/ClockSensitiveTrait.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,20 @@ public static function mockTime(string|\DateTimeImmutable|bool $when = true): Cl
4242
}
4343

4444
/**
45+
* @beforeClass
46+
*
4547
* @before
4648
*
4749
* @internal
4850
*/
49-
protected static function saveClockBeforeTest(bool $save = true): ClockInterface
51+
public static function saveClockBeforeTest(bool $save = true): ClockInterface
5052
{
5153
static $originalClock;
5254

55+
if ($save && $originalClock) {
56+
self::restoreClockAfterTest();
57+
}
58+
5359
return $save ? $originalClock = Clock::get() : $originalClock;
5460
}
5561

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Clock\Tests;
13+
14+
use PHPUnit\Framework\TestCase;
15+
use Psr\Clock\ClockInterface;
16+
use Symfony\Component\Clock\Clock;
17+
use Symfony\Component\Clock\MockClock;
18+
use Symfony\Component\Clock\NativeClock;
19+
use Symfony\Component\Clock\Test\ClockSensitiveTrait;
20+
21+
class ClockBeforeClassTest extends TestCase
22+
{
23+
use ClockSensitiveTrait;
24+
25+
private static ?ClockInterface $clock = null;
26+
27+
public static function setUpBeforeClass(): void
28+
{
29+
self::$clock = self::mockTime();
30+
}
31+
32+
public static function tearDownAfterClass(): void
33+
{
34+
self::$clock = null;
35+
}
36+
37+
public function testMockClock()
38+
{
39+
$this->assertInstanceOf(MockClock::class, self::$clock);
40+
$this->assertInstanceOf(NativeClock::class, Clock::get());
41+
42+
$clock = self::mockTime();
43+
$this->assertInstanceOf(MockClock::class, Clock::get());
44+
$this->assertSame(Clock::get(), $clock);
45+
46+
$this->assertNotSame($clock, self::$clock);
47+
48+
self::restoreClockAfterTest();
49+
self::saveClockBeforeTest();
50+
51+
$this->assertInstanceOf(MockClock::class, self::$clock);
52+
$this->assertInstanceOf(NativeClock::class, Clock::get());
53+
54+
$clock = self::mockTime();
55+
$this->assertInstanceOf(MockClock::class, Clock::get());
56+
$this->assertSame(Clock::get(), $clock);
57+
58+
$this->assertNotSame($clock, self::$clock);
59+
}
60+
}

0 commit comments

Comments
 (0)