Skip to content

Commit 35b8dfb

Browse files
committed
Merge remote-tracking branch 'upstream/6.3' into 6.3
* upstream/6.3: (64 commits) [Config] Improve adding support for XML format Backport symfony#18598 to 5.4 Fix Method 'getException' not found in ExceptionEvent Corrected return type of anonymous functions Minor tweak [Form] Improve form validation section [OptionsResolver] Fix indentation [Best Practices] Remove annotations paragraph [Encore] Webpack Dev Server: live reload & HMR Minor tweak Update definition.rst Minor tweaks add `OptionsResolverIntrospector`usage doc Minor tweaks fix reference [Form] Fix form data related events definition [Form] Improve form type methods explanation [Console] Add `ProgressIndicator` page Minor tweak Update micro_kernel_trait.rst ...
2 parents fef657f + 5fc65a3 commit 35b8dfb

File tree

147 files changed

+1682
-664
lines changed

Some content is hidden

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

147 files changed

+1682
-664
lines changed

_images/components/messenger/overview.svg

Lines changed: 1 addition & 1 deletion
Loading

_images/components/serializer/serializer_workflow.svg

Lines changed: 283 additions & 1 deletion
Loading
15 Bytes
Binary file not shown.
Binary file not shown.

best_practices.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,6 @@ Doctrine supports several metadata formats, but it's recommended to use PHP
207207
attributes because they are by far the most convenient and agile way of setting
208208
up and looking for mapping information.
209209

210-
If your PHP version doesn't support attributes yet, use annotations, which is
211-
similar but requires installing some extra dependencies in your project.
212-
213210
Controllers
214211
-----------
215212

@@ -411,15 +408,15 @@ checks that all application URLs load successfully::
411408
/**
412409
* @dataProvider urlProvider
413410
*/
414-
public function testPageIsSuccessful($url)
411+
public function testPageIsSuccessful($url): void
415412
{
416413
$client = self::createClient();
417414
$client->request('GET', $url);
418415

419416
$this->assertResponseIsSuccessful();
420417
}
421418

