Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c0d4fde

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [6.3] Remove unused test fixture [5.4] Remove unused test fixtures [Dotent] Add PHPDoc for `$overrideExistingVars` [SecurityBundle] Fix missing login-link element in xsd schema [Validator] Add missing Chinese translations #51934 replace a not-existing virtual request stack with the real one [Messenger] add handler description as array key to `HandlerFailedException::getWrappedExceptions()` [Serializer] Fix using `DateIntervalNormalizer` with union types [Validator] fix: add missing translations for for Thai (th) fix #52273 [doctrine-messenger] DB table locks on messenger_messages with many failures [Serializer] Handle defaultContext for DateTimeNormalizer declare constructor argument as optional for backwards compatibility [CI] Add step to verify symfony/deprecation-contracts requirements
2 parents 80361b8 + 3d078d1 commit c0d4fde

File tree

29 files changed

+214
-260
lines changed

29 files changed

+214
-260
lines changed

.github/get-modified-packages.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ function getPackageType(string $packageDir): string
6666

6767
$output = [];
6868
foreach ($modifiedPackages as $directory => $bool) {
69-
$name = json_decode(file_get_contents($directory.'/composer.json'), true)['name'] ?? 'unknown';
70-
$output[] = ['name' => $name, 'directory' => $directory, 'new' => $newPackage[$directory] ?? false, 'type' => getPackageType($directory)];
69+
$composerData = json_decode(file_get_contents($directory.'/composer.json'), true);
70+
$name = $composerData['name'] ?? 'unknown';
71+
$requiresDeprecationContracts = isset($composerData['require']['symfony/deprecation-contracts']);
72+
$output[] = ['name' => $name, 'directory' => $directory, 'new' => $newPackage[$directory] ?? false, 'type' => getPackageType($directory), 'requires_deprecation_contracts' => $requiresDeprecationContracts];
7173
}
7274

7375
echo json_encode($output);

.github/workflows/package-tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,44 @@ jobs:
100100
fi
101101
done
102102
103+
exit $ok
104+
- name: Verify symfony/deprecation-contracts requirements
105+
run: |
106+
set +e
107+
108+
ok=0
109+
json='${{ steps.find-packages.outputs.packages }}'
110+
for package in $(echo "${json}" | jq -r '.[] | @base64'); do
111+
_jq() {
112+
echo ${package} | base64 --decode | jq -r ${1}
113+
}
114+
115+
NAME=$(_jq '.name')
116+
if [[ $NAME = 'symfony/deprecation-contracts' || $NAME = 'symfony/contracts' ]]; then
117+
continue
118+
fi
119+
120+
echo "::group::$NAME"
121+
DIR=$(_jq '.directory')
122+
localExit=0
123+
grep -rq 'trigger_deprecation(' --include=*.php --exclude-dir=Tests/ --exclude-dir=Bridge/ $DIR
124+
triggersDeprecation=$?
125+
if [[ $triggersDeprecation -eq 0 && $(_jq '.requires_deprecation_contracts') == false ]]; then
126+
errorMessage="::error::$NAME does not require symfony/deprecation-contracts but triggers at least one deprecation"
127+
localExit=1
128+
elif [[ $triggersDeprecation -eq 1 && $(_jq '.requires_deprecation_contracts') == true ]]; then
129+
errorMessage="::error::$NAME requires symfony/deprecation-contracts but does not trigger any deprecation"
130+
localExit=1
131+
elif [[ $triggersDeprecation -ne 0 && $triggersDeprecation -ne 1 ]]; then
132+
echo "::error::grep failed"
133+
exit 2
134+
fi
135+
136+
ok=$(( $localExit || $ok ))
137+
echo ::endgroup::
138+
if [ $localExit -ne 0 ]; then
139+
echo $errorMessage
140+
fi
141+
done
142+
103143
exit $ok

src/Symfony/Bundle/DebugBundle/DependencyInjection/Compiler/DumpDataCollectorPass.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
1515
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\DependencyInjection\Reference;
1718

