Skip to content

Commit f0bf2bd

Browse files
committed
Merge remote-tracking branch 'upstream/6.4' into 6.4
* upstream/6.4: (81 commits) Minor reword [HttpClient] fix version added for HAR files feature [HTTPClient] Add documentation for `HarFileResponseFactory` Fix a typo making CI red [Serializer] Custom normalizer deprecation [Config] Improve adding support for XML format Backport #18598 to 5.4 Fix Method 'getException' not found in ExceptionEvent Corrected return type of anonymous functions Restore some internal references Minor tweak [Form] Improve form validation section [OptionsResolver] Fix indentation [Documentation] Deprecate annotations [Best Practices] Remove annotations paragraph [Encore] Webpack Dev Server: live reload & HMR Minor tweak Update definition.rst Minor tweaks add `OptionsResolverIntrospector`usage doc ...
2 parents adf5835 + e080852 commit f0bf2bd

File tree

158 files changed

+1887
-808
lines changed

Some content is hidden

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

158 files changed

+1887
-808
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: 6 additions & 8 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

@@ -227,11 +224,12 @@ nothing more than a few lines of *glue-code*, so you are not coupling the
227224
important parts of your application.
228225

229226
.. _best-practice-controller-annotations:
227+
.. _best-practice-controller-attributes:
230228

231-
Use Attributes or Annotations to Configure Routing, Caching, and Security
232-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
229+
Use Attributes to Configure Routing, Caching, and Security
230+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233231

234-
Using attributes or annotations for routing, caching, and security simplifies
232+
Using attributes for routing, caching, and security simplifies
235233
configuration. You don't need to browse several files created with different
236234
formats (YAML, XML, PHP): all the configuration is just where you require it,
237235
and it only uses one format.
@@ -411,15 +409,15 @@ checks that all application URLs load successfully::
411409
/**
412410
* @dataProvider urlProvider
413411
*/
414-
public function testPageIsSuccessful($url)
412+
public function testPageIsSuccessful($url): void
415413
{
416414
$client = self::createClient();
417415
$client->request('GET', $url);
418416

419417
$this->assertResponseIsSuccessful();
420418
}
421419

422-
public function urlProvider()
420+
public function urlProvider(): \Generator
423421
{
424422
yield ['/'];
425423
yield ['/posts'];

bundles/best_practices.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ Event Listeners ``src/EventListener/``
123123
Configuration (routes, services, etc.) ``config/``
124124
Web Assets (CSS, JS, images) ``public/``
125125
Translation files ``translations/``
126-
Validation (when not using annotations) ``config/validation/``
127-
Serialization (when not using annotations) ``config/serialization/``
126+
Validation (when not using attributes) ``config/validation/``
127+
Serialization (when not using attributes) ``config/serialization/``
128128
Templates ``templates/``
129129
Unit and Functional Tests ``tests/``
130130
=================================================== ========================================
@@ -163,7 +163,7 @@ If the bundle includes Doctrine ORM entities and/or ODM documents, it's
163163
recommended to define their mapping using XML files stored in
164164
``config/doctrine/``. This allows to override that mapping using the
165165
:doc:`standard Symfony mechanism to override bundle parts </bundles/override>`.
166-
This is not possible when using annotations/attributes to define the mapping.
166+
This is not possible when using attributes to define the mapping.
167167

168168
Tests
169169
-----

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']);

0 commit comments

Comments
 (0)