Skip to content

Commit e3399de

Browse files
authored
Merge branch 'symfony:5.4' into master
2 parents bfaf221 + 75862b6 commit e3399de

31 files changed

+209
-86
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: "Set-up PHP"
2424
uses: shivammathur/setup-php@v2
2525
with:
26-
php-version: 8.0
26+
php-version: 8.1
2727
coverage: none
2828
tools: "composer:v2"
2929

@@ -91,7 +91,7 @@ jobs:
9191
- name: Set-up PHP
9292
uses: shivammathur/setup-php@v2
9393
with:
94-
php-version: 8.0
94+
php-version: 8.1
9595
coverage: none
9696

9797
- name: Fetch branch from where the PR started

README.markdown

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,10 @@ $ composer install
4242
$ php build.php
4343
```
4444

45-
Now you can browse the docs at `_build/output/index.html`
45+
After generating docs, serve them with the internal PHP server:
46+
47+
```bash
48+
$ php -S localhost:8000 -t output/
49+
```
50+
51+
Browse `http://localhost:8000` to read the docs.

_build/build.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
$result = (new DocBuilder())->build($buildConfig);
4747

4848
if ($result->isSuccessful()) {
49+
// fix assets URLs to make them absolute (otherwise, they don't work in subdirectories)
50+
foreach (glob($outputDir.'/**/*.html') as $htmlFilePath) {
51+
$htmlContents = file_get_contents($htmlFilePath);
52+
file_put_contents($htmlFilePath, str_replace('href="assets/', 'href="/assets/', $htmlContents));
53+
}
54+
4955
$io->success(sprintf("The Symfony Docs were successfully built at %s", realpath($outputDir)));
5056
} else {
5157
$io->error(sprintf("There were some errors while building the docs:\n\n%s\n", $result->getErrorTrace()));

components/filesystem.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ following rules iteratively until no further processing can be done:
348348

349349
- "." segments are removed;
350350
- ".." segments are resolved;
351-
- backslashes ("\") are converted into forward slashes ("/");
351+
- backslashes ("\\") are converted into forward slashes ("/");
352352
- root paths ("/" and "C:/") always terminate with a slash;
353353
- non-root paths never terminate with a slash;
354354
- schemes (such as "phar://") are kept;

components/runtime.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ the component. This file runs the following logic:
5353

5454
.. caution::
5555

56+
If you use the Composer ``--no-plugins`` option, the ``autoload_runtime.php``
57+
file won't be created.
58+
5659
If you use the Composer ``--no-scripts`` option, make sure your Composer version
5760
is ``>=2.1.3``; otherwise the ``autoload_runtime.php`` file won't be created.
5861

components/string.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,11 @@ Methods to Search and Replace
334334
u('foo')->equalsTo('foo'); // true
335335

336336
// checks if the string content match the given regular expression.
337-
// You can pass flags for preg_match() as second argument. If PREG_PATTERN_ORDER
338-
// or PREG_SET_ORDER are passed, preg_match_all() will be used.
339337
u('avatar-73647.png')->match('/avatar-(\d+)\.png/');
340-
// result = ['avatar-73647.png', '73647']
341-
u('avatar-73647.png')->match('/avatar-(\d+)(-\d+)?\.png/', \PREG_UNMATCHED_AS_NULL);
342338
// result = ['avatar-73647.png', '73647', null]
339+
340+
// You can pass flags for preg_match() as second argument. If PREG_PATTERN_ORDER
341+
// or PREG_SET_ORDER are passed, preg_match_all() will be used.
343342
u('206-555-0100 and 800-555-1212')->match('/\d{3}-\d{3}-\d{4}/', \PREG_PATTERN_ORDER);
344343
// result = [['206-555-0100', '800-555-1212']]
345344

configuration.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,11 @@ In addition to your own env vars, this ``.env`` file also contains the env vars
674674
defined by the third-party packages installed in your application (they are
675675
added automatically by :ref:`Symfony Flex <symfony-flex>` when installing packages).
676676

677+
.. tip::
678+
679+
Since the ``.env`` file is read and parsed on every request, you don't need to
680+
clear the Symfony cache or restart the PHP container if you're using Docker.
681+
677682
.env File Syntax
678683
................
679684

contributing/code/standards.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,12 @@ Naming Conventions
206206
* Use `snake_case`_ for configuration parameters and Twig template variables
207207
(e.g. ``framework.csrf_protection``, ``http_status_code``);
208208

209-
* Use namespaces for all PHP classes and `UpperCamelCase`_ for their names (e.g.
210-
``ConsoleLogger``);
209+
* Use `SCREAMING_SNAKE_CASE`_ for constants (e.g. ``InputArgument::IS_ARRAY``);
210+
211+
* Use `UpperCamelCase`_ for enumeration cases (e.g. ``InputArgumentMode::IsArray``);
212+
213+
* Use namespaces for all PHP classes, interfaces, traits and enums and
214+
`UpperCamelCase`_ for their names (e.g. ``ConsoleLogger``);
211215

212216
* Prefix all abstract classes with ``Abstract`` except PHPUnit ``*TestCase``.
213217
Please note some early Symfony classes do not follow this convention and
@@ -218,6 +222,9 @@ Naming Conventions
218222

219223
* Suffix traits with ``Trait``;
220224

225+
* Don't use a dedicated suffix for classes or enumerations (e.g. like ``Class``
226+
or ``Enum``), except for the cases listed below.
227+
221228
* Suffix exceptions with ``Exception``;
222229

223230
* Prefix PHP attributes with ``As`` where applicable (e.g. ``#[AsCommand]``

contributing/documentation/index.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,3 @@ documentation:
2020
:doc:`License </contributing/documentation/license>`
2121
Explains the details of the Creative Commons BY-SA 3.0 license used for the
2222
Symfony Documentation.
23-
24-
.. toctree::
25-
:hidden:
26-
27-
format
28-
license
29-
overview
30-
standards
31-
translations

controller/argument_value_resolver.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,10 @@ In addition, some components and official bundles provide other value resolvers:
4949

5050
:class:`Symfony\\Component\\Security\\Http\\Controller\\UserValueResolver`
5151
Injects the object that represents the current logged in user if type-hinted
52-
with ``UserInterface``. Default value can be set to ``null`` in case
53-
the controller can be accessed by anonymous users. It requires installing
54-
the :doc:`SecurityBundle </security>`.
55-
56-
``Psr7ServerRequestResolver``
57-
Injects a `PSR-7`_ compliant version of the current request if type-hinted
58-
with ``RequestInterface``, ``MessageInterface`` or ``ServerRequestInterface``.
59-
It requires installing the `SensioFrameworkExtraBundle`_.
52+
with ``UserInterface``. You can also type-hint your own ``User`` class but you
53+
must then add the ``#[CurrentUser]`` attribute to the argument. Default value
54+
can be set to ``null`` in case the controller can be accessed by anonymous
55+
users. It requires installing the :doc:`SecurityBundle </security>`.
6056

6157
Adding a Custom Value Resolver
6258
------------------------------
@@ -247,6 +243,13 @@ Otherwise, set a priority lower than ``100`` to make sure the argument resolver
247243
is not triggered when the ``Request`` attribute is present (for example, when
248244
passing the user along sub-requests).
249245

246+
To ensure your resolvers are added in the right position you can run the following
247+
command to see which argument resolvers are present and in which order they run.
248+
249+
.. code-block:: terminal
250+
251+
$ php bin/console debug:container debug.argument_resolver.inner --show-arguments
252+
250253
.. tip::
251254

252255
As you can see in the ``UserValueResolver::supports()`` method, the user
@@ -260,5 +263,3 @@ passing the user along sub-requests).
260263

261264
.. _`@ParamConverter`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
262265
.. _`yield`: https://www.php.net/manual/en/language.generators.syntax.php
263-
.. _`PSR-7`: https://www.php-fig.org/psr/psr-7/
264-
.. _`SensioFrameworkExtraBundle`: https://github.com/sensiolabs/SensioFrameworkExtraBundle

0 commit comments

Comments
 (0)