422-
public function urlProvider()
419+
public function urlProvider(): \Generator
423420
{
424421
yield ['/'];
425422
yield ['/posts'];

bundles/configuration.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ The ``Configuration`` class to handle the sample configuration looks like::
183183

184184
class Configuration implements ConfigurationInterface
185185
{
186-
public function getConfigTreeBuilder()
186+
public function getConfigTreeBuilder(): TreeBuilder
187187
{
188188
$treeBuilder = new TreeBuilder('acme_social');
189189

@@ -217,7 +217,7 @@ force validation (e.g. if an additional option was passed, an exception will be
217217
thrown)::
218218

219219
// src/Acme/SocialBundle/DependencyInjection/AcmeSocialExtension.php
220-
public function load(array $configs, ContainerBuilder $container)
220+
public function load(array $configs, ContainerBuilder $container): void
221221
{
222222
$configuration = new Configuration();
223223

@@ -259,7 +259,7 @@ In your extension, you can load this and dynamically set its arguments::
259259
use Symfony\Component\Config\FileLocator;
260260
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
261261

262-
public function load(array $configs, ContainerBuilder $container)
262+
public function load(array $configs, ContainerBuilder $container): void
263263
{
264264
$loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config'));
265265
$loader->load('services.xml');
@@ -288,7 +288,7 @@ In your extension, you can load this and dynamically set its arguments::
288288
class AcmeHelloExtension extends ConfigurableExtension
289289
{
290290
// note that this method is called loadInternal and not load
291-
protected function loadInternal(array $mergedConfig, ContainerBuilder $container)
291+
protected function loadInternal(array $mergedConfig, ContainerBuilder $container): void
292292
{
293293
// ...
294294
}
@@ -304,7 +304,7 @@ In your extension, you can load this and dynamically set its arguments::
304304
(e.g. by overriding configurations and using :phpfunction:`isset` to check
305305
for the existence of a value). Be aware that it'll be very hard to support XML::
306306

307-
public function load(array $configs, ContainerBuilder $container)
307+
public function load(array $configs, ContainerBuilder $container): void
308308
{
309309
$config = [];
310310
// let resources override the previous set value
@@ -458,7 +458,7 @@ the extension. You might want to change this to a more professional URL::
458458
{
459459
// ...
460460

461-
public function getNamespace()
461+
public function getNamespace(): string
462462
{
463463
return 'http://acme_company.com/schema/dic/hello';
464464
}
@@ -490,7 +490,7 @@ can place it anywhere you like. You should return this path as the base path::
490490
{
491491
// ...
492492

493-
public function getXsdValidationBasePath()
493+
public function getXsdValidationBasePath(): string
494494
{
495495
return __DIR__.'/../Resources/config/schema';
496496
}

bundles/extension.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This is how the extension of an AcmeHelloBundle should look like::
3434

3535
class AcmeHelloExtension extends Extension
3636
{
37-
public function load(array $configs, ContainerBuilder $container)
37+
public function load(array $configs, ContainerBuilder $container): void
3838
{
3939
// ... you'll load the files here later
4040
}
@@ -90,7 +90,7 @@ For instance, assume you have a file called ``services.xml`` in the
9090
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
9191

9292
// ...
93-
public function load(array $configs, ContainerBuilder $container)
93+
public function load(array $configs, ContainerBuilder $container): void
9494
{
9595
$loader = new XmlFileLoader(
9696
$container,
@@ -167,7 +167,7 @@ they are compiled when generating the application cache to improve the overall
167167
performance. Define the list of annotated classes to compile in the
168168
``addAnnotatedClassesToCompile()`` method::
169169

170-
public function load(array $configs, ContainerBuilder $container)
170+
public function load(array $configs, ContainerBuilder $container): void
171171
{
172172
// ...
173173

bundles/prepend_extension.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To give an Extension the power to do this, it needs to implement
3131
{
3232
// ...
3333

34-
public function prepend(ContainerBuilder $container)
34+
public function prepend(ContainerBuilder $container): void
3535
{
3636
// ...
3737
}
@@ -52,7 +52,7 @@ a configuration setting in multiple bundles as well as disable a flag in multipl
5252
in case a specific other bundle is not registered::
5353

5454
// src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php
55-
public function prepend(ContainerBuilder $container)
55+
public function prepend(ContainerBuilder $container): void
5656
{
5757
// get all bundles
5858
$bundles = $container->getParameter('kernel.bundles');

cache.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,10 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or
307307
``Psr\Cache\CacheItemPoolInterface``::
308308

309309
use Symfony\Contracts\Cache\CacheInterface;
310+
// ...
310311

311312
// from a controller method
312-
public function listProducts(CacheInterface $customThingCache)
313+
public function listProducts(CacheInterface $customThingCache): Response
313314
{
314315
// ...
315316
}
@@ -555,7 +556,7 @@ the same key could be invalidated with one function call::
555556
) {
556557
}
557558

558-
public function someMethod()
559+
public function someMethod(): void
559560
{
560561
$value0 = $this->myCachePool->get('item_0', function (ItemInterface $item): string {
561562
$item->tag(['foo', 'bar']);

components/asset.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,19 @@ every day::
203203

204204
class DateVersionStrategy implements VersionStrategyInterface
205205
{
206-
private $version;
206+
private \DateTimeInterface $version;
207207

208208
public function __construct()
209209
{
210210
$this->version = date('Ymd');
211211
}
212212

213-
public function getVersion(string $path)
213+
public function getVersion(string $path): \DateTimeInterface
214214
{
215215
return $this->version;
216216
}
217217

218-
public function applyVersion(string $path)
218+
public function applyVersion(string $path): string
219219
{
220220
return sprintf('%s?v=%s', $path, $this->getVersion($path));
221221
}

components/browser_kit.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This method accepts a request and should return a response::
3838

3939
class Client extends AbstractBrowser
4040
{
41-
protected function doRequest($request)
41+
protected function doRequest($request): Response
4242
{
4343
// ... convert request into a response
4444

components/config/definition.rst

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ implements the :class:`Symfony\\Component\\Config\\Definition\\ConfigurationInte
5454

5555
class DatabaseConfiguration implements ConfigurationInterface
5656
{
57-
public function getConfigTreeBuilder()
57+
public function getConfigTreeBuilder(): TreeBuilder
5858
{
5959
$treeBuilder = new TreeBuilder('database');
6060

@@ -568,7 +568,9 @@ be large and you may want to split it up into sections. You can do this
568568
by making a section a separate node and then appending it into the main
569569
tree with ``append()``::
570570

571-
public function getConfigTreeBuilder()
571+
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
572+
573+
public function getConfigTreeBuilder(): TreeBuilder
572574
{
573575
$treeBuilder = new TreeBuilder('database');
574576

@@ -597,7 +599,7 @@ tree with ``append()``::
597599
return $treeBuilder;
598600
}
599601

600-
public function addParametersNode()
602+
public function addParametersNode(): NodeDefinition
601603
{
602604
$treeBuilder = new TreeBuilder('parameters');
603605

@@ -891,3 +893,8 @@ Otherwise the result is a clean array of configuration values::
891893
$databaseConfiguration,
892894
$configs
893895
);
896+
897+
.. caution::
898+
899+
When processing the configuration tree, the processor assumes that the top
900+
level array key (which matches the extension name) is already stripped off.

components/config/resources.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ which allows for recursively importing other resources::
4343

4444
class YamlUserLoader extends FileLoader
4545
{
46-
public function load($resource, $type = null)
46+
public function load($resource, $type = null): void
4747
{
4848
$configValues = Yaml::parse(file_get_contents($resource));
4949

@@ -54,7 +54,7 @@ which allows for recursively importing other resources::
5454
// $this->import('extra_users.yaml');
5555
}
5656

57-
public function supports($resource, $type = null)
57+
public function supports($resource, $type = null): bool
5858
{
5959
return is_string($resource) && 'yaml' === pathinfo(
6060
$resource,

components/console/changing_default_command.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ name to the ``setDefaultCommand()`` method::
1515
#[AsCommand(name: 'hello:world')]
1616
class HelloWorldCommand extends Command
1717
{
18-
protected function configure()
18+
protected function configure(): void
1919
{
2020
$this->setDescription('Outputs "Hello World"');
2121
}
2222

23-
protected function execute(InputInterface $input, OutputInterface $output)
23+
protected function execute(InputInterface $input, OutputInterface $output): int
2424
{
2525
$output->writeln('Hello World');
26+
27+
return Command::SUCCESS;
2628
}
2729
}
2830

components/console/console_arguments.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Have a look at the following command that has three options::
2222
#[AsCommand(name: 'demo:args', description: 'Describe args behaviors')]
2323
class DemoArgsCommand extends Command
2424
{
25-
protected function configure()
25+
protected function configure(): void
2626
{
2727
$this
2828
->setDefinition(
@@ -34,7 +34,7 @@ Have a look at the following command that has three options::
3434
);
3535
}
3636

37-
protected function execute(InputInterface $input, OutputInterface $output)
37+
protected function execute(InputInterface $input, OutputInterface $output): int
3838
{
3939
// ...
4040
}

components/console/helpers/progressbar.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ The progress will then be displayed as a throbber:
9797
1/3 [=========>------------------] 33%
9898
3/3 [============================] 100%
9999
100+
.. tip::
101+
102+
An alternative to this is to use a
103+
:doc:`/components/console/helpers/progressindicator` instead of a
104+
progress bar.
105+
100106
Whenever your task is finished, don't forget to call
101107
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::finish` to ensure
102108
that the progress bar display is refreshed with a 100% completion.

0 commit comments

Comments
 (0)