Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf280a4

Browse files
authored
Merge branch 'symfony:6.4' into Chris53897-patch-1
2 parents98bb452 +80f7c9e commitdf280a4

File tree

57 files changed

+917
-187
lines changed

Some content is hidden

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

57 files changed

+917
-187
lines changed
Loading

‎best_practices.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,12 @@ nothing more than a few lines of *glue-code*, so you are not coupling the
224224
important parts of your application.
225225

226226
.. _best-practice-controller-annotations:
227+
.. _best-practice-controller-attributes:
227228

228-
Use Attributesor Annotationsto Configure Routing, Caching, and Security
229-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
229+
Use Attributes to Configure Routing, Caching, and Security
230+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
230231

231-
Using attributesor annotationsfor routing, caching, and security simplifies
232+
Using attributes for routing, caching, and security simplifies
232233
configuration. You don't need to browse several files created with different
233234
formats (YAML, XML, PHP): all the configuration is just where you require it,
234235
and it only uses one format.

‎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 usingannotations) ``config/validation/``
127-
Serialization (when not usingannotations) ``config/serialization/``
126+
Validation (when not usingattributes) ``config/validation/``
127+
Serialization (when not usingattributes) ``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 usingannotations/attributes to define the mapping.
166+
This is not possible when using attributes to define the mapping.
167167

168168
Tests
169169
-----

‎components/browser_kit.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,28 @@ provides access to the link properties (e.g. ``$link->getMethod()``,
112112
$link = $crawler->selectLink('Go elsewhere...')->link();
113113
$client->click($link);
114114

115+
The:method:`Symfony\\Component\\BrowserKit\\AbstractBrowser::click` and
116+
:method:`Symfony\\Component\\BrowserKit\\AbstractBrowser::clickLink` methods
117+
can take an optional ``serverParameters`` argument. This
118+
parameter allows to send additional information like headers when clicking
119+
on a link::
120+
121+
use Acme\Client;
122+
123+
$client = new Client();
124+
$client->request('GET', '/product/123');
125+
126+
// works both with `click()`...
127+
$link = $crawler->selectLink('Go elsewhere...')->link();
128+
$client->click($link, ['X-Custom-Header' => 'Some data']);
129+
130+
// ... and `clickLink()`
131+
$crawler = $client->clickLink('Go elsewhere...', ['X-Custom-Header' => 'Some data']);
132+
133+
..versionadded::6.4
134+
135+
The ``serverParameters`` parameter was introduced in Symfony 6.4.
136+
115137
Submitting Forms
116138
~~~~~~~~~~~~~~~~
117139

‎components/config/resources.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ an array containing all matches.
3030
Resource Loaders
3131
----------------
3232

33-
For each type of resource (YAML, XML,annotation, etc.) a loader must be
33+
For each type of resource (YAML, XML,attributes, etc.) a loader must be
3434
defined. Each loader should implement
3535
:class:`Symfony\\Component\\Config\\Loader\\LoaderInterface` or extend the
3636
abstract:class:`Symfony\\Component\\Config\\Loader\\FileLoader` class,

‎components/console/events.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ Symfony doesn't handle any signal received by the command (not even ``SIGKILL``,
243243
``SIGTERM``, etc). This behavior is intended, as it gives you the flexibility to
244244
handle all signals e.g. to do some tasks before terminating the command.
245245

246+
..tip::
247+
248+
If you need to fetch the signal name from its integer value (e.g. for logging),
249+
you can use the
250+
:method:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap::getSignalName`
251+
method.
252+
253+
..versionadded::6.4
254+
255+
The:class:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap` class was
256+
introduced in Symfony 6.4.
257+
246258
..deprecated::6.3
247259