1819
/**
1920
* Registers the file link format for the {@link \Symfony\Component\HttpKernel\DataCollector\DumpDataCollector}.
@@ -30,6 +31,10 @@ public function process(ContainerBuilder $container): void
3031

3132
$definition = $container->getDefinition('data_collector.dump');
3233

34+
if (!$container->has('.virtual_request_stack')) {
35+
$definition->replaceArgument(3, new Reference('request_stack'));
36+
}
37+
3338
if (!$container->hasParameter('web_profiler.debug_toolbar.mode') || WebDebugToolbarListener::DISABLED === $container->getParameter('web_profiler.debug_toolbar.mode')) {
3439
$definition->replaceArgument(3, null);
3540
}

src/Symfony/Bundle/DebugBundle/Tests/DependencyInjection/Compiler/DumpDataCollectorPassTest.php

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Bundle\WebProfilerBundle\EventListener\WebDebugToolbarListener;
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
1818
use Symfony\Component\DependencyInjection\Definition;
19+
use Symfony\Component\DependencyInjection\Reference;
1920
use Symfony\Component\HttpFoundation\RequestStack;
2021
use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
2122

@@ -26,35 +27,51 @@ public function testProcessWithoutFileLinkFormatParameter()
2627
$container = new ContainerBuilder();
2728
$container->addCompilerPass(new DumpDataCollectorPass());
2829

29-
$definition = new Definition(DumpDataCollector::class, [null, null, null, null]);
30+
$definition = new Definition(DumpDataCollector::class, [null, null, new Reference('.virtual_request_stack'), null]);
3031
$container->setDefinition('data_collector.dump', $definition);
3132

3233
$container->compile();
3334

3435
$this->assertNull($definition->getArgument(1));
3536
}
3637

37-
public function testProcessWithToolbarEnabled()
38+
public function testProcessWithToolbarEnabledAndVirtualRequestStackPresent()
3839
{
3940
$container = new ContainerBuilder();
41+
$container->register('request_stack', RequestStack::class);
42+
$container->register('.virtual_request_stack', RequestStack::class);
4043
$container->addCompilerPass(new DumpDataCollectorPass());
41-
$requestStack = new RequestStack();
4244

43-
$definition = new Definition(DumpDataCollector::class, [null, null, null, $requestStack]);
45+
$definition = new Definition(DumpDataCollector::class, [null, null, null, new Reference('.virtual_request_stack')]);
4446
$container->setDefinition('data_collector.dump', $definition);
4547
$container->setParameter('web_profiler.debug_toolbar.mode', WebDebugToolbarListener::ENABLED);
4648

4749
$container->compile();
4850

49-
$this->assertSame($requestStack, $definition->getArgument(3));
51+
$this->assertEquals(new Reference('.virtual_request_stack'), $definition->getArgument(3));
52+
}
53+
54+
public function testProcessWithToolbarEnabledAndVirtualRequestStackNotPresent()
55+
{
56+
$container = new ContainerBuilder();
57+
$container->register('request_stack', RequestStack::class);
58+
$container->addCompilerPass(new DumpDataCollectorPass());
59+
60+
$definition = new Definition(DumpDataCollector::class, [null, null, null, new Reference('.virtual_request_stack')]);
61+
$container->setDefinition('data_collector.dump', $definition);
62+
$container->setParameter('web_profiler.debug_toolbar.mode', WebDebugToolbarListener::ENABLED);
63+
64+
$container->compile();
65+
66+
$this->assertEquals(new Reference('request_stack'), $definition->getArgument(3));
5067
}
5168

5269
public function testProcessWithToolbarDisabled()
5370
{
5471
$container = new ContainerBuilder();
5572
$container->addCompilerPass(new DumpDataCollectorPass());
5673

57-
$definition = new Definition(DumpDataCollector::class, [null, null, null, new RequestStack()]);
74+
$definition = new Definition(DumpDataCollector::class, [null, null, new Reference('.virtual_request_stack'), new RequestStack()]);
5875
$container->setDefinition('data_collector.dump', $definition);
5976
$container->setParameter('web_profiler.debug_toolbar.mode', WebDebugToolbarListener::DISABLED);
6077

@@ -68,7 +85,7 @@ public function testProcessWithoutToolbar()
6885
$container = new ContainerBuilder();
6986
$container->addCompilerPass(new DumpDataCollectorPass());
7087

71-
$definition = new Definition(DumpDataCollector::class, [null, null, null, new RequestStack()]);
88+
$definition = new Definition(DumpDataCollector::class, [null, null, new Reference('.virtual_request_stack'), new RequestStack()]);
7289
$container->setDefinition('data_collector.dump', $definition);
7390

7491
$container->compile();

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/DefaultController.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/Sub/DefaultController.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/Controller/Test/DefaultController.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/FooBundle/FooBundle.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Sensio/Cms/FooBundle/Controller/DefaultController.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Sensio/Cms/FooBundle/SensioCmsFooBundle.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Sensio/FooBundle/Controller/DefaultController.php

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/TestBundle/Sensio/FooBundle/SensioFooBundle.php

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/Symfony/Bundle/SecurityBundle/Resources/config/schema/security-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
<xsd:element name="http-basic-ldap" type="http_basic_ldap" minOccurs="0" maxOccurs="1" />
145145
<xsd:element name="json-login" type="json_login" minOccurs="0" maxOccurs="1" />
146146
<xsd:element name="json-login-ldap" type="json_login_ldap" minOccurs="0" maxOccurs="1" />
147+
<xsd:element name="login-link" type="login_link" minOccurs="0" maxOccurs="1" />
147148
<xsd:element name="login-throttling" type="login_throttling" minOccurs="0" maxOccurs="1" />
148149
<xsd:element name="remember-me" type="remember_me" minOccurs="0" maxOccurs="1" />
149150
<xsd:element name="remote-user" type="remote_user" minOccurs="0" maxOccurs="1" />

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ public function load(string $path, string ...$extraPaths): void
8989
* .env.local is always ignored in test env because tests should produce the same results for everyone.
9090
* .env.dist is loaded when it exists and .env is not found.
9191
*
92-
* @param string $path A file to load
93-
* @param string|null $envKey The name of the env vars that defines the app env
94-
* @param string $defaultEnv The app env to use when none is defined
95-
* @param array $testEnvs A list of app envs for which .env.local should be ignored
92+
* @param string $path A file to load
93+
* @param string|null $envKey The name of the env vars that defines the app env
94+
* @param string $defaultEnv The app env to use when none is defined
95+
* @param array $testEnvs A list of app envs for which .env.local should be ignored
96+
* @param bool $overrideExistingVars Whether existing environment variables set by the system should be overridden
9697
*
9798
* @throws FormatException when a file has a syntax error
9899
* @throws PathException when a file does not exist or is not readable
@@ -173,7 +174,7 @@ public function overload(string $path, string ...$extraPaths): void
173174
* Sets values as environment variables (via putenv, $_ENV, and $_SERVER).
174175
*
175176
* @param array $values An array of env variables
176-
* @param bool $overrideExistingVars true when existing environment variables must be overridden
177+
* @param bool $overrideExistingVars Whether existing environment variables set by the system should be overridden
177178
*/
178179
public function populate(array $values, bool $overrideExistingVars = false): void
179180
{

src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,3 @@ public function testGetEnumThrowsExceptionWithInvalidValueType()
367367
$this->assertNull($bag->getEnum('invalid-value', FooEnum::class));
368368
}
369369
}
370-
371-
class InputStringable
372-
{
373-
public function __construct(private string $value)
374-
{
375-
}
376-
377-
public function __toString(): string
378-
{
379-
return $this->value;
380-
}
381-
}

0 commit comments

Comments
 (0)