248260
In Symfony versions previous to 6.3, all signals (except ``SIGUSR1`` and

‎components/dom_crawler.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,18 @@ Access the attribute value of the first node of the current selection::
238238

239239
$class = $crawler->filterXPath('//body/p')->attr('class');
240240

241+
..tip::
242+
243+
You can define the default value to use if the node or attribute is empty
244+
by using the second argument of the ``attr()`` method::
245+
246+
$class = $crawler->filterXPath('//body/p')->attr('class', 'my-default-class');
247+
248+
..versionadded::6.4
249+
250+
The possibility to specify a default value to the ``attr()`` method
251+
was introduced in Symfony 6.4.
252+
241253
Extract attribute and/or node values from the list of nodes::
242254

243255
$attributes = $crawler

‎components/http_kernel.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ on the request's information.
263263
is passed to it. This step is also specific to the:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver`
264264
sub-class used by the Symfony Framework.
265265

266+
..deprecated::6.4
267+
268+
:class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface` and
269+
:class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` are
270+
deprecated since Symfony 6.4. Dependency injection should be used instead to
271+
access the service container.
272+
266273
.. _component-http-kernel-kernel-controller:
267274

268275
3) The ``kernel.controller`` Event

‎components/intl.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,41 @@ You may convert codes between two-letter alpha2 and three-letter alpha3 codes::
179179

180180
$alpha2Code = Countries::getAlpha2Code($alpha3Code);
181181

182+
Numeric Country Codes
183+
~~~~~~~~~~~~~~~~~~~~~
184+
185+
The `ISO 3166-1 numeric`_ standard defines three-digit country codes to represent
186+
countries, dependent territories, and special areas of geographical interest.
187+
188+
The main advantage over the ISO 3166-1 alphabetic codes (alpha-2 and alpha-3) is
189+
that these numeric codes are independent from the writing system. The alphabetic
190+
codes use the 26-letter English alphabet, which might be unavailable or difficult
191+
to use for people and systems using non-Latin scripts (e.g. Arabic or Japanese).
192+
193+
The:class:`Symfony\\Component\\Intl\\Countries` class provides access to these
194+
numeric country codes::
195+
196+
use Symfony\Component\Intl\Countries;
197+
198+
\Locale::setDefault('en');
199+
200+
$numericCodes = Countries::getNumericCodes();
201+
// ('alpha2Code' => 'numericCode')
202+
// => ['AA' => '958', 'AD' => '020', ...]
203+
204+
$numericCode = Countries::getNumericCode('FR');
205+
// => '250'
206+
207+
$alpha2 = Countries::getAlpha2FromNumeric('250');
208+
// => 'FR'
209+
210+
$exists = Countries::numericCodeExists('250');
211+
// => true
212+
213+
..versionadded::6.4
214+
215+
The support for numeric country codes was introduced in Symfony 6.4.
216+
182217
Locales
183218
~~~~~~~
184219

@@ -435,6 +470,7 @@ Learn more
435470
.. _`Unicode ISO 15924 Registry`:https://www.unicode.org/iso15924/iso15924-codes.html
436471
.. _`ISO 3166-1 alpha-2`:https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
437472
.. _`ISO 3166-1 alpha-3`:https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
473+
.. _`ISO 3166-1 numeric`:https://en.wikipedia.org/wiki/ISO_3166-1_numeric
438474
.. _`UTC/GMT time offsets`:https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
439475
.. _`daylight saving time (DST)`:https://en.wikipedia.org/wiki/Daylight_saving_time
440476
.. _`ISO 639-1 alpha-2`:https://en.wikipedia.org/wiki/ISO_639-1

‎components/lock.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -470,16 +470,16 @@ avoid stalled locks::
470470

471471
The ``MongoDbStore`` takes the following ``$options`` (depending on the first parameter type):
472472

473-
============= ================================================================================================
474-
Option Description
475-
============= ================================================================================================
476-
gcProbability Should a TTL Index be created expressed as a probability from 0.0 to 1.0 (Defaults to ``0.001``)
477-
gcProbablity Same as ``gcProbability``, see the deprecation note below
478-
database The name of the database
479-
collection The name of the collection
480-
uriOptions Array of URI options for `MongoDBClient::__construct`_
481-
driverOptions Array of driver options for `MongoDBClient::__construct`_
482-
============= ================================================================================================
473+
============== ================================================================================================
474+
OptionDescription
475+
============== ================================================================================================
476+
gcProbabilityShould a TTL Index be created expressed as a probability from 0.0 to 1.0 (Defaults to ``0.001``)
477+
gcProbablitySame as ``gcProbability``, see the deprecation note below
478+
databaseThe name of the database
479+
collectionThe name of the collection
480+
uriOptionsArray of URI options for `MongoDBClient::__construct`_
481+
driverOptionsArray of driver options for `MongoDBClient::__construct`_
482+
=============================================================================================================
483483

484484
..deprecated::6.3
485485

‎components/process.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,40 @@ instead::
410410
);
411411
$process->run();
412412

413+
Executing a PHP Child Process with the Same Configuration
414+
---------------------------------------------------------
415+
416+
..versionadded::6.4
417+
418+
The ``PhpSubprocess`` helper was introduced in Symfony 6.4.
419+
420+
When you start a PHP process, it uses the default configuration defined in
421+
your ``php.ini`` file. You can bypass these options with the ``-d`` command line
422+
option. For example, if ``memory_limit`` is set to ``256M``, you can disable this
423+
memory limit when running some command like this:
424+
``php -d memory_limit=-1 bin/console app:my-command``.
425+
426+
However, if you run the command via the Symfony ``Process`` class, PHP will use
427+
the settings defined in the ``php.ini`` file. You can solve this issue by using
428+
the:class:`Symfony\\Component\\Process\\PhpSubprocess` class to run the command::
429+
430+
use Symfony\Component\Process\Process;
431+
432+
class MyCommand extends Command
433+
{
434+
protected function execute(InputInterface $input, OutputInterface $output): int
435+
{
436+
// the memory_limit (and any other config option) of this command is
437+
// the one defined in php.ini instead of the new values (optionally)
438+
// passed via the '-d' command option
439+
$childProcess = new Process(['bin/console', 'cache:pool:prune']);
440+
441+
// the memory_limit (and any other config option) of this command takes
442+
// into account the values (optionally) passed via the '-d' command option
443+
$childProcess = new PhpSubprocess(['bin/console', 'cache:pool:prune']);
444+
}
445+
}
446+
413447
Process Timeout
414448
---------------
415449

‎components/serializer.rst

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ for each format:
289289
$classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml'));
290290

291291
.. _component-serializer-attributes-groups-annotations:
292+
.. _component-serializer-attributes-groups-attributes:
292293

293294
Then, create your groups definition:
294295

@@ -436,8 +437,8 @@ Ignoring Attributes
436437
All attributes are included by default when serializing objects. There are two
437438
options to ignore some of those attributes.
438439

439-
Option 1: Using ``@Ignore``Annotation
440-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
440+
Option 1: Using ``#[Ignore]``Attribute
441+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
441442

442443
..configuration-block::
443444

@@ -881,6 +882,20 @@ The Serializer component provides several built-in normalizers:
881882
Also it can denormalize ``uuid`` or ``ulid`` strings to:class:`Symfony\\Component\\Uid\\Uuid`
882883
or:class:`Symfony\\Component\\Uid\\Ulid`. The format does not matter.
883884

885+
:class:`Symfony\\Component\\Serializer\\Normalizer\\TranslatableNormalizer`
886+
This normalizer converts objects that implement
887+
:class:`Symfony\\Contracts\\Translation\\TranslatableInterface` into
888+
translated strings, using the
889+
:method:`Symfony\\Contracts\\Translation\\TranslatableInterface::trans`
890+
method. You can define the locale to use to translate the object by
891+
setting the ``TranslatableNormalizer::NORMALIZATION_LOCALE_KEY`` serializer
892+
context option.
893+
894+
..versionadded::6.4
895+
896+
The:class:`Symfony\\Component\\Serializer\\Normalizer\\TranslatableNormalizer`
897+
was introduced in Symfony 6.4.
898+
884899
..note::
885900

886901
You can also create your own Normalizer to use another structure. Read more at
@@ -998,6 +1013,22 @@ context to pass in these options using the key ``json_encode_options`` or
9981013

9991014
$this->serializer->serialize($data, 'json', ['json_encode_options' => \JSON_PRESERVE_ZERO_FRACTION]);
10001015

1016+
These are the options available:
1017+
1018+
=============================== =========================================================================================================== ================================
1019+
Option Description Default
1020+
=============================== ========================================================================================================== ================================
1021+
``json_decode_associative`` If set to true returns the result as an array, returns a nested ``stdClass`` hierarchy otherwise. ``false``
1022+
``json_decode_detailed_errors`` If set to true, exceptions thrown on parsing of JSON are more specific. Requires `seld/jsonlint`_ package. ``false``
1023+
``json_encode_options`` `$flags`_ passed to:phpfunction:`json_decode` function. ``0``
1024+
``json_decode_options`` `$flags`_ passed to:phpfunction:`json_encode` function. ``\JSON_PRESERVE_ZERO_FRACTION``
1025+
``json_decode_recursion_depth`` Sets maximum recursion depth. ``512``
1026+
=============================== ========================================================================================================== ================================
1027+
1028+
..versionadded::6.4
1029+
1030+
The support of ``json_decode_detailed_errors`` was introduced in Symfony 6.4.
1031+
10011032
The ``CsvEncoder``
10021033
~~~~~~~~~~~~~~~~~~
10031034

@@ -1827,3 +1858,5 @@ Learn more
18271858
.. _`RFC 4122`:https://tools.ietf.org/html/rfc4122
18281859
.. _`PHP reflection`:https://php.net/manual/en/book.reflection.php
18291860
.. _`data URI`:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
1861+
.. _seld/jsonlint:https://github.com/Seldaek/jsonlint
1862+
.. _$flags:https://www.php.net/manual/en/json.constants.php

‎components/uid.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ commands to learn about all their options):
572572
# generate 1 ULID with a specific timestamp
573573
$ php bin/console ulid:generate --time="2021-02-02 14:00:00"
574574
575-
# generate 2 ULIDs andouput them in RFC4122 format
575+
# generate 2 ULIDs andoutput them in RFC4122 format
576576
$ php bin/console ulid:generate --count=2 --format=rfc4122
577577
578578
In addition to generating new UIDs, you can also inspect them with the following

‎components/validator/resources.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ If you use annotations instead of attributes, it's also required to call
114114
->addDefaultDoctrineAnnotationReader() // add this only when using annotations
115115
->getValidator();
116116

117+
..deprecated::6.4
118+
119+
Annotations are deprecated since Symfony 6.4, use attributes instead.
120+
117121
To disable the annotation loader after it was enabled, call
118122
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`.
119123

‎components/var_dumper.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,24 @@ then its dump representation::
461461
462462
..image::/_images/components/var_dumper/09-cut.png
463463

464+
..code-block::php
465+
466+
class Foo
467+
{
468+
// $foo is uninitialized, which is different from being null
469+
private int|float $foo;
470+
public ?string $baz = null;
471+
}
472+
473+
$var = new Foo();
474+
dump($var);
475+
476+
..image::/_images/components/var_dumper/10-uninitialized.png
477+
478+
..versionadded::6.4
479+
480+
Displaying uninitialized variables information was introduced in Symfony 6.4.
481+
464482
.. _var-dumper-advanced:
465483

466484
Advanced Usage

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp