diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
new file mode 100644
index 0000000000000..44dffddaf9677
--- /dev/null
+++ b/.git-blame-ignore-revs
@@ -0,0 +1,2 @@
+# Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
+f4118e110a46de3ffb799e7d79bf15128d1646ea
diff --git a/.github/sync-translations.php b/.github/sync-translations.php
new file mode 100644
index 0000000000000..eb3f8e840ab4a
--- /dev/null
+++ b/.github/sync-translations.php
@@ -0,0 +1,100 @@
+formatOutput = true;
+
+ $xliff = $dom->appendChild($dom->createElement('xliff'));
+ $xliff->setAttribute('version', '1.2');
+ $xliff->setAttribute('xmlns', 'urn:oasis:names:tc:xliff:document:1.2');
+
+ $xliffFile = $xliff->appendChild($dom->createElement('file'));
+ $xliffFile->setAttribute('source-language', str_replace('_', '-', $defaultLocale));
+ $xliffFile->setAttribute('target-language', 'no' === $messages->getLocale() ? 'nb' : str_replace('_', '-', $messages->getLocale()));
+ $xliffFile->setAttribute('datatype', 'plaintext');
+ $xliffFile->setAttribute('original', 'file.ext');
+
+ $xliffBody = $xliffFile->appendChild($dom->createElement('body'));
+ foreach ($messages->all($domain) as $source => $target) {
+ $translation = $dom->createElement('trans-unit');
+ $metadata = $messages->getMetadata($source, $domain);
+
+ $translation->setAttribute('id', $metadata['id']);
+ if (isset($metadata['resname'])) {
+ $translation->setAttribute('resname', $metadata['resname']);
+ }
+
+ $s = $translation->appendChild($dom->createElement('source'));
+ $s->appendChild($dom->createTextNode($source));
+
+ $text = 1 === preg_match('/[&<>]/', $target) ? $dom->createCDATASection($target) : $dom->createTextNode($target);
+
+ $targetElement = $dom->createElement('target');
+
+ if ('en' !== $messages->getLocale() && $target === $source && 'Error' !== $source) {
+ $targetElement->setAttribute('state', 'needs-translation');
+ }
+ if (isset($metadata['target-attributes'])) {
+ foreach ($metadata['target-attributes'] as $key => $value) {
+ $targetElement->setAttribute($key, $value);
+ }
+ }
+
+ $t = $translation->appendChild($targetElement);
+ $t->appendChild($text);
+
+ $xliffBody->appendChild($translation);
+ }
+
+ return preg_replace('/^ +/m', '$0$0', $dom->saveXML());
+}
+
+
+foreach (['Security/Core' => 'security', 'Form' => 'validators', 'Validator' => 'validators'] as $component => $domain) {
+ $dir = __DIR__.'/../src/Symfony/Component/'.$component.'/Resources/translations';
+
+ $enCatalogue = (new XliffFileLoader())->load($dir.'/'.$domain.'.en.xlf', 'en', $domain);
+ file_put_contents($dir.'/'.$domain.'.en.xlf', dumpXliff1('en', $enCatalogue, $domain));
+
+ $finder = new Finder();
+
+ foreach ($finder->files()->in($dir)->name('*.xlf') as $file) {
+ $locale = substr($file->getBasename(), 1 + strlen($domain), -4);
+
+ if ('en' === $locale) {
+ continue;
+ }
+
+ $catalogue = (new XliffFileLoader())->load($file, $locale, $domain);
+ $localeCatalogue = new MessageCatalogue($locale);
+
+ foreach ($enCatalogue->all($domain) as $resname => $source) {
+ $metadata = [];
+ if ($catalogue->defines($resname, $domain)) {
+ $translation = $catalogue->get($resname, $domain);
+ $metadata = $catalogue->getMetadata($resname, $domain);
+ }
+ $metadata['id'] = $enCatalogue->getMetadata($resname, $domain)['id'];
+ if ($resname !== $source) {
+ $metadata['resname'] = $resname;
+ }
+ $localeCatalogue->set($source, $translation, $domain);
+ $localeCatalogue->setMetadata($source, $metadata, $domain);
+ }
+
+ file_put_contents($file, dumpXliff1('en', $localeCatalogue, $domain));
+ }
+}
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 1b72f86a75159..a0216526e0e80 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -95,9 +95,9 @@ jobs:
- 8094:8094
- 11210:11210
sqs:
- image: asyncaws/testing-sqs
+ image: localstack/localstack:3.0.2
ports:
- - 9494:9494
+ - 4566:4566
zookeeper:
image: wurstmeister/zookeeper:3.4.6
kafka:
@@ -184,8 +184,8 @@ jobs:
REDIS_SENTINEL_SERVICE: redis_sentinel
MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages
MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages
- MESSENGER_SQS_DSN: "sqs://localhost:9494/messages?sslmode=disable&poll_timeout=0.01"
- MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:9494/messages.fifo?sslmode=disable&poll_timeout=0.01"
+ MESSENGER_SQS_DSN: "sqs://localhost:4566/messages?sslmode=disable&poll_timeout=0.01"
+ MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:4566/messages.fifo?sslmode=disable&poll_timeout=0.01"
KAFKA_BROKER: 127.0.0.1:9092
POSTGRES_HOST: localhost
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 8333789ec831b..853399385adc0 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -30,6 +30,7 @@
'@Symfony:risky' => true,
'protected_to_private' => false,
'native_constant_invocation' => ['strict' => false],
+ 'nullable_type_declaration_for_default_null_value' => true,
'header_comment' => ['header' => $fileHeaderComment],
])
->setRiskyAllowed(true)
diff --git a/CHANGELOG-5.4.md b/CHANGELOG-5.4.md
index 97a5f10254eef..c6fa311ebc53c 100644
--- a/CHANGELOG-5.4.md
+++ b/CHANGELOG-5.4.md
@@ -7,6 +7,42 @@ in 5.4 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.4.0...v5.4.1
+* 5.4.35 (2024-01-30)
+
+ * bug #52913 [Routing] Fixed priority getting lost when setting localized prefix (pritasil)
+ * bug #53183 [Messenger] PhpSerializer: TypeError should throw `MessageDecodingFailedException` (B-Galati)
+ * bug #53678 [Mime] Fix serializing uninitialized `RawMessage::$message` to null (nicolas-grekas)
+ * bug #53634 [Notifer][Smsapi] Set messageId of SentMessage (tomasz-kusy)
+ * bug #53501 [DependencyInjection] support lazy evaluated exception messages with Xdebug 3 (xabbuh)
+ * bug #53671 [HttpClient] Fix pausing responses before they start when using curl (nicolas-grekas)
+ * bug #53663 [TwigBridge] separate child and parent context in NotificationEmail on writes (xabbuh)
+ * bug #53157 [Mailer] Throw `TransportException` when unable to read from socket (xdanik)
+ * bug #53361 [Serializer] Take unnamed variadic parameters into account when denormalizing (thijsBreker)
+ * bug #53530 [Serializer] Rewrite `AbstractObjectNormalizer::createChildContext()` to use the provided `cache_key` from original context when creating child contexts (amne)
+ * bug #53506 [HttpClient] Fix error chunk creation in passthru (rmikalkenas)
+ * bug #53357 [Translation] Fix `TranslationNodeVisitor` with constant domain (VincentLanglet)
+ * bug #53525 [Messenger] [AMQP] Throw exception on `nack` callback (kvrushifa)
+ * bug #53432 [HttpFoundation] Request without content-type or content-length header should result in null values, not empty strings (priyadi)
+ * bug #53593 [Cache] Fix possible infinite loop in `CachePoolPass` (HypeMC)
+ * bug #53588 [Translation] fix multi-byte code area to convert (xabbuh)
+ * bug #53565 [Mime] Fix undefined array key 0 when empty sender (0x346e3730)
+ * bug #53516 [Console] Allow '0' as a $shortcut in InputOption.php (lawsonjl-ornl)
+ * bug #53576 [Console] Only execute additional checks for color support if the output (theofidry)
+ * bug #53582 [TwigBundle] Fix configuration when "paths" is null (smnandre)
+ * bug #53581 [String] fix aircraft inflection (renanbr)
+ * bug #53509 [Security] Fix `AuthenticationUtils::getLastUsername()` returning null (alexandre-daubois)
+ * bug #53567 [String] Correct inflection of axis (Vladislav Iurciuc)
+ * bug #53537 [VarDumper] Fix missing colors initialization in `CliDumper` (nicolas-grekas)
+ * bug #53481 [Process] Fix executable finder when the command starts with a dash (kayw-geek)
+ * bug #53006 [ErrorHandler] Don't format binary strings (aleho)
+ * bug #53441 [Messenger] Amazon SQS Delay has a max of 15 minutes (alamirault)
+ * bug #53383 [Validator] re-allow an empty list of fields (xabbuh)
+ * bug #53418 [FrameworkBundle][Notifier] Fix service registration (MessageBird + TurboSms) (smnandre)
+ * bug #53350 [Validator] fix the exception being thrown (xabbuh)
+ * bug #53341 [FrameworkBundle] append instead of replacing potentially non-existent named-arguments (xabbuh)
+ * bug #53320 [Cache][DependencyInjection][Lock][Mailer][Messenger][Notifier][Translation] Url decode username and passwords from `parse_url()` results (alexandre-daubois)
+ * bug #53108 [Serializer] Fix using deserialization path 5.4 (HypeMC)
+
* 5.4.34 (2023-12-30)
* bug #52406 [Validator] Fix `Constraints\Email::ERROR_NAMES` (mathroc)
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index ca870dd304464..8ae25e554297b 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -15,9 +15,9 @@ The Symfony Connect username in parenthesis allows to get more information
- Thomas Calvet (fancyweb)
- Christophe Coevoet (stof)
- Wouter de Jong (wouterj)
+ - Alexandre Daubois (alexandre-daubois)
- Jordi Boggiano (seldaek)
- Maxime Steinhausser (ogizanagi)
- - Alexandre Daubois (alexandre-daubois)
- Kévin Dunglas (dunglas)
- Victor Berchet (victor)
- Ryan Weaver (weaverryan)
@@ -26,9 +26,9 @@ The Symfony Connect username in parenthesis allows to get more information
- Jules Pietri (heah)
- Roland Franssen
- Johannes S (johannes)
+ - Oskar Stark (oskarstark)
- Kris Wallsmith (kriswallsmith)
- Jakub Zalas (jakubzalas)
- - Oskar Stark (oskarstark)
- Yonel Ceruto (yonelceruto)
- Hugo Hamon (hhamon)
- Tobias Nyholm (tobias)
@@ -38,11 +38,11 @@ The Symfony Connect username in parenthesis allows to get more information
- Romain Neutron
- Antoine Lamirault (alamirault)
- Joseph Bielawski (stloyd)
+ - HypeMC (hypemc)
- Drak (drak)
- Abdellatif Ait boudad (aitboudad)
- - HypeMC (hypemc)
- - Lukas Kahwe Smith (lsmith)
- Kevin Bond (kbond)
+ - Lukas Kahwe Smith (lsmith)
- Hamza Amrouche (simperfit)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
@@ -64,25 +64,26 @@ The Symfony Connect username in parenthesis allows to get more information
- Diego Saint Esteben (dosten)
- stealth35 (stealth35)
- Alexander Mols (asm89)
+ - Gábor Egyed (1ed)
- Francis Besset (francisbesset)
- Titouan Galopin (tgalopin)
- Pierre du Plessis (pierredup)
- - Gábor Egyed (1ed)
- David Maicher (dmaicher)
- Bulat Shakirzyanov (avalanche123)
- - Iltar van der Berg
- Vincent Langlet (deviling)
+ - Iltar van der Berg
- Miha Vrhovnik (mvrhov)
- Gary PEGEOT (gary-p)
- Saša Stamenković (umpirsky)
- Allison Guilhem (a_guilhem)
- Mathieu Piot (mpiot)
+ - Mathieu Santostefano (welcomattic)
- Alexander Schranz (alexander-schranz)
- Vasilij Duško (staff)
- - Mathieu Santostefano (welcomattic)
- Sarah Khalil (saro0h)
- Laurent VOULLEMIER (lvo)
- Konstantin Kudryashov (everzet)
+ - Tomasz Kowalczyk (thunderer)
- Guilhem N (guilhemn)
- Bilal Amarni (bamarni)
- Eriksen Costa
@@ -91,10 +92,11 @@ The Symfony Connect username in parenthesis allows to get more information
- Peter Rehm (rpet)
- Henrik Bjørnskov (henrikbjorn)
- Mathias Arlaud (mtarld)
+ - Dariusz Ruminski
- Andrej Hudec (pulzarraider)
- Jáchym Toušek (enumag)
+ - Simon André (simonandre)
- David Buchmann (dbu)
- - Dariusz Ruminski
- Christian Raue
- Eric Clemmons (ericclemmons)
- Denis (yethee)
@@ -103,36 +105,36 @@ The Symfony Connect username in parenthesis allows to get more information
- Douglas Greenshields (shieldo)
- Frank A. Fiebig (fafiebig)
- Baldini
+ - Ruud Kamphuis (ruudk)
- Alex Pott
- Fran Moreno (franmomu)
- Arnout Boks (aboks)
- - Simon André (simonandre)
- Charles Sarrazin (csarrazi)
- - Ruud Kamphuis (ruudk)
- Henrik Westphal (snc)
- Dariusz Górecki (canni)
- Ener-Getick
- Graham Campbell (graham)
+ - Tomas Norkūnas (norkunas)
- Tugdual Saunier (tucksaun)
- Lee McDermott
- Brandon Turner
+ - Massimiliano Arione (garak)
- Luis Cordova (cordoval)
- Antoine Makdessi (amakdessi)
- Konstantin Myakshin (koc)
- Hubert Lenoir (hubert_lenoir)
- Daniel Holmes (dholmes)
- Julien Falque (julienfalque)
- - Tomas Norkūnas (norkunas)
- Toni Uebernickel (havvg)
- Bart van den Burg (burgov)
- Vasilij Dusko | CREATION
- Jordan Alliot (jalliot)
- - Massimiliano Arione (garak)
- John Wards (johnwards)
- Phil E. Taylor (philetaylor)
- Antoine Hérault (herzult)
- Konstantin.Myakshin
- Yanick Witschi (toflar)
+ - Théo FIDRY
- Arnaud Le Blanc (arnaud-lb)
- Joel Wurtz (brouznouf)
- Sebastiaan Stok (sstok)
@@ -140,15 +142,14 @@ The Symfony Connect username in parenthesis allows to get more information
- gnito-org
- Jeroen Spee (jeroens)
- Tim Nagel (merk)
- - Théo FIDRY
- Chris Wilkinson (thewilkybarkid)
- Jérôme Vasseur (jvasseur)
+ - Rokas Mikalkėnas (rokasm)
- Peter Kokot (peterkokot)
- Brice BERNARD (brikou)
- Tac Tacelosky (tacman1123)
- Michal Piotrowski
- marc.weistroff
- - Rokas Mikalkėnas (rokasm)
- Lars Strojny (lstrojny)
- lenar
- Vladimir Tsykun (vtsykun)
@@ -178,6 +179,7 @@ The Symfony Connect username in parenthesis allows to get more information
- François-Xavier de Guillebon (de-gui_f)
- noniagriconomie
- Eric GELOEN (gelo)
+ - Nicolas Philippe (nikophil)
- Gabriel Caruso
- Stefano Sala (stefano.sala)
- Ion Bazan (ionbazan)
@@ -187,7 +189,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Gregor Harlan (gharlan)
- Michael Babker (mbabker)
- Anthony MARTIN
- - Nicolas Philippe (nikophil)
- Sebastian Hörl (blogsh)
- Tigran Azatyan (tigranazatyan)
- Christopher Hertel (chertel)
@@ -207,17 +208,19 @@ The Symfony Connect username in parenthesis allows to get more information
- Andreas Braun
- Hugo Alliaume (kocal)
- Pablo Godel (pgodel)
+ - Florent Mata (fmata)
- Alessandro Chitolina (alekitto)
- - Tomasz Kowalczyk (thunderer)
+ - Dāvis Zālītis (k0d3r1s)
- Rafael Dohms (rdohms)
- jwdeitch
+ - David Prévot (taffit)
- Jérôme Parmentier (lctrs)
- Ahmed TAILOULOUTE (ahmedtai)
- Simon Berger
- Jérémy Derussé
+ - Valtteri R (valtzu)
- Matthieu Napoli (mnapoli)
- Tomas Votruba (tomas_votruba)
- - Florent Mata (fmata)
- Arman Hosseini (arman)
- Sokolov Evgeniy (ewgraf)
- Andréia Bohner (andreia)
@@ -227,15 +230,15 @@ The Symfony Connect username in parenthesis allows to get more information
- George Mponos (gmponos)
- Roman Martinuk (a2a4)
- Richard Shank (iampersistent)
- - David Prévot (taffit)
+ - Thomas Landauer (thomas-landauer)
- Romain Monteil (ker0x)
- Sergey (upyx)
- Marco Pivetta (ocramius)
- Antonio Pauletich (x-coder264)
- Vincent Touzet (vincenttouzet)
+ - Fabien Bourigault (fbourigault)
- Olivier Dolbeau (odolbeau)
- Rouven Weßling (realityking)
- - Valtteri R (valtzu)
- Ben Davies (bendavies)
- YaFou
- Clemens Tolboom
@@ -248,7 +251,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- Dawid Nowak
- - Dāvis Zālītis (k0d3r1s)
- Jannik Zschiesche
- Amal Raghav (kertz)
- Jonathan Ingram
@@ -259,7 +261,6 @@ The Symfony Connect username in parenthesis allows to get more information
- GDIBass
- Samuel NELA (snela)
- Vincent AUBERT (vincent)
- - Fabien Bourigault (fbourigault)
- Michael Voříšek
- zairig imad (zairigimad)
- Colin O'Dell (colinodell)
@@ -282,6 +283,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Martin Hujer (martinhujer)
- Sergey Linnik (linniksa)
- Richard Miller
+ - Aleksandar Jakovljevic (ajakov)
- Mario A. Alvarez Garcia (nomack84)
- Thomas Rabaix (rande)
- D (denderello)
@@ -310,11 +312,9 @@ The Symfony Connect username in parenthesis allows to get more information
- sun (sun)
- Larry Garfield (crell)
- Leo Feyer
- - Thomas Landauer (thomas-landauer)
- Philipp Wahala (hifi)
- Victor Bocharsky (bocharsky_bw)
- Nikolay Labinskiy (e-moe)
- - Aleksandar Jakovljevic (ajakov)
- Martin Schuhfuß (usefulthink)
- apetitpa
- Guilliam Xavier
@@ -366,6 +366,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Florent Morselli (spomky_)
- dFayet
- Rob Frawley 2nd (robfrawley)
+ - Renan (renanbr)
- Nikita Konstantinov (unkind)
- Dariusz
- Francois Zaninotto
@@ -402,6 +403,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Sullivan SENECHAL (soullivaneuh)
- Loick Piera (pyrech)
- Uwe Jäger (uwej711)
+ - W0rma
- Lynn van der Berg (kjarli)
- Michaël Perrin (michael.perrin)
- Eugene Leonovich (rybakit)
@@ -425,7 +427,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Frank de Jonge
- Andrii Bodnar
- Dane Powell
- - Renan (renanbr)
- Sebastien Morel (plopix)
- Christopher Davis (chrisguitarguy)
- Karoly Gossler (connorhu)
@@ -473,7 +474,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Chris Smith (cs278)
- Thomas Bisignani (toma)
- Florian Klein (docteurklein)
- - W0rma
- Damien Alexandre (damienalexandre)
- Manuel Kießling (manuelkiessling)
- Alexey Kopytko (sanmai)
@@ -544,6 +544,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Pavel Kirpitsov (pavel-kirpichyov)
- Robert Meijers
- Artur Eshenbrener
+ - Priyadi Iman Nurcahyo (priyadi)
- Harm van Tilborg (hvt)
- Thomas Perez (scullwm)
- Cédric Anne
@@ -588,6 +589,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Greg Thornton (xdissent)
- Alex Bowers
- Michel Roca (mroca)
+ - Asis Pattisahusiwa
- Costin Bereveanu (schniper)
- Andrii Dembitskyi
- Gasan Guseynov (gassan)
@@ -604,9 +606,11 @@ The Symfony Connect username in parenthesis allows to get more information
- Saif Eddin G
- Endre Fejes
- Tobias Naumann (tna)
+ - Mathieu Rochette (mathroc)
- Daniel Beyer
- flack (flack)
- Shein Alexey
+ - Joppe De Cuyper (joppedc)
- Joe Lencioni
- Daniel Tschinder
- Diego Agulló (aeoris)
@@ -683,6 +687,7 @@ The Symfony Connect username in parenthesis allows to get more information
- vagrant
- Matthias Krauser (mkrauser)
- Benjamin Cremer (bcremer)
+ - Alex Hofbauer (alexhofbauer)
- Maarten de Boer (mdeboer)
- Asier Illarramendi (doup)
- AKeeman (akeeman)
@@ -690,7 +695,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Restless-ET
- Vlad Gregurco (vgregurco)
- Artem Stepin (astepin)
- - Priyadi Iman Nurcahyo (priyadi)
- Boris Vujicic (boris.vujicic)
- Dries Vints
- Judicaël RUFFIEUX (axanagor)
@@ -709,6 +713,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Vitaliy Tverdokhlib (vitaliytv)
- Ariel Ferrandini (aferrandini)
- BASAK Semih (itsemih)
+ - Kai Dederichs
- Dirk Pahl (dirkaholic)
- Cédric Lombardot (cedriclombardot)
- Jérémy REYNAUD (babeuloula)
@@ -779,7 +784,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Eduardo Oliveira (entering)
- Oleksii Zhurbytskyi
- Bilge
- - Asis Pattisahusiwa
- Anatoly Pashin (b1rdex)
- Jonathan Johnson (jrjohnson)
- Eugene Wissner
@@ -787,6 +791,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Roy Van Ginneken (rvanginneken)
- ondrowan
- Barry vd. Heuvel (barryvdh)
+ - Antonin CLAUZIER (0x346e3730)
- Chad Sikorra (chadsikorra)
- Evan S Kaufman (evanskaufman)
- mcben
@@ -803,7 +808,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Leevi Graham (leevigraham)
- Anthony Ferrara
- tim
- - Mathieu Rochette (mathroc)
- Ioan Negulescu
- Greg ORIOL
- Jakub Škvára (jskvara)
@@ -813,7 +817,6 @@ The Symfony Connect username in parenthesis allows to get more information
- alexpods
- Adam Szaraniec
- Dariusz Ruminski
- - Joppe De Cuyper (joppedc)
- Romain Gautier (mykiwi)
- Matthieu Bontemps
- Erik Trapman
@@ -905,6 +908,7 @@ The Symfony Connect username in parenthesis allows to get more information
- julien57
- Mátyás Somfai (smatyas)
- Bastien DURAND (deamon)
+ - Nicolas Rigaud
- Dmitry Simushev
- alcaeus
- Ahmed Ghanem (ahmedghanem00)
@@ -976,7 +980,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Dustin Dobervich (dustin10)
- Luis Tacón (lutacon)
- Dmitrii Tarasov (dtarasov)
- - Alex Hofbauer (alexhofbauer)
- dantleech
- Philipp Kolesnikov
- Jack Worman (jworman)
@@ -1086,7 +1089,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Tiago Brito (blackmx)
- Gintautas Miselis (naktibalda)
- Richard van den Brand (ricbra)
- - Kai Dederichs
- Toon Verwerft (veewee)
- develop
- flip111
@@ -1100,6 +1102,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Mark Sonnabaum
- Chris Jones (magikid)
- Massimiliano Braglia (massimilianobraglia)
+ - Thijs-jan Veldhuizen (tjveldhuizen)
- Richard Quadling
- James Hudson (mrthehud)
- Raphaëll Roussel
@@ -1123,6 +1126,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Wybren Koelmans (wybren_koelmans)
- Roberto Nygaard
- victor-prdh
+ - Kev
- Davide Borsatto (davide.borsatto)
- Florian Hermann (fhermann)
- zenas1210
@@ -1156,6 +1160,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Tarjei Huse (tarjei)
- Besnik Br
- Issam Raouf (iraouf)
+ - Simon Mönch
- Jose Gonzalez
- Jonathan (jlslew)
- Claudio Zizza
@@ -1222,6 +1227,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Evan C
- buffcode
- Glodzienski
+ - Natsuki Ikeguchi
- Krzysztof Łabuś (crozin)
- Xavier Lacot (xavier)
- Jon Dufresne
@@ -1229,7 +1235,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Denis Zunke (donalberto)
- Adrien Roches (neirda24)
- _sir_kane (waly)
- - Antonin CLAUZIER (0x346e3730)
- Olivier Maisonneuve
- Andrei C. (moldman)
- Mike Meier (mykon)
@@ -1309,6 +1314,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Maksim Kotlyar (makasim)
- Neil Ferreira
- Julie Hourcade (juliehde)
+ - Marc Biorklund (mbiork)
- Dmitry Parnas (parnas)
- Loïc Beurlet
- Ana Raro
@@ -1412,6 +1418,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Daniel Cestari
- Matt Janssen
- Stéphane Delprat
+ - Mior Muhammad Zaki (crynobone)
- Elan Ruusamäe (glen)
- Brunet Laurent (lbrunet)
- Florent Viel (luxifer)
@@ -1487,6 +1494,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Jules Matsounga (hyoa)
- Yewhen Khoptynskyi (khoptynskyi)
- Jérôme Nadaud (jnadaud)
+ - Frank Naegler
- Sam Malone
- Ha Phan (haphan)
- Chris Jones (leek)
@@ -1495,6 +1503,7 @@ The Symfony Connect username in parenthesis allows to get more information
- xaav
- Jean-Christophe Cuvelier [Artack]
- Mahmoud Mostafa (mahmoud)
+ - Ninos
- Alexandre Tranchant (alexandre_t)
- Anthony Moutte
- Ahmed Abdou
@@ -1514,6 +1523,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Grégoire Hébert (gregoirehebert)
- Franz Wilding (killerpoke)
- Ferenczi Krisztian (fchris82)
+ - Ioan Ovidiu Enache (ionutenache)
- Artyum Petrov
- Oleg Golovakhin (doc_tr)
- Guillaume Smolders (guillaumesmo)
@@ -1839,7 +1849,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Gustavo Adrian
- Jorrit Schippers (jorrit)
- Matthias Neid
- - Kev
- Yannick
- Kuzia
- Vladimir Luchaninov (luchaninov)
@@ -2055,6 +2064,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Maxime THIRY
- Norman Soetbeer
- Ludek Stepan
+ - Frederik Schwan
- Mark van den Berg
- Aaron Stephens (astephens)
- Craig Menning (cmenning)
@@ -2181,6 +2191,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Aurélien Fontaine
- ncou
- Ian Carroll
+ - Dennis Fehr
- caponica
- jdcook
- Daniel Kay (danielkay-cp)
@@ -2197,6 +2208,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Martin Pärtel
- Daniel Rotter (danrot)
- Frédéric Bouchery (fbouchery)
+ - Jacek Kobus (jackks)
- Patrick Daley (padrig)
- Phillip Look (plook)
- Foxprodev
@@ -2215,6 +2227,7 @@ The Symfony Connect username in parenthesis allows to get more information
- mfettig
- Oleksii Bulba
- Ramon Cuñat
+ - mboultoureau
- Raphaëll Roussel
- Vitalii
- Tadcka
@@ -2231,7 +2244,6 @@ The Symfony Connect username in parenthesis allows to get more information
- parinz1234
- Romain Geissler
- Adrien Moiruad
- - Natsuki Ikeguchi
- Viktoriia Zolotova
- Tomaz Ahlin
- Nasim
@@ -2298,6 +2310,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Jos Elstgeest
- Kirill Lazarev
- Thomas Counsell
+ - Joe
- BilgeXA
- mmokhi
- Serhii Smirnov
@@ -2401,6 +2414,7 @@ The Symfony Connect username in parenthesis allows to get more information
- izenin
- Mephistofeles
- Oleh Korneliuk
+ - Evgeny Ruban
- Hoffmann András
- LubenZA
- Victor Garcia
@@ -2481,7 +2495,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Anton Sukhachev (mrsuh)
- Pavlo Pelekh (pelekh)
- Stefan Kleff (stefanxl)
- - Thijs-jan Veldhuizen (tjveldhuizen)
- Vitaliy Zhuk (zhukv)
- Marcel Siegert
- ryunosuke
@@ -2635,7 +2648,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Grayson Koonce
- Ruben Jansen
- Wissame MEKHILEF
- - Marc Biorklund
- shreypuranik
- NanoSector
- Thibaut Salanon
@@ -2686,6 +2698,7 @@ The Symfony Connect username in parenthesis allows to get more information
- downace
- Aarón Nieves Fernández
- Mikolaj Czajkowski
+ - Ahto Türkson
- Ph3nol
- Kirill Saksin
- Shiro
@@ -2737,6 +2750,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Mohammad Ali Sarbanha (sarbanha)
- Sergii Dolgushev (sergii-swds)
- Steeve Titeca (stiteca)
+ - Thomas Citharel (tcit)
- Artem Lopata (bumz)
- alex
- evgkord
@@ -2804,6 +2818,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Shamimul Alam
- Cyril HERRERA
- dropfen
+ - RAHUL K JHA
- Andrey Chernykh
- Edvinas Klovas
- Drew Butler
@@ -2901,6 +2916,7 @@ The Symfony Connect username in parenthesis allows to get more information
- John Nickell (jrnickell)
- Martin Mayer (martin)
- Grzegorz Łukaszewicz (newicz)
+ - Nico Müller (nicomllr)
- Omar Yepez (oyepez003)
- Jonny Schmid (schmidjon)
- Toby Griffiths (tog)
@@ -2912,6 +2928,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Ernest Hymel
- Andrea Civita
- Nicolás Alonso
+ - Roman Tyshyk
- LoginovIlya
- andreyserdjuk
- Nick Chiu
@@ -2975,6 +2992,7 @@ The Symfony Connect username in parenthesis allows to get more information
- NothingWeAre
- Storkeus
- goabonga
+ - Vladislav Iurciuc
- Alan Chen
- Anton Zagorskii
- ging-dev
@@ -2995,7 +3013,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Matheus Gontijo
- Gerrit Drost
- Linnaea Von Lavia
- - Simon Mönch
- Javan Eskander
- Lenar Lõhmus
- Cristian Gonzalez
@@ -3169,6 +3186,7 @@ The Symfony Connect username in parenthesis allows to get more information
- helmi
- Michael Steininger
- Nardberjean
+ - Dylan
- ghazy ben ahmed
- Karolis
- Myke79
@@ -3190,6 +3208,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Steffen Keuper
- Kai Eichinger
- Antonio Angelino
+ - Kay Wei
- Jens Schulze
- Tema Yud
- Matt Fields
@@ -3424,6 +3443,7 @@ The Symfony Connect username in parenthesis allows to get more information
- Andreas Forsblom (aforsblo)
- Alex Olmos (alexolmos)
- Cedric BERTOLINI (alsciende)
+ - Cornel Cruceru (amne)
- Robin Kanters (anddarerobin)
- Antoine (antoinela_adveris)
- Juan Ases García (ases)
@@ -3443,7 +3463,6 @@ The Symfony Connect username in parenthesis allows to get more information
- Bermon Clément (chou666)
- Kousuke Ebihara (co3k)
- Loïc Vernet (coil)
- - Mior Muhammad Zaki (crynobone)
- Christoph Vincent Schaefer (cvschaefer)
- Kamil Piwowarski (cyklista)
- Damon Jones (damon__jones)
diff --git a/README.md b/README.md
index d02bbd835b32b..7c4f1a85899bb 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
+
[Symfony][1] is a **PHP framework** for web and console applications and a set
diff --git a/composer.json b/composer.json
index 469c30715f775..f9bc553e63b86 100644
--- a/composer.json
+++ b/composer.json
@@ -121,7 +121,7 @@
"amphp/http-client": "^4.2.1",
"amphp/http-tunnel": "^1.0",
"async-aws/ses": "^1.0",
- "async-aws/sqs": "^1.0",
+ "async-aws/sqs": "^1.0|^2.0",
"async-aws/sns": "^1.0",
"cache/integration-tests": "dev-master",
"doctrine/annotations": "^1.13.1|^2",
diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
index be31c7218af5b..884185d0f8031 100644
--- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
+++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
@@ -50,7 +50,7 @@ public function __construct(ContainerInterface $container, array $subscriberIds
*
* @return void
*/
- public function dispatchEvent($eventName, EventArgs $eventArgs = null)
+ public function dispatchEvent($eventName, ?EventArgs $eventArgs = null)
{
if (!$this->initializedSubscribers) {
$this->initializeSubscribers();
diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
index 8e500b56c1fe3..6283d66cc2b81 100644
--- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
+++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
@@ -39,7 +39,7 @@ class DoctrineDataCollector extends DataCollector
*/
private $loggers = [];
- public function __construct(ManagerRegistry $registry, DebugDataHolder $debugDataHolder = null)
+ public function __construct(ManagerRegistry $registry, ?DebugDataHolder $debugDataHolder = null)
{
$this->registry = $registry;
$this->connections = $registry->getConnectionNames();
@@ -58,7 +58,7 @@ public function addLogger(string $name, DebugStack $logger)
/**
* {@inheritdoc}
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
$this->data = [
'queries' => $this->collectQueries(),
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
index 5e3cb301ccfdf..627d5f6c5122f 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
@@ -35,7 +35,7 @@ class DoctrineChoiceLoader extends AbstractChoiceLoader
*
* @param string $class The class name of the loaded objects
*/
- public function __construct(ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
+ public function __construct(ObjectManager $manager, string $class, ?IdReader $idReader = null, ?EntityLoaderInterface $objectLoader = null)
{
$classMetadata = $manager->getClassMetadata($class);
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
index 5a6e23d963946..29b10a14f4119 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
@@ -78,7 +78,7 @@ public function isIntId(): bool
*
* This method assumes that the object has a single-column ID.
*/
- public function getIdValue(object $object = null): string
+ public function getIdValue(?object $object = null): string
{
if (!$object) {
return '';
diff --git a/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php b/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php
index 74dc9ec250f2b..8026ea873137b 100644
--- a/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php
+++ b/src/Symfony/Bridge/Doctrine/IdGenerator/UlidGenerator.php
@@ -21,7 +21,7 @@ final class UlidGenerator extends AbstractIdGenerator
{
private $factory;
- public function __construct(UlidFactory $factory = null)
+ public function __construct(?UlidFactory $factory = null)
{
$this->factory = $factory;
}
diff --git a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidGenerator.php b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidGenerator.php
index af31f109fe66e..773722d5ff9cb 100644
--- a/src/Symfony/Bridge/Doctrine/IdGenerator/UuidGenerator.php
+++ b/src/Symfony/Bridge/Doctrine/IdGenerator/UuidGenerator.php
@@ -23,7 +23,7 @@ final class UuidGenerator extends AbstractIdGenerator
private $factory;
private $entityGetter;
- public function __construct(UuidFactory $factory = null)
+ public function __construct(?UuidFactory $factory = null)
{
$this->protoFactory = $this->factory = $factory ?? new UuidFactory();
}
diff --git a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
index 4c385ef070a6c..87a234961b44f 100644
--- a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
+++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
@@ -26,7 +26,7 @@ class DbalLogger implements SQLLogger
protected $logger;
protected $stopwatch;
- public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch = null)
+ public function __construct(?LoggerInterface $logger = null, ?Stopwatch $stopwatch = null)
{
$this->logger = $logger;
$this->stopwatch = $stopwatch;
@@ -37,7 +37,7 @@ public function __construct(LoggerInterface $logger = null, Stopwatch $stopwatch
*
* @return void
*/
- public function startQuery($sql, array $params = null, array $types = null)
+ public function startQuery($sql, ?array $params = null, ?array $types = null)
{
if (null !== $this->stopwatch) {
$this->stopwatch->start('doctrine', 'doctrine');
diff --git a/src/Symfony/Bridge/Doctrine/Messenger/AbstractDoctrineMiddleware.php b/src/Symfony/Bridge/Doctrine/Messenger/AbstractDoctrineMiddleware.php
index 9fbf2deb963e3..83413c37871f6 100644
--- a/src/Symfony/Bridge/Doctrine/Messenger/AbstractDoctrineMiddleware.php
+++ b/src/Symfony/Bridge/Doctrine/Messenger/AbstractDoctrineMiddleware.php
@@ -28,7 +28,7 @@ abstract class AbstractDoctrineMiddleware implements MiddlewareInterface
protected $managerRegistry;
protected $entityManagerName;
- public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null)
+ public function __construct(ManagerRegistry $managerRegistry, ?string $entityManagerName = null)
{
$this->managerRegistry = $managerRegistry;
$this->entityManagerName = $entityManagerName;
diff --git a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php
index 40adcbabae59f..2ef3bbbb92815 100644
--- a/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php
+++ b/src/Symfony/Bridge/Doctrine/Messenger/DoctrineOpenTransactionLoggerMiddleware.php
@@ -29,7 +29,7 @@ class DoctrineOpenTransactionLoggerMiddleware extends AbstractDoctrineMiddleware
/** @var bool */
private $isHandling = false;
- public function __construct(ManagerRegistry $managerRegistry, string $entityManagerName = null, LoggerInterface $logger = null)
+ public function __construct(ManagerRegistry $managerRegistry, ?string $entityManagerName = null, ?LoggerInterface $logger = null)
{
parent::__construct($managerRegistry, $entityManagerName);
diff --git a/src/Symfony/Bridge/Doctrine/Middleware/Debug/DBAL3/Statement.php b/src/Symfony/Bridge/Doctrine/Middleware/Debug/DBAL3/Statement.php
index 16217c2f46a51..9705a77a459f0 100644
--- a/src/Symfony/Bridge/Doctrine/Middleware/Debug/DBAL3/Statement.php
+++ b/src/Symfony/Bridge/Doctrine/Middleware/Debug/DBAL3/Statement.php
@@ -36,7 +36,7 @@ public function __construct(
DebugDataHolder $debugDataHolder,
string $connectionName,
string $sql,
- Stopwatch $stopwatch = null
+ ?Stopwatch $stopwatch = null
) {
$this->stopwatch = $stopwatch;
$this->connectionName = $connectionName;
diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
index a1043d8213f33..faf0a2948cabd 100644
--- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
+++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
@@ -39,7 +39,7 @@ class EntityUserProvider implements UserProviderInterface, PasswordUpgraderInter
private $class;
private $property;
- public function __construct(ManagerRegistry $registry, string $classOrAlias, string $property = null, string $managerName = null)
+ public function __construct(ManagerRegistry $registry, string $classOrAlias, ?string $property = null, ?string $managerName = null)
{
$this->registry = $registry;
$this->managerName = $managerName;
diff --git a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php
index 0de248b1efdf0..c29ccc49d767e 100644
--- a/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php
+++ b/src/Symfony/Bridge/Doctrine/Test/DoctrineTestHelper.php
@@ -40,7 +40,7 @@ class DoctrineTestHelper
*
* @return EntityManager
*/
- public static function createTestEntityManager(Configuration $config = null)
+ public static function createTestEntityManager(?Configuration $config = null)
{
if (!\extension_loaded('pdo_sqlite')) {
TestCase::markTestSkipped('Extension pdo_sqlite is required.');
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index 75102ee331410..cde5c8f5bcda7 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -783,7 +783,7 @@ public function testOverrideChoicesValuesWithCallable()
'em' => 'default',
'class' => self::ITEM_GROUP_CLASS,
'choice_label' => 'name',
- 'choice_value' => function (GroupableEntity $entity = null) {
+ 'choice_value' => function (?GroupableEntity $entity = null) {
if (null === $entity) {
return '';
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
index e4e67eb663557..757813f017af9 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php
@@ -123,7 +123,7 @@ public function testTestGetPropertiesWithEmbedded()
/**
* @dataProvider typesProvider
*/
- public function testExtract(string $property, array $type = null)
+ public function testExtract(string $property, ?array $type = null)
{
$this->assertEquals($type, $this->createExtractor()->getTypes(DoctrineDummy::class, $property, []));
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php
index 9aa8d6ef61230..d9f21b04c29f6 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php
@@ -211,7 +211,7 @@ public function testFieldMappingsConfiguration()
/**
* @dataProvider regexpProvider
*/
- public function testClassValidator(bool $expected, string $classValidatorRegexp = null)
+ public function testClassValidator(bool $expected, ?string $classValidatorRegexp = null)
{
$doctrineLoader = new DoctrineLoader(DoctrineTestHelper::createTestEntityManager(), $classValidatorRegexp, false);
diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php
index dc848c143ca9e..3a238e0b8ab22 100644
--- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php
+++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php
@@ -46,14 +46,14 @@ class UniqueEntity extends Constraint
*/
public function __construct(
$fields,
- string $message = null,
- string $service = null,
- string $em = null,
- string $entityClass = null,
- string $repositoryMethod = null,
- string $errorPath = null,
- bool $ignoreNull = null,
- array $groups = null,
+ ?string $message = null,
+ ?string $service = null,
+ ?string $em = null,
+ ?string $entityClass = null,
+ ?string $repositoryMethod = null,
+ ?string $errorPath = null,
+ ?bool $ignoreNull = null,
+ ?array $groups = null,
$payload = null,
array $options = []
) {
diff --git a/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php b/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php
index 9fcb0d3486ada..601ef0f2b5fa6 100644
--- a/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php
@@ -36,7 +36,7 @@ final class DoctrineLoader implements LoaderInterface
private $entityManager;
private $classValidatorRegexp;
- public function __construct(EntityManagerInterface $entityManager, string $classValidatorRegexp = null)
+ public function __construct(EntityManagerInterface $entityManager, ?string $classValidatorRegexp = null)
{
$this->entityManager = $entityManager;
$this->classValidatorRegexp = $classValidatorRegexp;
diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
index 4b87c264e4d5a..0c212e162c4af 100644
--- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
+++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php
@@ -182,7 +182,7 @@ private function replacePlaceHolder(array $record): array
return $record;
}
- private function dumpData($data, bool $colors = null): string
+ private function dumpData($data, ?bool $colors = null): string
{
if (null === $this->dumper) {
return '';
diff --git a/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php
index 54988766c3a2d..62c2117ab5eec 100644
--- a/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php
+++ b/src/Symfony/Bridge/Monolog/Formatter/VarDumperFormatter.php
@@ -21,7 +21,7 @@ class VarDumperFormatter implements FormatterInterface
{
private $cloner;
- public function __construct(VarCloner $cloner = null)
+ public function __construct(?VarCloner $cloner = null)
{
$this->cloner = $cloner ?? new VarCloner();
}
diff --git a/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php b/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php
index 17d3c2f28d227..c3b34c5c17b66 100644
--- a/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php
+++ b/src/Symfony/Bridge/Monolog/Handler/ConsoleHandler.php
@@ -60,7 +60,7 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
* @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging
* level (leave empty to use the default mapping)
*/
- public function __construct(OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = [], array $consoleFormatterOptions = [])
+ public function __construct(?OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = [], array $consoleFormatterOptions = [])
{
parent::__construct(Logger::DEBUG, $bubble);
$this->output = $output;
diff --git a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php
index fb01daddcc777..e0c10d265e3a9 100644
--- a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php
+++ b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php
@@ -58,7 +58,7 @@ class ElasticsearchLogstashHandler extends AbstractHandler
/**
* @param string|int $level The minimum logging level at which this handler will be triggered
*/
- public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', HttpClientInterface $client = null, $level = Logger::DEBUG, bool $bubble = true, string $elasticsearchVersion = '1.0.0')
+ public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', ?HttpClientInterface $client = null, $level = Logger::DEBUG, bool $bubble = true, string $elasticsearchVersion = '1.0.0')
{
if (!interface_exists(HttpClientInterface::class)) {
throw new \LogicException(sprintf('The "%s" handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php
index 4643f5b6d7598..a3431a21404cd 100644
--- a/src/Symfony/Bridge/Monolog/Logger.php
+++ b/src/Symfony/Bridge/Monolog/Logger.php
@@ -25,7 +25,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface
/**
* {@inheritdoc}
*/
- public function getLogs(Request $request = null)
+ public function getLogs(?Request $request = null)
{
if ($logger = $this->getDebugLogger()) {
return $logger->getLogs($request);
@@ -37,7 +37,7 @@ public function getLogs(Request $request = null)
/**
* {@inheritdoc}
*/
- public function countErrors(Request $request = null)
+ public function countErrors(?Request $request = null)
{
if ($logger = $this->getDebugLogger()) {
return $logger->countErrors($request);
diff --git a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php
index 98b1d229220fe..31c19bf828d9b 100644
--- a/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php
+++ b/src/Symfony/Bridge/Monolog/Processor/DebugProcessor.php
@@ -23,7 +23,7 @@ class DebugProcessor implements DebugLoggerInterface, ResetInterface
private $errorCount = [];
private $requestStack;
- public function __construct(RequestStack $requestStack = null)
+ public function __construct(?RequestStack $requestStack = null)
{
$this->requestStack = $requestStack;
}
@@ -68,7 +68,7 @@ public function __invoke(array $record)
/**
* {@inheritdoc}
*/
- public function getLogs(Request $request = null)
+ public function getLogs(?Request $request = null)
{
if (null !== $request) {
return $this->records[spl_object_hash($request)] ?? [];
@@ -84,7 +84,7 @@ public function getLogs(Request $request = null)
/**
* {@inheritdoc}
*/
- public function countErrors(Request $request = null)
+ public function countErrors(?Request $request = null)
{
if (null !== $request) {
return $this->errorCount[spl_object_hash($request)] ?? 0;
diff --git a/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php b/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php
index f72023cdfdac4..805e598f06e00 100644
--- a/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php
+++ b/src/Symfony/Bridge/Monolog/Processor/WebProcessor.php
@@ -25,7 +25,7 @@
*/
class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
{
- public function __construct(array $extraFields = null)
+ public function __construct(?array $extraFields = null)
{
// Pass an empty array as the default null value would access $_SERVER
parent::__construct([], $extraFields);
diff --git a/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php b/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php
index e258c7942a20a..ff5ab0023295c 100644
--- a/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php
+++ b/src/Symfony/Bridge/Monolog/Tests/ClassThatInheritLogger.php
@@ -16,12 +16,12 @@
class ClassThatInheritLogger extends Logger
{
- public function getLogs(Request $request = null): array
+ public function getLogs(?Request $request = null): array
{
return parent::getLogs($request);
}
- public function countErrors(Request $request = null): int
+ public function countErrors(?Request $request = null): int
{
return parent::countErrors($request);
}
diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php b/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php
index bc87c724c9d31..697b5872cb579 100644
--- a/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php
+++ b/src/Symfony/Bridge/Monolog/Tests/Processor/ClassThatInheritDebugProcessor.php
@@ -16,12 +16,12 @@
class ClassThatInheritDebugProcessor extends DebugProcessor
{
- public function getLogs(Request $request = null): array
+ public function getLogs(?Request $request = null): array
{
return parent::getLogs($request);
}
- public function countErrors(Request $request = null): int
+ public function countErrors(?Request $request = null): int
{
return parent::countErrors($request);
}
diff --git a/src/Symfony/Bridge/PhpUnit/CoverageListener.php b/src/Symfony/Bridge/PhpUnit/CoverageListener.php
index 766252b8728b7..65d6aa9dc9dcc 100644
--- a/src/Symfony/Bridge/PhpUnit/CoverageListener.php
+++ b/src/Symfony/Bridge/PhpUnit/CoverageListener.php
@@ -26,7 +26,7 @@ class CoverageListener implements TestListener
private $sutFqcnResolver;
private $warningOnSutNotFound;
- public function __construct(callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false)
+ public function __construct(?callable $sutFqcnResolver = null, bool $warningOnSutNotFound = false)
{
$this->sutFqcnResolver = $sutFqcnResolver ?? static function (Test $test): ?string {
$class = \get_class($test);
diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
index d4c78210114d7..42a2795d54d02 100644
--- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
@@ -44,7 +44,7 @@ class DebugCommand extends Command
private $filesystemLoaders;
private $fileLinkFormatter;
- public function __construct(Environment $twig, string $projectDir = null, array $bundlesMetadata = [], string $twigDefaultPath = null, FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(Environment $twig, ?string $projectDir = null, array $bundlesMetadata = [], ?string $twigDefaultPath = null, ?FileLinkFormatter $fileLinkFormatter = null)
{
parent::__construct();
@@ -218,7 +218,7 @@ private function displayPathsJson(SymfonyStyle $io, string $name)
$io->writeln(json_encode($data));
}
- private function displayGeneralText(SymfonyStyle $io, string $filter = null)
+ private function displayGeneralText(SymfonyStyle $io, ?string $filter = null)
{
$decorated = $io->isDecorated();
$types = ['functions', 'filters', 'tests', 'globals'];
@@ -280,7 +280,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter)
$io->writeln($decorated ? OutputFormatter::escape($data) : $data);
}
- private function getLoaderPaths(string $name = null): array
+ private function getLoaderPaths(?string $name = null): array
{
$loaderPaths = [];
foreach ($this->getFilesystemLoaders() as $loader) {
diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php
index b91110b34a5bc..17bfa435a1b94 100644
--- a/src/Symfony/Bridge/Twig/Command/LintCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php
@@ -236,7 +236,7 @@ private function displayJson(OutputInterface $output, array $filesInfo)
return min($errors, 1);
}
- private function renderException(SymfonyStyle $output, string $template, Error $exception, string $file = null, GithubActionReporter $githubReporter = null)
+ private function renderException(SymfonyStyle $output, string $template, Error $exception, ?string $file = null, ?GithubActionReporter $githubReporter = null)
{
$line = $exception->getTemplateLine();
diff --git a/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php b/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php
index 4a469781084e0..3df1aa4a5951b 100644
--- a/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php
+++ b/src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php
@@ -32,7 +32,7 @@ class TwigDataCollector extends DataCollector implements LateDataCollectorInterf
private $twig;
private $computed;
- public function __construct(Profile $profile, Environment $twig = null)
+ public function __construct(Profile $profile, ?Environment $twig = null)
{
$this->profile = $profile;
$this->twig = $twig;
@@ -41,7 +41,7 @@ public function __construct(Profile $profile, Environment $twig = null)
/**
* {@inheritdoc}
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
}
diff --git a/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php b/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php
index b0ccd684e8b6f..1bc1bb0774e7d 100644
--- a/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php
+++ b/src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php
@@ -32,7 +32,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
/**
* @param bool|callable $debug The debugging mode as a boolean or a callable that should return it
*/
- public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
+ public function __construct(Environment $twig, ?HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
{
if (!\is_bool($debug) && !\is_callable($debug)) {
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, get_debug_type($debug)));
diff --git a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php
index 694821f7bf6b8..9ec9778e3c29b 100644
--- a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php
@@ -46,7 +46,7 @@ public function getFunctions(): array
* If the package used to generate the path is an instance of
* UrlPackage, you will always get a URL and not a path.
*/
- public function getAssetUrl(string $path, string $packageName = null): string
+ public function getAssetUrl(string $path, ?string $packageName = null): string
{
return $this->packages->getUrl($path, $packageName);
}
@@ -54,7 +54,7 @@ public function getAssetUrl(string $path, string $packageName = null): string
/**
* Returns the version of an asset.
*/
- public function getAssetVersion(string $path, string $packageName = null): string
+ public function getAssetVersion(string $path, ?string $packageName = null): string
{
return $this->packages->getVersion($path, $packageName);
}
diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
index 353bd84f3f6f7..d76924633efe0 100644
--- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
@@ -97,6 +97,8 @@ public function formatArgs(array $args): string
$formattedValue = ''.strtolower(htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)).' ';
} elseif ('resource' === $item[0]) {
$formattedValue = 'resource ';
+ } elseif (preg_match('/[^\x07-\x0D\x1B\x20-\xFF]/', $item[1])) {
+ $formattedValue = 'binary string ';
} else {
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset));
}
@@ -162,7 +164,7 @@ public function fileExcerpt(string $file, int $line, int $srcContext = 3): ?stri
/**
* Formats a file path.
*/
- public function formatFile(string $file, int $line, string $text = null): string
+ public function formatFile(string $file, int $line, ?string $text = null): string
{
$file = trim($file);
diff --git a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php
index 46ad8eaf679c2..f6620062c8dcc 100644
--- a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php
@@ -29,7 +29,7 @@ final class DumpExtension extends AbstractExtension
private $cloner;
private $dumper;
- public function __construct(ClonerInterface $cloner, HtmlDumper $dumper = null)
+ public function __construct(ClonerInterface $cloner, ?HtmlDumper $dumper = null)
{
$this->cloner = $cloner;
$this->dumper = $dumper;
diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php
index 7f0b1ed597e36..24c792aec5de2 100644
--- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php
@@ -32,7 +32,7 @@ final class FormExtension extends AbstractExtension
{
private $translator;
- public function __construct(TranslatorInterface $translator = null)
+ public function __construct(?TranslatorInterface $translator = null)
{
$this->translator = $translator;
}
diff --git a/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php b/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
index ab83054a9ff0f..565b37f71c498 100644
--- a/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
+++ b/src/Symfony/Bridge/Twig/Extension/HttpKernelRuntime.php
@@ -25,7 +25,7 @@ final class HttpKernelRuntime
private $handler;
private $fragmentUriGenerator;
- public function __construct(FragmentHandler $handler, FragmentUriGeneratorInterface $fragmentUriGenerator = null)
+ public function __construct(FragmentHandler $handler, ?FragmentUriGeneratorInterface $fragmentUriGenerator = null)
{
$this->handler = $handler;
$this->fragmentUriGenerator = $fragmentUriGenerator;
diff --git a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php
index 071b9ff247f1d..94e9dedacfffd 100644
--- a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php
@@ -45,7 +45,7 @@ public function getFunctions(): array
*
* @param string|null $key The firewall key or null to use the current firewall key
*/
- public function getLogoutPath(string $key = null): string
+ public function getLogoutPath(?string $key = null): string
{
return $this->generator->getLogoutPath($key);
}
@@ -55,7 +55,7 @@ public function getLogoutPath(string $key = null): string
*
* @param string|null $key The firewall key or null to use the current firewall key
*/
- public function getLogoutUrl(string $key = null): string
+ public function getLogoutUrl(?string $key = null): string
{
return $this->generator->getLogoutUrl($key);
}
diff --git a/src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php b/src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php
index 51d6eba2da185..c146848c6353a 100644
--- a/src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/ProfilerExtension.php
@@ -28,7 +28,7 @@ final class ProfilerExtension extends BaseProfilerExtension
*/
private $events;
- public function __construct(Profile $profile, Stopwatch $stopwatch = null)
+ public function __construct(Profile $profile, ?Stopwatch $stopwatch = null)
{
parent::__construct($profile);
diff --git a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php
index 0e58fc0ec66e4..8ff7ea79f8067 100644
--- a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php
@@ -29,7 +29,7 @@ final class SecurityExtension extends AbstractExtension
private $impersonateUrlGenerator;
- public function __construct(AuthorizationCheckerInterface $securityChecker = null, ImpersonateUrlGenerator $impersonateUrlGenerator = null)
+ public function __construct(?AuthorizationCheckerInterface $securityChecker = null, ?ImpersonateUrlGenerator $impersonateUrlGenerator = null)
{
$this->securityChecker = $securityChecker;
$this->impersonateUrlGenerator = $impersonateUrlGenerator;
@@ -38,7 +38,7 @@ public function __construct(AuthorizationCheckerInterface $securityChecker = nul
/**
* @param mixed $object
*/
- public function isGranted($role, $object = null, string $field = null): bool
+ public function isGranted($role, $object = null, ?string $field = null): bool
{
if (null === $this->securityChecker) {
return false;
@@ -55,7 +55,7 @@ public function isGranted($role, $object = null, string $field = null): bool
}
}
- public function getImpersonateExitUrl(string $exitTo = null): string
+ public function getImpersonateExitUrl(?string $exitTo = null): string
{
if (null === $this->impersonateUrlGenerator) {
return '';
@@ -64,7 +64,7 @@ public function getImpersonateExitUrl(string $exitTo = null): string
return $this->impersonateUrlGenerator->generateExitUrl($exitTo);
}
- public function getImpersonateExitPath(string $exitTo = null): string
+ public function getImpersonateExitPath(?string $exitTo = null): string
{
if (null === $this->impersonateUrlGenerator) {
return '';
diff --git a/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php b/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php
index 80a25a949bdb5..4531ee506f26c 100644
--- a/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php
@@ -26,7 +26,7 @@ final class StopwatchExtension extends AbstractExtension
private $stopwatch;
private $enabled;
- public function __construct(Stopwatch $stopwatch = null, bool $enabled = true)
+ public function __construct(?Stopwatch $stopwatch = null, bool $enabled = true)
{
$this->stopwatch = $stopwatch;
$this->enabled = $enabled;
diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
index d50348098e67a..f961b3def3e1f 100644
--- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php
@@ -37,7 +37,7 @@ final class TranslationExtension extends AbstractExtension
private $translator;
private $translationNodeVisitor;
- public function __construct(TranslatorInterface $translator = null, TranslationNodeVisitor $translationNodeVisitor = null)
+ public function __construct(?TranslatorInterface $translator = null, ?TranslationNodeVisitor $translationNodeVisitor = null)
{
$this->translator = $translator;
$this->translationNodeVisitor = $translationNodeVisitor;
@@ -109,7 +109,7 @@ public function getTranslationNodeVisitor(): TranslationNodeVisitor
* @param string|\Stringable|TranslatableInterface|null $message
* @param array|string $arguments Can be the locale as a string when $message is a TranslatableInterface
*/
- public function trans($message, $arguments = [], string $domain = null, string $locale = null, int $count = null): string
+ public function trans($message, $arguments = [], ?string $domain = null, ?string $locale = null, ?int $count = null): string
{
if ($message instanceof TranslatableInterface) {
if ([] !== $arguments && !\is_string($arguments)) {
@@ -138,7 +138,7 @@ public function trans($message, $arguments = [], string $domain = null, string $
return $this->getTranslator()->trans($message, $arguments, $domain, $locale);
}
- public function createTranslatable(string $message, array $parameters = [], string $domain = null): TranslatableMessage
+ public function createTranslatable(string $message, array $parameters = [], ?string $domain = null): TranslatableMessage
{
if (!class_exists(TranslatableMessage::class)) {
throw new \LogicException(sprintf('You cannot use the "%s" as the Translation Component is not installed. Try running "composer require symfony/translation".', __CLASS__));
diff --git a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
index 9b5911ec28992..3b783fc78d43d 100644
--- a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php
@@ -51,7 +51,7 @@ public function getFunctions(): array
/**
* Returns true if the transition is enabled.
*/
- public function canTransition(object $subject, string $transitionName, string $name = null): bool
+ public function canTransition(object $subject, string $transitionName, ?string $name = null): bool
{
return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName);
}
@@ -61,12 +61,12 @@ public function canTransition(object $subject, string $transitionName, string $n
*
* @return Transition[]
*/
- public function getEnabledTransitions(object $subject, string $name = null): array
+ public function getEnabledTransitions(object $subject, ?string $name = null): array
{
return $this->workflowRegistry->get($subject, $name)->getEnabledTransitions($subject);
}
- public function getEnabledTransition(object $subject, string $transition, string $name = null): ?Transition
+ public function getEnabledTransition(object $subject, string $transition, ?string $name = null): ?Transition
{
return $this->workflowRegistry->get($subject, $name)->getEnabledTransition($subject, $transition);
}
@@ -74,7 +74,7 @@ public function getEnabledTransition(object $subject, string $transition, string
/**
* Returns true if the place is marked.
*/
- public function hasMarkedPlace(object $subject, string $placeName, string $name = null): bool
+ public function hasMarkedPlace(object $subject, string $placeName, ?string $name = null): bool
{
return $this->workflowRegistry->get($subject, $name)->getMarking($subject)->has($placeName);
}
@@ -84,7 +84,7 @@ public function hasMarkedPlace(object $subject, string $placeName, string $name
*
* @return string[]|int[]
*/
- public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, string $name = null): array
+ public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, ?string $name = null): array
{
$places = $this->workflowRegistry->get($subject, $name)->getMarking($subject)->getPlaces();
@@ -102,7 +102,7 @@ public function getMarkedPlaces(object $subject, bool $placesNameOnly = true, st
* Use a string (the place name) to get place metadata
* Use a Transition instance to get transition metadata
*/
- public function getMetadata(object $subject, string $key, $metadataSubject = null, string $name = null)
+ public function getMetadata(object $subject, string $key, $metadataSubject = null, ?string $name = null)
{
return $this
->workflowRegistry
@@ -112,7 +112,7 @@ public function getMetadata(object $subject, string $key, $metadataSubject = nul
;
}
- public function buildTransitionBlockerList(object $subject, string $transitionName, string $name = null): TransitionBlockerList
+ public function buildTransitionBlockerList(object $subject, string $transitionName, ?string $name = null): TransitionBlockerList
{
$workflow = $this->workflowRegistry->get($subject, $name);
diff --git a/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php b/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php
index 0f83de4198d65..2a66144552d65 100644
--- a/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php
+++ b/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php
@@ -40,7 +40,7 @@ class NotificationEmail extends TemplatedEmail
'footer_text' => 'Notification e-mail sent by Symfony',
];
- public function __construct(Headers $headers = null, AbstractPart $body = null)
+ public function __construct(?Headers $headers = null, ?AbstractPart $body = null)
{
$missingPackages = [];
if (!class_exists(CssInlinerExtension::class)) {
@@ -61,7 +61,7 @@ public function __construct(Headers $headers = null, AbstractPart $body = null)
/**
* Creates a NotificationEmail instance that is appropriate to send to normal (non-admin) users.
*/
- public static function asPublicEmail(Headers $headers = null, AbstractPart $body = null): self
+ public static function asPublicEmail(?Headers $headers = null, ?AbstractPart $body = null): self
{
$email = new static($headers, $body);
$email->markAsPublic();
@@ -178,6 +178,26 @@ public function getHtmlTemplate(): ?string
return '@email/'.$this->theme.'/notification/body.html.twig';
}
+ /**
+ * @return $this
+ */
+ public function context(array $context)
+ {
+ $parentContext = [];
+
+ foreach ($context as $key => $value) {
+ if (\array_key_exists($key, $this->context)) {
+ $this->context[$key] = $value;
+ } else {
+ $parentContext[$key] = $value;
+ }
+ }
+
+ parent::context($parentContext);
+
+ return $this;
+ }
+
public function getContext(): array
{
return array_merge($this->context, parent::getContext());
diff --git a/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php b/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php
index 853c01427da30..dcdb4e34f6619 100644
--- a/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php
+++ b/src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php
@@ -41,7 +41,7 @@ public function toName(): string
* @param string|null $contentType The media type (i.e. MIME type) of the image file (e.g. 'image/png').
* Some email clients require this to display embedded images.
*/
- public function image(string $image, string $contentType = null): string
+ public function image(string $image, ?string $contentType = null): string
{
$file = $this->twig->getLoader()->getSourceContext($image);
if ($path = $file->getPath()) {
@@ -60,7 +60,7 @@ public function image(string $image, string $contentType = null): string
* @param string|null $contentType The media type (i.e. MIME type) of the file (e.g. 'application/pdf').
* Some email clients require this to display attached files.
*/
- public function attach(string $file, string $name = null, string $contentType = null): void
+ public function attach(string $file, ?string $name = null, ?string $contentType = null): void
{
$file = $this->twig->getLoader()->getSourceContext($file);
if ($path = $file->getPath()) {
diff --git a/src/Symfony/Bridge/Twig/Node/DumpNode.php b/src/Symfony/Bridge/Twig/Node/DumpNode.php
index 68c00556f86bf..3cd92674bd020 100644
--- a/src/Symfony/Bridge/Twig/Node/DumpNode.php
+++ b/src/Symfony/Bridge/Twig/Node/DumpNode.php
@@ -21,7 +21,7 @@ final class DumpNode extends Node
{
private $varPrefix;
- public function __construct(string $varPrefix, ?Node $values, int $lineno, string $tag = null)
+ public function __construct(string $varPrefix, ?Node $values, int $lineno, ?string $tag = null)
{
$nodes = [];
if (null !== $values) {
diff --git a/src/Symfony/Bridge/Twig/Node/FormThemeNode.php b/src/Symfony/Bridge/Twig/Node/FormThemeNode.php
index e37311267bb17..2d4659ae7bb61 100644
--- a/src/Symfony/Bridge/Twig/Node/FormThemeNode.php
+++ b/src/Symfony/Bridge/Twig/Node/FormThemeNode.php
@@ -20,7 +20,7 @@
*/
final class FormThemeNode extends Node
{
- public function __construct(Node $form, Node $resources, int $lineno, string $tag = null, bool $only = false)
+ public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false)
{
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
}
diff --git a/src/Symfony/Bridge/Twig/Node/StopwatchNode.php b/src/Symfony/Bridge/Twig/Node/StopwatchNode.php
index cfa4d8a197f9b..796ee4dab8d16 100644
--- a/src/Symfony/Bridge/Twig/Node/StopwatchNode.php
+++ b/src/Symfony/Bridge/Twig/Node/StopwatchNode.php
@@ -22,7 +22,7 @@
*/
final class StopwatchNode extends Node
{
- public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, string $tag = null)
+ public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null)
{
parent::__construct(['body' => $body, 'name' => $name, 'var' => $var], [], $lineno, $tag);
}
diff --git a/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php b/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php
index df29f0a19931f..5a96d7420122f 100644
--- a/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php
+++ b/src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php
@@ -20,7 +20,7 @@
*/
final class TransDefaultDomainNode extends Node
{
- public function __construct(AbstractExpression $expr, int $lineno = 0, string $tag = null)
+ public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null)
{
parent::__construct(['expr' => $expr], [], $lineno, $tag);
}
diff --git a/src/Symfony/Bridge/Twig/Node/TransNode.php b/src/Symfony/Bridge/Twig/Node/TransNode.php
index 8a126ba569172..881104c8cc3fd 100644
--- a/src/Symfony/Bridge/Twig/Node/TransNode.php
+++ b/src/Symfony/Bridge/Twig/Node/TransNode.php
@@ -24,7 +24,7 @@
*/
final class TransNode extends Node
{
- public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, int $lineno = 0, string $tag = null)
+ public function __construct(Node $body, ?Node $domain = null, ?AbstractExpression $count = null, ?AbstractExpression $vars = null, ?AbstractExpression $locale = null, int $lineno = 0, ?string $tag = null)
{
$nodes = ['body' => $body];
if (null !== $domain) {
diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php
index 765b4b69bd88c..3e86f482632c9 100644
--- a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php
+++ b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php
@@ -20,7 +20,7 @@ class Scope
private $data = [];
private $left = false;
- public function __construct(self $parent = null)
+ public function __construct(?self $parent = null)
{
$this->parent = $parent;
}
diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
index d42245e2b89a4..ac0ccd21cdd37 100644
--- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
+++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php
@@ -158,6 +158,22 @@ private function getReadDomainFromNode(Node $node): ?string
return $node->getAttribute('value');
}
+ if (
+ $node instanceof FunctionExpression
+ && 'constant' === $node->getAttribute('name')
+ ) {
+ $nodeArguments = $node->getNode('arguments');
+ if ($nodeArguments->getIterator()->current() instanceof ConstantExpression) {
+ $constantName = $nodeArguments->getIterator()->current()->getAttribute('value');
+ if (\defined($constantName)) {
+ $value = \constant($constantName);
+ if (\is_string($value)) {
+ return $value;
+ }
+ }
+ }
+ }
+
return self::UNDEFINED_DOMAIN;
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
index 45591415e3312..b04b8a6a739ae 100644
--- a/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
@@ -321,7 +321,7 @@ public static function provideCompletionSuggestions(): iterable
yield 'option --format' => [['--format', ''], ['text', 'json']];
}
- private function createCommandTester(array $paths = [], array $bundleMetadata = [], string $defaultPath = null, bool $useChainLoader = false, array $globals = []): CommandTester
+ private function createCommandTester(array $paths = [], array $bundleMetadata = [], ?string $defaultPath = null, bool $useChainLoader = false, array $globals = []): CommandTester
{
$projectDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures';
$loader = new FilesystemLoader([], $projectDir);
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
index 7de52965b0ef7..a0230aa239606 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php
@@ -206,7 +206,7 @@ public function testDefaultTranslationDomainWithNamedArguments()
$this->assertEquals('foo (custom)foo (foo)foo (custom)foo (custom)foo (fr)foo (custom)foo (fr)', trim($template->render([])));
}
- private function getTemplate($template, TranslatorInterface $translator = null): TemplateWrapper
+ private function getTemplate($template, ?TranslatorInterface $translator = null): TemplateWrapper
{
if (null === $translator) {
$translator = new Translator('en');
diff --git a/src/Symfony/Bridge/Twig/Tests/Mime/NotificationEmailTest.php b/src/Symfony/Bridge/Twig/Tests/Mime/NotificationEmailTest.php
index ceafea1bb6b72..71ced84f7173e 100644
--- a/src/Symfony/Bridge/Twig/Tests/Mime/NotificationEmailTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Mime/NotificationEmailTest.php
@@ -128,4 +128,54 @@ public function testPublicMailSubject()
$headers = $email->getPreparedHeaders();
$this->assertSame('Foo', $headers->get('Subject')->getValue());
}
+
+ public function testContext()
+ {
+ $email = new NotificationEmail();
+ $email->context(['some' => 'context']);
+
+ $this->assertSame([
+ 'importance' => NotificationEmail::IMPORTANCE_LOW,
+ 'content' => '',
+ 'exception' => false,
+ 'action_text' => null,
+ 'action_url' => null,
+ 'markdown' => false,
+ 'raw' => false,
+ 'footer_text' => 'Notification e-mail sent by Symfony',
+ 'some' => 'context',
+ ], $email->getContext());
+
+ $context = $email->getContext();
+ $context['foo'] = 'bar';
+ $email->context($context);
+
+ $this->assertSame([
+ 'importance' => NotificationEmail::IMPORTANCE_LOW,
+ 'content' => '',
+ 'exception' => false,
+ 'action_text' => null,
+ 'action_url' => null,
+ 'markdown' => false,
+ 'raw' => false,
+ 'footer_text' => 'Notification e-mail sent by Symfony',
+ 'some' => 'context',
+ 'foo' => 'bar',
+ ], $email->getContext());
+
+ $email->action('Action Text', 'Action URL');
+
+ $this->assertSame([
+ 'importance' => NotificationEmail::IMPORTANCE_LOW,
+ 'content' => '',
+ 'exception' => false,
+ 'action_text' => 'Action Text',
+ 'action_url' => 'Action URL',
+ 'markdown' => false,
+ 'raw' => false,
+ 'footer_text' => 'Notification e-mail sent by Symfony',
+ 'some' => 'context',
+ 'foo' => 'bar',
+ ], $email->getContext());
+ }
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Mime/TemplatedEmailTest.php b/src/Symfony/Bridge/Twig/Tests/Mime/TemplatedEmailTest.php
index b21017193251d..dd23cd37320f2 100644
--- a/src/Symfony/Bridge/Twig/Tests/Mime/TemplatedEmailTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Mime/TemplatedEmailTest.php
@@ -94,8 +94,7 @@ public function testSymfonySerialize()
}
]
},
- "body": null,
- "message": null
+ "body": null
}
EOF;
diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
index 060a0578f2044..4e7b501da0050 100644
--- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
@@ -22,6 +22,8 @@
class TwigExtractorTest extends TestCase
{
+ public const CUSTOM_DOMAIN = 'domain';
+
/**
* @dataProvider getExtractData
*/
@@ -77,6 +79,11 @@ public static function getExtractData()
// make sure this works with twig's named arguments
['{{ "new key" | trans(domain="domain") }}', ['new key' => 'domain']],
+ // make sure this works with const domain
+ ['{{ "new key" | trans({}, constant(\'Symfony\\\\Bridge\\\\Twig\\\\Tests\\\\Translation\\\\TwigExtractorTest::CUSTOM_DOMAIN\')) }}', ['new key' => self::CUSTOM_DOMAIN]],
+ ['{% trans from constant(\'Symfony\\\\Bridge\\\\Twig\\\\Tests\\\\Translation\\\\TwigExtractorTest::CUSTOM_DOMAIN\') %}new key{% endtrans %}', ['new key' => self::CUSTOM_DOMAIN]],
+ ['{{ t("new key", {}, constant(\'Symfony\\\\Bridge\\\\Twig\\\\Tests\\\\Translation\\\\TwigExtractorTest::CUSTOM_DOMAIN\')) | trans() }}', ['new key' => self::CUSTOM_DOMAIN]],
+
// concat translations
['{{ ("new" ~ " key") | trans() }}', ['new key' => 'messages']],
['{{ ("another " ~ "new " ~ "key") | trans() }}', ['another new key' => 'messages']],
diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json
index 07275fe457320..1abf3ad1df889 100644
--- a/src/Symfony/Bridge/Twig/composer.json
+++ b/src/Symfony/Bridge/Twig/composer.json
@@ -42,7 +42,7 @@
"symfony/security-core": "^4.4|^5.0|^6.0",
"symfony/security-csrf": "^4.4|^5.0|^6.0",
"symfony/security-http": "^4.4|^5.0|^6.0",
- "symfony/serializer": "^5.2|^6.0",
+ "symfony/serializer": "^5.4.35|~6.3.12|^6.4.3",
"symfony/stopwatch": "^4.4|^5.0|^6.0",
"symfony/console": "^5.3|^6.0",
"symfony/expression-language": "^4.4|^5.0|^6.0",
diff --git a/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php b/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php
index 0feabe95facb2..4c3930fadc116 100644
--- a/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php
+++ b/src/Symfony/Bundle/DebugBundle/Command/ServerDumpPlaceholderCommand.php
@@ -32,7 +32,7 @@ class ServerDumpPlaceholderCommand extends Command
private $replacedCommand;
- public function __construct(DumpServer $server = null, array $descriptors = [])
+ public function __construct(?DumpServer $server = null, array $descriptors = [])
{
$this->replacedCommand = new ServerDumpCommand((new \ReflectionClass(DumpServer::class))->newInstanceWithoutConstructor(), $descriptors);
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
index 55044001798d0..9c6ac5fe03188 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/AnnotationsCacheWarmer.php
@@ -32,7 +32,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
/**
* @param string $phpArrayFile The PHP file where annotations are cached
*/
- public function __construct(Reader $annotationReader, string $phpArrayFile, string $excludeRegexp = null, bool $debug = false)
+ public function __construct(Reader $annotationReader, string $phpArrayFile, ?string $excludeRegexp = null, bool $debug = false)
{
parent::__construct($phpArrayFile);
$this->annotationReader = $annotationReader;
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php
index 50843f5263c18..aabb0061e48b9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ConfigBuilderCacheWarmer.php
@@ -31,7 +31,7 @@ class ConfigBuilderCacheWarmer implements CacheWarmerInterface
private $kernel;
private $logger;
- public function __construct(KernelInterface $kernel, LoggerInterface $logger = null)
+ public function __construct(KernelInterface $kernel, ?LoggerInterface $logger = null)
{
$this->kernel = $kernel;
$this->logger = $logger;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
index 4d2d8422335bf..4be5c2c98a0a5 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
@@ -41,7 +41,7 @@ class CacheClearCommand extends Command
private $cacheClearer;
private $filesystem;
- public function __construct(CacheClearerInterface $cacheClearer, Filesystem $filesystem = null)
+ public function __construct(CacheClearerInterface $cacheClearer, ?Filesystem $filesystem = null)
{
parent::__construct();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
index b72924dfa78d6..21ac705ee2eac 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
@@ -38,7 +38,7 @@ final class CachePoolClearCommand extends Command
/**
* @param string[]|null $poolNames
*/
- public function __construct(Psr6CacheClearer $poolClearer, array $poolNames = null)
+ public function __construct(Psr6CacheClearer $poolClearer, ?array $poolNames = null)
{
parent::__construct();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
index b36d48cfe3973..e439665435c0d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CachePoolDeleteCommand.php
@@ -36,7 +36,7 @@ final class CachePoolDeleteCommand extends Command
/**
* @param string[]|null $poolNames
*/
- public function __construct(Psr6CacheClearer $poolClearer, array $poolNames = null)
+ public function __construct(Psr6CacheClearer $poolClearer, ?array $poolNames = null)
{
parent::__construct();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php
index e1e3c95341de3..478509a5c21e1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php
@@ -37,7 +37,7 @@ class DebugAutowiringCommand extends ContainerDebugCommand
private $supportsHref;
private $fileLinkFormatter;
- public function __construct(string $name = null, FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?string $name = null, ?FileLinkFormatter $fileLinkFormatter = null)
{
$this->supportsHref = method_exists(OutputFormatterStyle::class, 'setHref');
$this->fileLinkFormatter = $fileLinkFormatter;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
index cf929f9879b54..bb1eff1abda11 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php
@@ -42,7 +42,7 @@ class RouterDebugCommand extends Command
private $router;
private $fileLinkFormatter;
- public function __construct(RouterInterface $router, FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(RouterInterface $router, ?FileLinkFormatter $fileLinkFormatter = null)
{
parent::__construct();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php
index 0e07d88fa3eb7..24bb242d91d15 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php
@@ -32,7 +32,7 @@ final class SecretsDecryptToLocalCommand extends Command
private $vault;
private $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsEncryptFromLocalCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsEncryptFromLocalCommand.php
index 79f51c51ad085..1e5edcfbbcfae 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsEncryptFromLocalCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsEncryptFromLocalCommand.php
@@ -31,7 +31,7 @@ final class SecretsEncryptFromLocalCommand extends Command
private $vault;
private $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsGenerateKeysCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsGenerateKeysCommand.php
index a9440b4c8fabc..f2c2a3cfee40d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsGenerateKeysCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsGenerateKeysCommand.php
@@ -34,7 +34,7 @@ final class SecretsGenerateKeysCommand extends Command
private $vault;
private $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsListCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsListCommand.php
index 0b13e0cf21889..7dd826e316c95 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsListCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsListCommand.php
@@ -35,7 +35,7 @@ final class SecretsListCommand extends Command
private $vault;
private $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsRemoveCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsRemoveCommand.php
index 0451ef300f634..5be85e45d5251 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsRemoveCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsRemoveCommand.php
@@ -36,7 +36,7 @@ final class SecretsRemoveCommand extends Command
private $vault;
private $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsSetCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsSetCommand.php
index 412247da70636..e96b838860712 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/SecretsSetCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/SecretsSetCommand.php
@@ -37,7 +37,7 @@ final class SecretsSetCommand extends Command
private $vault;
private $localVault;
- public function __construct(AbstractVault $vault, AbstractVault $localVault = null)
+ public function __construct(AbstractVault $vault, ?AbstractVault $localVault = null)
{
$this->vault = $vault;
$this->localVault = $localVault;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
index 006fd250550b8..12155a6465ac0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
@@ -60,7 +60,7 @@ class TranslationDebugCommand extends Command
private $codePaths;
private $enabledLocales;
- public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
+ public function __construct(TranslatorInterface $translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, ?string $defaultTransPath = null, ?string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
{
parent::__construct();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
index 7adc0b4bb5568..634c5be093c85 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
@@ -61,7 +61,7 @@ class TranslationUpdateCommand extends Command
private $codePaths;
private $enabledLocales;
- public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
+ public function __construct(TranslationWriterInterface $writer, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultLocale, ?string $defaultTransPath = null, ?string $defaultViewsPath = null, array $transPaths = [], array $codePaths = [], array $enabledLocales = [])
{
parent::__construct();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php
index 7fe7bc937d315..1bd56cc7a364e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Application.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Application.php
@@ -135,7 +135,7 @@ public function get(string $name)
/**
* {@inheritdoc}
*/
- public function all(string $namespace = null)
+ public function all(?string $namespace = null)
{
$this->registerCommands();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
index 537d6d08c3846..d3b3b6896ab67 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php
@@ -113,7 +113,7 @@ abstract protected function describeContainerTags(ContainerBuilder $builder, arr
*
* @param Definition|Alias|object $service
*/
- abstract protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null);
+ abstract protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null);
/**
* Describes container services.
@@ -127,7 +127,7 @@ abstract protected function describeContainerDeprecations(ContainerBuilder $buil
abstract protected function describeContainerDefinition(Definition $definition, array $options = []);
- abstract protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null);
+ abstract protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null);
abstract protected function describeContainerParameter($parameter, array $options = []);
@@ -304,7 +304,7 @@ protected function sortByPriority(array $tag): array
return $tag;
}
- public static function getClassDescription(string $class, string &$resolvedClass = null): string
+ public static function getClassDescription(string $class, ?string &$resolvedClass = null): string
{
$resolvedClass = $class;
try {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index 0ad063343f78c..585af1eefd539 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -67,7 +67,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
$this->writeData($data, $options);
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -120,7 +120,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$this->writeData($this->getContainerDefinitionData($definition, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']), $options);
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
if (!$builder) {
$this->writeData($this->getContainerAliasData($alias), $options);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
index a3fbabc6d2bf9..f23be9d579952 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
@@ -88,7 +88,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
}
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -253,7 +253,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output);
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
$output = '- Service: `'.$alias.'`'
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index e7eb18762de86..56bb0fbd9bed4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -39,7 +39,7 @@ class TextDescriptor extends Descriptor
{
private $fileLinkFormatter;
- public function __construct(FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this->fileLinkFormatter = $fileLinkFormatter;
}
@@ -141,7 +141,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
}
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -389,7 +389,7 @@ protected function describeContainerDeprecations(ContainerBuilder $builder, arra
$options['output']->listing($formattedLogs);
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
if ($alias->isPublic() && !$alias->isPrivate()) {
$options['output']->comment(sprintf('This service is a public alias for the service %s ', (string) $alias));
@@ -541,7 +541,7 @@ private function formatRouterConfig(array $config): string
return trim($configAsString);
}
- private function formatControllerLink($controller, string $anchorText, callable $getContainer = null): string
+ private function formatControllerLink($controller, string $anchorText, ?callable $getContainer = null): string
{
if (null === $this->fileLinkFormatter) {
return $anchorText;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
index 350452f33cee9..56b1af9bf6c64 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php
@@ -53,7 +53,7 @@ protected function describeContainerTags(ContainerBuilder $builder, array $optio
$this->writeDocument($this->getContainerTagsDocument($builder, isset($options['show_hidden']) && $options['show_hidden']));
}
- protected function describeContainerService(object $service, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerService(object $service, array $options = [], ?ContainerBuilder $builder = null)
{
if (!isset($options['id'])) {
throw new \InvalidArgumentException('An "id" option must be provided.');
@@ -72,7 +72,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$this->writeDocument($this->getContainerDefinitionDocument($definition, $options['id'] ?? null, isset($options['omit_tags']) && $options['omit_tags'], isset($options['show_arguments']) && $options['show_arguments']));
}
- protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
+ protected function describeContainerAlias(Alias $alias, array $options = [], ?ContainerBuilder $builder = null)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, $options['id'] ?? null)->childNodes->item(0), true));
@@ -155,7 +155,7 @@ private function getRouteCollectionDocument(RouteCollection $routes): \DOMDocume
return $dom;
}
- private function getRouteDocument(Route $route, string $name = null): \DOMDocument
+ private function getRouteDocument(Route $route, ?string $name = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($routeXML = $dom->createElement('route'));
@@ -255,7 +255,7 @@ private function getContainerTagsDocument(ContainerBuilder $builder, bool $showH
return $dom;
}
- private function getContainerServiceDocument(object $service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
+ private function getContainerServiceDocument(object $service, string $id, ?ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
@@ -275,7 +275,7 @@ private function getContainerServiceDocument(object $service, string $id, Contai
return $dom;
}
- private function getContainerServicesDocument(ContainerBuilder $builder, string $tag = null, bool $showHidden = false, bool $showArguments = false, callable $filter = null): \DOMDocument
+ private function getContainerServicesDocument(ContainerBuilder $builder, ?string $tag = null, bool $showHidden = false, bool $showArguments = false, ?callable $filter = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($containerXML = $dom->createElement('container'));
@@ -301,7 +301,7 @@ private function getContainerServicesDocument(ContainerBuilder $builder, string
return $dom;
}
- private function getContainerDefinitionDocument(Definition $definition, string $id = null, bool $omitTags = false, bool $showArguments = false): \DOMDocument
+ private function getContainerDefinitionDocument(Definition $definition, ?string $id = null, bool $omitTags = false, bool $showArguments = false): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($serviceXML = $dom->createElement('definition'));
@@ -432,7 +432,7 @@ private function getArgumentNodes(array $arguments, \DOMDocument $dom): array
return $nodes;
}
- private function getContainerAliasDocument(Alias $alias, string $id = null): \DOMDocument
+ private function getContainerAliasDocument(Alias $alias, ?string $id = null): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($aliasXML = $dom->createElement('alias'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php b/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php
index 1f17c999424d3..ca303e12d2368 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Helper/DescriptorHelper.php
@@ -25,7 +25,7 @@
*/
class DescriptorHelper extends BaseDescriptorHelper
{
- public function __construct(FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this
->register('txt', new TextDescriptor($fileLinkFormatter))
diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
index d4b9f4181642a..7eebd8ac7f9e6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php
@@ -193,7 +193,7 @@ protected function json($data, int $status = 200, array $headers = [], array $co
*
* @param \SplFileInfo|string $file File object or path to file to be sent as response
*/
- protected function file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
+ protected function file($file, ?string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
{
$response = new BinaryFileResponse($file);
$response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);
@@ -261,7 +261,7 @@ protected function renderView(string $view, array $parameters = []): string
/**
* Renders a view.
*/
- protected function render(string $view, array $parameters = [], Response $response = null): Response
+ protected function render(string $view, array $parameters = [], ?Response $response = null): Response
{
$content = $this->renderView($view, $parameters);
@@ -279,7 +279,7 @@ protected function render(string $view, array $parameters = [], Response $respon
*
* If an invalid form is found in the list of parameters, a 422 status code is returned.
*/
- protected function renderForm(string $view, array $parameters = [], Response $response = null): Response
+ protected function renderForm(string $view, array $parameters = [], ?Response $response = null): Response
{
if (null === $response) {
$response = new Response();
@@ -307,7 +307,7 @@ protected function renderForm(string $view, array $parameters = [], Response $re
/**
* Streams a view.
*/
- protected function stream(string $view, array $parameters = [], StreamedResponse $response = null): StreamedResponse
+ protected function stream(string $view, array $parameters = [], ?StreamedResponse $response = null): StreamedResponse
{
if (!$this->container->has('twig')) {
throw new \LogicException('You cannot use the "stream" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
@@ -335,7 +335,7 @@ protected function stream(string $view, array $parameters = [], StreamedResponse
*
* throw $this->createNotFoundException('Page not found!');
*/
- protected function createNotFoundException(string $message = 'Not Found', \Throwable $previous = null): NotFoundHttpException
+ protected function createNotFoundException(string $message = 'Not Found', ?\Throwable $previous = null): NotFoundHttpException
{
return new NotFoundHttpException($message, $previous);
}
@@ -349,7 +349,7 @@ protected function createNotFoundException(string $message = 'Not Found', \Throw
*
* @throws \LogicException If the Security component is not available
*/
- protected function createAccessDeniedException(string $message = 'Access Denied.', \Throwable $previous = null): AccessDeniedException
+ protected function createAccessDeniedException(string $message = 'Access Denied.', ?\Throwable $previous = null): AccessDeniedException
{
if (!class_exists(AccessDeniedException::class)) {
throw new \LogicException('You cannot use the "createAccessDeniedException" method if the Security component is not available. Try running "composer require symfony/security-bundle".');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php
index 6a0fed64f6ae1..702d69748062b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Controller/RedirectController.php
@@ -31,7 +31,7 @@ class RedirectController
private $httpPort;
private $httpsPort;
- public function __construct(UrlGeneratorInterface $router = null, int $httpPort = null, int $httpsPort = null)
+ public function __construct(?UrlGeneratorInterface $router = null, ?int $httpPort = null, ?int $httpsPort = null)
{
$this->router = $router;
$this->httpPort = $httpPort;
@@ -107,7 +107,7 @@ public function redirectAction(Request $request, string $route, bool $permanent
*
* @throws HttpException In case the path is empty
*/
- public function urlRedirectAction(Request $request, string $path, bool $permanent = false, string $scheme = null, int $httpPort = null, int $httpsPort = null, bool $keepRequestMethod = false): Response
+ public function urlRedirectAction(Request $request, string $path, bool $permanent = false, ?string $scheme = null, ?int $httpPort = null, ?int $httpsPort = null, bool $keepRequestMethod = false): Response
{
if ('' == $path) {
throw new HttpException($permanent ? 410 : 404);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php
index 2283dbc91fccf..5ea4c5b53a12c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php
@@ -25,7 +25,7 @@ class TemplateController
{
private $twig;
- public function __construct(Environment $twig = null)
+ public function __construct(?Environment $twig = null)
{
$this->twig = $twig;
}
@@ -40,7 +40,7 @@ public function __construct(Environment $twig = null)
* @param array $context The context (arguments) of the template
* @param int $statusCode The HTTP status code to return with the response. Defaults to 200
*/
- public function templateAction(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
+ public function templateAction(string $template, ?int $maxAge = null, ?int $sharedAge = null, ?bool $private = null, array $context = [], int $statusCode = 200): Response
{
if (null === $this->twig) {
throw new \LogicException('You cannot use the TemplateController if the Twig Bundle is not available.');
@@ -65,7 +65,7 @@ public function templateAction(string $template, int $maxAge = null, int $shared
return $response;
}
- public function __invoke(string $template, int $maxAge = null, int $sharedAge = null, bool $private = null, array $context = [], int $statusCode = 200): Response
+ public function __invoke(string $template, ?int $maxAge = null, ?int $sharedAge = null, ?bool $private = null, array $context = [], int $statusCode = 200): Response
{
return $this->templateAction($template, $maxAge, $sharedAge, $private, $context, $statusCode);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 156c16b27ae8f..487759a87a1ba 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -123,7 +123,7 @@ public function getConfigTreeBuilder()
->end()
;
- $willBeAvailable = static function (string $package, string $class, string $parentPackage = null) {
+ $willBeAvailable = static function (string $package, string $class, ?string $parentPackage = null) {
$parentPackages = (array) $parentPackage;
$parentPackages[] = 'symfony/framework-bundle';
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 7529acd605873..aaaac8d30ab28 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -138,7 +138,7 @@
use Symfony\Component\Notifier\Bridge\Mailjet\MailjetTransportFactory as MailjetNotifierTransportFactory;
use Symfony\Component\Notifier\Bridge\Mattermost\MattermostTransportFactory;
use Symfony\Component\Notifier\Bridge\Mercure\MercureTransportFactory;
-use Symfony\Component\Notifier\Bridge\MessageBird\MessageBirdTransport;
+use Symfony\Component\Notifier\Bridge\MessageBird\MessageBirdTransportFactory;
use Symfony\Component\Notifier\Bridge\MessageMedia\MessageMediaTransportFactory;
use Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsTransportFactory;
use Symfony\Component\Notifier\Bridge\Mobyt\MobytTransportFactory;
@@ -157,7 +157,7 @@
use Symfony\Component\Notifier\Bridge\SpotHit\SpotHitTransportFactory;
use Symfony\Component\Notifier\Bridge\Telegram\TelegramTransportFactory;
use Symfony\Component\Notifier\Bridge\Telnyx\TelnyxTransportFactory;
-use Symfony\Component\Notifier\Bridge\TurboSms\TurboSmsTransport;
+use Symfony\Component\Notifier\Bridge\TurboSms\TurboSmsTransportFactory;
use Symfony\Component\Notifier\Bridge\Twilio\TwilioTransportFactory;
use Symfony\Component\Notifier\Bridge\Vonage\VonageTransportFactory;
use Symfony\Component\Notifier\Bridge\Yunpian\YunpianTransportFactory;
@@ -2555,7 +2555,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
MailjetNotifierTransportFactory::class => 'notifier.transport_factory.mailjet',
MattermostTransportFactory::class => 'notifier.transport_factory.mattermost',
MercureTransportFactory::class => 'notifier.transport_factory.mercure',
- MessageBirdTransport::class => 'notifier.transport_factory.message-bird',
+ MessageBirdTransportFactory::class => 'notifier.transport_factory.message-bird',
MessageMediaTransportFactory::class => 'notifier.transport_factory.message-media',
MicrosoftTeamsTransportFactory::class => 'notifier.transport_factory.microsoft-teams',
MobytTransportFactory::class => 'notifier.transport_factory.mobyt',
@@ -2574,7 +2574,7 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
SpotHitTransportFactory::class => 'notifier.transport_factory.spot-hit',
TelegramTransportFactory::class => 'notifier.transport_factory.telegram',
TelnyxTransportFactory::class => 'notifier.transport_factory.telnyx',
- TurboSmsTransport::class => 'notifier.transport_factory.turbo-sms',
+ TurboSmsTransportFactory::class => 'notifier.transport_factory.turbo-sms',
TwilioTransportFactory::class => 'notifier.transport_factory.twilio',
VonageTransportFactory::class => 'notifier.transport_factory.vonage',
YunpianTransportFactory::class => 'notifier.transport_factory.yunpian',
@@ -2594,27 +2594,27 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages, true) && \in_array(MercureBundle::class, $container->getParameter('kernel.bundles'), true)) {
$container->getDefinition($classToServices[MercureTransportFactory::class])
- ->replaceArgument('$registry', new Reference(HubRegistry::class))
- ->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
- ->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
+ ->replaceArgument(0, new Reference(HubRegistry::class))
+ ->replaceArgument(1, new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
+ ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
} elseif (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true)) {
$container->removeDefinition($classToServices[MercureTransportFactory::class]);
}
if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'], true)) {
$container->getDefinition($classToServices[FakeChatTransportFactory::class])
- ->replaceArgument('$mailer', new Reference('mailer'))
- ->replaceArgument('$logger', new Reference('logger'))
- ->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
- ->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
+ ->replaceArgument(0, new Reference('mailer'))
+ ->replaceArgument(1, new Reference('logger'))
+ ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
+ ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
}
if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'], true)) {
$container->getDefinition($classToServices[FakeSmsTransportFactory::class])
- ->replaceArgument('$mailer', new Reference('mailer'))
- ->replaceArgument('$logger', new Reference('logger'))
- ->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
- ->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
+ ->replaceArgument(0, new Reference('mailer'))
+ ->replaceArgument(1, new Reference('logger'))
+ ->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
+ ->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
}
if (isset($config['admin_recipients'])) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php
index fe38c4adcaa59..e2dd8f9408d96 100644
--- a/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php
+++ b/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php
@@ -37,7 +37,7 @@ class HttpCache extends BaseHttpCache
/**
* @param string|StoreInterface $cache The cache directory (default used if null) or the storage instance
*/
- public function __construct(KernelInterface $kernel, $cache = null, SurrogateInterface $surrogate = null, array $options = null)
+ public function __construct(KernelInterface $kernel, $cache = null, ?SurrogateInterface $surrogate = null, ?array $options = null)
{
$this->kernel = $kernel;
$this->surrogate = $surrogate;
@@ -65,7 +65,7 @@ public function __construct(KernelInterface $kernel, $cache = null, SurrogateInt
/**
* {@inheritdoc}
*/
- protected function forward(Request $request, bool $catch = false, Response $entry = null)
+ protected function forward(Request $request, bool $catch = false, ?Response $entry = null)
{
$this->getKernel()->boot();
$this->getKernel()->getContainer()->set('cache', $this);
diff --git a/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php b/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
index a0285301250ba..3dec82d8c17ca 100644
--- a/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
+++ b/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
@@ -37,7 +37,7 @@ class KernelBrowser extends HttpKernelBrowser
/**
* {@inheritdoc}
*/
- public function __construct(KernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
+ public function __construct(KernelInterface $kernel, array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
parent::__construct($kernel, $server, $history, $cookieJar);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php
index e130bd2fa931f..2660f7265167a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php
@@ -43,7 +43,7 @@ public function __construct(LoaderResolverInterface $resolver, array $defaultOpt
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null): RouteCollection
+ public function load($resource, ?string $type = null): RouteCollection
{
if ($this->loading) {
// This can happen if a fatal error occurs in parent::load().
diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/RedirectableCompiledUrlMatcher.php b/src/Symfony/Bundle/FrameworkBundle/Routing/RedirectableCompiledUrlMatcher.php
index dba9d6d9613d1..3ae4523ba802c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Routing/RedirectableCompiledUrlMatcher.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Routing/RedirectableCompiledUrlMatcher.php
@@ -24,7 +24,7 @@ class RedirectableCompiledUrlMatcher extends CompiledUrlMatcher implements Redir
/**
* {@inheritdoc}
*/
- public function redirect(string $path, string $route, string $scheme = null): array
+ public function redirect(string $path, string $route, ?string $scheme = null): array
{
return [
'_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',
diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
index 8e36efe0a6184..06a3f71ffdc99 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
@@ -40,7 +40,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
/**
* @param mixed $resource The main resource to load
*/
- public function __construct(ContainerInterface $container, $resource, array $options = [], RequestContext $context = null, ContainerInterface $parameters = null, LoggerInterface $logger = null, string $defaultLocale = null)
+ public function __construct(ContainerInterface $container, $resource, array $options = [], ?RequestContext $context = null, ?ContainerInterface $parameters = null, ?LoggerInterface $logger = null, ?string $defaultLocale = null)
{
$this->container = $container;
$this->resource = $resource;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php b/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php
index 55b95f055994f..9b8db8ca3acf1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php
@@ -43,7 +43,7 @@ public static function assertResponseFormatSame(?string $expectedFormat, string
self::assertThatForResponse(new ResponseConstraint\ResponseFormatSame(self::getRequest(), $expectedFormat), $message);
}
- public static function assertResponseRedirects(string $expectedLocation = null, int $expectedCode = null, string $message = ''): void
+ public static function assertResponseRedirects(?string $expectedLocation = null, ?int $expectedCode = null, string $message = ''): void
{
$constraint = new ResponseConstraint\ResponseIsRedirected();
if ($expectedLocation) {
@@ -76,17 +76,17 @@ public static function assertResponseHeaderNotSame(string $headerName, string $e
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHeaderSame($headerName, $expectedValue)), $message);
}
- public static function assertResponseHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertResponseHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(new ResponseConstraint\ResponseHasCookie($name, $path, $domain), $message);
}
- public static function assertResponseNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertResponseNotHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHasCookie($name, $path, $domain)), $message);
}
- public static function assertResponseCookieValueSame(string $name, string $expectedValue, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertResponseCookieValueSame(string $name, string $expectedValue, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForResponse(LogicalAnd::fromConstraints(
new ResponseConstraint\ResponseHasCookie($name, $path, $domain),
@@ -99,17 +99,17 @@ public static function assertResponseIsUnprocessable(string $message = ''): void
self::assertThatForResponse(new ResponseConstraint\ResponseIsUnprocessable(), $message);
}
- public static function assertBrowserHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertBrowserHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain), $message);
}
- public static function assertBrowserNotHasCookie(string $name, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertBrowserNotHasCookie(string $name, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(new LogicalNot(new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain)), $message);
}
- public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', string $domain = null, string $message = ''): void
+ public static function assertBrowserCookieValueSame(string $name, string $expectedValue, bool $raw = false, string $path = '/', ?string $domain = null, string $message = ''): void
{
self::assertThatForClient(LogicalAnd::fromConstraints(
new BrowserKitConstraint\BrowserHasCookie($name, $path, $domain),
@@ -156,7 +156,7 @@ public static function assertThatForClient(Constraint $constraint, string $messa
self::assertThat(self::getClient(), $constraint, $message);
}
- private static function getClient(AbstractBrowser $newClient = null): ?AbstractBrowser
+ private static function getClient(?AbstractBrowser $newClient = null): ?AbstractBrowser
{
static $client;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php b/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php
index 1a629d6255fbe..491812aa99d72 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php
@@ -20,12 +20,12 @@
trait MailerAssertionsTrait
{
- public static function assertEmailCount(int $count, string $transport = null, string $message = ''): void
+ public static function assertEmailCount(int $count, ?string $transport = null, string $message = ''): void
{
self::assertThat(self::getMessageMailerEvents(), new MailerConstraint\EmailCount($count, $transport), $message);
}
- public static function assertQueuedEmailCount(int $count, string $transport = null, string $message = ''): void
+ public static function assertQueuedEmailCount(int $count, ?string $transport = null, string $message = ''): void
{
self::assertThat(self::getMessageMailerEvents(), new MailerConstraint\EmailCount($count, $transport, true), $message);
}
@@ -93,12 +93,12 @@ public static function assertEmailAddressContains(RawMessage $email, string $hea
/**
* @return MessageEvent[]
*/
- public static function getMailerEvents(string $transport = null): array
+ public static function getMailerEvents(?string $transport = null): array
{
return self::getMessageMailerEvents()->getEvents($transport);
}
- public static function getMailerEvent(int $index = 0, string $transport = null): ?MessageEvent
+ public static function getMailerEvent(int $index = 0, ?string $transport = null): ?MessageEvent
{
return self::getMailerEvents($transport)[$index] ?? null;
}
@@ -106,12 +106,12 @@ public static function getMailerEvent(int $index = 0, string $transport = null):
/**
* @return RawMessage[]
*/
- public static function getMailerMessages(string $transport = null): array
+ public static function getMailerMessages(?string $transport = null): array
{
return self::getMessageMailerEvents()->getMessages($transport);
}
- public static function getMailerMessage(int $index = 0, string $transport = null): ?RawMessage
+ public static function getMailerMessage(int $index = 0, ?string $transport = null): ?RawMessage
{
return self::getMailerMessages($transport)[$index] ?? null;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/TestBrowserToken.php b/src/Symfony/Bundle/FrameworkBundle/Test/TestBrowserToken.php
index 7580743f6d5cb..ebc88c98e4926 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Test/TestBrowserToken.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Test/TestBrowserToken.php
@@ -23,7 +23,7 @@ class TestBrowserToken extends AbstractToken
{
private $firewallName;
- public function __construct(array $roles = [], UserInterface $user = null, string $firewallName = 'main')
+ public function __construct(array $roles = [], ?UserInterface $user = null, string $firewallName = 'main')
{
parent::__construct($roles);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index e3ac1066af80a..57535aea50e35 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -158,12 +158,12 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}
- private function createCommandTester(array $extractedMessages = [], array $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
+ private function createCommandTester(array $extractedMessages = [], array $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
{
return new CommandTester($this->createCommand($extractedMessages, $loadedMessages, $kernel, $transPaths, $codePaths));
}
- private function createCommand(array $extractedMessages = [], array $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = [], ExtractorInterface $extractor = null, array $bundles = [], array $enabledLocales = []): TranslationDebugCommand
+ private function createCommand(array $extractedMessages = [], array $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = [], ?ExtractorInterface $extractor = null, array $bundles = [], array $enabledLocales = []): TranslationDebugCommand
{
$translator = $this->createMock(Translator::class);
$translator
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php
index 6992ade4d422b..0b8ee7648eab6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandCompletionTest.php
@@ -67,7 +67,7 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}
- private function createCommandCompletionTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandCompletionTester
+ private function createCommandCompletionTester($extractedMessages = [], $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandCompletionTester
{
$translator = $this->createMock(Translator::class);
$translator
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index f883fac0c57ce..8b2ad0891ce28 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -193,7 +193,7 @@ protected function tearDown(): void
$this->fs->remove($this->translationDir);
}
- private function createCommandTester($extractedMessages = [], $loadedMessages = [], KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
+ private function createCommandTester($extractedMessages = [], $loadedMessages = [], ?KernelInterface $kernel = null, array $transPaths = [], array $codePaths = []): CommandTester
{
$translator = $this->createMock(Translator::class);
$translator
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php
index 5fb3e774a709d..68e9ea413aa2f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/ControllerResolverTest.php
@@ -148,7 +148,7 @@ class_exists(AbstractControllerTest::class);
$this->assertSame($controllerContainer, $controller->getContainer());
}
- protected function createControllerResolver(LoggerInterface $logger = null, Psr11ContainerInterface $container = null)
+ protected function createControllerResolver(?LoggerInterface $logger = null, ?Psr11ContainerInterface $container = null)
{
if (!$container) {
$container = $this->createMockContainer();
@@ -172,7 +172,7 @@ class ContainerAwareController implements ContainerAwareInterface
{
private $container;
- public function setContainer(ContainerInterface $container = null)
+ public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
index a5d58edbb4226..21275b490b249 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/DataCollectorTranslatorPassTest.php
@@ -108,7 +108,7 @@ public static function getNotImplementingTranslatorBagInterfaceTranslatorClassNa
class TranslatorWithTranslatorBag implements TranslatorInterface
{
- public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
+ public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
{
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
index 9792d2266050c..8794f539e56b6 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/ProfilerPassTest.php
@@ -65,7 +65,7 @@ public function testValidCollector()
public static function provideValidCollectorWithTemplateUsingAutoconfigure(): \Generator
{
yield [new class() implements TemplateAwareDataCollectorInterface {
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
}
@@ -85,7 +85,7 @@ public static function getTemplate(): string
}];
yield [new class() extends AbstractDataCollector {
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
index 52a6ad6a4840f..5e955d0163a31 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
@@ -2093,7 +2093,7 @@ protected function createContainer(array $data = [])
], $data)));
}
- protected function createContainerFromFile($file, $data = [], $resetCompilerPasses = true, $compile = true, FrameworkExtension $extension = null)
+ protected function createContainerFromFile($file, $data = [], $resetCompilerPasses = true, $compile = true, ?FrameworkExtension $extension = null)
{
$cacheKey = md5(static::class.$file.serialize($data));
if ($compile && isset(self::$containerCache[$cacheKey])) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php
index 4743460e6ee5b..2dc1fac4bf83b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php
@@ -21,7 +21,7 @@ class AutowiredServices
private $dispatcher;
private $cachePool;
- public function __construct(Reader $annotationReader = null, EventDispatcherInterface $dispatcher, CacheItemPoolInterface $cachePool)
+ public function __construct(?Reader $annotationReader, EventDispatcherInterface $dispatcher, CacheItemPoolInterface $cachePool)
{
$this->annotationReader = $annotationReader;
$this->dispatcher = $dispatcher;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php
index f2f077786f2b7..0a01712ca690a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php
@@ -20,7 +20,7 @@ class AnnotatedController
/**
* @Route("/null_request", name="null_request")
*/
- public function requestDefaultNullAction(Request $request = null)
+ public function requestDefaultNullAction(?Request $request = null)
{
return new Response($request ? \get_class($request) : null);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
index 5173f8a8efb51..fba3fea8df641 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Translation/Translator.php
@@ -120,7 +120,7 @@ public function warmUp(string $cacheDir)
return [];
}
- public function addResource(string $format, $resource, string $locale, string $domain = null)
+ public function addResource(string $format, $resource, string $locale, ?string $domain = null)
{
if ($this->resourceFiles) {
$this->addResourceFiles();
diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
index 1ed5129294961..01eea81a38315 100644
--- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
+++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
@@ -46,7 +46,7 @@ class SecurityDataCollector extends DataCollector implements LateDataCollectorIn
private $hasVarDumper;
private $authenticatorManagerEnabled;
- public function __construct(TokenStorageInterface $tokenStorage = null, RoleHierarchyInterface $roleHierarchy = null, LogoutUrlGenerator $logoutUrlGenerator = null, AccessDecisionManagerInterface $accessDecisionManager = null, FirewallMapInterface $firewallMap = null, TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false)
+ public function __construct(?TokenStorageInterface $tokenStorage = null, ?RoleHierarchyInterface $roleHierarchy = null, ?LogoutUrlGenerator $logoutUrlGenerator = null, ?AccessDecisionManagerInterface $accessDecisionManager = null, ?FirewallMapInterface $firewallMap = null, ?TraceableFirewallListener $firewall = null, bool $authenticatorManagerEnabled = false)
{
if (!$authenticatorManagerEnabled) {
trigger_deprecation('symfony/security-bundle', '5.4', 'Setting the $authenticatorManagerEnabled argument of "%s" to "false" is deprecated, use the new authenticator system instead.', __METHOD__);
@@ -65,7 +65,7 @@ public function __construct(TokenStorageInterface $tokenStorage = null, RoleHier
/**
* {@inheritdoc}
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
if (null === $this->tokenStorage) {
$this->data = [
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index c19cae041bd10..41740edf2d4db 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -620,7 +620,7 @@ private function createContextListener(ContainerBuilder $container, string $cont
return $this->contextListeners[$contextKey] = $listenerId;
}
- private function createAuthenticationListeners(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, ?string $defaultProvider, array $providerIds, ?string $defaultEntryPoint, string $contextListenerId = null)
+ private function createAuthenticationListeners(ContainerBuilder $container, string $id, array $firewall, array &$authenticationProviders, ?string $defaultProvider, array $providerIds, ?string $defaultEntryPoint, ?string $contextListenerId = null)
{
$listeners = [];
$hasListeners = false;
@@ -1060,7 +1060,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
return $this->expressions[$id] = new Reference($id);
}
- private function createRequestMatcher(ContainerBuilder $container, string $path = null, string $host = null, int $port = null, array $methods = [], array $ips = null, array $attributes = []): Reference
+ private function createRequestMatcher(ContainerBuilder $container, ?string $path = null, ?string $host = null, ?int $port = null, array $methods = [], ?array $ips = null, array $attributes = []): Reference
{
if ($methods) {
$methods = array_map('strtoupper', $methods);
diff --git a/src/Symfony/Bundle/SecurityBundle/LoginLink/FirewallAwareLoginLinkHandler.php b/src/Symfony/Bundle/SecurityBundle/LoginLink/FirewallAwareLoginLinkHandler.php
index 5c61cfcfabad4..ec9e658cccc77 100644
--- a/src/Symfony/Bundle/SecurityBundle/LoginLink/FirewallAwareLoginLinkHandler.php
+++ b/src/Symfony/Bundle/SecurityBundle/LoginLink/FirewallAwareLoginLinkHandler.php
@@ -38,7 +38,7 @@ public function __construct(FirewallMap $firewallMap, ContainerInterface $loginL
$this->requestStack = $requestStack;
}
- public function createLoginLink(UserInterface $user, Request $request = null): LoginLinkDetails
+ public function createLoginLink(UserInterface $user, ?Request $request = null): LoginLinkDetails
{
return $this->getForFirewall()->createLoginLink($user, $request);
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php
index 4b361ffdba61b..92953024ccca8 100644
--- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php
+++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php
@@ -29,7 +29,7 @@ final class FirewallConfig
private $authenticators;
private $switchUser;
- public function __construct(string $name, string $userChecker, string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, string $provider = null, string $context = null, string $entryPoint = null, string $accessDeniedHandler = null, string $accessDeniedUrl = null, array $authenticators = [], array $switchUser = null)
+ public function __construct(string $name, string $userChecker, ?string $requestMatcher = null, bool $securityEnabled = true, bool $stateless = false, ?string $provider = null, ?string $context = null, ?string $entryPoint = null, ?string $accessDeniedHandler = null, ?string $accessDeniedUrl = null, array $authenticators = [], ?array $switchUser = null)
{
$this->name = $name;
$this->userChecker = $userChecker;
diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php
index 4ebc9c7de0dc7..e7ed2d0bf1ce0 100644
--- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php
+++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallContext.php
@@ -30,7 +30,7 @@ class FirewallContext
/**
* @param iterable $listeners
*/
- public function __construct(iterable $listeners, ExceptionListener $exceptionListener = null, LogoutListener $logoutListener = null, FirewallConfig $config = null)
+ public function __construct(iterable $listeners, ?ExceptionListener $exceptionListener = null, ?LogoutListener $logoutListener = null, ?FirewallConfig $config = null)
{
$this->listeners = $listeners;
$this->exceptionListener = $exceptionListener;
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php
index 126a97020c192..ae706830738f3 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DataCollector/SecurityDataCollectorTest.php
@@ -230,7 +230,7 @@ public function testCollectCollectsDecisionLogWhenStrategyIsAffirmative()
$voter2 = new DummyVoter();
$decoratedVoter1 = new TraceableVoter($voter1, new class() implements EventDispatcherInterface {
- public function dispatch(object $event, string $eventName = null): object
+ public function dispatch(object $event, ?string $eventName = null): object
{
return new \stdClass();
}
@@ -305,7 +305,7 @@ public function testCollectCollectsDecisionLogWhenStrategyIsUnanimous()
$voter2 = new DummyVoter();
$decoratedVoter1 = new TraceableVoter($voter1, new class() implements EventDispatcherInterface {
- public function dispatch(object $event, string $eventName = null): object
+ public function dispatch(object $event, ?string $eventName = null): object
{
return new \stdClass();
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php
index b10b8a810bc7a..d2fb348676bc7 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/RegisterEntryPointsPassTest.php
@@ -93,7 +93,7 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
], JsonResponse::HTTP_FORBIDDEN);
}
- public function start(Request $request, AuthenticationException $authException = null): Response
+ public function start(Request $request, ?AuthenticationException $authException = null): Response
{
}
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php
index c1d38688ecd25..ff3ed7c22ff87 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/AnonymousBundle/AppCustomAuthenticator.php
@@ -46,7 +46,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
{
}
- public function start(Request $request, AuthenticationException $authException = null): Response
+ public function start(Request $request, ?AuthenticationException $authException = null): Response
{
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php
index 56552b99c7983..16a757260cf27 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php
@@ -20,7 +20,7 @@ class EntryPointStub implements AuthenticationEntryPointInterface
{
public const RESPONSE_TEXT = '2be8e651259189d841a19eecdf37e771e2431741';
- public function start(Request $request, AuthenticationException $authException = null): Response
+ public function start(Request $request, ?AuthenticationException $authException = null): Response
{
return new Response(self::RESPONSE_TEXT);
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php
index db6aacca8cfc2..373a16229bbea 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FormLoginBundle/Controller/LoginController.php
@@ -29,7 +29,7 @@ public function __construct(ContainerInterface $container)
$this->container = $container;
}
- public function loginAction(Request $request, UserInterface $user = null)
+ public function loginAction(Request $request, ?UserInterface $user = null)
{
// get the login error if there is one
if ($request->attributes->has(Security::AUTHENTICATION_ERROR)) {
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php
index 43e439ecfa9bf..91d65fc262419 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AppCustomAuthenticator.php
@@ -48,7 +48,7 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token,
{
}
- public function start(Request $request, AuthenticationException $authException = null): Response
+ public function start(Request $request, ?AuthenticationException $authException = null): Response
{
return new Response($authException->getMessage(), Response::HTTP_UNAUTHORIZED);
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AuthenticationController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AuthenticationController.php
index 21a2ea9e4b8f6..973588469da3a 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AuthenticationController.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/GuardedBundle/AuthenticationController.php
@@ -27,7 +27,7 @@ public function manualLoginAction(GuardAuthenticatorHandler $guardAuthenticatorH
return new Response('Logged in.');
}
- public function profileAction(UserInterface $user = null)
+ public function profileAction(?UserInterface $user = null)
{
if (null === $user) {
return new Response('Not logged in.');
diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
index 76faa0107e374..36b05857546de 100644
--- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php
@@ -147,7 +147,7 @@ private function addTwigOptions(ArrayNodeDefinition $rootNode)
->normalizeKeys(false)
->useAttributeAsKey('paths')
->beforeNormalization()
- ->always()
+ ->ifArray()
->then(function ($paths) {
$normalized = [];
foreach ($paths as $path => $namespace) {
diff --git a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php
index 8cc0ffc4df76f..6526ea4d07b80 100644
--- a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php
+++ b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php
@@ -34,7 +34,7 @@ class TemplateIterator implements \IteratorAggregate
* @param array $paths Additional Twig paths to warm
* @param string|null $defaultPath The directory where global templates can be stored
*/
- public function __construct(KernelInterface $kernel, array $paths = [], string $defaultPath = null)
+ public function __construct(KernelInterface $kernel, array $paths = [], ?string $defaultPath = null)
{
$this->kernel = $kernel;
$this->paths = $paths;
@@ -75,7 +75,7 @@ public function getIterator(): \Traversable
*
* @return string[]
*/
- private function findTemplatesInDirectory(string $dir, string $namespace = null, array $excludeDirs = []): array
+ private function findTemplatesInDirectory(string $dir, ?string $namespace = null, array $excludeDirs = []): array
{
if (!is_dir($dir)) {
return [];
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php
index 41627c48041e3..6ed43087579ce 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -52,4 +52,16 @@ public function testArrayKeysInGlobalsAreNotNormalized()
$this->assertSame(['global' => ['value' => ['some-key' => 'some-value']]], $config['globals']);
}
+
+ public function testNullPathsAreConvertedToIterable()
+ {
+ $input = [
+ 'paths' => null,
+ ];
+
+ $processor = new Processor();
+ $config = $processor->processConfiguration(new Configuration(), [$input]);
+
+ $this->assertSame([], $config['paths']);
+ }
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionPanelController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionPanelController.php
index 4941208c88bc2..0eb122314c070 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionPanelController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionPanelController.php
@@ -28,7 +28,7 @@ class ExceptionPanelController
private $errorRenderer;
private $profiler;
- public function __construct(HtmlErrorRenderer $errorRenderer, Profiler $profiler = null)
+ public function __construct(HtmlErrorRenderer $errorRenderer, ?Profiler $profiler = null)
{
$this->errorRenderer = $errorRenderer;
$this->profiler = $profiler;
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
index 2ad7df32928e9..72ed0e07474b8 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
@@ -40,7 +40,7 @@ class ProfilerController
private $cspHandler;
private $baseDir;
- public function __construct(UrlGeneratorInterface $generator, Profiler $profiler = null, Environment $twig, array $templates, ContentSecurityPolicyHandler $cspHandler = null, string $baseDir = null)
+ public function __construct(UrlGeneratorInterface $generator, ?Profiler $profiler, Environment $twig, array $templates, ?ContentSecurityPolicyHandler $cspHandler = null, ?string $baseDir = null)
{
$this->generator = $generator;
$this->profiler = $profiler;
@@ -124,7 +124,7 @@ public function panelAction(Request $request, string $token): Response
*
* @throws NotFoundHttpException
*/
- public function toolbarAction(Request $request, string $token = null): Response
+ public function toolbarAction(Request $request, ?string $token = null): Response
{
if (null === $this->profiler) {
throw new NotFoundHttpException('The profiler must be enabled.');
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
index 50560e0b3ffa1..0de07db823f97 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php
@@ -40,7 +40,7 @@ class RouterController
*/
private $expressionLanguageProviders = [];
- public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = [])
+ public function __construct(?Profiler $profiler, Environment $twig, ?UrlMatcherInterface $matcher = null, ?RouteCollection $routes = null, iterable $expressionLanguageProviders = [])
{
$this->profiler = $profiler;
$this->twig = $twig;
diff --git a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
index e703cf98c79f4..574e5f79c013d 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php
@@ -48,7 +48,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface
private $cspHandler;
private $dumpDataCollector;
- public function __construct(Environment $twig, bool $interceptRedirects = false, int $mode = self::ENABLED, UrlGeneratorInterface $urlGenerator = null, string $excludedAjaxPaths = '^/bundles|^/_wdt', ContentSecurityPolicyHandler $cspHandler = null, DumpDataCollector $dumpDataCollector = null)
+ public function __construct(Environment $twig, bool $interceptRedirects = false, int $mode = self::ENABLED, ?UrlGeneratorInterface $urlGenerator = null, string $excludedAjaxPaths = '^/bundles|^/_wdt', ?ContentSecurityPolicyHandler $cspHandler = null, ?DumpDataCollector $dumpDataCollector = null)
{
$this->twig = $twig;
$this->urlGenerator = $urlGenerator;
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php
index 039af91035c29..2a4e975760426 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php
@@ -43,7 +43,7 @@ class WebProfilerExtension extends ProfilerExtension
*/
private $stackLevel = 0;
- public function __construct(HtmlDumper $dumper = null)
+ public function __construct(?HtmlDumper $dumper = null)
{
$this->dumper = $dumper ?? new HtmlDumper();
$this->dumper->setOutput($this->output = fopen('php://memory', 'r+'));
@@ -83,7 +83,7 @@ public function dumpData(Environment $env, Data $data, int $maxDepth = 0)
return str_replace("\n$1"', $message);
diff --git a/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php b/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php
index f60ad306377af..d066ccd451ea1 100644
--- a/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php
+++ b/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php
@@ -24,7 +24,7 @@ class AssetNotFoundException extends RuntimeException
* @param int $code Exception code
* @param \Throwable $previous Previous exception used for the exception chaining
*/
- public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
+ public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
diff --git a/src/Symfony/Component/Asset/Package.php b/src/Symfony/Component/Asset/Package.php
index a74e33449f8ed..ccd6707e15d22 100644
--- a/src/Symfony/Component/Asset/Package.php
+++ b/src/Symfony/Component/Asset/Package.php
@@ -26,7 +26,7 @@ class Package implements PackageInterface
private $versionStrategy;
private $context;
- public function __construct(VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
+ public function __construct(VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null)
{
$this->versionStrategy = $versionStrategy;
$this->context = $context ?? new NullContext();
diff --git a/src/Symfony/Component/Asset/Packages.php b/src/Symfony/Component/Asset/Packages.php
index 4d1540e1ebcd0..7673432ee8709 100644
--- a/src/Symfony/Component/Asset/Packages.php
+++ b/src/Symfony/Component/Asset/Packages.php
@@ -28,7 +28,7 @@ class Packages
/**
* @param PackageInterface[] $packages Additional packages indexed by name
*/
- public function __construct(PackageInterface $defaultPackage = null, iterable $packages = [])
+ public function __construct(?PackageInterface $defaultPackage = null, iterable $packages = [])
{
$this->defaultPackage = $defaultPackage;
@@ -57,7 +57,7 @@ public function addPackage(string $name, PackageInterface $package)
* @throws InvalidArgumentException If there is no package by that name
* @throws LogicException If no default package is defined
*/
- public function getPackage(string $name = null)
+ public function getPackage(?string $name = null)
{
if (null === $name) {
if (null === $this->defaultPackage) {
@@ -82,7 +82,7 @@ public function getPackage(string $name = null)
*
* @return string
*/
- public function getVersion(string $path, string $packageName = null)
+ public function getVersion(string $path, ?string $packageName = null)
{
return $this->getPackage($packageName)->getVersion($path);
}
@@ -97,7 +97,7 @@ public function getVersion(string $path, string $packageName = null)
*
* @return string A public path which takes into account the base path and URL path
*/
- public function getUrl(string $path, string $packageName = null)
+ public function getUrl(string $path, ?string $packageName = null)
{
return $this->getPackage($packageName)->getUrl($path);
}
diff --git a/src/Symfony/Component/Asset/PathPackage.php b/src/Symfony/Component/Asset/PathPackage.php
index 3c7c0bfcfc3bb..68dcb88b89bd8 100644
--- a/src/Symfony/Component/Asset/PathPackage.php
+++ b/src/Symfony/Component/Asset/PathPackage.php
@@ -31,7 +31,7 @@ class PathPackage extends Package
/**
* @param string $basePath The base path to be prepended to relative paths
*/
- public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
+ public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null)
{
parent::__construct($versionStrategy, $context);
diff --git a/src/Symfony/Component/Asset/UrlPackage.php b/src/Symfony/Component/Asset/UrlPackage.php
index 9928bb217e89c..9b842224a4b7f 100644
--- a/src/Symfony/Component/Asset/UrlPackage.php
+++ b/src/Symfony/Component/Asset/UrlPackage.php
@@ -41,7 +41,7 @@ class UrlPackage extends Package
/**
* @param string|string[] $baseUrls Base asset URLs
*/
- public function __construct($baseUrls, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
+ public function __construct($baseUrls, VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null)
{
parent::__construct($versionStrategy, $context);
diff --git a/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php b/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
index ee7c9ebf2f36c..650d02d568773 100644
--- a/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
+++ b/src/Symfony/Component/Asset/VersionStrategy/JsonManifestVersionStrategy.php
@@ -40,7 +40,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
* @param string $manifestPath Absolute path to the manifest file
* @param bool $strictMode Throws an exception for unknown paths
*/
- public function __construct(string $manifestPath, HttpClientInterface $httpClient = null, $strictMode = false)
+ public function __construct(string $manifestPath, ?HttpClientInterface $httpClient = null, $strictMode = false)
{
$this->manifestPath = $manifestPath;
$this->httpClient = $httpClient;
diff --git a/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php b/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php
index 1d2fb6fe6774d..9e6e9ce8bae4e 100644
--- a/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php
+++ b/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php
@@ -25,7 +25,7 @@ class StaticVersionStrategy implements VersionStrategyInterface
* @param string $version Version number
* @param string $format Url format
*/
- public function __construct(string $version, string $format = null)
+ public function __construct(string $version, ?string $format = null)
{
$this->version = $version;
$this->format = $format ?: '%s?%s';
diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php
index 56792e70d48ff..785a21626435a 100644
--- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php
+++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php
@@ -50,7 +50,7 @@ abstract class AbstractBrowser
/**
* @param array $server The server parameters (equivalent of $_SERVER)
*/
- public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
+ public function __construct(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
$this->setServerParameters($server);
$this->history = $history ?? new History();
@@ -146,7 +146,7 @@ public function getServerParameter(string $key, $default = '')
return $this->server[$key] ?? $default;
}
- public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true): Crawler
+ public function xmlHttpRequest(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], ?string $content = null, bool $changeHistory = true): Crawler
{
$this->setServerParameter('HTTP_X_REQUESTED_WITH', 'XMLHttpRequest');
@@ -352,7 +352,7 @@ public function submitForm(string $button, array $fieldValues = [], string $meth
*
* @return Crawler
*/
- public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], string $content = null, bool $changeHistory = true)
+ public function request(string $method, string $uri, array $parameters = [], array $files = [], array $server = [], ?string $content = null, bool $changeHistory = true)
{
if ($this->isMainRequest) {
$this->redirectCount = 0;
diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php
index d4be13197543d..bbec9477409a9 100644
--- a/src/Symfony/Component/BrowserKit/Cookie.php
+++ b/src/Symfony/Component/BrowserKit/Cookie.php
@@ -55,7 +55,7 @@ class Cookie
* @param bool $encodedValue Whether the value is encoded or not
* @param string|null $samesite The cookie samesite attribute
*/
- public function __construct(string $name, ?string $value, string $expires = null, string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false, string $samesite = null)
+ public function __construct(string $name, ?string $value, ?string $expires = null, ?string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false, ?string $samesite = null)
{
if ($encodedValue) {
$this->value = urldecode($value);
@@ -125,7 +125,7 @@ public function __toString()
*
* @throws \InvalidArgumentException
*/
- public static function fromString(string $cookie, string $url = null)
+ public static function fromString(string $cookie, ?string $url = null)
{
$parts = explode(';', $cookie);
diff --git a/src/Symfony/Component/BrowserKit/CookieJar.php b/src/Symfony/Component/BrowserKit/CookieJar.php
index 2185cd2f89bf9..ced9878550a68 100644
--- a/src/Symfony/Component/BrowserKit/CookieJar.php
+++ b/src/Symfony/Component/BrowserKit/CookieJar.php
@@ -35,7 +35,7 @@ public function set(Cookie $cookie)
*
* @return Cookie|null
*/
- public function get(string $name, string $path = '/', string $domain = null)
+ public function get(string $name, string $path = '/', ?string $domain = null)
{
$this->flushExpiredCookies();
@@ -67,7 +67,7 @@ public function get(string $name, string $path = '/', string $domain = null)
* all cookies for the given name/path expire (this behavior
* ensures a BC behavior with previous versions of Symfony).
*/
- public function expire(string $name, ?string $path = '/', string $domain = null)
+ public function expire(string $name, ?string $path = '/', ?string $domain = null)
{
if (null === $path) {
$path = '/';
@@ -107,7 +107,7 @@ public function clear()
*
* @param string[] $setCookies Set-Cookie headers from an HTTP response
*/
- public function updateFromSetCookie(array $setCookies, string $uri = null)
+ public function updateFromSetCookie(array $setCookies, ?string $uri = null)
{
$cookies = [];
@@ -133,7 +133,7 @@ public function updateFromSetCookie(array $setCookies, string $uri = null)
/**
* Updates the cookie jar from a Response object.
*/
- public function updateFromResponse(Response $response, string $uri = null)
+ public function updateFromResponse(Response $response, ?string $uri = null)
{
$this->updateFromSetCookie($response->getHeader('Set-Cookie', false), $uri);
}
diff --git a/src/Symfony/Component/BrowserKit/HttpBrowser.php b/src/Symfony/Component/BrowserKit/HttpBrowser.php
index d46060574858c..c1a0fdcbba2e7 100644
--- a/src/Symfony/Component/BrowserKit/HttpBrowser.php
+++ b/src/Symfony/Component/BrowserKit/HttpBrowser.php
@@ -28,7 +28,7 @@ class HttpBrowser extends AbstractBrowser
{
private $client;
- public function __construct(HttpClientInterface $client = null, History $history = null, CookieJar $cookieJar = null)
+ public function __construct(?HttpClientInterface $client = null, ?History $history = null, ?CookieJar $cookieJar = null)
{
if (!$client && !class_exists(HttpClient::class)) {
throw new \LogicException(sprintf('You cannot use "%s" as the HttpClient component is not installed. Try running "composer require symfony/http-client".', __CLASS__));
diff --git a/src/Symfony/Component/BrowserKit/Request.php b/src/Symfony/Component/BrowserKit/Request.php
index a8a4f501436c1..9ab1afd99e705 100644
--- a/src/Symfony/Component/BrowserKit/Request.php
+++ b/src/Symfony/Component/BrowserKit/Request.php
@@ -33,7 +33,7 @@ class Request
* @param array $server An array of server parameters
* @param string $content The raw body data
*/
- public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], string $content = null)
+ public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], ?string $content = null)
{
$this->uri = $uri;
$this->method = $method;
diff --git a/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserCookieValueSame.php b/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserCookieValueSame.php
index f3103242c2109..d69d0f65113b2 100644
--- a/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserCookieValueSame.php
+++ b/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserCookieValueSame.php
@@ -22,7 +22,7 @@ final class BrowserCookieValueSame extends Constraint
private $path;
private $domain;
- public function __construct(string $name, string $value, bool $raw = false, string $path = '/', string $domain = null)
+ public function __construct(string $name, string $value, bool $raw = false, string $path = '/', ?string $domain = null)
{
$this->name = $name;
$this->path = $path;
diff --git a/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHasCookie.php b/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHasCookie.php
index 2b84a5e9b9bd7..e95a54c1514d5 100644
--- a/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHasCookie.php
+++ b/src/Symfony/Component/BrowserKit/Test/Constraint/BrowserHasCookie.php
@@ -20,7 +20,7 @@ final class BrowserHasCookie extends Constraint
private $path;
private $domain;
- public function __construct(string $name, string $path = '/', string $domain = null)
+ public function __construct(string $name, string $path = '/', ?string $domain = null)
{
$this->name = $name;
$this->path = $path;
diff --git a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
index c732238a7f126..1f0bb530497da 100644
--- a/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php
@@ -20,7 +20,7 @@
class AbstractBrowserTest extends TestCase
{
- public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null)
+ public function getBrowser(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
return new TestClient($server, $history, $cookieJar);
}
diff --git a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
index 44f61289d8d6a..e1f19b16ce814 100644
--- a/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
+++ b/src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
@@ -19,7 +19,7 @@
class HttpBrowserTest extends AbstractBrowserTest
{
- public function getBrowser(array $server = [], History $history = null, CookieJar $cookieJar = null)
+ public function getBrowser(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
return new TestHttpClient($server, $history, $cookieJar);
}
diff --git a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php
index 184418b7b4477..6e8b523512b2c 100644
--- a/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php
+++ b/src/Symfony/Component/BrowserKit/Tests/TestHttpClient.php
@@ -23,7 +23,7 @@ class TestHttpClient extends HttpBrowser
protected $nextResponse = null;
protected $nextScript = null;
- public function __construct(array $server = [], History $history = null, CookieJar $cookieJar = null)
+ public function __construct(array $server = [], ?History $history = null, ?CookieJar $cookieJar = null)
{
$client = new MockHttpClient(function (string $method, string $url, array $options) {
if (null === $this->nextResponse) {
diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
index df900555bb515..de5af179320d2 100644
--- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php
@@ -101,7 +101,7 @@ static function ($deferred, $namespace, &$expiredIds, $getId, $defaultLifetime)
*
* @return AdapterInterface
*/
- public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, LoggerInterface $logger = null)
+ public static function createSystemCache(string $namespace, int $defaultLifetime, string $version, string $directory, ?LoggerInterface $logger = null)
{
$opcache = new PhpFilesAdapter($namespace, $defaultLifetime, $directory, true);
if (null !== $logger) {
diff --git a/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php b/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php
index 270a139e83a48..639e3144107ed 100644
--- a/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ApcuAdapter.php
@@ -25,7 +25,7 @@ class ApcuAdapter extends AbstractAdapter
/**
* @throws CacheException if APCu is not enabled
*/
- public function __construct(string $namespace = '', int $defaultLifetime = 0, string $version = null, MarshallerInterface $marshaller = null)
+ public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $version = null, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('APCu is not enabled.');
diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
index d8695b743dae2..b251814eb28e5 100644
--- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php
@@ -73,7 +73,7 @@ static function ($key, $value, $isHit) {
/**
* {@inheritdoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
$item = $this->getItem($key);
$metadata = $item->getMetadata();
diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
index 059c0ed275da7..7d95528363233 100644
--- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php
@@ -92,7 +92,7 @@ static function ($sourceItem, $item, $defaultLifetime, $sourceMetadata = null) {
/**
* {@inheritdoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
$doSave = true;
$callback = static function (CacheItem $item, bool &$save) use ($callback, &$doSave) {
@@ -104,7 +104,7 @@ public function get(string $key, callable $callback, float $beta = null, array &
$lastItem = null;
$i = 0;
- $wrap = function (CacheItem $item = null, bool &$save = true) use ($key, $callback, $beta, &$wrap, &$i, &$doSave, &$lastItem, &$metadata) {
+ $wrap = function (?CacheItem $item = null, bool &$save = true) use ($key, $callback, $beta, &$wrap, &$i, &$doSave, &$lastItem, &$metadata) {
$adapter = $this->adapters[$i];
if (isset($this->adapters[++$i])) {
$callback = $wrap;
diff --git a/src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php b/src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php
index fa5f85ad24558..84ab281438b65 100644
--- a/src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php
@@ -39,7 +39,7 @@ class CouchbaseBucketAdapter extends AbstractAdapter
private $bucket;
private $marshaller;
- public function __construct(\CouchbaseBucket $bucket, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
+ public function __construct(\CouchbaseBucket $bucket, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Couchbase >= 2.6.0 < 3.0.0 is required.');
diff --git a/src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php b/src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php
index 1c4f9180b0ac6..c0a1317d23d1d 100644
--- a/src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/CouchbaseCollectionAdapter.php
@@ -33,7 +33,7 @@ class CouchbaseCollectionAdapter extends AbstractAdapter
private $connection;
private $marshaller;
- public function __construct(Collection $connection, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
+ public function __construct(Collection $connection, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Couchbase >= 3.0.0 < 4.0.0 is required.');
diff --git a/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php b/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php
index d0ff0e55eb377..c126824138639 100644
--- a/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php
@@ -61,7 +61,7 @@ class DoctrineDbalAdapter extends AbstractAdapter implements PruneableInterface
*
* @throws InvalidArgumentException When namespace contains invalid characters
*/
- public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null)
+ public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], ?MarshallerInterface $marshaller = null)
{
if (isset($namespace[0]) && preg_match('#[^-+.A-Za-z0-9]#', $namespace, $match)) {
throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+.A-Za-z0-9] are allowed.', $match[0]));
diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php b/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php
index 7185dd4877e42..13daa568c7cdd 100644
--- a/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/FilesystemAdapter.php
@@ -20,7 +20,7 @@ class FilesystemAdapter extends AbstractAdapter implements PruneableInterface
{
use FilesystemTrait;
- public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, MarshallerInterface $marshaller = null)
+ public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null)
{
$this->marshaller = $marshaller ?? new DefaultMarshaller();
parent::__construct('', $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php
index afde84375fea9..440a37af5ede1 100644
--- a/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/FilesystemTagAwareAdapter.php
@@ -34,7 +34,7 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
*/
private const TAG_FOLDER = 'tags';
- public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, MarshallerInterface $marshaller = null)
+ public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, ?MarshallerInterface $marshaller = null)
{
$this->marshaller = new TagAwareMarshaller($marshaller);
parent::__construct('', $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php
index 2f953aa79b62e..0bc20d4b7f841 100644
--- a/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php
@@ -46,7 +46,7 @@ class MemcachedAdapter extends AbstractAdapter
*
* Using a MemcachedAdapter as a pure items store is fine.
*/
- public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
+ public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if (!static::isSupported()) {
throw new CacheException('Memcached '.(\PHP_VERSION_ID >= 80100 ? '> 3.1.5' : '>= 2.2.0').' is required.');
@@ -114,6 +114,8 @@ public static function createConnection($servers, array $options = [])
$params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
if (!empty($m[2])) {
[$username, $password] = explode(':', $m[2], 2) + [1 => null];
+ $username = rawurldecode($username);
+ $password = null !== $password ? rawurldecode($password) : null;
}
return 'file:'.($m[1] ?? '');
diff --git a/src/Symfony/Component/Cache/Adapter/NullAdapter.php b/src/Symfony/Component/Cache/Adapter/NullAdapter.php
index 15f7f8c455a16..bf5382ffdb182 100644
--- a/src/Symfony/Component/Cache/Adapter/NullAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/NullAdapter.php
@@ -40,7 +40,7 @@ static function ($key) {
/**
* {@inheritdoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
$save = true;
diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php
index ba0aaa15853bf..52c139c3dfc29 100644
--- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php
@@ -62,7 +62,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
* @throws InvalidArgumentException When PDO error mode is not PDO::ERRMODE_EXCEPTION
* @throws InvalidArgumentException When namespace contains invalid characters
*/
- public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], MarshallerInterface $marshaller = null)
+ public function __construct($connOrDsn, string $namespace = '', int $defaultLifetime = 0, array $options = [], ?MarshallerInterface $marshaller = null)
{
if ($connOrDsn instanceof Connection || (\is_string($connOrDsn) && str_contains($connOrDsn, '://'))) {
trigger_deprecation('symfony/cache', '5.4', 'Usage of a DBAL Connection with "%s" is deprecated and will be removed in symfony 6.0. Use "%s" instead.', __CLASS__, DoctrineDbalAdapter::class);
@@ -176,7 +176,7 @@ public function clear(string $prefix = '')
/**
* {@inheritDoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
if (isset($this->dbalAdapter)) {
return $this->dbalAdapter->get($key, $callback, $beta, $metadata);
diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
index 8c8fb916415ce..43e000a999d28 100644
--- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php
@@ -83,7 +83,7 @@ public static function create(string $file, CacheItemPoolInterface $fallbackPool
/**
* {@inheritdoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
if (null === $this->values) {
$this->initialize();
diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php
index d47c4053011cd..8dcd79cd98a90 100644
--- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php
@@ -43,7 +43,7 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
*
* @throws CacheException if OPcache is not enabled
*/
- public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, bool $appendOnly = false)
+ public function __construct(string $namespace = '', int $defaultLifetime = 0, ?string $directory = null, bool $appendOnly = false)
{
$this->appendOnly = $appendOnly;
self::$startTime = self::$startTime ?? $_SERVER['REQUEST_TIME'] ?? time();
diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
index c715cade5c1f0..317018e59739b 100644
--- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php
@@ -102,7 +102,7 @@ static function (CacheItemInterface $innerItem, array $item) {
/**
* {@inheritdoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
if (!$this->pool instanceof CacheInterface) {
return $this->doGet($this, $key, $callback, $beta, $metadata);
diff --git a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php
index eb5950e531677..86714ae43726c 100644
--- a/src/Symfony/Component/Cache/Adapter/RedisAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/RedisAdapter.php
@@ -25,7 +25,7 @@ class RedisAdapter extends AbstractAdapter
* @param string $namespace The default namespace
* @param int $defaultLifetime The default lifetime
*/
- public function __construct($redis, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
+ public function __construct($redis, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
$this->init($redis, $namespace, $defaultLifetime, $marshaller);
}
diff --git a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
index 186b32e70d103..958486e0f0703 100644
--- a/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
@@ -66,7 +66,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
* @param string $namespace The default namespace
* @param int $defaultLifetime The default lifetime
*/
- public function __construct($redis, string $namespace = '', int $defaultLifetime = 0, MarshallerInterface $marshaller = null)
+ public function __construct($redis, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null)
{
if ($redis instanceof \Predis\ClientInterface && $redis->getConnection() instanceof ClusterInterface && !$redis->getConnection() instanceof PredisCluster) {
throw new InvalidArgumentException(sprintf('Unsupported Predis cluster connection: only "%s" is, "%s" given.', PredisCluster::class, get_debug_type($redis->getConnection())));
diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
index ff22e5a8ac56e..fb59599eb02cf 100644
--- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php
@@ -43,7 +43,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac
private static $getTagsByKey;
private static $saveTags;
- public function __construct(AdapterInterface $itemsPool, AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15)
+ public function __construct(AdapterInterface $itemsPool, ?AdapterInterface $tagsPool = null, float $knownTagVersionsTtl = 0.15)
{
$this->pool = $itemsPool;
$this->tags = $tagsPool ?: $itemsPool;
diff --git a/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php b/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php
index 4b06557f8502a..06951db265f7e 100644
--- a/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php
@@ -38,7 +38,7 @@ public function __construct(AdapterInterface $pool)
/**
* {@inheritdoc}
*/
- public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
+ public function get(string $key, callable $callback, ?float $beta = null, ?array &$metadata = null)
{
if (!$this->pool instanceof CacheInterface) {
throw new \BadMethodCallException(sprintf('Cannot call "%s::get()": this class doesn\'t implement "%s".', get_debug_type($this->pool), CacheInterface::class));
diff --git a/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php b/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php
index e121596e83841..047958099335b 100644
--- a/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php
+++ b/src/Symfony/Component/Cache/DataCollector/CacheDataCollector.php
@@ -39,7 +39,7 @@ public function addInstance(string $name, TraceableAdapter $instance)
/**
* {@inheritdoc}
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
$empty = ['calls' => [], 'config' => [], 'options' => [], 'statistics' => []];
$this->data = ['instances' => $empty, 'total' => $empty];
diff --git a/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php b/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
index 14ac2bde48f04..ee539af7730be 100644
--- a/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
+++ b/src/Symfony/Component/Cache/DependencyInjection/CachePoolPass.php
@@ -209,10 +209,10 @@ public function process(ContainerBuilder $container)
}
$notAliasedCacheClearerId = $this->cacheClearerId;
- while ($container->hasAlias($this->cacheClearerId)) {
- $this->cacheClearerId = (string) $container->getAlias($this->cacheClearerId);
+ while ($container->hasAlias($notAliasedCacheClearerId)) {
+ $notAliasedCacheClearerId = (string) $container->getAlias($notAliasedCacheClearerId);
}
- if ($container->hasDefinition($this->cacheClearerId)) {
+ if ($container->hasDefinition($notAliasedCacheClearerId)) {
$clearers[$notAliasedCacheClearerId] = $allPools;
}
diff --git a/src/Symfony/Component/Cache/LockRegistry.php b/src/Symfony/Component/Cache/LockRegistry.php
index 65f20bb7328e8..d0c5fc5ba54f6 100644
--- a/src/Symfony/Component/Cache/LockRegistry.php
+++ b/src/Symfony/Component/Cache/LockRegistry.php
@@ -84,7 +84,7 @@ public static function setFiles(array $files): array
return $previousFiles;
}
- public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, \Closure $setMetadata = null, LoggerInterface $logger = null)
+ public static function compute(callable $callback, ItemInterface $item, bool &$save, CacheInterface $pool, ?\Closure $setMetadata = null, ?LoggerInterface $logger = null)
{
if ('\\' === \DIRECTORY_SEPARATOR && null === self::$lockedFiles) {
// disable locking on Windows by default
diff --git a/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php b/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php
index 3202dd69cdab7..43f7e7e2ace11 100644
--- a/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php
+++ b/src/Symfony/Component/Cache/Marshaller/DefaultMarshaller.php
@@ -23,7 +23,7 @@ class DefaultMarshaller implements MarshallerInterface
private $useIgbinarySerialize = true;
private $throwOnSerializationFailure;
- public function __construct(bool $useIgbinarySerialize = null, bool $throwOnSerializationFailure = false)
+ public function __construct(?bool $useIgbinarySerialize = null, bool $throwOnSerializationFailure = false)
{
if (null === $useIgbinarySerialize) {
$useIgbinarySerialize = \extension_loaded('igbinary') && (\PHP_VERSION_ID < 70400 || version_compare('3.1.6', phpversion('igbinary'), '<='));
diff --git a/src/Symfony/Component/Cache/Marshaller/SodiumMarshaller.php b/src/Symfony/Component/Cache/Marshaller/SodiumMarshaller.php
index dbf486a721e47..7895ef557ebe6 100644
--- a/src/Symfony/Component/Cache/Marshaller/SodiumMarshaller.php
+++ b/src/Symfony/Component/Cache/Marshaller/SodiumMarshaller.php
@@ -29,7 +29,7 @@ class SodiumMarshaller implements MarshallerInterface
* more rotating keys can be provided to decrypt values;
* each key must be generated using sodium_crypto_box_keypair()
*/
- public function __construct(array $decryptionKeys, MarshallerInterface $marshaller = null)
+ public function __construct(array $decryptionKeys, ?MarshallerInterface $marshaller = null)
{
if (!self::isSupported()) {
throw new CacheException('The "sodium" PHP extension is not loaded.');
diff --git a/src/Symfony/Component/Cache/Marshaller/TagAwareMarshaller.php b/src/Symfony/Component/Cache/Marshaller/TagAwareMarshaller.php
index f7eeb7837678f..f2f26abcf93b3 100644
--- a/src/Symfony/Component/Cache/Marshaller/TagAwareMarshaller.php
+++ b/src/Symfony/Component/Cache/Marshaller/TagAwareMarshaller.php
@@ -20,7 +20,7 @@ class TagAwareMarshaller implements MarshallerInterface
{
private $marshaller;
- public function __construct(MarshallerInterface $marshaller = null)
+ public function __construct(?MarshallerInterface $marshaller = null)
{
$this->marshaller = $marshaller ?? new DefaultMarshaller();
}
diff --git a/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php b/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php
index 6f11b8b5a2078..e09e2826f30a2 100644
--- a/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php
+++ b/src/Symfony/Component/Cache/Messenger/EarlyExpirationDispatcher.php
@@ -27,14 +27,14 @@ class EarlyExpirationDispatcher
private $reverseContainer;
private $callbackWrapper;
- public function __construct(MessageBusInterface $bus, ReverseContainer $reverseContainer, callable $callbackWrapper = null)
+ public function __construct(MessageBusInterface $bus, ReverseContainer $reverseContainer, ?callable $callbackWrapper = null)
{
$this->bus = $bus;
$this->reverseContainer = $reverseContainer;
$this->callbackWrapper = $callbackWrapper;
}
- public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, LoggerInterface $logger = null)
+ public function __invoke(callable $callback, CacheItem $item, bool &$save, AdapterInterface $pool, \Closure $setMetadata, ?LoggerInterface $logger = null)
{
if (!$item->isHit() || null === $message = EarlyExpirationMessage::create($this->reverseContainer, $callback, $item, $pool)) {
// The item is stale or the callback cannot be reversed: we must compute the value now
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTestCase.php
index 10382178c8375..65104981fa33a 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AbstractRedisAdapterTestCase.php
@@ -25,7 +25,7 @@ abstract class AbstractRedisAdapterTestCase extends AdapterTestCase
protected static $redis;
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
return new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
}
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
index 65700581931ae..91b648fd718ec 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
@@ -236,7 +236,7 @@ public function testPrune()
/** @var PruneableInterface|CacheItemPoolInterface $cache */
$cache = $this->createCachePool();
- $doSet = function ($name, $value, \DateInterval $expiresAfter = null) use ($cache) {
+ $doSet = function ($name, $value, ?\DateInterval $expiresAfter = null) use ($cache) {
$item = $cache->getItem($name);
$item->set($value);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
index c6772f9f5a8f9..0106b9b414f9c 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ChainAdapterTest.php
@@ -30,7 +30,7 @@
*/
class ChainAdapterTest extends AdapterTestCase
{
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testGetMetadata' === $testMethod) {
return new ChainAdapter([new FilesystemAdapter('a', $defaultLifetime), new FilesystemAdapter('b', $defaultLifetime)], $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php
index 63a567a069e08..acdb30435e437 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/DoctrineDbalAdapterTest.php
@@ -106,7 +106,7 @@ public function testConfigureSchemaTableExists()
/**
* @dataProvider provideDsnWithSQLite
*/
- public function testDsnWithSQLite(string $dsn, string $file = null)
+ public function testDsnWithSQLite(string $dsn, ?string $file = null)
{
try {
$pool = new DoctrineDbalAdapter($dsn);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
index 180ce6f3d0dab..e93316255c642 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php
@@ -44,7 +44,7 @@ public static function setUpBeforeClass(): void
}
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null, string $namespace = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null, ?string $namespace = null): CacheItemPoolInterface
{
$client = $defaultLifetime ? AbstractAdapter::createConnection('memcached://'.getenv('MEMCACHED_HOST')) : self::$client;
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php
index a4edc7a608db5..4e6ebede0a596 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/NamespacedProxyAdapterTest.php
@@ -21,7 +21,7 @@
*/
class NamespacedProxyAdapterTest extends ProxyAdapterTest
{
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testGetMetadata' === $testMethod) {
return new ProxyAdapter(new FilesystemAdapter(), 'foo', $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
index b630e9eebea3a..5120d81c707e0 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoAdapterTest.php
@@ -70,7 +70,7 @@ public function testCleanupExpiredItems()
/**
* @dataProvider provideDsnSQLite
*/
- public function testDsnWithSQLite(string $dsn, string $file = null)
+ public function testDsnWithSQLite(string $dsn, ?string $file = null)
{
try {
$pool = new PdoAdapter($dsn);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
index 1ed86b06c8e91..29f210f8aafaa 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php
@@ -121,7 +121,7 @@ public function testConfigureSchemaTableExists()
/**
* @dataProvider provideDsn
*/
- public function testDsn(string $dsn, string $file = null)
+ public function testDsn(string $dsn, ?string $file = null)
{
$this->expectDeprecation('Since symfony/cache 5.4: Usage of a DBAL Connection with "Symfony\Component\Cache\Adapter\PdoAdapter" is deprecated and will be removed in symfony 6.0. Use "Symfony\Component\Cache\Adapter\DoctrineDbalAdapter" instead.');
try {
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
index 83e230e8c22a6..541681df291c2 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PhpArrayAdapterTest.php
@@ -75,7 +75,7 @@ protected function tearDown(): void
}
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testGetMetadata' === $testMethod || 'testClearPrefix' === $testMethod) {
return new PhpArrayAdapter(self::$file, new FilesystemAdapter());
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php
index 0971f80c553e5..0468e89449729 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareAdapterTest.php
@@ -27,7 +27,7 @@ protected function setUp(): void
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
$this->assertInstanceOf(\Predis\Client::class, self::$redis);
$adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php
index af25b2df52c45..3a118dc17147e 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/PredisTagAwareClusterAdapterTest.php
@@ -27,7 +27,7 @@ protected function setUp(): void
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
$this->assertInstanceOf(\Predis\Client::class, self::$redis);
$adapter = new RedisTagAwareAdapter(self::$redis, str_replace('\\', '.', __CLASS__), $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterAndRedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterAndRedisAdapterTest.php
index 1f800e19d1cdf..4bff8c33909d7 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterAndRedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterAndRedisAdapterTest.php
@@ -32,7 +32,7 @@ public static function setUpBeforeClass(): void
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'));
}
- public function createCachePool($defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool($defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
return new ProxyAdapter(new RedisAdapter(self::$redis, str_replace('\\', '.', __CLASS__), 100), 'ProxyNS', $defaultLifetime);
}
@@ -66,6 +66,7 @@ static function (CacheItem $item, $expiry) {
$this->assertSame($value, $this->cache->getItem('baz')->get());
sleep(1);
+ usleep(100000);
$this->assertSame($value, $this->cache->getItem('foo')->get());
$this->assertSame($value, $this->cache->getItem('bar')->get());
$this->assertFalse($this->cache->getItem('baz')->isHit());
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
index 378efa7b759f9..387542bb1a631 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php
@@ -29,7 +29,7 @@ class ProxyAdapterTest extends AdapterTestCase
'testPrune' => 'ProxyAdapter just proxies',
];
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testGetMetadata' === $testMethod) {
return new ProxyAdapter(new FilesystemAdapter(), '', $defaultLifetime);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
index 71fa5b0a6d568..b57f6ce1b0bcf 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php
@@ -28,7 +28,7 @@ public static function setUpBeforeClass(): void
self::$redis = AbstractAdapter::createConnection('redis://'.getenv('REDIS_HOST'), ['lazy' => true]);
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
index cdfa4f43e1a5a..aa550d705a2c6 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisClusterAdapterTest.php
@@ -36,7 +36,7 @@ public static function setUpBeforeClass(): void
self::$redis->setOption(\Redis::OPT_PREFIX, 'prefix_');
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php
index 12e3b6ff55365..f00eb9de8aaeb 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareAdapterTest.php
@@ -28,7 +28,7 @@ protected function setUp(): void
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php
index b5823711dc858..860709bf7f2cb 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareArrayAdapterTest.php
@@ -27,7 +27,7 @@ protected function setUp(): void
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php
index d4a1bc97779ca..c7d143d3a35db 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/RedisTagAwareClusterAdapterTest.php
@@ -28,7 +28,7 @@ protected function setUp(): void
$this->skippedTests['testTagItemExpiry'] = 'Testing expiration slows down the test suite';
}
- public function createCachePool(int $defaultLifetime = 0, string $testMethod = null): CacheItemPoolInterface
+ public function createCachePool(int $defaultLifetime = 0, ?string $testMethod = null): CacheItemPoolInterface
{
if ('testClearWithPrefix' === $testMethod && \defined('Redis::SCAN_PREFIX')) {
self::$redis->setOption(\Redis::OPT_SCAN, \Redis::SCAN_PREFIX);
diff --git a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php
index 39350274aea33..401abac24f628 100644
--- a/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php
+++ b/src/Symfony/Component/Cache/Tests/DependencyInjection/CachePoolPassTest.php
@@ -20,8 +20,10 @@
use Symfony\Component\Cache\DependencyInjection\CachePoolPass;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
class CachePoolPassTest extends TestCase
{
@@ -232,4 +234,33 @@ public function testChainAdapterPool()
$this->assertInstanceOf(ChildDefinition::class, $doctrineCachePool);
$this->assertSame('cache.app', $doctrineCachePool->getParent());
}
+
+ public function testGlobalClearerAlias()
+ {
+ $container = new ContainerBuilder();
+ $container->setParameter('kernel.container_class', 'app');
+ $container->setParameter('kernel.project_dir', 'foo');
+
+ $container->register('cache.default_clearer', Psr6CacheClearer::class);
+
+ $container->setDefinition('cache.system_clearer', new ChildDefinition('cache.default_clearer'));
+
+ $container->setDefinition('cache.foo_bar_clearer', new ChildDefinition('cache.default_clearer'));
+ $container->setAlias('cache.global_clearer', 'cache.foo_bar_clearer');
+
+ $container->register('cache.adapter.array', ArrayAdapter::class)
+ ->setAbstract(true)
+ ->addTag('cache.pool');
+
+ $cachePool = new ChildDefinition('cache.adapter.array');
+ $cachePool->addTag('cache.pool', ['clearer' => 'cache.system_clearer']);
+ $container->setDefinition('app.cache_pool', $cachePool);
+
+ $this->cachePoolPass->process($container);
+
+ $definition = $container->getDefinition('cache.foo_bar_clearer');
+
+ $this->assertTrue($definition->hasTag('cache.pool.clearer'));
+ $this->assertEquals(['app.cache_pool' => new Reference('app.cache_pool', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $definition->getArgument(0));
+ }
}
diff --git a/src/Symfony/Component/Cache/Traits/ContractsTrait.php b/src/Symfony/Component/Cache/Traits/ContractsTrait.php
index 9a491adb5acb8..c22e75fb9a358 100644
--- a/src/Symfony/Component/Cache/Traits/ContractsTrait.php
+++ b/src/Symfony/Component/Cache/Traits/ContractsTrait.php
@@ -57,7 +57,7 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable
return $previousWrapper;
}
- private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, array &$metadata = null)
+ private function doGet(AdapterInterface $pool, string $key, callable $callback, ?float $beta, ?array &$metadata = null)
{
if (0 > $beta = $beta ?? 1.0) {
throw new InvalidArgumentException(sprintf('Argument "$beta" provided to "%s::get()" must be a positive number, %f given.', static::class, $beta));
diff --git a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
index 16e768990b942..0455093c9b93c 100644
--- a/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
+++ b/src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php
@@ -88,7 +88,7 @@ protected function doUnlink(string $file)
return @unlink($file);
}
- private function write(string $file, string $data, int $expiresAt = null)
+ private function write(string $file, string $data, ?int $expiresAt = null)
{
$unlink = false;
set_error_handler(__CLASS__.'::throwError');
@@ -127,7 +127,7 @@ private function write(string $file, string $data, int $expiresAt = null)
}
}
- private function getFile(string $id, bool $mkdir = false, string $directory = null)
+ private function getFile(string $id, bool $mkdir = false, ?string $directory = null)
{
// Use MD5 to favor speed over security, which is not an issue here
$hash = str_replace('/', '-', base64_encode(hash('md5', static::class.$id, true)));
diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php
index 352d142c9e5b4..a2a92aefd50df 100644
--- a/src/Symfony/Component/Cache/Traits/RedisTrait.php
+++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php
@@ -560,7 +560,7 @@ protected function doSave(array $values, int $lifetime)
return $failed;
}
- private function pipeline(\Closure $generator, object $redis = null): \Generator
+ private function pipeline(\Closure $generator, ?object $redis = null): \Generator
{
$ids = [];
$redis = $redis ?? $this->redis;
diff --git a/src/Symfony/Component/Config/Builder/ClassBuilder.php b/src/Symfony/Component/Config/Builder/ClassBuilder.php
index 9960d650806a4..f8983fc9aa480 100644
--- a/src/Symfony/Component/Config/Builder/ClassBuilder.php
+++ b/src/Symfony/Component/Config/Builder/ClassBuilder.php
@@ -122,7 +122,7 @@ public function addMethod(string $name, string $body, array $params = []): void
$this->methods[] = new Method(strtr($body, ['NAME' => $this->camelCase($name)] + $params));
}
- public function addProperty(string $name, string $classType = null, string $defaultValue = null): Property
+ public function addProperty(string $name, ?string $classType = null, ?string $defaultValue = null): Property
{
$property = new Property($name, '_' !== $name[0] ? $this->camelCase($name) : $name);
if (null !== $classType) {
diff --git a/src/Symfony/Component/Config/ConfigCacheInterface.php b/src/Symfony/Component/Config/ConfigCacheInterface.php
index 3cd7a5cc00179..b431cfae1cd9a 100644
--- a/src/Symfony/Component/Config/ConfigCacheInterface.php
+++ b/src/Symfony/Component/Config/ConfigCacheInterface.php
@@ -45,5 +45,5 @@ public function isFresh();
*
* @throws \RuntimeException When the cache file cannot be written
*/
- public function write(string $content, array $metadata = null);
+ public function write(string $content, ?array $metadata = null);
}
diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php
index 673cfaf60ede8..e4ba288aaff26 100644
--- a/src/Symfony/Component/Config/Definition/BaseNode.php
+++ b/src/Symfony/Component/Config/Definition/BaseNode.php
@@ -45,7 +45,7 @@ abstract class BaseNode implements NodeInterface
/**
* @throws \InvalidArgumentException if the name contains a period
*/
- public function __construct(?string $name, NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
+ public function __construct(?string $name, ?NodeInterface $parent = null, string $pathSeparator = self::DEFAULT_PATH_SEPARATOR)
{
if (str_contains($name = (string) $name, $pathSeparator)) {
throw new \InvalidArgumentException('The name must not contain ".'.$pathSeparator.'".');
diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
index eb5b04021f8ae..4e1171c4b4318 100644
--- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
@@ -39,7 +39,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
/**
* {@inheritdoc}
*/
- public function __construct(?string $name, NodeParentInterface $parent = null)
+ public function __construct(?string $name, ?NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);
@@ -197,7 +197,7 @@ public function disallowNewKeysInSubsequentConfigs()
*
* @return $this
*/
- public function fixXmlConfig(string $singular, string $plural = null)
+ public function fixXmlConfig(string $singular, ?string $plural = null)
{
$this->normalization()->remap($singular, $plural);
diff --git a/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php
index ace0b34a20d5f..bbc0623951650 100644
--- a/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php
@@ -24,7 +24,7 @@ class BooleanNodeDefinition extends ScalarNodeDefinition
/**
* {@inheritdoc}
*/
- public function __construct(?string $name, NodeParentInterface $parent = null)
+ public function __construct(?string $name, ?NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);
diff --git a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php
index 14387b51bbdee..cebc5274fadc3 100644
--- a/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php
+++ b/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php
@@ -35,7 +35,7 @@ public function __construct(NodeDefinition $node)
*
* @return $this
*/
- public function always(\Closure $then = null)
+ public function always(?\Closure $then = null)
{
$this->ifPart = function () { return true; };
@@ -53,7 +53,7 @@ public function always(\Closure $then = null)
*
* @return $this
*/
- public function ifTrue(\Closure $closure = null)
+ public function ifTrue(?\Closure $closure = null)
{
if (null === $closure) {
$closure = function ($v) { return true === $v; };
diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php
index 245e97277cf03..2868017c8665a 100644
--- a/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php
+++ b/src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php
@@ -39,7 +39,7 @@ public function __construct()
*
* @return $this
*/
- public function setParent(ParentNodeDefinitionInterface $parent = null)
+ public function setParent(?ParentNodeDefinitionInterface $parent = null)
{
$this->parent = $parent;
diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
index cf153f01ca4e0..b913d3b98ae02 100644
--- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php
@@ -38,7 +38,7 @@ abstract class NodeDefinition implements NodeParentInterface
protected $parent;
protected $attributes = [];
- public function __construct(?string $name, NodeParentInterface $parent = null)
+ public function __construct(?string $name, ?NodeParentInterface $parent = null)
{
$this->parent = $parent;
$this->name = $name;
diff --git a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php
index 06cbbd4345fff..a384ec3cf7c4e 100644
--- a/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php
+++ b/src/Symfony/Component/Config/Definition/Builder/NormalizationBuilder.php
@@ -35,7 +35,7 @@ public function __construct(NodeDefinition $node)
*
* @return $this
*/
- public function remap(string $key, string $plural = null)
+ public function remap(string $key, ?string $plural = null)
{
$this->remappings[] = [$key, null === $plural ? $key.'s' : $plural];
@@ -47,7 +47,7 @@ public function remap(string $key, string $plural = null)
*
* @return ExprBuilder|$this
*/
- public function before(\Closure $closure = null)
+ public function before(?\Closure $closure = null)
{
if (null !== $closure) {
$this->before[] = $closure;
diff --git a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php
index f3c3c2109cd72..783792fac34c9 100644
--- a/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php
+++ b/src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php
@@ -23,7 +23,7 @@ class TreeBuilder implements NodeParentInterface
protected $tree;
protected $root;
- public function __construct(string $name, string $type = 'array', NodeBuilder $builder = null)
+ public function __construct(string $name, string $type = 'array', ?NodeBuilder $builder = null)
{
$builder = $builder ?? new NodeBuilder();
$this->root = $builder->node($name, $type)->setParent($this);
diff --git a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php
index 4efc726c0cf2d..d93e6950d779e 100644
--- a/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php
+++ b/src/Symfony/Component/Config/Definition/Builder/ValidationBuilder.php
@@ -31,7 +31,7 @@ public function __construct(NodeDefinition $node)
*
* @return ExprBuilder|$this
*/
- public function rule(\Closure $closure = null)
+ public function rule(?\Closure $closure = null)
{
if (null !== $closure) {
$this->rules[] = $closure;
diff --git a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
index 4979ae96c813e..a0a5e2587438b 100644
--- a/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
+++ b/src/Symfony/Component/Config/Definition/Dumper/XmlReferenceDumper.php
@@ -27,12 +27,12 @@ class XmlReferenceDumper
{
private $reference;
- public function dump(ConfigurationInterface $configuration, string $namespace = null)
+ public function dump(ConfigurationInterface $configuration, ?string $namespace = null)
{
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace);
}
- public function dumpNode(NodeInterface $node, string $namespace = null)
+ public function dumpNode(NodeInterface $node, ?string $namespace = null)
{
$this->reference = '';
$this->writeNode($node, 0, true, $namespace);
@@ -42,7 +42,7 @@ public function dumpNode(NodeInterface $node, string $namespace = null)
return $ref;
}
- private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, string $namespace = null)
+ private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, ?string $namespace = null)
{
$rootName = ($root ? 'config' : $node->getName());
$rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null));
diff --git a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php
index 6fcfb71bd9818..718a1ae539ccd 100644
--- a/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php
+++ b/src/Symfony/Component/Config/Definition/Dumper/YamlReferenceDumper.php
@@ -71,7 +71,7 @@ public function dumpNode(NodeInterface $node)
return $ref;
}
- private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false)
+ private function writeNode(NodeInterface $node, ?NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false)
{
$comments = [];
$default = '';
diff --git a/src/Symfony/Component/Config/Definition/EnumNode.php b/src/Symfony/Component/Config/Definition/EnumNode.php
index 822e6b57f1642..649a191cae32c 100644
--- a/src/Symfony/Component/Config/Definition/EnumNode.php
+++ b/src/Symfony/Component/Config/Definition/EnumNode.php
@@ -22,7 +22,7 @@ class EnumNode extends ScalarNode
{
private $values;
- public function __construct(?string $name, NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
+ public function __construct(?string $name, ?NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
{
$values = array_unique($values);
if (empty($values)) {
diff --git a/src/Symfony/Component/Config/Definition/NumericNode.php b/src/Symfony/Component/Config/Definition/NumericNode.php
index 50d137c2d71fb..7d1eff79a9720 100644
--- a/src/Symfony/Component/Config/Definition/NumericNode.php
+++ b/src/Symfony/Component/Config/Definition/NumericNode.php
@@ -27,7 +27,7 @@ class NumericNode extends ScalarNode
* @param int|float|null $min
* @param int|float|null $max
*/
- public function __construct(?string $name, NodeInterface $parent = null, $min = null, $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
+ public function __construct(?string $name, ?NodeInterface $parent = null, $min = null, $max = null, string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
{
parent::__construct($name, $parent, $pathSeparator);
$this->min = $min;
diff --git a/src/Symfony/Component/Config/Definition/Processor.php b/src/Symfony/Component/Config/Definition/Processor.php
index 312783f555bd5..55dd920183d0a 100644
--- a/src/Symfony/Component/Config/Definition/Processor.php
+++ b/src/Symfony/Component/Config/Definition/Processor.php
@@ -67,7 +67,7 @@ public function processConfiguration(ConfigurationInterface $configuration, arra
* @param string $key The key to normalize
* @param string|null $plural The plural form of the key if it is irregular
*/
- public static function normalizeConfig(array $config, string $key, string $plural = null): array
+ public static function normalizeConfig(array $config, string $key, ?string $plural = null): array
{
if (null === $plural) {
$plural = $key.'s';
diff --git a/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php b/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php
index e235ea04956a6..e020642fc2546 100644
--- a/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php
+++ b/src/Symfony/Component/Config/Exception/FileLoaderImportCircularReferenceException.php
@@ -18,7 +18,7 @@
*/
class FileLoaderImportCircularReferenceException extends LoaderLoadException
{
- public function __construct(array $resources, ?int $code = 0, \Throwable $previous = null)
+ public function __construct(array $resources, ?int $code = 0, ?\Throwable $previous = null)
{
if (null === $code) {
trigger_deprecation('symfony/config', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__);
diff --git a/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php b/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php
index 3ee4b938f417a..bd9302dc29fe5 100644
--- a/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php
+++ b/src/Symfony/Component/Config/Exception/FileLocatorFileNotFoundException.php
@@ -20,7 +20,7 @@ class FileLocatorFileNotFoundException extends \InvalidArgumentException
{
private $paths;
- public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, array $paths = [])
+ public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, array $paths = [])
{
parent::__construct($message, $code, $previous);
diff --git a/src/Symfony/Component/Config/Exception/LoaderLoadException.php b/src/Symfony/Component/Config/Exception/LoaderLoadException.php
index b20e74db463f4..a2a657bdf0c1e 100644
--- a/src/Symfony/Component/Config/Exception/LoaderLoadException.php
+++ b/src/Symfony/Component/Config/Exception/LoaderLoadException.php
@@ -25,7 +25,7 @@ class LoaderLoadException extends \Exception
* @param \Throwable|null $previous A previous exception
* @param string|null $type The type of resource
*/
- public function __construct(string $resource, string $sourceResource = null, ?int $code = 0, \Throwable $previous = null, string $type = null)
+ public function __construct(string $resource, ?string $sourceResource = null, ?int $code = 0, ?\Throwable $previous = null, ?string $type = null)
{
if (null === $code) {
trigger_deprecation('symfony/config', '5.3', 'Passing null as $code to "%s()" is deprecated, pass 0 instead.', __METHOD__);
diff --git a/src/Symfony/Component/Config/FileLocator.php b/src/Symfony/Component/Config/FileLocator.php
index da350908a6bd9..e50324850da50 100644
--- a/src/Symfony/Component/Config/FileLocator.php
+++ b/src/Symfony/Component/Config/FileLocator.php
@@ -33,7 +33,7 @@ public function __construct($paths = [])
/**
* {@inheritdoc}
*/
- public function locate(string $name, string $currentPath = null, bool $first = true)
+ public function locate(string $name, ?string $currentPath = null, bool $first = true)
{
if ('' === $name) {
throw new \InvalidArgumentException('An empty file name is not valid to be located.');
diff --git a/src/Symfony/Component/Config/FileLocatorInterface.php b/src/Symfony/Component/Config/FileLocatorInterface.php
index e3ca1d49c4066..97b5ff39357ba 100644
--- a/src/Symfony/Component/Config/FileLocatorInterface.php
+++ b/src/Symfony/Component/Config/FileLocatorInterface.php
@@ -30,5 +30,5 @@ interface FileLocatorInterface
* @throws \InvalidArgumentException If $name is empty
* @throws FileLocatorFileNotFoundException If a file is not found
*/
- public function locate(string $name, string $currentPath = null, bool $first = true);
+ public function locate(string $name, ?string $currentPath = null, bool $first = true);
}
diff --git a/src/Symfony/Component/Config/Loader/DelegatingLoader.php b/src/Symfony/Component/Config/Loader/DelegatingLoader.php
index e5a74ee63b39d..617cb2ad6d140 100644
--- a/src/Symfony/Component/Config/Loader/DelegatingLoader.php
+++ b/src/Symfony/Component/Config/Loader/DelegatingLoader.php
@@ -31,7 +31,7 @@ public function __construct(LoaderResolverInterface $resolver)
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
if (false === $loader = $this->resolver->resolve($resource, $type)) {
throw new LoaderLoadException($resource, null, 0, null, $type);
@@ -43,7 +43,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
return false !== $this->resolver->resolve($resource, $type);
}
diff --git a/src/Symfony/Component/Config/Loader/FileLoader.php b/src/Symfony/Component/Config/Loader/FileLoader.php
index 4e1b46c4edd7b..5e1d8d563789b 100644
--- a/src/Symfony/Component/Config/Loader/FileLoader.php
+++ b/src/Symfony/Component/Config/Loader/FileLoader.php
@@ -31,7 +31,7 @@ abstract class FileLoader extends Loader
private $currentDir;
- public function __construct(FileLocatorInterface $locator, string $env = null)
+ public function __construct(FileLocatorInterface $locator, ?string $env = null)
{
$this->locator = $locator;
parent::__construct($env);
@@ -70,7 +70,7 @@ public function getLocator()
* @throws FileLoaderImportCircularReferenceException
* @throws FileLocatorFileNotFoundException
*/
- public function import($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null, $exclude = null)
+ public function import($resource, ?string $type = null, bool $ignoreErrors = false, ?string $sourceResource = null, $exclude = null)
{
if (\is_string($resource) && \strlen($resource) !== ($i = strcspn($resource, '*?{[')) && !str_contains($resource, "\n")) {
$excluded = [];
@@ -133,7 +133,7 @@ protected function glob(string $pattern, bool $recursive, &$resource = null, boo
yield from $resource;
}
- private function doImport($resource, string $type = null, bool $ignoreErrors = false, string $sourceResource = null)
+ private function doImport($resource, ?string $type = null, bool $ignoreErrors = false, ?string $sourceResource = null)
{
try {
$loader = $this->resolve($resource, $type);
diff --git a/src/Symfony/Component/Config/Loader/GlobFileLoader.php b/src/Symfony/Component/Config/Loader/GlobFileLoader.php
index fecb1c5d073ac..cccae608b1d15 100644
--- a/src/Symfony/Component/Config/Loader/GlobFileLoader.php
+++ b/src/Symfony/Component/Config/Loader/GlobFileLoader.php
@@ -21,7 +21,7 @@ class GlobFileLoader extends FileLoader
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
return $this->import($resource);
}
@@ -29,7 +29,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
return 'glob' === $type;
}
diff --git a/src/Symfony/Component/Config/Loader/Loader.php b/src/Symfony/Component/Config/Loader/Loader.php
index e7d74b5a10b74..892164da2044a 100644
--- a/src/Symfony/Component/Config/Loader/Loader.php
+++ b/src/Symfony/Component/Config/Loader/Loader.php
@@ -23,7 +23,7 @@ abstract class Loader implements LoaderInterface
protected $resolver;
protected $env;
- public function __construct(string $env = null)
+ public function __construct(?string $env = null)
{
$this->env = $env;
}
@@ -52,7 +52,7 @@ public function setResolver(LoaderResolverInterface $resolver)
*
* @return mixed
*/
- public function import($resource, string $type = null)
+ public function import($resource, ?string $type = null)
{
return $this->resolve($resource, $type)->load($resource, $type);
}
@@ -67,7 +67,7 @@ public function import($resource, string $type = null)
*
* @throws LoaderLoadException If no loader is found
*/
- public function resolve($resource, string $type = null)
+ public function resolve($resource, ?string $type = null)
{
if ($this->supports($resource, $type)) {
return $this;
diff --git a/src/Symfony/Component/Config/Loader/LoaderInterface.php b/src/Symfony/Component/Config/Loader/LoaderInterface.php
index 93a160b1e4b69..9497a521ebcdd 100644
--- a/src/Symfony/Component/Config/Loader/LoaderInterface.php
+++ b/src/Symfony/Component/Config/Loader/LoaderInterface.php
@@ -27,7 +27,7 @@ interface LoaderInterface
*
* @throws \Exception If something went wrong
*/
- public function load($resource, string $type = null);
+ public function load($resource, ?string $type = null);
/**
* Returns whether this class supports the given resource.
@@ -36,7 +36,7 @@ public function load($resource, string $type = null);
*
* @return bool
*/
- public function supports($resource, string $type = null);
+ public function supports($resource, ?string $type = null);
/**
* Gets the loader resolver.
diff --git a/src/Symfony/Component/Config/Loader/LoaderResolver.php b/src/Symfony/Component/Config/Loader/LoaderResolver.php
index cce0702b71b35..a6ee1a27d91e7 100644
--- a/src/Symfony/Component/Config/Loader/LoaderResolver.php
+++ b/src/Symfony/Component/Config/Loader/LoaderResolver.php
@@ -39,7 +39,7 @@ public function __construct(array $loaders = [])
/**
* {@inheritdoc}
*/
- public function resolve($resource, string $type = null)
+ public function resolve($resource, ?string $type = null)
{
foreach ($this->loaders as $loader) {
if ($loader->supports($resource, $type)) {
diff --git a/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php b/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php
index 8a4841947e55e..3245eba8c7f96 100644
--- a/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php
+++ b/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php
@@ -26,5 +26,5 @@ interface LoaderResolverInterface
*
* @return LoaderInterface|false
*/
- public function resolve($resource, string $type = null);
+ public function resolve($resource, ?string $type = null);
}
diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
index 661603692c2ba..186056c59a099 100644
--- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
+++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
@@ -34,7 +34,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
* @param string $resource The fully-qualified class name
* @param bool|null $exists Boolean when the existence check has already been done
*/
- public function __construct(string $resource, bool $exists = null)
+ public function __construct(string $resource, ?bool $exists = null)
{
$this->resource = $resource;
if (null !== $exists) {
@@ -143,7 +143,7 @@ public function __wakeup()
*
* @internal
*/
- public static function throwOnRequiredClass(string $class, \Exception $previous = null)
+ public static function throwOnRequiredClass(string $class, ?\Exception $previous = null)
{
// If the passed class is the resource being checked, we shouldn't throw.
if (null === $previous && self::$autoloadedClass === $class) {
diff --git a/src/Symfony/Component/Config/Resource/DirectoryResource.php b/src/Symfony/Component/Config/Resource/DirectoryResource.php
index 035814a2a59ec..19b0a4bccbc4e 100644
--- a/src/Symfony/Component/Config/Resource/DirectoryResource.php
+++ b/src/Symfony/Component/Config/Resource/DirectoryResource.php
@@ -29,7 +29,7 @@ class DirectoryResource implements SelfCheckingResourceInterface
*
* @throws \InvalidArgumentException
*/
- public function __construct(string $resource, string $pattern = null)
+ public function __construct(string $resource, ?string $pattern = null)
{
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
$this->pattern = $pattern;
diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php
index ba0e180c53537..dfc46e97fbfa6 100644
--- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php
+++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php
@@ -115,7 +115,7 @@ public function isFresh()
*
* @throws \RuntimeException When cache file can't be written
*/
- public function write(string $content, array $metadata = null)
+ public function write(string $content, ?array $metadata = null)
{
$mode = 0666;
$umask = umask();
diff --git a/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php b/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php
index 5f20ca6ac9f7f..8c8c3b02f538b 100644
--- a/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php
+++ b/src/Symfony/Component/Config/Tests/Builder/GeneratedConfigTest.php
@@ -160,7 +160,7 @@ public function testSetExtraKeyMethodIsNotGeneratedWhenAllowExtraKeysIsFalse()
/**
* Generate the ConfigBuilder or return an already generated instance.
*/
- private function generateConfigBuilder(string $configurationClass, string $outputDir = null)
+ private function generateConfigBuilder(string $configurationClass, ?string $outputDir = null)
{
$outputDir ?? $outputDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
if (!str_contains($outputDir, __DIR__)) {
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
index 64b5d8d7456fa..8dbe54a3374a6 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
@@ -223,7 +223,7 @@ protected function getTestBuilder(): ExprBuilder
* @param array|null $config The config you want to use for the finalization, if nothing provided
* a simple ['key'=>'value'] will be used
*/
- protected function finalizeTestBuilder(NodeDefinition $nodeDefinition, array $config = null): array
+ protected function finalizeTestBuilder(NodeDefinition $nodeDefinition, ?array $config = null): array
{
return $nodeDefinition
->end()
diff --git a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php
index 9aa991ecc5b5e..cae46ca8f9adf 100644
--- a/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/Config/Tests/Loader/FileLoaderTest.php
@@ -155,12 +155,12 @@ class TestFileLoader extends FileLoader
{
private $supports = true;
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
return $resource;
}
- public function supports($resource, string $type = null): bool
+ public function supports($resource, ?string $type = null): bool
{
return $this->supports;
}
diff --git a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
index 9b163f100fd7b..3fe6c1e54ca82 100644
--- a/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
+++ b/src/Symfony/Component/Config/Tests/Loader/LoaderTest.php
@@ -104,11 +104,11 @@ public function testImportWithType()
class ProjectLoader1 extends Loader
{
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
}
- public function supports($resource, string $type = null): bool
+ public function supports($resource, ?string $type = null): bool
{
return \is_string($resource) && 'foo' === pathinfo($resource, \PATHINFO_EXTENSION);
}
diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
index 875baf9f7f370..7d8ed91cdfb85 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
@@ -64,7 +64,7 @@ public function testIsFreshForDeletedResources()
/**
* @dataProvider provideHashedSignature
*/
- public function testHashedSignature(bool $changeExpected, int $changedLine, ?string $changedCode, \Closure $setContext = null)
+ public function testHashedSignature(bool $changeExpected, int $changedLine, ?string $changedCode, ?\Closure $setContext = null)
{
if ($setContext) {
$setContext();
diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php
index 29951e9c1a164..bb5341882181a 100644
--- a/src/Symfony/Component/Console/Application.php
+++ b/src/Symfony/Component/Console/Application.php
@@ -134,7 +134,7 @@ public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
*
* @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}.
*/
- public function run(InputInterface $input = null, OutputInterface $output = null)
+ public function run(?InputInterface $input = null, ?OutputInterface $output = null)
{
if (\function_exists('putenv')) {
@putenv('LINES='.$this->terminal->getHeight());
@@ -778,7 +778,7 @@ public function find(string $name)
*
* @return Command[]
*/
- public function all(string $namespace = null)
+ public function all(?string $namespace = null)
{
$this->init();
@@ -1147,7 +1147,7 @@ private function getAbbreviationSuggestions(array $abbrevs): string
*
* @return string
*/
- public function extractNamespace(string $name, int $limit = null)
+ public function extractNamespace(string $name, ?int $limit = null)
{
$parts = explode(':', $name, -1);
diff --git a/src/Symfony/Component/Console/CI/GithubActionReporter.php b/src/Symfony/Component/Console/CI/GithubActionReporter.php
index a15c1ff18b864..065717854af4f 100644
--- a/src/Symfony/Component/Console/CI/GithubActionReporter.php
+++ b/src/Symfony/Component/Console/CI/GithubActionReporter.php
@@ -57,7 +57,7 @@ public static function isGithubActionEnvironment(): bool
*
* @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-error-message
*/
- public function error(string $message, string $file = null, int $line = null, int $col = null): void
+ public function error(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
{
$this->log('error', $message, $file, $line, $col);
}
@@ -67,7 +67,7 @@ public function error(string $message, string $file = null, int $line = null, in
*
* @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message
*/
- public function warning(string $message, string $file = null, int $line = null, int $col = null): void
+ public function warning(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
{
$this->log('warning', $message, $file, $line, $col);
}
@@ -77,12 +77,12 @@ public function warning(string $message, string $file = null, int $line = null,
*
* @see https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-debug-message
*/
- public function debug(string $message, string $file = null, int $line = null, int $col = null): void
+ public function debug(string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
{
$this->log('debug', $message, $file, $line, $col);
}
- private function log(string $type, string $message, string $file = null, int $line = null, int $col = null): void
+ private function log(string $type, string $message, ?string $file = null, ?int $line = null, ?int $col = null): void
{
// Some values must be encoded.
$message = strtr($message, self::ESCAPED_DATA);
diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php
index cfa18361ea980..d181036709ebe 100644
--- a/src/Symfony/Component/Console/Command/Command.php
+++ b/src/Symfony/Component/Console/Command/Command.php
@@ -96,7 +96,7 @@ public static function getDefaultDescription(): ?string
*
* @throws LogicException When the command name is empty
*/
- public function __construct(string $name = null)
+ public function __construct(?string $name = null)
{
$this->definition = new InputDefinition();
@@ -132,7 +132,7 @@ public function ignoreValidationErrors()
$this->ignoreValidationErrors = true;
}
- public function setApplication(Application $application = null)
+ public function setApplication(?Application $application = null)
{
$this->application = $application;
if ($application) {
@@ -433,7 +433,7 @@ public function getNativeDefinition()
*
* @throws InvalidArgumentException When argument mode is not valid
*/
- public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
+ public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null)
{
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
if (null !== $this->fullDefinition) {
@@ -454,7 +454,7 @@ public function addArgument(string $name, int $mode = null, string $description
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*/
- public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
+ public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null)
{
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
if (null !== $this->fullDefinition) {
diff --git a/src/Symfony/Component/Console/Command/LazyCommand.php b/src/Symfony/Component/Console/Command/LazyCommand.php
index e576ad03fe468..302a0809e8b80 100644
--- a/src/Symfony/Component/Console/Command/LazyCommand.php
+++ b/src/Symfony/Component/Console/Command/LazyCommand.php
@@ -43,7 +43,7 @@ public function ignoreValidationErrors(): void
$this->getCommand()->ignoreValidationErrors();
}
- public function setApplication(Application $application = null): void
+ public function setApplication(?Application $application = null): void
{
if ($this->command instanceof parent) {
$this->command->setApplication($application);
@@ -117,7 +117,7 @@ public function getNativeDefinition(): InputDefinition
/**
* @return $this
*/
- public function addArgument(string $name, int $mode = null, string $description = '', $default = null): self
+ public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null): self
{
$this->getCommand()->addArgument($name, $mode, $description, $default);
@@ -127,7 +127,7 @@ public function addArgument(string $name, int $mode = null, string $description
/**
* @return $this
*/
- public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null): self
+ public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null): self
{
$this->getCommand()->addOption($name, $shortcut, $mode, $description, $default);
diff --git a/src/Symfony/Component/Console/Command/LockableTrait.php b/src/Symfony/Component/Console/Command/LockableTrait.php
index b1856dca7c3a8..d21edc2c0ee6f 100644
--- a/src/Symfony/Component/Console/Command/LockableTrait.php
+++ b/src/Symfony/Component/Console/Command/LockableTrait.php
@@ -30,7 +30,7 @@ trait LockableTrait
/**
* Locks a command.
*/
- private function lock(string $name = null, bool $blocking = false): bool
+ private function lock(?string $name = null, bool $blocking = false): bool
{
if (!class_exists(SemaphoreStore::class)) {
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
diff --git a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
index 2a3acc99b7be4..eb11b4f91cde0 100644
--- a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
+++ b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
@@ -43,7 +43,7 @@ class ApplicationDescription
*/
private $aliases;
- public function __construct(Application $application, string $namespace = null, bool $showHidden = false)
+ public function __construct(Application $application, ?string $namespace = null, bool $showHidden = false)
{
$this->application = $application;
$this->namespace = $namespace;
diff --git a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
index 4f7cd8b3e0821..f17e5f1f2bd9e 100644
--- a/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/XmlDescriptor.php
@@ -79,7 +79,7 @@ public function getCommandDocument(Command $command, bool $short = false): \DOMD
return $dom;
}
- public function getApplicationDocument(Application $application, string $namespace = null, bool $short = false): \DOMDocument
+ public function getApplicationDocument(Application $application, ?string $namespace = null, bool $short = false): \DOMDocument
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->appendChild($rootXml = $dom->createElement('symfony'));
diff --git a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
index 57d9b38ba0c3b..d4c26493f4d96 100644
--- a/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
+++ b/src/Symfony/Component/Console/Event/ConsoleErrorEvent.php
@@ -25,7 +25,7 @@ final class ConsoleErrorEvent extends ConsoleEvent
private $error;
private $exitCode;
- public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = null)
+ public function __construct(InputInterface $input, OutputInterface $output, \Throwable $error, ?Command $command = null)
{
parent::__construct($command, $input, $output);
diff --git a/src/Symfony/Component/Console/EventListener/ErrorListener.php b/src/Symfony/Component/Console/EventListener/ErrorListener.php
index 897d9853f2848..e9c9e3ea478d3 100644
--- a/src/Symfony/Component/Console/EventListener/ErrorListener.php
+++ b/src/Symfony/Component/Console/EventListener/ErrorListener.php
@@ -26,7 +26,7 @@ class ErrorListener implements EventSubscriberInterface
{
private $logger;
- public function __construct(LoggerInterface $logger = null)
+ public function __construct(?LoggerInterface $logger = null)
{
$this->logger = $logger;
}
diff --git a/src/Symfony/Component/Console/Exception/CommandNotFoundException.php b/src/Symfony/Component/Console/Exception/CommandNotFoundException.php
index 910ae19286712..81ec318abf26d 100644
--- a/src/Symfony/Component/Console/Exception/CommandNotFoundException.php
+++ b/src/Symfony/Component/Console/Exception/CommandNotFoundException.php
@@ -26,7 +26,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
* @param int $code Exception code
* @param \Throwable|null $previous Previous exception used for the exception chaining
*/
- public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
+ public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
diff --git a/src/Symfony/Component/Console/Formatter/NullOutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/NullOutputFormatterStyle.php
index 9232510f4a49c..afd3d004359ec 100644
--- a/src/Symfony/Component/Console/Formatter/NullOutputFormatterStyle.php
+++ b/src/Symfony/Component/Console/Formatter/NullOutputFormatterStyle.php
@@ -27,7 +27,7 @@ public function apply(string $text): string
/**
* {@inheritdoc}
*/
- public function setBackground(string $color = null): void
+ public function setBackground(?string $color = null): void
{
// do nothing
}
@@ -35,7 +35,7 @@ public function setBackground(string $color = null): void
/**
* {@inheritdoc}
*/
- public function setForeground(string $color = null): void
+ public function setForeground(?string $color = null): void
{
// do nothing
}
diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
index 8370ba0587a79..d7ae66494d67c 100644
--- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
+++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
@@ -33,7 +33,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
* @param string|null $foreground The style foreground color name
* @param string|null $background The style background color name
*/
- public function __construct(string $foreground = null, string $background = null, array $options = [])
+ public function __construct(?string $foreground = null, ?string $background = null, array $options = [])
{
$this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
}
@@ -41,7 +41,7 @@ public function __construct(string $foreground = null, string $background = null
/**
* {@inheritdoc}
*/
- public function setForeground(string $color = null)
+ public function setForeground(?string $color = null)
{
$this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
}
@@ -49,7 +49,7 @@ public function setForeground(string $color = null)
/**
* {@inheritdoc}
*/
- public function setBackground(string $color = null)
+ public function setBackground(?string $color = null)
{
$this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
}
diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php
index b30560d22e161..89e4d24381be0 100644
--- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php
+++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php
@@ -21,12 +21,12 @@ interface OutputFormatterStyleInterface
/**
* Sets style foreground color.
*/
- public function setForeground(string $color = null);
+ public function setForeground(?string $color = null);
/**
* Sets style background color.
*/
- public function setBackground(string $color = null);
+ public function setBackground(?string $color = null);
/**
* Sets some specific style option.
diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php
index fc48dc0e15e6a..1b9356301e2dd 100644
--- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php
+++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleStack.php
@@ -26,7 +26,7 @@ class OutputFormatterStyleStack implements ResetInterface
private $emptyStyle;
- public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
+ public function __construct(?OutputFormatterStyleInterface $emptyStyle = null)
{
$this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
$this->reset();
@@ -55,7 +55,7 @@ public function push(OutputFormatterStyleInterface $style)
*
* @throws InvalidArgumentException When style tags incorrectly nested
*/
- public function pop(OutputFormatterStyleInterface $style = null)
+ public function pop(?OutputFormatterStyleInterface $style = null)
{
if (empty($this->styles)) {
return $this->emptyStyle;
diff --git a/src/Symfony/Component/Console/Helper/Dumper.php b/src/Symfony/Component/Console/Helper/Dumper.php
index b013b6c527b6c..605e4d70b7c2d 100644
--- a/src/Symfony/Component/Console/Helper/Dumper.php
+++ b/src/Symfony/Component/Console/Helper/Dumper.php
@@ -26,7 +26,7 @@ final class Dumper
private $cloner;
private $handler;
- public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null)
+ public function __construct(OutputInterface $output, ?CliDumper $dumper = null, ?ClonerInterface $cloner = null)
{
$this->output = $output;
$this->dumper = $dumper;
diff --git a/src/Symfony/Component/Console/Helper/Helper.php b/src/Symfony/Component/Console/Helper/Helper.php
index c7d3e25d0e33e..6b3f7f43ad971 100644
--- a/src/Symfony/Component/Console/Helper/Helper.php
+++ b/src/Symfony/Component/Console/Helper/Helper.php
@@ -26,7 +26,7 @@ abstract class Helper implements HelperInterface
/**
* {@inheritdoc}
*/
- public function setHelperSet(HelperSet $helperSet = null)
+ public function setHelperSet(?HelperSet $helperSet = null)
{
$this->helperSet = $helperSet;
}
@@ -96,7 +96,7 @@ public static function length(?string $string): int
*
* @return string
*/
- public static function substr(?string $string, int $from, int $length = null)
+ public static function substr(?string $string, int $from, ?int $length = null)
{
$string ?? $string = '';
diff --git a/src/Symfony/Component/Console/Helper/HelperInterface.php b/src/Symfony/Component/Console/Helper/HelperInterface.php
index fc952b48612ec..5bf4d63271a40 100644
--- a/src/Symfony/Component/Console/Helper/HelperInterface.php
+++ b/src/Symfony/Component/Console/Helper/HelperInterface.php
@@ -21,7 +21,7 @@ interface HelperInterface
/**
* Sets the helper set associated with this helper.
*/
- public function setHelperSet(HelperSet $helperSet = null);
+ public function setHelperSet(?HelperSet $helperSet = null);
/**
* Gets the helper set associated with this helper.
diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php
index 719762d242ca9..c870ab997ea2d 100644
--- a/src/Symfony/Component/Console/Helper/HelperSet.php
+++ b/src/Symfony/Component/Console/Helper/HelperSet.php
@@ -37,7 +37,7 @@ public function __construct(array $helpers = [])
}
}
- public function set(HelperInterface $helper, string $alias = null)
+ public function set(HelperInterface $helper, ?string $alias = null)
{
$this->helpers[$helper->getName()] = $helper;
if (null !== $alias) {
@@ -76,7 +76,7 @@ public function get(string $name)
/**
* @deprecated since Symfony 5.4
*/
- public function setCommand(Command $command = null)
+ public function setCommand(?Command $command = null)
{
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
diff --git a/src/Symfony/Component/Console/Helper/ProcessHelper.php b/src/Symfony/Component/Console/Helper/ProcessHelper.php
index 4ea3d724d88dc..86a250b27f11b 100644
--- a/src/Symfony/Component/Console/Helper/ProcessHelper.php
+++ b/src/Symfony/Component/Console/Helper/ProcessHelper.php
@@ -32,7 +32,7 @@ class ProcessHelper extends Helper
* @param callable|null $callback A PHP callback to run whenever there is some
* output available on STDOUT or STDERR
*/
- public function run(OutputInterface $output, $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
+ public function run(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
{
if (!class_exists(Process::class)) {
throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
@@ -98,7 +98,7 @@ public function run(OutputInterface $output, $cmd, string $error = null, callabl
*
* @see run()
*/
- public function mustRun(OutputInterface $output, $cmd, string $error = null, callable $callback = null): Process
+ public function mustRun(OutputInterface $output, $cmd, ?string $error = null, ?callable $callback = null): Process
{
$process = $this->run($output, $cmd, $error, $callback);
@@ -112,7 +112,7 @@ public function mustRun(OutputInterface $output, $cmd, string $error = null, cal
/**
* Wraps a Process callback to add debugging output.
*/
- public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable
+ public function wrapCallback(OutputInterface $output, Process $process, ?callable $callback = null): callable
{
if ($output instanceof ConsoleOutputInterface) {
$output = $output->getErrorOutput();
diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php
index eb6aacb1a4018..1d7b8d4562cb6 100644
--- a/src/Symfony/Component/Console/Helper/ProgressBar.php
+++ b/src/Symfony/Component/Console/Helper/ProgressBar.php
@@ -293,7 +293,7 @@ public function maxSecondsBetweenRedraws(float $seconds): void
*
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
*/
- public function iterate(iterable $iterable, int $max = null): iterable
+ public function iterate(iterable $iterable, ?int $max = null): iterable
{
$this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
@@ -311,7 +311,7 @@ public function iterate(iterable $iterable, int $max = null): iterable
*
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged
*/
- public function start(int $max = null)
+ public function start(?int $max = null)
{
$this->startTime = time();
$this->step = 0;
diff --git a/src/Symfony/Component/Console/Helper/ProgressIndicator.php b/src/Symfony/Component/Console/Helper/ProgressIndicator.php
index 3482343fcdfc0..3cc0e1451ac5f 100644
--- a/src/Symfony/Component/Console/Helper/ProgressIndicator.php
+++ b/src/Symfony/Component/Console/Helper/ProgressIndicator.php
@@ -50,7 +50,7 @@ class ProgressIndicator
* @param int $indicatorChangeInterval Change interval in milliseconds
* @param array|null $indicatorValues Animated indicator characters
*/
- public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
+ public function __construct(OutputInterface $output, ?string $format = null, int $indicatorChangeInterval = 100, ?array $indicatorValues = null)
{
$this->output = $output;
@@ -129,8 +129,6 @@ public function advance()
/**
* Finish the indicator with message.
- *
- * @param $message
*/
public function finish(string $message)
{
diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php
index 5c3447ab3afa5..408a76d67dd61 100644
--- a/src/Symfony/Component/Console/Helper/Table.php
+++ b/src/Symfony/Component/Console/Helper/Table.php
@@ -451,7 +451,7 @@ public function render()
*
* +-----+-----------+-------+
*/
- private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null)
+ private function renderRowSeparator(int $type = self::SEPARATOR_MID, ?string $title = null, ?string $titleFormat = null)
{
if (0 === $count = $this->numberOfColumns) {
return;
@@ -516,7 +516,7 @@ private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
*
* | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
*/
- private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null)
+ private function renderRow(array $row, string $cellFormat, ?string $firstCellFormat = null)
{
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
$columns = $this->getRowColumns($row);
diff --git a/src/Symfony/Component/Console/Helper/TableStyle.php b/src/Symfony/Component/Console/Helper/TableStyle.php
index dfc41e6a4c0bb..0643c79eb90ee 100644
--- a/src/Symfony/Component/Console/Helper/TableStyle.php
+++ b/src/Symfony/Component/Console/Helper/TableStyle.php
@@ -90,7 +90,7 @@ public function getPaddingChar()
*
* @return $this
*/
- public function setHorizontalBorderChars(string $outside, string $inside = null): self
+ public function setHorizontalBorderChars(string $outside, ?string $inside = null): self
{
$this->horizontalOutsideBorderChar = $outside;
$this->horizontalInsideBorderChar = $inside ?? $outside;
@@ -115,7 +115,7 @@ public function setHorizontalBorderChars(string $outside, string $inside = null)
*
* @return $this
*/
- public function setVerticalBorderChars(string $outside, string $inside = null): self
+ public function setVerticalBorderChars(string $outside, ?string $inside = null): self
{
$this->verticalOutsideBorderChar = $outside;
$this->verticalInsideBorderChar = $inside ?? $outside;
@@ -169,7 +169,7 @@ public function getBorderChars(): array
*
* @return $this
*/
- public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = null, string $topMidBottom = null, string $topRightBottom = null): self
+ public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, ?string $topLeftBottom = null, ?string $topMidBottom = null, ?string $topRightBottom = null): self
{
$this->crossingChar = $cross;
$this->crossingTopLeftChar = $topLeft;
diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php
index 675b9ef5891f5..0c4b2d25bd4d3 100644
--- a/src/Symfony/Component/Console/Input/ArgvInput.php
+++ b/src/Symfony/Component/Console/Input/ArgvInput.php
@@ -43,7 +43,7 @@ class ArgvInput extends Input
private $tokens;
private $parsed;
- public function __construct(array $argv = null, InputDefinition $definition = null)
+ public function __construct(?array $argv = null, ?InputDefinition $definition = null)
{
$argv = $argv ?? $_SERVER['argv'] ?? [];
diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php
index c65161484ec92..21a517cfb6f82 100644
--- a/src/Symfony/Component/Console/Input/ArrayInput.php
+++ b/src/Symfony/Component/Console/Input/ArrayInput.php
@@ -27,7 +27,7 @@ class ArrayInput extends Input
{
private $parameters;
- public function __construct(array $parameters, InputDefinition $definition = null)
+ public function __construct(array $parameters, ?InputDefinition $definition = null)
{
$this->parameters = $parameters;
diff --git a/src/Symfony/Component/Console/Input/Input.php b/src/Symfony/Component/Console/Input/Input.php
index d37460ed3a026..0faab2cf12cb7 100644
--- a/src/Symfony/Component/Console/Input/Input.php
+++ b/src/Symfony/Component/Console/Input/Input.php
@@ -33,7 +33,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
protected $arguments = [];
protected $interactive = true;
- public function __construct(InputDefinition $definition = null)
+ public function __construct(?InputDefinition $definition = null)
{
if (null === $definition) {
$this->definition = new InputDefinition();
diff --git a/src/Symfony/Component/Console/Input/InputArgument.php b/src/Symfony/Component/Console/Input/InputArgument.php
index 8a64f7ac8a8e9..1a8bf44b73b07 100644
--- a/src/Symfony/Component/Console/Input/InputArgument.php
+++ b/src/Symfony/Component/Console/Input/InputArgument.php
@@ -38,7 +38,7 @@ class InputArgument
*
* @throws InvalidArgumentException When argument mode is not valid
*/
- public function __construct(string $name, int $mode = null, string $description = '', $default = null)
+ public function __construct(string $name, ?int $mode = null, string $description = '', $default = null)
{
if (null === $mode) {
$mode = self::OPTIONAL;
diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php
index 2bec34fe1a395..1d8dbca310212 100644
--- a/src/Symfony/Component/Console/Input/InputOption.php
+++ b/src/Symfony/Component/Console/Input/InputOption.php
@@ -59,7 +59,7 @@ class InputOption
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*/
- public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
+ public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null)
{
if (str_starts_with($name, '--')) {
$name = substr($name, 2);
@@ -69,7 +69,7 @@ public function __construct(string $name, $shortcut = null, int $mode = null, st
throw new InvalidArgumentException('An option name cannot be empty.');
}
- if (empty($shortcut)) {
+ if ('' === $shortcut || [] === $shortcut) {
$shortcut = null;
}
@@ -78,10 +78,10 @@ public function __construct(string $name, $shortcut = null, int $mode = null, st
$shortcut = implode('|', $shortcut);
}
$shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
- $shortcuts = array_filter($shortcuts);
+ $shortcuts = array_filter($shortcuts, 'strlen');
$shortcut = implode('|', $shortcuts);
- if (empty($shortcut)) {
+ if ('' === $shortcut) {
throw new InvalidArgumentException('An option shortcut cannot be empty.');
}
}
diff --git a/src/Symfony/Component/Console/Output/ConsoleOutput.php b/src/Symfony/Component/Console/Output/ConsoleOutput.php
index f19f9ebf444cb..560aeb5814d40 100644
--- a/src/Symfony/Component/Console/Output/ConsoleOutput.php
+++ b/src/Symfony/Component/Console/Output/ConsoleOutput.php
@@ -37,7 +37,7 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
* @param bool|null $decorated Whether to decorate messages (null for auto-guessing)
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*/
- public function __construct(int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
+ public function __construct(int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null)
{
parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
diff --git a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php
index 8f16497583b66..70d70c50bb84e 100644
--- a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php
+++ b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php
@@ -43,7 +43,7 @@ public function __construct($stream, array &$sections, int $verbosity, bool $dec
*
* @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared
*/
- public function clear(int $lines = null)
+ public function clear(?int $lines = null)
{
if (empty($this->content) || !$this->isDecorated()) {
return;
diff --git a/src/Symfony/Component/Console/Output/Output.php b/src/Symfony/Component/Console/Output/Output.php
index d7c5fb2d11433..28c40bb3e6ec8 100644
--- a/src/Symfony/Component/Console/Output/Output.php
+++ b/src/Symfony/Component/Console/Output/Output.php
@@ -37,7 +37,7 @@ abstract class Output implements OutputInterface
* @param bool $decorated Whether to decorate messages
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*/
- public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
+ public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null)
{
$this->verbosity = $verbosity ?? self::VERBOSITY_NORMAL;
$this->formatter = $formatter ?? new OutputFormatter();
diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php
index f057f0e51d159..0ef15cf318b46 100644
--- a/src/Symfony/Component/Console/Output/StreamOutput.php
+++ b/src/Symfony/Component/Console/Output/StreamOutput.php
@@ -39,7 +39,7 @@ class StreamOutput extends Output
*
* @throws InvalidArgumentException When first argument is not a real stream
*/
- public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
+ public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, ?bool $decorated = null, ?OutputFormatterInterface $formatter = null)
{
if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
@@ -95,6 +95,10 @@ protected function hasColorSupport()
return false;
}
+ if (!$this->isTty()) {
+ return false;
+ }
+
if (\DIRECTORY_SEPARATOR === '\\'
&& \function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($this->stream)
@@ -105,7 +109,36 @@ protected function hasColorSupport()
return 'Hyper' === getenv('TERM_PROGRAM')
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
- || str_starts_with((string) getenv('TERM'), 'xterm')
- || stream_isatty($this->stream);
+ || str_starts_with((string) getenv('TERM'), 'xterm');
+ }
+
+ /**
+ * Checks if the stream is a TTY, i.e; whether the output stream is connected to a terminal.
+ *
+ * Reference: Composer\Util\Platform::isTty
+ * https://github.com/composer/composer
+ */
+ private function isTty(): bool
+ {
+ // Detect msysgit/mingw and assume this is a tty because detection
+ // does not work correctly, see https://github.com/composer/composer/issues/9690
+ if (\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
+ return true;
+ }
+
+ // Modern cross-platform function, includes the fstat fallback so if it is present we trust it
+ if (\function_exists('stream_isatty')) {
+ return stream_isatty($this->stream);
+ }
+
+ // Only trusting this if it is positive, otherwise prefer fstat fallback.
+ if (\function_exists('posix_isatty') && posix_isatty($this->stream)) {
+ return true;
+ }
+
+ $stat = @fstat($this->stream);
+
+ // Check if formatted mode is S_IFCHR
+ return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
}
}
diff --git a/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php b/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php
index 3f4d375f42dcb..b08503b3ab00e 100644
--- a/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php
+++ b/src/Symfony/Component/Console/Output/TrimmedBufferOutput.php
@@ -24,7 +24,7 @@ class TrimmedBufferOutput extends Output
private $maxLength;
private $buffer = '';
- public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
+ public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, ?OutputFormatterInterface $formatter = null)
{
if ($maxLength <= 0) {
throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php
index 3a73f04b2383d..ba574428377c5 100644
--- a/src/Symfony/Component/Console/Question/Question.php
+++ b/src/Symfony/Component/Console/Question/Question.php
@@ -186,7 +186,7 @@ public function getAutocompleterCallback(): ?callable
*
* @return $this
*/
- public function setAutocompleterCallback(callable $callback = null): self
+ public function setAutocompleterCallback(?callable $callback = null): self
{
if ($this->hidden && null !== $callback) {
throw new LogicException('A hidden question cannot use the autocompleter.');
@@ -202,7 +202,7 @@ public function setAutocompleterCallback(callable $callback = null): self
*
* @return $this
*/
- public function setValidator(callable $validator = null)
+ public function setValidator(?callable $validator = null)
{
$this->validator = $validator;
diff --git a/src/Symfony/Component/Console/SingleCommandApplication.php b/src/Symfony/Component/Console/SingleCommandApplication.php
index e93c1821b8a52..774e5d8c44359 100644
--- a/src/Symfony/Component/Console/SingleCommandApplication.php
+++ b/src/Symfony/Component/Console/SingleCommandApplication.php
@@ -46,7 +46,7 @@ public function setAutoExit(bool $autoExit): self
return $this;
}
- public function run(InputInterface $input = null, OutputInterface $output = null): int
+ public function run(?InputInterface $input = null, ?OutputInterface $output = null): int
{
if ($this->running) {
return parent::run($input, $output);
diff --git a/src/Symfony/Component/Console/Style/StyleInterface.php b/src/Symfony/Component/Console/Style/StyleInterface.php
index 38d23b77ebec6..9f25a43f6c42a 100644
--- a/src/Symfony/Component/Console/Style/StyleInterface.php
+++ b/src/Symfony/Component/Console/Style/StyleInterface.php
@@ -85,14 +85,14 @@ public function table(array $headers, array $rows);
*
* @return mixed
*/
- public function ask(string $question, string $default = null, callable $validator = null);
+ public function ask(string $question, ?string $default = null, ?callable $validator = null);
/**
* Asks a question with the user input hidden.
*
* @return mixed
*/
- public function askHidden(string $question, callable $validator = null);
+ public function askHidden(string $question, ?callable $validator = null);
/**
* Asks for confirmation.
diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php
index e3c5ac8e74460..00edf388276ea 100644
--- a/src/Symfony/Component/Console/Style/SymfonyStyle.php
+++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php
@@ -61,7 +61,7 @@ public function __construct(InputInterface $input, OutputInterface $output)
*
* @param string|array $messages The message to write in the block
*/
- public function block($messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
+ public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
{
$messages = \is_array($messages) ? array_values($messages) : [$messages];
@@ -250,7 +250,7 @@ public function definitionList(...$list)
/**
* {@inheritdoc}
*/
- public function ask(string $question, string $default = null, callable $validator = null)
+ public function ask(string $question, ?string $default = null, ?callable $validator = null)
{
$question = new Question($question, $default);
$question->setValidator($validator);
@@ -261,7 +261,7 @@ public function ask(string $question, string $default = null, callable $validato
/**
* {@inheritdoc}
*/
- public function askHidden(string $question, callable $validator = null)
+ public function askHidden(string $question, ?callable $validator = null)
{
$question = new Question($question);
@@ -338,7 +338,7 @@ public function createProgressBar(int $max = 0)
/**
* @see ProgressBar::iterate()
*/
- public function progressIterate(iterable $iterable, int $max = null): iterable
+ public function progressIterate(iterable $iterable, ?int $max = null): iterable
{
yield from $this->createProgressBar()->iterate($iterable, $max);
@@ -463,7 +463,7 @@ private function writeBuffer(string $message, bool $newLine, int $type): void
$this->bufferedOutput->write($message, $newLine, $type);
}
- private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
+ private function createBlock(iterable $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
{
$indentLength = 0;
$prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix));
diff --git a/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php b/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php
index 23f7a3bd9ddbd..a35927950d252 100644
--- a/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php
+++ b/src/Symfony/Component/Console/Tests/CI/GithubActionReporterTest.php
@@ -34,7 +34,7 @@ public function testIsGithubActionEnvironment()
/**
* @dataProvider annotationsFormatProvider
*/
- public function testAnnotationsFormat(string $type, string $message, string $file = null, int $line = null, int $col = null, string $expected)
+ public function testAnnotationsFormat(string $type, string $message, ?string $file, ?int $line, ?int $col, string $expected)
{
$reporter = new GithubActionReporter($buffer = new BufferedOutput());
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
index 0b1772107bbd7..21905f4750dd0 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
@@ -162,7 +162,7 @@ public function testInlineStyle()
/**
* @dataProvider provideInlineStyleOptionsCases
*/
- public function testInlineStyleOptions(string $tag, string $expected = null, string $input = null, bool $truecolor = false)
+ public function testInlineStyleOptions(string $tag, ?string $expected = null, ?string $input = null, bool $truecolor = false)
{
if ($truecolor && 'truecolor' !== getenv('COLORTERM')) {
$this->markTestSkipped('The terminal does not support true colors.');
diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
index 78d22939cd536..c83b9d5a37c2c 100644
--- a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
@@ -117,7 +117,7 @@ public function testIteration()
}
}
- private function getGenericMockHelper($name, HelperSet $helperset = null)
+ private function getGenericMockHelper($name, ?HelperSet $helperset = null)
{
$mock_helper = $this->createMock(HelperInterface::class);
$mock_helper->expects($this->any())
diff --git a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
index 943bcf628c586..55a840ac7c7a8 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
@@ -55,6 +55,20 @@ public function testShortcut()
$this->assertEquals('f|ff|fff', $option->getShortcut(), '__construct() removes the leading - of the shortcuts');
$option = new InputOption('foo');
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null by default');
+ $option = new InputOption('foo', '');
+ $this->assertNull($option->getShortcut(), '__construct() makes the shortcut null when given an empty string');
+ $option = new InputOption('foo', []);
+ $this->assertNull($option->getShortcut(), '__construct() makes the shortcut null when given an empty array');
+ $option = new InputOption('foo', ['f', '', 'fff']);
+ $this->assertEquals('f|fff', $option->getShortcut(), '__construct() removes empty shortcuts');
+ $option = new InputOption('foo', 'f||fff');
+ $this->assertEquals('f|fff', $option->getShortcut(), '__construct() removes empty shortcuts');
+ $option = new InputOption('foo', '0');
+ $this->assertEquals('0', $option->getShortcut(), '-0 is an acceptable shortcut value');
+ $option = new InputOption('foo', ['0', 'z']);
+ $this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in an array');
+ $option = new InputOption('foo', '0|z');
+ $this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in a string-list');
}
public function testModes()
diff --git a/src/Symfony/Component/CssSelector/Node/ElementNode.php b/src/Symfony/Component/CssSelector/Node/ElementNode.php
index fbf8ea0f99096..a1881975be17f 100644
--- a/src/Symfony/Component/CssSelector/Node/ElementNode.php
+++ b/src/Symfony/Component/CssSelector/Node/ElementNode.php
@@ -26,7 +26,7 @@ class ElementNode extends AbstractNode
private $namespace;
private $element;
- public function __construct(string $namespace = null, string $element = null)
+ public function __construct(?string $namespace = null, ?string $element = null)
{
$this->namespace = $namespace;
$this->element = $element;
diff --git a/src/Symfony/Component/CssSelector/Node/SelectorNode.php b/src/Symfony/Component/CssSelector/Node/SelectorNode.php
index 6e52b2fa720cf..cdb0e462b6daa 100644
--- a/src/Symfony/Component/CssSelector/Node/SelectorNode.php
+++ b/src/Symfony/Component/CssSelector/Node/SelectorNode.php
@@ -26,7 +26,7 @@ class SelectorNode extends AbstractNode
private $tree;
private $pseudoElement;
- public function __construct(NodeInterface $tree, string $pseudoElement = null)
+ public function __construct(NodeInterface $tree, ?string $pseudoElement = null)
{
$this->tree = $tree;
$this->pseudoElement = $pseudoElement ? strtolower($pseudoElement) : null;
diff --git a/src/Symfony/Component/CssSelector/Parser/Parser.php b/src/Symfony/Component/CssSelector/Parser/Parser.php
index d73489edfb481..b0b6427f7121c 100644
--- a/src/Symfony/Component/CssSelector/Parser/Parser.php
+++ b/src/Symfony/Component/CssSelector/Parser/Parser.php
@@ -29,7 +29,7 @@ class Parser implements ParserInterface
{
private $tokenizer;
- public function __construct(Tokenizer $tokenizer = null)
+ public function __construct(?Tokenizer $tokenizer = null)
{
$this->tokenizer = $tokenizer ?? new Tokenizer();
}
diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php
index 8ce4730360354..3d3ac7ac92b9a 100644
--- a/src/Symfony/Component/CssSelector/XPath/Translator.php
+++ b/src/Symfony/Component/CssSelector/XPath/Translator.php
@@ -48,7 +48,7 @@ class Translator implements TranslatorInterface
private $pseudoClassTranslators = [];
private $attributeMatchingTranslators = [];
- public function __construct(ParserInterface $parser = null)
+ public function __construct(?ParserInterface $parser = null)
{
$this->mainParser = $parser ?? new Parser();
diff --git a/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php b/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php
index c2afe2cfa2920..be86e21ab7d75 100644
--- a/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php
+++ b/src/Symfony/Component/DependencyInjection/Argument/BoundArgument.php
@@ -28,7 +28,7 @@ final class BoundArgument implements ArgumentInterface
private $type;
private $file;
- public function __construct($value, bool $trackUsage = true, int $type = 0, string $file = null)
+ public function __construct($value, bool $trackUsage = true, int $type = 0, ?string $file = null)
{
$this->value = $value;
if ($trackUsage) {
diff --git a/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php
index bc138fe239fd3..1aface4878cbb 100644
--- a/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php
+++ b/src/Symfony/Component/DependencyInjection/Argument/ServiceLocator.php
@@ -24,7 +24,7 @@ class ServiceLocator extends BaseServiceLocator
private $serviceMap;
private $serviceTypes;
- public function __construct(\Closure $factory, array $serviceMap, array $serviceTypes = null)
+ public function __construct(\Closure $factory, array $serviceMap, ?array $serviceTypes = null)
{
$this->factory = $factory;
$this->serviceMap = $serviceMap;
diff --git a/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php b/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php
index 1ba8de790b69e..cc6adc626d49a 100644
--- a/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php
+++ b/src/Symfony/Component/DependencyInjection/Argument/TaggedIteratorArgument.php
@@ -31,7 +31,7 @@ class TaggedIteratorArgument extends IteratorArgument
* @param bool $needsIndexes Whether indexes are required and should be generated when computing the map
* @param string|null $defaultPriorityMethod The static method that should be called to get each service's priority when their tag doesn't define the "priority" attribute
*/
- public function __construct(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, bool $needsIndexes = false, string $defaultPriorityMethod = null)
+ public function __construct(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, bool $needsIndexes = false, ?string $defaultPriorityMethod = null)
{
parent::__construct([]);
diff --git a/src/Symfony/Component/DependencyInjection/Attribute/AutoconfigureTag.php b/src/Symfony/Component/DependencyInjection/Attribute/AutoconfigureTag.php
index ed5807ca02670..a83a6e975ef6c 100644
--- a/src/Symfony/Component/DependencyInjection/Attribute/AutoconfigureTag.php
+++ b/src/Symfony/Component/DependencyInjection/Attribute/AutoconfigureTag.php
@@ -19,7 +19,7 @@
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
class AutoconfigureTag extends Autoconfigure
{
- public function __construct(string $name = null, array $attributes = [])
+ public function __construct(?string $name = null, array $attributes = [])
{
parent::__construct(
tags: [
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
index 0e679d21826ed..ef392a512da7c 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php
@@ -595,7 +595,7 @@ private function populateAutowiringAlias(string $id): void
}
}
- private function getCombinedAlias(string $type, string $name = null): ?string
+ private function getCombinedAlias(string $type, ?string $name = null): ?string
{
if (str_contains($type, '&')) {
$types = explode('&', $type);
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php
index 867a4a22412f2..2f5edde2df25b 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php
@@ -164,7 +164,7 @@ private function checkTypeDeclarations(Definition $checkedDefinition, \Reflectio
/**
* @throws InvalidParameterTypeException When a parameter is not compatible with the declared type
*/
- private function checkType(Definition $checkedDefinition, $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, \ReflectionType $reflectionType = null): void
+ private function checkType(Definition $checkedDefinition, $value, \ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, ?\ReflectionType $reflectionType = null): void
{
$reflectionType = $reflectionType ?? $parameter->getType();
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
index 2285f8ea5b784..b4528d67b90fe 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php
@@ -32,7 +32,7 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass
private $notInlinableIds = [];
private $graph;
- public function __construct(AnalyzeServiceReferencesPass $analyzingPass = null)
+ public function __construct(?AnalyzeServiceReferencesPass $analyzingPass = null)
{
$this->analyzingPass = $analyzingPass;
}
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
index 9dc39314cb619..0a07be8213e65 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php
@@ -153,7 +153,7 @@ class MergeExtensionConfigurationContainerBuilder extends ContainerBuilder
{
private $extensionClass;
- public function __construct(ExtensionInterface $extension, ParameterBagInterface $parameterBag = null)
+ public function __construct(ExtensionInterface $extension, ?ParameterBagInterface $parameterBag = null)
{
parent::__construct($parameterBag);
@@ -187,7 +187,7 @@ public function compile(bool $resolveEnvPlaceholders = false)
/**
* {@inheritdoc}
*/
- public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null)
+ public function resolveEnvPlaceholders($value, $format = null, ?array &$usedEnvs = null)
{
if (true !== $format || !\is_string($value)) {
return parent::resolveEnvPlaceholders($value, $format, $usedEnvs);
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php
index 44ef3a52e9046..f44622b166387 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceLocatorTagPass.php
@@ -104,7 +104,7 @@ protected function processValue($value, bool $isRoot = false)
/**
* @param Reference[] $refMap
*/
- public static function register(ContainerBuilder $container, array $refMap, string $callerId = null): Reference
+ public static function register(ContainerBuilder $container, array $refMap, ?string $callerId = null): Reference
{
foreach ($refMap as $id => $ref) {
if (!$ref instanceof Reference) {
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php
index 1225514c24f21..e67f03610832e 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php
@@ -74,7 +74,7 @@ public function clear()
/**
* Connects 2 nodes together in the Graph.
*/
- public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
+ public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, ?Reference $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
{
if (null === $sourceId || null === $destId) {
return;
diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php
index 6cb148e0ccd25..ced09e991ed0b 100644
--- a/src/Symfony/Component/DependencyInjection/Container.php
+++ b/src/Symfony/Component/DependencyInjection/Container.php
@@ -63,7 +63,7 @@ class Container implements ContainerInterface, ResetInterface
private $compiled = false;
private $getEnv;
- public function __construct(ParameterBagInterface $parameterBag = null)
+ public function __construct(?ParameterBagInterface $parameterBag = null)
{
$this->parameterBag = $parameterBag ?? new EnvPlaceholderParameterBag();
}
diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php
index e7b9d575ece50..23bf8b762cb7a 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php
@@ -21,5 +21,5 @@ interface ContainerAwareInterface
/**
* Sets the container.
*/
- public function setContainer(ContainerInterface $container = null);
+ public function setContainer(?ContainerInterface $container = null);
}
diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php
index b0727b32f9ec3..f5a5d30fc1edc 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php
@@ -23,7 +23,7 @@ trait ContainerAwareTrait
*/
protected $container;
- public function setContainer(ContainerInterface $container = null)
+ public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index e51691006e7c2..a9e61ab88121d 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -163,7 +163,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
'mixed' => true,
];
- public function __construct(ParameterBagInterface $parameterBag = null)
+ public function __construct(?ParameterBagInterface $parameterBag = null)
{
parent::__construct($parameterBag);
@@ -440,7 +440,7 @@ public function fileExists(string $path, $trackContents = true): bool
* @throws BadMethodCallException When this ContainerBuilder is compiled
* @throws \LogicException if the extension is not registered
*/
- public function loadFromExtension(string $extension, array $values = null)
+ public function loadFromExtension(string $extension, ?array $values = null)
{
if ($this->isCompiled()) {
throw new BadMethodCallException('Cannot load from an extension on a compiled container.');
@@ -553,7 +553,7 @@ public function get(string $id, int $invalidBehavior = ContainerInterface::EXCEP
return $this->doGet($id, $invalidBehavior);
}
- private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, bool $isConstructorArgument = false)
+ private function doGet(string $id, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?array &$inlineServices = null, bool $isConstructorArgument = false)
{
if (isset($inlineServices[$id])) {
return $inlineServices[$id];
@@ -900,7 +900,7 @@ public function getAlias(string $id)
*
* @return Definition
*/
- public function register(string $id, string $class = null)
+ public function register(string $id, ?string $class = null)
{
return $this->setDefinition($id, new Definition($class));
}
@@ -913,7 +913,7 @@ public function register(string $id, string $class = null)
*
* @return Definition
*/
- public function autowire(string $id, string $class = null)
+ public function autowire(string $id, ?string $class = null)
{
return $this->setDefinition($id, (new Definition($class))->setAutowired(true));
}
@@ -1037,7 +1037,7 @@ public function findDefinition(string $id)
* @throws RuntimeException When the service is a synthetic service
* @throws InvalidArgumentException When configure callable is not callable
*/
- private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, string $id = null, bool $tryProxy = true)
+ private function createService(Definition $definition, array &$inlineServices, bool $isConstructorArgument = false, ?string $id = null, bool $tryProxy = true)
{
if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) {
return $inlineServices[$h];
@@ -1353,7 +1353,7 @@ public function registerAttributeForAutoconfiguration(string $attributeClass, ca
* "$fooBar"-named arguments with $type as type-hint. Such arguments will
* receive the service $id when autowiring is used.
*/
- public function registerAliasForArgument(string $id, string $type, string $name = null): Alias
+ public function registerAliasForArgument(string $id, string $type, ?string $name = null): Alias
{
$name = (new Target($name ?? $id))->name;
@@ -1393,7 +1393,7 @@ public function getAutoconfiguredAttributes(): array
*
* @return mixed The value with env parameters resolved if a string or an array is passed
*/
- public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs = null)
+ public function resolveEnvPlaceholders($value, $format = null, ?array &$usedEnvs = null)
{
if (null === $format) {
$format = '%%env(%s)%%';
diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php
index 7fc6752554f70..749dac415cd2c 100644
--- a/src/Symfony/Component/DependencyInjection/Definition.php
+++ b/src/Symfony/Component/DependencyInjection/Definition.php
@@ -61,7 +61,7 @@ class Definition
*/
public $decorationOnInvalid;
- public function __construct(string $class = null, array $arguments = [])
+ public function __construct(?string $class = null, array $arguments = [])
{
if (null !== $class) {
$this->setClass($class);
@@ -135,7 +135,7 @@ public function getFactory()
*
* @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals
*/
- public function setDecoratedService(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
+ public function setDecoratedService(?string $id, ?string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE)
{
if ($renamedId && $id === $renamedId) {
throw new InvalidArgumentException(sprintf('The decorated service inner name for "%s" must be different than the service name itself.', $id));
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 66bf26879b70e..ae27c374ac85c 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -1031,7 +1031,7 @@ private function addInlineReference(string $id, Definition $definition, string $
return $code;
}
- private function addInlineService(string $id, Definition $definition, Definition $inlineDef = null, bool $forConstructor = true): string
+ private function addInlineService(string $id, Definition $definition, ?Definition $inlineDef = null, bool $forConstructor = true): string
{
$code = '';
@@ -1088,7 +1088,7 @@ private function addInlineService(string $id, Definition $definition, Definition
return $code;
}
- private function addServices(array &$services = null): string
+ private function addServices(?array &$services = null): string
{
$publicServices = $privateServices = '';
$definitions = $this->container->getDefinitions();
@@ -1130,7 +1130,7 @@ private function generateServiceFiles(array $services): iterable
}
}
- private function addNewInstance(Definition $definition, string $return = '', string $id = null): string
+ private function addNewInstance(Definition $definition, string $return = '', ?string $id = null): string
{
$tail = $return ? ";\n" : '';
@@ -1704,7 +1704,7 @@ private function getServiceConditionals($value): string
return implode(' && ', $conditions);
}
- private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = [], bool $byConstructor = null): \SplObjectStorage
+ private function getDefinitionsFromArguments(array $arguments, ?\SplObjectStorage $definitions = null, array &$calls = [], ?bool $byConstructor = null): \SplObjectStorage
{
if (null === $definitions) {
$definitions = new \SplObjectStorage();
@@ -1935,7 +1935,7 @@ private function dumpParameter(string $name): string
return sprintf('$this->parameters[%s]', $this->doExport($name));
}
- private function getServiceCall(string $id, Reference $reference = null): string
+ private function getServiceCall(string $id, ?Reference $reference = null): string
{
while ($this->container->hasAlias($id)) {
$id = (string) $this->container->getAlias($id);
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
index 823eb97b0e8ed..dbeb0db1e3521 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
@@ -317,7 +317,7 @@ private function dumpValue($value)
return $value;
}
- private function getServiceCall(string $id, Reference $reference = null): string
+ private function getServiceCall(string $id, ?Reference $reference = null): string
{
if (null !== $reference) {
switch ($reference->getInvalidBehavior()) {
diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
index 818174b3970c7..a9f88128cc009 100644
--- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
+++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
@@ -27,7 +27,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
/**
* @param EnvVarLoaderInterface[] $loaders
*/
- public function __construct(ContainerInterface $container, \Traversable $loaders = null)
+ public function __construct(ContainerInterface $container, ?\Traversable $loaders = null)
{
$this->container = $container;
$this->loaders = $loaders ?? new \ArrayIterator();
@@ -253,15 +253,15 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv)
}
if ('url' === $prefix) {
- $parsedEnv = parse_url($env);
+ $params = parse_url($env);
- if (false === $parsedEnv) {
+ if (false === $params) {
throw new RuntimeException(sprintf('Invalid URL in env var "%s".', $name));
}
- if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) {
+ if (!isset($params['scheme'], $params['host'])) {
throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, "%s" given.', $name, $env));
}
- $parsedEnv += [
+ $params += [
'port' => null,
'user' => null,
'pass' => null,
@@ -270,10 +270,13 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv)
'fragment' => null,
];
+ $params['user'] = null !== $params['user'] ? rawurldecode($params['user']) : null;
+ $params['pass'] = null !== $params['pass'] ? rawurldecode($params['pass']) : null;
+
// remove the '/' separator
- $parsedEnv['path'] = '/' === ($parsedEnv['path'] ?? '/') ? '' : substr($parsedEnv['path'], 1);
+ $params['path'] = '/' === ($params['path'] ?? '/') ? '' : substr($params['path'], 1);
- return $parsedEnv;
+ return $params;
}
if ('query_string' === $prefix) {
diff --git a/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php b/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php
index 0006f5621cbf2..f9c4ffa345a44 100644
--- a/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php
+++ b/src/Symfony/Component/DependencyInjection/Exception/AutowiringFailedException.php
@@ -19,13 +19,11 @@ class AutowiringFailedException extends RuntimeException
private $serviceId;
private $messageCallback;
- public function __construct(string $serviceId, $message = '', int $code = 0, \Throwable $previous = null)
+ public function __construct(string $serviceId, $message = '', int $code = 0, ?\Throwable $previous = null)
{
$this->serviceId = $serviceId;
- if ($message instanceof \Closure
- && (\function_exists('xdebug_is_enabled') ? xdebug_is_enabled() : \function_exists('xdebug_info'))
- ) {
+ if ($message instanceof \Closure && \function_exists('xdebug_is_enabled') && xdebug_is_enabled()) {
$message = $message();
}
diff --git a/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php b/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php
index 48b5e486ae71d..6cd53c9f738ba 100644
--- a/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php
+++ b/src/Symfony/Component/DependencyInjection/Exception/EnvParameterException.php
@@ -18,7 +18,7 @@
*/
class EnvParameterException extends InvalidArgumentException
{
- public function __construct(array $envs, \Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
+ public function __construct(array $envs, ?\Throwable $previous = null, string $message = 'Incompatible use of dynamic environment variables "%s" found in parameters.')
{
parent::__construct(sprintf($message, implode('", "', $envs)), 0, $previous);
}
diff --git a/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php b/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php
index 2450ccb5c797f..38438803e8ea7 100644
--- a/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php
+++ b/src/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php
@@ -20,7 +20,7 @@ class ParameterCircularReferenceException extends RuntimeException
{
private $parameters;
- public function __construct(array $parameters, \Throwable $previous = null)
+ public function __construct(array $parameters, ?\Throwable $previous = null)
{
parent::__construct(sprintf('Circular reference detected for parameter "%s" ("%s" > "%s").', $parameters[0], implode('" > "', $parameters), $parameters[0]), 0, $previous);
diff --git a/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php b/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php
index 5d38310141d1b..77c5792ee9198 100644
--- a/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php
+++ b/src/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php
@@ -34,7 +34,7 @@ class ParameterNotFoundException extends InvalidArgumentException implements Not
* @param string[] $alternatives Some parameter name alternatives
* @param string|null $nonNestedAlternative The alternative parameter name when the user expected dot notation for nested parameters
*/
- public function __construct(string $key, string $sourceId = null, string $sourceKey = null, \Throwable $previous = null, array $alternatives = [], string $nonNestedAlternative = null)
+ public function __construct(string $key, ?string $sourceId = null, ?string $sourceKey = null, ?\Throwable $previous = null, array $alternatives = [], ?string $nonNestedAlternative = null)
{
$this->key = $key;
$this->sourceId = $sourceId;
diff --git a/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php b/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php
index a38671bcf24bd..238471a1a5656 100644
--- a/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php
+++ b/src/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php
@@ -21,7 +21,7 @@ class ServiceCircularReferenceException extends RuntimeException
private $serviceId;
private $path;
- public function __construct(string $serviceId, array $path, \Throwable $previous = null)
+ public function __construct(string $serviceId, array $path, ?\Throwable $previous = null)
{
parent::__construct(sprintf('Circular reference detected for service "%s", path: "%s".', $serviceId, implode(' -> ', $path)), 0, $previous);
diff --git a/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php b/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php
index f91afae397d94..7cb46534dd9ec 100644
--- a/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php
+++ b/src/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php
@@ -24,7 +24,7 @@ class ServiceNotFoundException extends InvalidArgumentException implements NotFo
private $sourceId;
private $alternatives;
- public function __construct(string $id, string $sourceId = null, \Throwable $previous = null, array $alternatives = [], string $msg = null)
+ public function __construct(string $id, ?string $sourceId = null, ?\Throwable $previous = null, array $alternatives = [], ?string $msg = null)
{
if (null !== $msg) {
// no-op
diff --git a/src/Symfony/Component/DependencyInjection/ExpressionLanguage.php b/src/Symfony/Component/DependencyInjection/ExpressionLanguage.php
index 961c737e8d5c5..852797c23c74a 100644
--- a/src/Symfony/Component/DependencyInjection/ExpressionLanguage.php
+++ b/src/Symfony/Component/DependencyInjection/ExpressionLanguage.php
@@ -30,7 +30,7 @@ class ExpressionLanguage extends BaseExpressionLanguage
/**
* {@inheritdoc}
*/
- public function __construct(CacheItemPoolInterface $cache = null, array $providers = [], callable $serviceCompiler = null)
+ public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [], ?callable $serviceCompiler = null)
{
// prepend the default provider to let users override it easily
array_unshift($providers, new ExpressionLanguageProvider($serviceCompiler));
diff --git a/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php b/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php
index 9198ca0a40a9a..a62d64e8d82ec 100644
--- a/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php
+++ b/src/Symfony/Component/DependencyInjection/ExpressionLanguageProvider.php
@@ -26,7 +26,7 @@ class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
private $serviceCompiler;
- public function __construct(callable $serviceCompiler = null)
+ public function __construct(?callable $serviceCompiler = null)
{
$this->serviceCompiler = $serviceCompiler;
}
diff --git a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
index f33011ad1d84f..eb9fd65467ad5 100644
--- a/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
+++ b/src/Symfony/Component/DependencyInjection/LazyProxy/ProxyHelper.php
@@ -21,7 +21,7 @@ class ProxyHelper
/**
* @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context
*/
- public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false): ?string
+ public static function getTypeHint(\ReflectionFunctionAbstract $r, ?\ReflectionParameter $p = null, bool $noBuiltin = false): ?string
{
if ($p instanceof \ReflectionParameter) {
$type = $p->getType();
diff --git a/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php b/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php
index fe2b91a2a49f9..966668873d4c9 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php
@@ -25,7 +25,7 @@ class ClosureLoader extends Loader
{
private $container;
- public function __construct(ContainerBuilder $container, string $env = null)
+ public function __construct(ContainerBuilder $container, ?string $env = null)
{
$this->container = $container;
parent::__construct($env);
@@ -34,7 +34,7 @@ public function __construct(ContainerBuilder $container, string $env = null)
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
return $resource($this->container, $this->env);
}
@@ -42,7 +42,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
return $resource instanceof \Closure;
}
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php
index 96d6fd75a7764..178798ceae264 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/AbstractServiceConfigurator.php
@@ -20,7 +20,7 @@ abstract class AbstractServiceConfigurator extends AbstractConfigurator
protected $id;
private $defaultTags = [];
- public function __construct(ServicesConfigurator $parent, Definition $definition, string $id = null, array $defaultTags = [])
+ public function __construct(ServicesConfigurator $parent, Definition $definition, ?string $id = null, array $defaultTags = [])
{
$this->parent = $parent;
$this->definition = $definition;
@@ -42,7 +42,7 @@ public function __destruct()
/**
* Registers a service.
*/
- final public function set(?string $id, string $class = null): ServiceConfigurator
+ final public function set(?string $id, ?string $class = null): ServiceConfigurator
{
$this->__destruct();
@@ -106,7 +106,7 @@ final public function stack(string $id, array $services): AliasConfigurator
/**
* Registers a service.
*/
- final public function __invoke(string $id, string $class = null): ServiceConfigurator
+ final public function __invoke(string $id, ?string $class = null): ServiceConfigurator
{
$this->__destruct();
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php
index ac6fdb6d0030e..0efd54111df8c 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ContainerConfigurator.php
@@ -38,7 +38,7 @@ class ContainerConfigurator extends AbstractConfigurator
private $anonymousCount = 0;
private $env;
- public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, string $path, string $file, string $env = null)
+ public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, string $path, string $file, ?string $env = null)
{
$this->container = $container;
$this->loader = $loader;
@@ -58,7 +58,7 @@ final public function extension(string $namespace, array $config)
$this->container->loadFromExtension($namespace, static::processValue($config));
}
- final public function import(string $resource, string $type = null, $ignoreErrors = false)
+ final public function import(string $resource, ?string $type = null, $ignoreErrors = false)
{
$this->loader->setCurrentDir(\dirname($this->path));
$this->loader->import($resource, $type, $ignoreErrors, $this->file);
@@ -128,7 +128,7 @@ function service(string $serviceId): ReferenceConfigurator
*
* @deprecated since Symfony 5.1, use inline_service() instead.
*/
-function inline(string $class = null): InlineServiceConfigurator
+function inline(?string $class = null): InlineServiceConfigurator
{
trigger_deprecation('symfony/dependency-injection', '5.1', '"%s()" is deprecated, use "inline_service()" instead.', __FUNCTION__);
@@ -138,7 +138,7 @@ function inline(string $class = null): InlineServiceConfigurator
/**
* Creates an inline service.
*/
-function inline_service(string $class = null): InlineServiceConfigurator
+function inline_service(?string $class = null): InlineServiceConfigurator
{
return new InlineServiceConfigurator(new Definition($class));
}
@@ -166,7 +166,7 @@ function iterator(array $values): IteratorArgument
/**
* Creates a lazy iterator by tag name.
*/
-function tagged_iterator(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, string $defaultPriorityMethod = null): TaggedIteratorArgument
+function tagged_iterator(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, ?string $defaultPriorityMethod = null): TaggedIteratorArgument
{
return new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod, false, $defaultPriorityMethod);
}
@@ -174,7 +174,7 @@ function tagged_iterator(string $tag, string $indexAttribute = null, string $def
/**
* Creates a service locator by tag name.
*/
-function tagged_locator(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, string $defaultPriorityMethod = null): ServiceLocatorArgument
+function tagged_locator(string $tag, ?string $indexAttribute = null, ?string $defaultIndexMethod = null, ?string $defaultPriorityMethod = null): ServiceLocatorArgument
{
return new ServiceLocatorArgument(new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod, true, $defaultPriorityMethod));
}
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php
index e0b42750d55c3..db0e1c47e4386 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/DefaultsConfigurator.php
@@ -28,7 +28,7 @@ class DefaultsConfigurator extends AbstractServiceConfigurator
private $path;
- public function __construct(ServicesConfigurator $parent, Definition $definition, string $path = null)
+ public function __construct(ServicesConfigurator $parent, Definition $definition, ?string $path = null)
{
parent::__construct($parent, $definition, null, []);
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/InstanceofConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/InstanceofConfigurator.php
index fbba62304d28e..2f472db6559ab 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/InstanceofConfigurator.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/InstanceofConfigurator.php
@@ -32,7 +32,7 @@ class InstanceofConfigurator extends AbstractServiceConfigurator
private $path;
- public function __construct(ServicesConfigurator $parent, Definition $definition, string $id, string $path = null)
+ public function __construct(ServicesConfigurator $parent, Definition $definition, string $id, ?string $path = null)
{
parent::__construct($parent, $definition, $id, []);
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServiceConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServiceConfigurator.php
index 932ecd35153d5..92a92a760e653 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServiceConfigurator.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServiceConfigurator.php
@@ -47,7 +47,7 @@ class ServiceConfigurator extends AbstractServiceConfigurator
private $path;
private $destructed = false;
- public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, ?string $id, array $defaultTags, string $path = null)
+ public function __construct(ContainerBuilder $container, array $instanceof, bool $allowParent, ServicesConfigurator $parent, Definition $definition, ?string $id, array $defaultTags, ?string $path = null)
{
$this->container = $container;
$this->instanceof = $instanceof;
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php
index 388251e26a374..d18aad120f802 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/ServicesConfigurator.php
@@ -34,7 +34,7 @@ class ServicesConfigurator extends AbstractConfigurator
private $anonymousHash;
private $anonymousCount;
- public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, string $path = null, int &$anonymousCount = 0)
+ public function __construct(ContainerBuilder $container, PhpFileLoader $loader, array &$instanceof, ?string $path = null, int &$anonymousCount = 0)
{
$this->defaults = new Definition();
$this->container = $container;
@@ -70,7 +70,7 @@ final public function instanceof(string $fqcn): InstanceofConfigurator
* @param string|null $id The service id, or null to create an anonymous service
* @param string|null $class The class of the service, or null when $id is also the class name
*/
- final public function set(?string $id, string $class = null): ServiceConfigurator
+ final public function set(?string $id, ?string $class = null): ServiceConfigurator
{
$defaults = $this->defaults;
$definition = new Definition();
@@ -180,7 +180,7 @@ final public function stack(string $id, array $services): AliasConfigurator
/**
* Registers a service.
*/
- final public function __invoke(string $id, string $class = null): ServiceConfigurator
+ final public function __invoke(string $id, ?string $class = null): ServiceConfigurator
{
return $this->set($id, $class);
}
diff --git a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php
index b3a1ae1b54793..2209056ad44c4 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/Configurator/Traits/DecorateTrait.php
@@ -25,7 +25,7 @@ trait DecorateTrait
*
* @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals
*/
- final public function decorate(?string $id, string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): self
+ final public function decorate(?string $id, ?string $renamedId = null, int $priority = 0, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE): self
{
$this->definition->setDecoratedService($id, $renamedId, $priority, $invalidBehavior);
diff --git a/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php b/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php
index b4e9a5917c972..aed79ff43d232 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/DirectoryLoader.php
@@ -21,7 +21,7 @@ class DirectoryLoader extends FileLoader
/**
* {@inheritdoc}
*/
- public function load($file, string $type = null)
+ public function load($file, ?string $type = null)
{
$file = rtrim($file, '/');
$path = $this->locator->locate($file);
@@ -45,7 +45,7 @@ public function load($file, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
if ('directory' === $type) {
return true;
diff --git a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
index f5f78e30f0096..a63dbe1330d20 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
@@ -40,7 +40,7 @@ abstract class FileLoader extends BaseFileLoader
protected $singlyImplemented = [];
protected $autoRegisterAliasesForSinglyImplementedInterfaces = true;
- public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null)
+ public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, ?string $env = null)
{
$this->container = $container;
@@ -52,7 +52,7 @@ public function __construct(ContainerBuilder $container, FileLocatorInterface $l
*
* @param bool|string $ignoreErrors Whether errors should be ignored; pass "not_found" to ignore only when the loaded resource is not found
*/
- public function import($resource, string $type = null, $ignoreErrors = false, string $sourceResource = null, $exclude = null)
+ public function import($resource, ?string $type = null, $ignoreErrors = false, ?string $sourceResource = null, $exclude = null)
{
$args = \func_get_args();
diff --git a/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php
index e38aaf43bedab..5378dfcf992a4 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/GlobFileLoader.php
@@ -21,7 +21,7 @@ class GlobFileLoader extends FileLoader
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
foreach ($this->glob($resource, false, $globResource) as $path => $info) {
$this->import($path);
@@ -35,7 +35,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
return 'glob' === $type;
}
diff --git a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php
index d88d7a6307b86..4f0c35b5465d1 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php
@@ -24,7 +24,7 @@ class IniFileLoader extends FileLoader
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
$path = $this->locator->locate($resource);
@@ -57,7 +57,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
if (!\is_string($resource)) {
return false;
diff --git a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php
index 3815b28f00fba..245592c936652 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php
@@ -36,7 +36,7 @@ class PhpFileLoader extends FileLoader
protected $autoRegisterAliasesForSinglyImplementedInterfaces = false;
private $generator;
- public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, string $env = null, ConfigBuilderGeneratorInterface $generator = null)
+ public function __construct(ContainerBuilder $container, FileLocatorInterface $locator, ?string $env = null, ?ConfigBuilderGeneratorInterface $generator = null)
{
parent::__construct($container, $locator, $env);
$this->generator = $generator;
@@ -45,7 +45,7 @@ public function __construct(ContainerBuilder $container, FileLocatorInterface $l
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
// the container and loader variables are exposed to the included file below
$container = $this->container;
@@ -77,7 +77,7 @@ public function load($resource, string $type = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
if (!\is_string($resource)) {
return false;
diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
index 73b0f0deb37d2..7d52958809f62 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
@@ -43,7 +43,7 @@ class XmlFileLoader extends FileLoader
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
$path = $this->locator->locate($resource);
@@ -70,7 +70,7 @@ public function load($resource, string $type = null)
return null;
}
- private function loadXml(\DOMDocument $xml, string $path, \DOMNode $root = null): void
+ private function loadXml(\DOMDocument $xml, string $path, ?\DOMNode $root = null): void
{
$defaults = $this->getServiceDefaults($xml, $path, $root);
@@ -98,7 +98,7 @@ private function loadXml(\DOMDocument $xml, string $path, \DOMNode $root = null)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
if (!\is_string($resource)) {
return false;
@@ -111,14 +111,14 @@ public function supports($resource, string $type = null)
return 'xml' === $type;
}
- private function parseParameters(\DOMDocument $xml, string $file, \DOMNode $root = null)
+ private function parseParameters(\DOMDocument $xml, string $file, ?\DOMNode $root = null)
{
if ($parameters = $this->getChildren($root ?? $xml->documentElement, 'parameters')) {
$this->container->getParameterBag()->add($this->getArgumentsAsPhp($parameters[0], 'parameter', $file));
}
}
- private function parseImports(\DOMDocument $xml, string $file, \DOMNode $root = null)
+ private function parseImports(\DOMDocument $xml, string $file, ?\DOMNode $root = null)
{
$xpath = new \DOMXPath($xml);
$xpath->registerNamespace('container', self::NS);
@@ -134,7 +134,7 @@ private function parseImports(\DOMDocument $xml, string $file, \DOMNode $root =
}
}
- private function parseDefinitions(\DOMDocument $xml, string $file, Definition $defaults, \DOMNode $root = null)
+ private function parseDefinitions(\DOMDocument $xml, string $file, Definition $defaults, ?\DOMNode $root = null)
{
$xpath = new \DOMXPath($xml);
$xpath->registerNamespace('container', self::NS);
@@ -192,7 +192,7 @@ private function parseDefinitions(\DOMDocument $xml, string $file, Definition $d
}
}
- private function getServiceDefaults(\DOMDocument $xml, string $file, \DOMNode $root = null): Definition
+ private function getServiceDefaults(\DOMDocument $xml, string $file, ?\DOMNode $root = null): Definition
{
$xpath = new \DOMXPath($xml);
$xpath->registerNamespace('container', self::NS);
@@ -415,7 +415,7 @@ private function parseFileToDOM(string $file): \DOMDocument
/**
* Processes anonymous services.
*/
- private function processAnonymousServices(\DOMDocument $xml, string $file, \DOMNode $root = null)
+ private function processAnonymousServices(\DOMDocument $xml, string $file, ?\DOMNode $root = null)
{
$definitions = [];
$count = 0;
diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
index 2d9137cb5e40f..66e1cd84db52c 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php
@@ -116,7 +116,7 @@ class YamlFileLoader extends FileLoader
/**
* {@inheritdoc}
*/
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
$path = $this->locator->locate($resource);
@@ -183,7 +183,7 @@ private function loadContent(array $content, string $path)
/**
* {@inheritdoc}
*/
- public function supports($resource, string $type = null)
+ public function supports($resource, ?string $type = null)
{
if (!\is_string($resource)) {
return false;
diff --git a/src/Symfony/Component/DependencyInjection/ServiceLocator.php b/src/Symfony/Component/DependencyInjection/ServiceLocator.php
index 4be0d6f721f82..36eac64f03d65 100644
--- a/src/Symfony/Component/DependencyInjection/ServiceLocator.php
+++ b/src/Symfony/Component/DependencyInjection/ServiceLocator.php
@@ -134,7 +134,7 @@ private function createCircularReferenceException(string $id, array $path): Cont
return new ServiceCircularReferenceException($id, $path);
}
- private function formatAlternatives(array $alternatives = null, string $separator = 'and'): string
+ private function formatAlternatives(?array $alternatives = null, string $separator = 'and'): string
{
$format = '"%s"%s';
if (null === $alternatives) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
index fae8772193b32..66c04d09aea98 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php
@@ -239,7 +239,7 @@ public function testAliasDecoratedService()
/**
* @dataProvider getYamlCompileTests
*/
- public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, ContainerBuilder $mainContainer = null)
+ public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, ?ContainerBuilder $mainContainer = null)
{
// allow a container to be passed in, which might have autoconfigure settings
$container = $mainContainer ?? new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php
index 50828a47b4bb3..a0eb24d223945 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ValidateEnvPlaceholdersPassTest.php
@@ -365,7 +365,7 @@ class EnvExtension extends Extension
private $configuration;
private $config;
- public function __construct(ConfigurationInterface $configuration = null)
+ public function __construct(?ConfigurationInterface $configuration = null)
{
$this->configuration = $configuration ?? new EnvConfiguration();
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
index 02e34fc13e376..5dbaadcb17d64 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
@@ -299,12 +299,12 @@ class TestFileLoader extends FileLoader
{
public $autoRegisterAliasesForSinglyImplementedInterfaces = true;
- public function load($resource, string $type = null)
+ public function load($resource, ?string $type = null)
{
return $resource;
}
- public function supports($resource, string $type = null): bool
+ public function supports($resource, ?string $type = null): bool
{
return false;
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/GlobFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/GlobFileLoaderTest.php
index 2f45c844c568e..1ae959b5cecfd 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/GlobFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/GlobFileLoaderTest.php
@@ -38,7 +38,7 @@ public function testLoadAddsTheGlobResourceToTheContainer()
class GlobFileLoaderWithoutImport extends GlobFileLoader
{
- public function import($resource, string $type = null, $ignoreErrors = false, string $sourceResource = null, $exclude = null)
+ public function import($resource, ?string $type = null, $ignoreErrors = false, ?string $sourceResource = null, $exclude = null)
{
return null;
}
diff --git a/src/Symfony/Component/DependencyInjection/TypedReference.php b/src/Symfony/Component/DependencyInjection/TypedReference.php
index 4099a0059b133..d31a00388be3e 100644
--- a/src/Symfony/Component/DependencyInjection/TypedReference.php
+++ b/src/Symfony/Component/DependencyInjection/TypedReference.php
@@ -27,7 +27,7 @@ class TypedReference extends Reference
* @param int $invalidBehavior The behavior when the service does not exist
* @param string|null $name The name of the argument targeting the service
*/
- public function __construct(string $id, string $type, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, string $name = null)
+ public function __construct(string $id, string $type, int $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, ?string $name = null)
{
$this->name = $type === $id ? $name : null;
parent::__construct($id, $invalidBehavior);
diff --git a/src/Symfony/Component/DomCrawler/AbstractUriElement.php b/src/Symfony/Component/DomCrawler/AbstractUriElement.php
index 8ff0b992ac7d1..f4b0e0661bc78 100644
--- a/src/Symfony/Component/DomCrawler/AbstractUriElement.php
+++ b/src/Symfony/Component/DomCrawler/AbstractUriElement.php
@@ -40,7 +40,7 @@ abstract class AbstractUriElement
*
* @throws \InvalidArgumentException if the node is not a link
*/
- public function __construct(\DOMElement $node, string $currentUri = null, ?string $method = 'GET')
+ public function __construct(\DOMElement $node, ?string $currentUri = null, ?string $method = 'GET')
{
$this->setNode($node);
$this->method = $method ? strtoupper($method) : null;
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index 08baced5e9b88..a6c214add0964 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -81,7 +81,7 @@ class Crawler implements \Countable, \IteratorAggregate
/**
* @param \DOMNodeList|\DOMNode|\DOMNode[]|string|null $node A Node to use as the base for the crawling
*/
- public function __construct($node = null, string $uri = null, string $baseHref = null)
+ public function __construct($node = null, ?string $uri = null, ?string $baseHref = null)
{
$this->uri = $uri;
$this->baseHref = $baseHref ?: $uri;
@@ -153,7 +153,7 @@ public function add($node)
* or ISO-8859-1 as a fallback, which is the default charset defined by the
* HTTP 1.1 specification.
*/
- public function addContent(string $content, string $type = null)
+ public function addContent(string $content, ?string $type = null)
{
if (empty($type)) {
$type = str_starts_with($content, 'createSubCrawler(\array_slice($this->nodes, $offset, $length));
}
@@ -546,7 +546,7 @@ public function ancestors()
* @throws \InvalidArgumentException When current node is empty
* @throws \RuntimeException If the CssSelector Component is not available and $selector is provided
*/
- public function children(string $selector = null)
+ public function children(?string $selector = null)
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
@@ -610,7 +610,7 @@ public function nodeName()
*
* @throws \InvalidArgumentException When current node is empty
*/
- public function text(string $default = null, bool $normalizeWhitespace = true)
+ public function text(?string $default = null, bool $normalizeWhitespace = true)
{
if (!$this->nodes) {
if (null !== $default) {
@@ -646,7 +646,7 @@ public function innerText(): string
*
* @throws \InvalidArgumentException When current node is empty
*/
- public function html(string $default = null)
+ public function html(?string $default = null)
{
if (!$this->nodes) {
if (null !== $default) {
@@ -915,7 +915,7 @@ public function images()
*
* @throws \InvalidArgumentException If the current node list is empty or the selected node is not instance of DOMElement
*/
- public function form(array $values = null, string $method = null)
+ public function form(?array $values = null, ?string $method = null)
{
if (!$this->nodes) {
throw new \InvalidArgumentException('The current node list is empty.');
diff --git a/src/Symfony/Component/DomCrawler/Form.php b/src/Symfony/Component/DomCrawler/Form.php
index ebad35b3827fc..3b03b58694928 100644
--- a/src/Symfony/Component/DomCrawler/Form.php
+++ b/src/Symfony/Component/DomCrawler/Form.php
@@ -44,7 +44,7 @@ class Form extends Link implements \ArrayAccess
*
* @throws \LogicException if the node is not a button inside a form tag
*/
- public function __construct(\DOMElement $node, string $currentUri = null, string $method = null, string $baseHref = null)
+ public function __construct(\DOMElement $node, ?string $currentUri = null, ?string $method = null, ?string $baseHref = null)
{
parent::__construct($node, $currentUri, $method);
$this->baseHref = $baseHref;
diff --git a/src/Symfony/Component/DomCrawler/Image.php b/src/Symfony/Component/DomCrawler/Image.php
index b1ac5ca2ccb42..fb3a579369854 100644
--- a/src/Symfony/Component/DomCrawler/Image.php
+++ b/src/Symfony/Component/DomCrawler/Image.php
@@ -16,7 +16,7 @@
*/
class Image extends AbstractUriElement
{
- public function __construct(\DOMElement $node, string $currentUri = null)
+ public function __construct(\DOMElement $node, ?string $currentUri = null)
{
parent::__construct($node, $currentUri, 'GET');
}
diff --git a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTestCase.php b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTestCase.php
index 55178ca0e4538..831c2f060b012 100644
--- a/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTestCase.php
+++ b/src/Symfony/Component/DomCrawler/Tests/AbstractCrawlerTestCase.php
@@ -24,7 +24,7 @@ abstract class AbstractCrawlerTestCase extends TestCase
abstract public static function getDoctype(): string;
- protected function createCrawler($node = null, string $uri = null, string $baseHref = null)
+ protected function createCrawler($node = null, ?string $uri = null, ?string $baseHref = null)
{
return new Crawler($node, $uri, $baseHref);
}
diff --git a/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php b/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php
index 44110543f93d3..5b3b84e7a4d05 100644
--- a/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php
+++ b/src/Symfony/Component/Dotenv/Command/DotenvDumpCommand.php
@@ -33,7 +33,7 @@ final class DotenvDumpCommand extends Command
private $projectDir;
private $defaultEnv;
- public function __construct(string $projectDir, string $defaultEnv = null)
+ public function __construct(string $projectDir, ?string $defaultEnv = null)
{
$this->projectDir = $projectDir;
$this->defaultEnv = $defaultEnv;
diff --git a/src/Symfony/Component/Dotenv/Dotenv.php b/src/Symfony/Component/Dotenv/Dotenv.php
index 685df57d736f8..b454452608fe0 100644
--- a/src/Symfony/Component/Dotenv/Dotenv.php
+++ b/src/Symfony/Component/Dotenv/Dotenv.php
@@ -107,7 +107,7 @@ public function load(string $path, string ...$extraPaths): void
* @throws FormatException when a file has a syntax error
* @throws PathException when a file does not exist or is not readable
*/
- public function loadEnv(string $path, string $envKey = null, string $defaultEnv = 'dev', array $testEnvs = ['test'], bool $overrideExistingVars = false): void
+ public function loadEnv(string $path, ?string $envKey = null, string $defaultEnv = 'dev', array $testEnvs = ['test'], bool $overrideExistingVars = false): void
{
$k = $envKey ?? $this->envKey;
diff --git a/src/Symfony/Component/Dotenv/Exception/FormatException.php b/src/Symfony/Component/Dotenv/Exception/FormatException.php
index 3ac77e592d6a1..358fbaab01a46 100644
--- a/src/Symfony/Component/Dotenv/Exception/FormatException.php
+++ b/src/Symfony/Component/Dotenv/Exception/FormatException.php
@@ -20,7 +20,7 @@ final class FormatException extends \LogicException implements ExceptionInterfac
{
private $context;
- public function __construct(string $message, FormatExceptionContext $context, int $code = 0, \Throwable $previous = null)
+ public function __construct(string $message, FormatExceptionContext $context, int $code = 0, ?\Throwable $previous = null)
{
$this->context = $context;
diff --git a/src/Symfony/Component/Dotenv/Exception/PathException.php b/src/Symfony/Component/Dotenv/Exception/PathException.php
index 4a4d71722223d..e432b2e33a8bf 100644
--- a/src/Symfony/Component/Dotenv/Exception/PathException.php
+++ b/src/Symfony/Component/Dotenv/Exception/PathException.php
@@ -18,7 +18,7 @@
*/
final class PathException extends \RuntimeException implements ExceptionInterface
{
- public function __construct(string $path, int $code = 0, \Throwable $previous = null)
+ public function __construct(string $path, int $code = 0, ?\Throwable $previous = null)
{
parent::__construct(sprintf('Unable to read the "%s" environment file.', $path), $code, $previous);
}
diff --git a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
index 844dbd6d23e85..d5e81052ce6f3 100644
--- a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
+++ b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php
@@ -301,7 +301,7 @@ public function loadClass(string $class): void
$this->checkClass($class, $file);
}
- private function checkClass(string $class, string $file = null): void
+ private function checkClass(string $class, ?string $file = null): void
{
$exists = null === $file || class_exists($class, false) || interface_exists($class, false) || trait_exists($class, false);
@@ -763,7 +763,7 @@ private function getOwnInterfaces(string $class, ?string $parent): array
return $ownInterfaces;
}
- private function setReturnType(string $types, string $class, string $method, string $filename, ?string $parent, \ReflectionType $returnType = null): void
+ private function setReturnType(string $types, string $class, string $method, string $filename, ?string $parent, ?\ReflectionType $returnType = null): void
{
if ('__construct' === $method) {
return;
diff --git a/src/Symfony/Component/ErrorHandler/Error/FatalError.php b/src/Symfony/Component/ErrorHandler/Error/FatalError.php
index 57fc690e26d6c..73fa3aaa0e6b8 100644
--- a/src/Symfony/Component/ErrorHandler/Error/FatalError.php
+++ b/src/Symfony/Component/ErrorHandler/Error/FatalError.php
@@ -20,7 +20,7 @@ class FatalError extends \Error
*
* @param array $error An array as returned by error_get_last()
*/
- public function __construct(string $message, int $code, array $error, int $traceOffset = null, bool $traceArgs = true, array $trace = null)
+ public function __construct(string $message, int $code, array $error, ?int $traceOffset = null, bool $traceArgs = true, ?array $trace = null)
{
parent::__construct($message, $code);
diff --git a/src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php b/src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php
index f85d275151a52..4e1ae8e86a83f 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorEnhancer/ClassNotFoundErrorEnhancer.php
@@ -21,9 +21,6 @@
*/
class ClassNotFoundErrorEnhancer implements ErrorEnhancerInterface
{
- /**
- * {@inheritdoc}
- */
public function enhance(\Throwable $error): ?\Throwable
{
// Some specific versions of PHP produce a fatal error when extending a not found class.
@@ -110,7 +107,8 @@ private function getClassCandidates(string $class): array
private function findClassInPath(string $path, string $class, string $prefix): array
{
- if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
+ $path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path);
+ if (!$path || !is_dir($path)) {
return [];
}
diff --git a/src/Symfony/Component/ErrorHandler/ErrorHandler.php b/src/Symfony/Component/ErrorHandler/ErrorHandler.php
index 003040242f39c..d7b90439a5a5c 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorHandler.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorHandler.php
@@ -108,7 +108,7 @@ class ErrorHandler
/**
* Registers the error handler.
*/
- public static function register(self $handler = null, bool $replace = true): self
+ public static function register(?self $handler = null, bool $replace = true): self
{
if (null === self::$reservedMemory) {
self::$reservedMemory = str_repeat('x', 32768);
@@ -181,7 +181,7 @@ public static function call(callable $function, ...$arguments)
}
}
- public function __construct(BufferingLogger $bootstrappingLogger = null, bool $debug = false)
+ public function __construct(?BufferingLogger $bootstrappingLogger = null, bool $debug = false)
{
if ($bootstrappingLogger) {
$this->bootstrappingLogger = $bootstrappingLogger;
@@ -633,7 +633,7 @@ public function handleException(\Throwable $exception)
*
* @internal
*/
- public static function handleFatalError(array $error = null): void
+ public static function handleFatalError(?array $error = null): void
{
if (null === self::$reservedMemory) {
return;
diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php
index 92434b8e94506..80b65ad8b3501 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php
@@ -47,7 +47,7 @@ class HtmlErrorRenderer implements ErrorRendererInterface
* @param string|FileLinkFormatter|null $fileLinkFormat
* @param bool|callable $outputBuffer The output buffer as a string or a callable that should return it
*/
- public function __construct($debug = false, string $charset = null, $fileLinkFormat = null, string $projectDir = null, $outputBuffer = '', LoggerInterface $logger = null)
+ public function __construct($debug = false, ?string $charset = null, $fileLinkFormat = null, ?string $projectDir = null, $outputBuffer = '', ?LoggerInterface $logger = null)
{
if (!\is_bool($debug) && !\is_callable($debug)) {
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \gettype($debug)));
@@ -173,6 +173,8 @@ private function formatArgs(array $args): string
$formattedValue = ''.strtolower(var_export($item[1], true)).' ';
} elseif ('resource' === $item[0]) {
$formattedValue = 'resource ';
+ } elseif (preg_match('/[^\x07-\x0D\x1B\x20-\xFF]/', $item[1])) {
+ $formattedValue = 'binary string ';
} else {
$formattedValue = str_replace("\n", '', $this->escape(var_export($item[1], true)));
}
@@ -233,7 +235,7 @@ private function getFileLink(string $file, int $line)
* @param int $line The line number
* @param string $text Use this text for the link rather than the file path
*/
- private function formatFile(string $file, int $line, string $text = null): string
+ private function formatFile(string $file, int $line, ?string $text = null): string
{
$file = trim($file);
diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php
index 4d1e752dc1ffe..e6c4c898e19df 100644
--- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php
+++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php
@@ -34,7 +34,7 @@ class SerializerErrorRenderer implements ErrorRendererInterface
* formats not supported by Request::getMimeTypes() should be given as mime types
* @param bool|callable $debug The debugging mode as a boolean or a callable that should return it
*/
- public function __construct(SerializerInterface $serializer, $format, ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false)
+ public function __construct(SerializerInterface $serializer, $format, ?ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false)
{
if (!\is_string($format) && !\is_callable($format)) {
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be a string or a callable, "%s" given.', __METHOD__, \gettype($format)));
diff --git a/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php b/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php
index 262dae62bcbf0..f73842ad8f721 100644
--- a/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php
+++ b/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php
@@ -63,7 +63,7 @@ class FlattenException
/**
* @return static
*/
- public static function create(\Exception $exception, int $statusCode = null, array $headers = []): self
+ public static function create(\Exception $exception, ?int $statusCode = null, array $headers = []): self
{
return static::createFromThrowable($exception, $statusCode, $headers);
}
@@ -71,7 +71,7 @@ public static function create(\Exception $exception, int $statusCode = null, arr
/**
* @return static
*/
- public static function createFromThrowable(\Throwable $exception, int $statusCode = null, array $headers = []): self
+ public static function createFromThrowable(\Throwable $exception, ?int $statusCode = null, array $headers = []): self
{
$e = new static();
$e->setMessage($exception->getMessage());
diff --git a/src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php b/src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php
index 6680b95a0cc3d..1ae12d5e74dc2 100644
--- a/src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php
+++ b/src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php
@@ -54,4 +54,45 @@ public static function getRenderData(): iterable
$expectedNonDebug,
];
}
+
+ public function testRendersStackWithoutBinaryStrings()
+ {
+ if (\PHP_VERSION_ID >= 70400) {
+ // make sure method arguments are available in stack traces (see https://www.php.net/manual/en/ini.core.php)
+ ini_set('zend.exception_ignore_args', false);
+ }
+
+ $binaryData = file_get_contents(__DIR__.'/../Fixtures/pixel.png');
+ $exception = $this->getRuntimeException($binaryData);
+
+ $rendered = (new HtmlErrorRenderer(true))->render($exception)->getAsString();
+
+ $this->assertStringContainsString(
+ "buildRuntimeException('FooException')",
+ $rendered,
+ '->render() contains the method call with "FooException"'
+ );
+
+ $this->assertStringContainsString(
+ 'getRuntimeException(binary string)',
+ $rendered,
+ '->render() contains the method call with "binary string" replacement'
+ );
+
+ $this->assertStringContainsString(
+ 'binary string ',
+ $rendered,
+ '->render() returns the HTML content with "binary string" replacement'
+ );
+ }
+
+ private function getRuntimeException(string $unusedArgument): \RuntimeException
+ {
+ return $this->buildRuntimeException('FooException');
+ }
+
+ private function buildRuntimeException(string $message): \RuntimeException
+ {
+ return new \RuntimeException($message);
+ }
}
diff --git a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/pixel.png b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/pixel.png
new file mode 100644
index 0000000000000..35269f61fcde4
Binary files /dev/null and b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/pixel.png differ
diff --git a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
index acfbf619c4f97..84d6a08a14a5b 100644
--- a/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
@@ -42,7 +42,7 @@ class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterfa
private $requestStack;
private $currentRequestHash = '';
- public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null, RequestStack $requestStack = null)
+ public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, ?LoggerInterface $logger = null, ?RequestStack $requestStack = null)
{
$this->dispatcher = $dispatcher;
$this->stopwatch = $stopwatch;
@@ -97,7 +97,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
/**
* {@inheritdoc}
*/
- public function getListeners(string $eventName = null)
+ public function getListeners(?string $eventName = null)
{
return $this->dispatcher->getListeners($eventName);
}
@@ -123,7 +123,7 @@ public function getListenerPriority(string $eventName, $listener)
/**
* {@inheritdoc}
*/
- public function hasListeners(string $eventName = null)
+ public function hasListeners(?string $eventName = null)
{
return $this->dispatcher->hasListeners($eventName);
}
@@ -131,7 +131,7 @@ public function hasListeners(string $eventName = null)
/**
* {@inheritdoc}
*/
- public function dispatch(object $event, string $eventName = null): object
+ public function dispatch(object $event, ?string $eventName = null): object
{
$eventName = $eventName ?? \get_class($event);
@@ -171,7 +171,7 @@ public function dispatch(object $event, string $eventName = null): object
/**
* @return array
*/
- public function getCalledListeners(Request $request = null)
+ public function getCalledListeners(?Request $request = null)
{
if (null === $this->callStack) {
return [];
@@ -192,7 +192,7 @@ public function getCalledListeners(Request $request = null)
/**
* @return array
*/
- public function getNotCalledListeners(Request $request = null)
+ public function getNotCalledListeners(?Request $request = null)
{
try {
$allListeners = $this->getListeners();
@@ -235,7 +235,7 @@ public function getNotCalledListeners(Request $request = null)
return $notCalled;
}
- public function getOrphanedEvents(Request $request = null): array
+ public function getOrphanedEvents(?Request $request = null): array
{
if ($request) {
return $this->orphanedEvents[spl_object_hash($request)] ?? [];
diff --git a/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php b/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
index 3c4cc13352c4c..80d49a168b701 100644
--- a/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
+++ b/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
@@ -33,7 +33,7 @@ final class WrappedListener
private $priority;
private static $hasClassStub;
- public function __construct($listener, ?string $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null)
+ public function __construct($listener, ?string $name, Stopwatch $stopwatch, ?EventDispatcherInterface $dispatcher = null)
{
$this->listener = $listener;
$this->optimizedListener = $listener instanceof \Closure ? $listener : (\is_callable($listener) ? \Closure::fromCallable($listener) : null);
diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php
index 8fe8fb5c299af..9c86bd95c76ad 100644
--- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php
@@ -45,7 +45,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function dispatch(object $event, string $eventName = null): object
+ public function dispatch(object $event, ?string $eventName = null): object
{
$eventName = $eventName ?? \get_class($event);
@@ -65,7 +65,7 @@ public function dispatch(object $event, string $eventName = null): object
/**
* {@inheritdoc}
*/
- public function getListeners(string $eventName = null)
+ public function getListeners(?string $eventName = null)
{
if (null !== $eventName) {
if (empty($this->listeners[$eventName])) {
@@ -120,7 +120,7 @@ public function getListenerPriority(string $eventName, $listener)
/**
* {@inheritdoc}
*/
- public function hasListeners(string $eventName = null)
+ public function hasListeners(?string $eventName = null)
{
if (null !== $eventName) {
return !empty($this->listeners[$eventName]);
diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php
index cc324e1c6160c..4b65e5a66a916 100644
--- a/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php
+++ b/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php
@@ -50,7 +50,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber);
*
* @return array
*/
- public function getListeners(string $eventName = null);
+ public function getListeners(?string $eventName = null);
/**
* Gets the listener priority for a specific event.
@@ -66,5 +66,5 @@ public function getListenerPriority(string $eventName, callable $listener);
*
* @return bool
*/
- public function hasListeners(string $eventName = null);
+ public function hasListeners(?string $eventName = null);
}
diff --git a/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php
index 568d79c3a2916..4e00bfa455fc3 100644
--- a/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php
@@ -28,7 +28,7 @@ public function __construct(EventDispatcherInterface $dispatcher)
/**
* {@inheritdoc}
*/
- public function dispatch(object $event, string $eventName = null): object
+ public function dispatch(object $event, ?string $eventName = null): object
{
return $this->dispatcher->dispatch($event, $eventName);
}
@@ -68,7 +68,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber)
/**
* {@inheritdoc}
*/
- public function getListeners(string $eventName = null)
+ public function getListeners(?string $eventName = null)
{
return $this->dispatcher->getListeners($eventName);
}
@@ -84,7 +84,7 @@ public function getListenerPriority(string $eventName, $listener)
/**
* {@inheritdoc}
*/
- public function hasListeners(string $eventName = null)
+ public function hasListeners(?string $eventName = null)
{
return $this->dispatcher->hasListeners($eventName);
}
diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php b/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php
index 2bc17b4403ddf..de841fd517602 100644
--- a/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php
+++ b/src/Symfony/Component/ExpressionLanguage/ExpressionFunction.php
@@ -81,7 +81,7 @@ public function getEvaluator()
* @throws \InvalidArgumentException if given PHP function name is in namespace
* and expression function name is not defined
*/
- public static function fromPhp(string $phpFunctionName, string $expressionFunctionName = null)
+ public static function fromPhp(string $phpFunctionName, ?string $expressionFunctionName = null)
{
$phpFunctionName = ltrim($phpFunctionName, '\\');
if (!\function_exists($phpFunctionName)) {
diff --git a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
index 001f49d36262c..69ea781f6afdf 100644
--- a/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
+++ b/src/Symfony/Component/ExpressionLanguage/ExpressionLanguage.php
@@ -34,7 +34,7 @@ class ExpressionLanguage
/**
* @param ExpressionFunctionProviderInterface[] $providers
*/
- public function __construct(CacheItemPoolInterface $cache = null, array $providers = [])
+ public function __construct(?CacheItemPoolInterface $cache = null, array $providers = [])
{
$this->cache = $cache ?? new ArrayAdapter();
$this->registerFunctions();
diff --git a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php
index a8d68f924241a..b347d20f8462c 100644
--- a/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php
+++ b/src/Symfony/Component/ExpressionLanguage/Node/ArrayNode.php
@@ -27,7 +27,7 @@ public function __construct()
$this->index = -1;
}
- public function addElement(Node $value, Node $key = null)
+ public function addElement(Node $value, ?Node $key = null)
{
if (null === $key) {
$key = new ConstantNode(++$this->index);
diff --git a/src/Symfony/Component/ExpressionLanguage/SyntaxError.php b/src/Symfony/Component/ExpressionLanguage/SyntaxError.php
index 0bfd7e9977727..e165dc22a0d72 100644
--- a/src/Symfony/Component/ExpressionLanguage/SyntaxError.php
+++ b/src/Symfony/Component/ExpressionLanguage/SyntaxError.php
@@ -13,7 +13,7 @@
class SyntaxError extends \LogicException
{
- public function __construct(string $message, int $cursor = 0, string $expression = '', string $subject = null, array $proposals = null)
+ public function __construct(string $message, int $cursor = 0, string $expression = '', ?string $subject = null, ?array $proposals = null)
{
$message = sprintf('%s around position %d', rtrim($message, '.'), $cursor);
if ($expression) {
diff --git a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
index d98091adea460..7c02289c0d950 100644
--- a/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
+++ b/src/Symfony/Component/ExpressionLanguage/Tests/ParserTest.php
@@ -243,7 +243,7 @@ public function testNameProposal()
/**
* @dataProvider getLintData
*/
- public function testLint($expression, $names, string $exception = null)
+ public function testLint($expression, $names, ?string $exception = null)
{
if ($exception) {
$this->expectException(SyntaxError::class);
diff --git a/src/Symfony/Component/ExpressionLanguage/Token.php b/src/Symfony/Component/ExpressionLanguage/Token.php
index 3df869f07147b..e2e1a5c7dd9e4 100644
--- a/src/Symfony/Component/ExpressionLanguage/Token.php
+++ b/src/Symfony/Component/ExpressionLanguage/Token.php
@@ -56,7 +56,7 @@ public function __toString()
*
* @return bool
*/
- public function test(string $type, string $value = null)
+ public function test(string $type, ?string $value = null)
{
return $this->type === $type && (null === $value || $this->value == $value);
}
diff --git a/src/Symfony/Component/ExpressionLanguage/TokenStream.php b/src/Symfony/Component/ExpressionLanguage/TokenStream.php
index 130513bbf8d21..8814e6c00e270 100644
--- a/src/Symfony/Component/ExpressionLanguage/TokenStream.php
+++ b/src/Symfony/Component/ExpressionLanguage/TokenStream.php
@@ -58,7 +58,7 @@ public function next()
/**
* @param string|null $message The syntax error message
*/
- public function expect(string $type, string $value = null, string $message = null)
+ public function expect(string $type, ?string $value = null, ?string $message = null)
{
$token = $this->current;
if (!$token->test($type, $value)) {
diff --git a/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php b/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php
index 48b6408095a13..06b732b1685c8 100644
--- a/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php
+++ b/src/Symfony/Component/Filesystem/Exception/FileNotFoundException.php
@@ -19,7 +19,7 @@
*/
class FileNotFoundException extends IOException
{
- public function __construct(string $message = null, int $code = 0, \Throwable $previous = null, string $path = null)
+ public function __construct(?string $message = null, int $code = 0, ?\Throwable $previous = null, ?string $path = null)
{
if (null === $message) {
if (null === $path) {
diff --git a/src/Symfony/Component/Filesystem/Exception/IOException.php b/src/Symfony/Component/Filesystem/Exception/IOException.php
index fea26e4ddc40c..44254a819d4eb 100644
--- a/src/Symfony/Component/Filesystem/Exception/IOException.php
+++ b/src/Symfony/Component/Filesystem/Exception/IOException.php
@@ -22,7 +22,7 @@ class IOException extends \RuntimeException implements IOExceptionInterface
{
private $path;
- public function __construct(string $message, int $code = 0, \Throwable $previous = null, string $path = null)
+ public function __construct(string $message, int $code = 0, ?\Throwable $previous = null, ?string $path = null)
{
$this->path = $path;
diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php
index 23192bc74c237..037629f18919d 100644
--- a/src/Symfony/Component/Filesystem/Filesystem.php
+++ b/src/Symfony/Component/Filesystem/Filesystem.php
@@ -132,7 +132,7 @@ public function exists($files)
*
* @throws IOException When touch fails
*/
- public function touch($files, int $time = null, int $atime = null)
+ public function touch($files, ?int $time = null, ?int $atime = null)
{
foreach ($this->toIterable($files) as $file) {
if (!($time ? self::box('touch', $file, $time, $atime) : self::box('touch', $file))) {
@@ -534,7 +534,7 @@ public function makePathRelative(string $endPath, string $startPath)
*
* @throws IOException When file type is unknown
*/
- public function mirror(string $originDir, string $targetDir, \Traversable $iterator = null, array $options = [])
+ public function mirror(string $originDir, string $targetDir, ?\Traversable $iterator = null, array $options = [])
{
$targetDir = rtrim($targetDir, '/\\');
$originDir = rtrim($originDir, '/\\');
diff --git a/src/Symfony/Component/Filesystem/Path.php b/src/Symfony/Component/Filesystem/Path.php
index 9aa37355a8555..858e1623eb2cd 100644
--- a/src/Symfony/Component/Filesystem/Path.php
+++ b/src/Symfony/Component/Filesystem/Path.php
@@ -257,7 +257,7 @@ public static function getRoot(string $path): string
* @param string|null $extension if specified, only that extension is cut
* off (may contain leading dot)
*/
- public static function getFilenameWithoutExtension(string $path, string $extension = null): string
+ public static function getFilenameWithoutExtension(string $path, ?string $extension = null): string
{
if ('' === $path) {
return '';
diff --git a/src/Symfony/Component/Finder/Comparator/Comparator.php b/src/Symfony/Component/Finder/Comparator/Comparator.php
index 3af551f4cc4ac..23cf94ecc72ce 100644
--- a/src/Symfony/Component/Finder/Comparator/Comparator.php
+++ b/src/Symfony/Component/Finder/Comparator/Comparator.php
@@ -19,7 +19,7 @@ class Comparator
private $target;
private $operator = '==';
- public function __construct(string $target = null, string $operator = '==')
+ public function __construct(?string $target = null, string $operator = '==')
{
if (null === $target) {
trigger_deprecation('symfony/finder', '5.4', 'Constructing a "%s" without setting "$target" is deprecated.', __CLASS__);
diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php
index 1ffdd469fcec1..03ae96f0736ba 100644
--- a/src/Symfony/Component/Form/Button.php
+++ b/src/Symfony/Component/Form/Button.php
@@ -114,7 +114,7 @@ public function offsetUnset($offset)
/**
* {@inheritdoc}
*/
- public function setParent(FormInterface $parent = null)
+ public function setParent(?FormInterface $parent = null)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot set the parent of a submitted button.');
@@ -140,7 +140,7 @@ public function getParent()
*
* @throws BadMethodCallException
*/
- public function add($child, string $type = null, array $options = [])
+ public function add($child, ?string $type = null, array $options = [])
{
throw new BadMethodCallException('Buttons cannot have children.');
}
@@ -414,7 +414,7 @@ public function isRoot()
/**
* {@inheritdoc}
*/
- public function createView(FormView $parent = null)
+ public function createView(?FormView $parent = null)
{
if (null === $parent && $this->parent) {
$parent = $this->parent->createView();
diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php
index c85bcc0d9e344..3c6b0be18cbd9 100644
--- a/src/Symfony/Component/Form/ButtonBuilder.php
+++ b/src/Symfony/Component/Form/ButtonBuilder.php
@@ -71,7 +71,7 @@ public function __construct(?string $name, array $options = [])
*
* @throws BadMethodCallException
*/
- public function add($child, string $type = null, array $options = [])
+ public function add($child, ?string $type = null, array $options = [])
{
throw new BadMethodCallException('Buttons cannot have children.');
}
@@ -81,7 +81,7 @@ public function add($child, string $type = null, array $options = [])
*
* @throws BadMethodCallException
*/
- public function create(string $name, string $type = null, array $options = [])
+ public function create(string $name, ?string $type = null, array $options = [])
{
throw new BadMethodCallException('Buttons cannot have children.');
}
@@ -221,7 +221,7 @@ public function setAttributes(array $attributes)
*
* @throws BadMethodCallException
*/
- public function setDataMapper(DataMapperInterface $dataMapper = null)
+ public function setDataMapper(?DataMapperInterface $dataMapper = null)
{
throw new BadMethodCallException('Buttons do not support data mappers.');
}
diff --git a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
index e5056d897fc9d..c3b38e6e62856 100644
--- a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
+++ b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
@@ -57,7 +57,7 @@ class ArrayChoiceList implements ChoiceListInterface
* incrementing integers are used as
* values
*/
- public function __construct(iterable $choices, callable $value = null)
+ public function __construct(iterable $choices, ?callable $value = null)
{
if ($choices instanceof \Traversable) {
$choices = iterator_to_array($choices);
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php
index 83b2ca0aa2ab4..eb137f5021d48 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/Cache/ChoiceLoader.php
@@ -29,7 +29,7 @@ final class ChoiceLoader extends AbstractStaticOption implements ChoiceLoaderInt
/**
* {@inheritdoc}
*/
- public function loadChoiceList(callable $value = null): ChoiceListInterface
+ public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
return $this->getOption()->loadChoiceList($value);
}
@@ -37,7 +37,7 @@ public function loadChoiceList(callable $value = null): ChoiceListInterface
/**
* {@inheritdoc}
*/
- public function loadChoicesForValues(array $values, callable $value = null): array
+ public function loadChoicesForValues(array $values, ?callable $value = null): array
{
return $this->getOption()->loadChoicesForValues($values, $value);
}
@@ -45,7 +45,7 @@ public function loadChoicesForValues(array $values, callable $value = null): arr
/**
* {@inheritdoc}
*/
- public function loadValuesForChoices(array $choices, callable $value = null): array
+ public function loadValuesForChoices(array $choices, ?callable $value = null): array
{
return $this->getOption()->loadValuesForChoices($choices, $value);
}
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
index 1c08d812a937f..c6c654b6f8a4b 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
@@ -35,7 +35,7 @@ interface ChoiceListFactoryInterface
*
* @return ChoiceListInterface
*/
- public function createListFromChoices(iterable $choices, callable $value = null/* , callable $filter = null */);
+ public function createListFromChoices(iterable $choices, ?callable $value = null/* , callable $filter = null */);
/**
* Creates a choice list that is loaded with the given loader.
@@ -48,7 +48,7 @@ public function createListFromChoices(iterable $choices, callable $value = null/
*
* @return ChoiceListInterface
*/
- public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null/* , callable $filter = null */);
+ public function createListFromLoader(ChoiceLoaderInterface $loader, ?callable $value = null/* , callable $filter = null */);
/**
* Creates a view for the given choice list.
@@ -84,5 +84,5 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, callable $va
*
* @return ChoiceListView
*/
- public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null/* , $labelTranslationParameters = [] */);
+ public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, ?callable $index = null, ?callable $groupBy = null, $attr = null/* , $labelTranslationParameters = [] */);
}
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php b/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
index 9a244e542ec23..9ee423bdf1041 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/DefaultChoiceListFactory.php
@@ -35,7 +35,7 @@ class DefaultChoiceListFactory implements ChoiceListFactoryInterface
*
* @param callable|null $filter
*/
- public function createListFromChoices(iterable $choices, callable $value = null/* , callable $filter = null */)
+ public function createListFromChoices(iterable $choices, ?callable $value = null/* , callable $filter = null */)
{
$filter = \func_num_args() > 2 ? func_get_arg(2) : null;
@@ -56,7 +56,7 @@ public function createListFromChoices(iterable $choices, callable $value = null/
*
* @param callable|null $filter
*/
- public function createListFromLoader(ChoiceLoaderInterface $loader, callable $value = null/* , callable $filter = null */)
+ public function createListFromLoader(ChoiceLoaderInterface $loader, ?callable $value = null/* , callable $filter = null */)
{
$filter = \func_num_args() > 2 ? func_get_arg(2) : null;
@@ -72,7 +72,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, callable $va
*
* @param array|callable $labelTranslationParameters The parameters used to translate the choice labels
*/
- public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, callable $index = null, callable $groupBy = null, $attr = null/* , $labelTranslationParameters = [] */)
+ public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, ?callable $index = null, ?callable $groupBy = null, $attr = null/* , $labelTranslationParameters = [] */)
{
$labelTranslationParameters = \func_num_args() > 6 ? func_get_arg(6) : [];
$preferredViews = [];
diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
index 2f1ec6475e2db..abd514783f5a3 100644
--- a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
+++ b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
@@ -41,7 +41,7 @@ class PropertyAccessDecorator implements ChoiceListFactoryInterface
private $decoratedFactory;
private $propertyAccessor;
- public function __construct(ChoiceListFactoryInterface $decoratedFactory, PropertyAccessorInterface $propertyAccessor = null)
+ public function __construct(ChoiceListFactoryInterface $decoratedFactory, ?PropertyAccessorInterface $propertyAccessor = null)
{
$this->decoratedFactory = $decoratedFactory;
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
diff --git a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php
index ab4c103e849dd..f6acd7f6e696a 100644
--- a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php
+++ b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php
@@ -47,7 +47,7 @@ class LazyChoiceList implements ChoiceListInterface
*
* @param callable|null $value The callable generating the choice values
*/
- public function __construct(ChoiceLoaderInterface $loader, callable $value = null)
+ public function __construct(ChoiceLoaderInterface $loader, ?callable $value = null)
{
$this->loader = $loader;
$this->value = $value;
diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php
index 0f6a64dd3214b..d79d693f47318 100644
--- a/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php
+++ b/src/Symfony/Component/Form/ChoiceList/Loader/AbstractChoiceLoader.php
@@ -31,7 +31,7 @@ abstract class AbstractChoiceLoader implements ChoiceLoaderInterface
*
* {@inheritdoc}
*/
- public function loadChoiceList(callable $value = null): ChoiceListInterface
+ public function loadChoiceList(?callable $value = null): ChoiceListInterface
{
return new ArrayChoiceList($this->choices ?? $this->choices = $this->loadChoices(), $value);
}
@@ -39,7 +39,7 @@ public function loadChoiceList(callable $value = null): ChoiceListInterface
/**
* {@inheritdoc}
*/
- public function loadChoicesForValues(array $values, callable $value = null)
+ public function loadChoicesForValues(array $values, ?callable $value = null)
{
if (!$values) {
return [];
@@ -51,7 +51,7 @@ public function loadChoicesForValues(array $values, callable $value = null)
/**
* {@inheritdoc}
*/
- public function loadValuesForChoices(array $choices, callable $value = null)
+ public function loadValuesForChoices(array $choices, ?callable $value = null)
{
if (!$choices) {
return [];
diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php b/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php
index 98e03bbe3a567..4bf467f9890b5 100644
--- a/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php
+++ b/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php
@@ -36,7 +36,7 @@ interface ChoiceLoaderInterface
*
* @return ChoiceListInterface
*/
- public function loadChoiceList(callable $value = null);
+ public function loadChoiceList(?callable $value = null);
/**
* Loads the choices corresponding to the given values.
@@ -54,7 +54,7 @@ public function loadChoiceList(callable $value = null);
*
* @return array
*/
- public function loadChoicesForValues(array $values, callable $value = null);
+ public function loadChoicesForValues(array $values, ?callable $value = null);
/**
* Loads the values corresponding to the given choices.
@@ -72,5 +72,5 @@ public function loadChoicesForValues(array $values, callable $value = null);
*
* @return string[]
*/
- public function loadValuesForChoices(array $choices, callable $value = null);
+ public function loadValuesForChoices(array $choices, ?callable $value = null);
}
diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php b/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php
index 5e9314e2bad2a..f5ad609815f6e 100644
--- a/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php
+++ b/src/Symfony/Component/Form/ChoiceList/Loader/FilterChoiceLoaderDecorator.php
@@ -55,7 +55,7 @@ protected function loadChoices(): iterable
/**
* {@inheritdoc}
*/
- public function loadChoicesForValues(array $values, callable $value = null): array
+ public function loadChoicesForValues(array $values, ?callable $value = null): array
{
return array_filter($this->decoratedLoader->loadChoicesForValues($values, $value), $this->filter);
}
@@ -63,7 +63,7 @@ public function loadChoicesForValues(array $values, callable $value = null): arr
/**
* {@inheritdoc}
*/
- public function loadValuesForChoices(array $choices, callable $value = null): array
+ public function loadValuesForChoices(array $choices, ?callable $value = null): array
{
return $this->decoratedLoader->loadValuesForChoices(array_filter($choices, $this->filter), $value);
}
diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php b/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php
index 546937b900c0c..80d73af1323ea 100644
--- a/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php
+++ b/src/Symfony/Component/Form/ChoiceList/Loader/IntlCallbackChoiceLoader.php
@@ -22,7 +22,7 @@ class IntlCallbackChoiceLoader extends CallbackChoiceLoader
/**
* {@inheritdoc}
*/
- public function loadChoicesForValues(array $values, callable $value = null)
+ public function loadChoicesForValues(array $values, ?callable $value = null)
{
return parent::loadChoicesForValues(array_filter($values), $value);
}
@@ -30,7 +30,7 @@ public function loadChoicesForValues(array $values, callable $value = null)
/**
* {@inheritdoc}
*/
- public function loadValuesForChoices(array $choices, callable $value = null)
+ public function loadValuesForChoices(array $choices, ?callable $value = null)
{
$choices = array_filter($choices);
diff --git a/src/Symfony/Component/Form/Command/DebugCommand.php b/src/Symfony/Component/Form/Command/DebugCommand.php
index 6979831c32682..e408a909b9f9c 100644
--- a/src/Symfony/Component/Form/Command/DebugCommand.php
+++ b/src/Symfony/Component/Form/Command/DebugCommand.php
@@ -43,7 +43,7 @@ class DebugCommand extends Command
private $guessers;
private $fileLinkFormatter;
- public function __construct(FormRegistryInterface $formRegistry, array $namespaces = ['Symfony\Component\Form\Extension\Core\Type'], array $types = [], array $extensions = [], array $guessers = [], FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(FormRegistryInterface $formRegistry, array $namespaces = ['Symfony\Component\Form\Extension\Core\Type'], array $types = [], array $extensions = [], array $guessers = [], ?FileLinkFormatter $fileLinkFormatter = null)
{
parent::__construct();
diff --git a/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php
index 4862a674c2b52..1146b35d731ba 100644
--- a/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Component/Form/Console/Descriptor/TextDescriptor.php
@@ -26,7 +26,7 @@ class TextDescriptor extends Descriptor
{
private $fileLinkFormatter;
- public function __construct(FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this->fileLinkFormatter = $fileLinkFormatter;
}
@@ -192,7 +192,7 @@ private function normalizeAndSortOptionsColumns(array $options): array
return $options;
}
- private function formatClassLink(string $class, string $text = null): string
+ private function formatClassLink(string $class, ?string $text = null): string
{
if (null === $text) {
$text = $class;
diff --git a/src/Symfony/Component/Form/Console/Helper/DescriptorHelper.php b/src/Symfony/Component/Form/Console/Helper/DescriptorHelper.php
index 355fb95989a36..72bfa6e6a7ee3 100644
--- a/src/Symfony/Component/Form/Console/Helper/DescriptorHelper.php
+++ b/src/Symfony/Component/Form/Console/Helper/DescriptorHelper.php
@@ -23,7 +23,7 @@
*/
class DescriptorHelper extends BaseDescriptorHelper
{
- public function __construct(FileLinkFormatter $fileLinkFormatter = null)
+ public function __construct(?FileLinkFormatter $fileLinkFormatter = null)
{
$this
->register('txt', new TextDescriptor($fileLinkFormatter))
diff --git a/src/Symfony/Component/Form/Exception/TransformationFailedException.php b/src/Symfony/Component/Form/Exception/TransformationFailedException.php
index 89eba088edbdb..4d4fce1962431 100644
--- a/src/Symfony/Component/Form/Exception/TransformationFailedException.php
+++ b/src/Symfony/Component/Form/Exception/TransformationFailedException.php
@@ -21,7 +21,7 @@ class TransformationFailedException extends RuntimeException
private $invalidMessage;
private $invalidMessageParameters;
- public function __construct(string $message = '', int $code = 0, \Throwable $previous = null, string $invalidMessage = null, array $invalidMessageParameters = [])
+ public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, ?string $invalidMessage = null, array $invalidMessageParameters = [])
{
parent::__construct($message, $code, $previous);
@@ -34,7 +34,7 @@ public function __construct(string $message = '', int $code = 0, \Throwable $pre
* @param string|null $invalidMessage The message or message key
* @param array $invalidMessageParameters Data to be passed into the translator
*/
- public function setInvalidMessage(string $invalidMessage = null, array $invalidMessageParameters = []): void
+ public function setInvalidMessage(?string $invalidMessage = null, array $invalidMessageParameters = []): void
{
$this->invalidMessage = $invalidMessage;
$this->invalidMessageParameters = $invalidMessageParameters;
diff --git a/src/Symfony/Component/Form/Extension/Core/CoreExtension.php b/src/Symfony/Component/Form/Extension/Core/CoreExtension.php
index c6768b86b497a..717d64633eb0d 100644
--- a/src/Symfony/Component/Form/Extension/Core/CoreExtension.php
+++ b/src/Symfony/Component/Form/Extension/Core/CoreExtension.php
@@ -32,7 +32,7 @@ class CoreExtension extends AbstractExtension
private $choiceListFactory;
private $translator;
- public function __construct(PropertyAccessorInterface $propertyAccessor = null, ChoiceListFactoryInterface $choiceListFactory = null, TranslatorInterface $translator = null)
+ public function __construct(?PropertyAccessorInterface $propertyAccessor = null, ?ChoiceListFactoryInterface $choiceListFactory = null, ?TranslatorInterface $translator = null)
{
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
$this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(new PropertyAccessDecorator(new DefaultChoiceListFactory(), $this->propertyAccessor));
diff --git a/src/Symfony/Component/Form/Extension/Core/DataAccessor/PropertyPathAccessor.php b/src/Symfony/Component/Form/Extension/Core/DataAccessor/PropertyPathAccessor.php
index 3c97075e5fcb4..e639bad2a49c2 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataAccessor/PropertyPathAccessor.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataAccessor/PropertyPathAccessor.php
@@ -31,7 +31,7 @@ class PropertyPathAccessor implements DataAccessorInterface
{
private $propertyAccessor;
- public function __construct(PropertyAccessorInterface $propertyAccessor = null)
+ public function __construct(?PropertyAccessorInterface $propertyAccessor = null)
{
$this->propertyAccessor = $propertyAccessor ?? PropertyAccess::createPropertyAccessor();
}
diff --git a/src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php b/src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php
index 5f4c498a33526..7995842eecbbf 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataMapper/DataMapper.php
@@ -27,7 +27,7 @@ class DataMapper implements DataMapperInterface
{
private $dataAccessor;
- public function __construct(DataAccessorInterface $dataAccessor = null)
+ public function __construct(?DataAccessorInterface $dataAccessor = null)
{
$this->dataAccessor = $dataAccessor ?? new ChainAccessor([
new CallbackAccessor(),
diff --git a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
index 4c4257cfb21a3..fe3fe1886b7a2 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
@@ -32,7 +32,7 @@ class PropertyPathMapper implements DataMapperInterface
{
private $propertyAccessor;
- public function __construct(PropertyAccessorInterface $propertyAccessor = null)
+ public function __construct(?PropertyAccessorInterface $propertyAccessor = null)
{
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
}
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php
index 142f4894e1401..1c56d179f99b1 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php
@@ -34,7 +34,7 @@ abstract class BaseDateTimeTransformer implements DataTransformerInterface
*
* @throws InvalidArgumentException if a timezone is not valid
*/
- public function __construct(string $inputTimezone = null, string $outputTimezone = null)
+ public function __construct(?string $inputTimezone = null, ?string $outputTimezone = null)
{
$this->inputTimezone = $inputTimezone ?: date_default_timezone_get();
$this->outputTimezone = $outputTimezone ?: date_default_timezone_get();
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php
index 5a37d4c706780..f11fd9011f70d 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateIntervalToArrayTransformer.php
@@ -46,7 +46,7 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface
* @param string[]|null $fields The date fields
* @param bool $pad Whether to use padding
*/
- public function __construct(array $fields = null, bool $pad = false)
+ public function __construct(?array $fields = null, bool $pad = false)
{
$this->fields = $fields ?? ['years', 'months', 'days', 'hours', 'minutes', 'seconds', 'invert'];
$this->pad = $pad;
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
index 710dfb59658b5..7cc9b96469758 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
@@ -31,7 +31,7 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer
* @param string[]|null $fields The date fields
* @param bool $pad Whether to use padding
*/
- public function __construct(string $inputTimezone = null, string $outputTimezone = null, array $fields = null, bool $pad = false, \DateTimeInterface $referenceDate = null)
+ public function __construct(?string $inputTimezone = null, ?string $outputTimezone = null, ?array $fields = null, bool $pad = false, ?\DateTimeInterface $referenceDate = null)
{
parent::__construct($inputTimezone, $outputTimezone);
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
index 7c8a4bcb28b3e..b0b1f187cec56 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
@@ -39,7 +39,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
*
* @throws UnexpectedTypeException If a format is not supported or if a timezone is not a string
*/
- public function __construct(string $inputTimezone = null, string $outputTimezone = null, int $dateFormat = null, int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, string $pattern = null)
+ public function __construct(?string $inputTimezone = null, ?string $outputTimezone = null, ?int $dateFormat = null, ?int $timeFormat = null, int $calendar = \IntlDateFormatter::GREGORIAN, ?string $pattern = null)
{
parent::__construct($inputTimezone, $outputTimezone);
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
index 9e680b1c762d3..4e3df8690a571 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
@@ -49,7 +49,7 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
* @param string $format The date format
* @param string|null $parseFormat The parse format when different from $format
*/
- public function __construct(string $inputTimezone = null, string $outputTimezone = null, string $format = 'Y-m-d H:i:s', string $parseFormat = null)
+ public function __construct(?string $inputTimezone = null, ?string $outputTimezone = null, string $format = 'Y-m-d H:i:s', ?string $parseFormat = null)
{
parent::__construct($inputTimezone, $outputTimezone);
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
index 36bc131887805..57e3093e6235f 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
@@ -28,7 +28,7 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
* @param int|null $roundingMode One of the ROUND_ constants in this class
* @param string|null $locale locale used for transforming
*/
- public function __construct(?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_DOWN, string $locale = null)
+ public function __construct(?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_DOWN, ?string $locale = null)
{
parent::__construct(0, $grouping, $roundingMode, $locale);
}
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php
index 9784fe673b121..5d013a16b9eef 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php
@@ -23,7 +23,7 @@ class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransform
{
private $divisor;
- public function __construct(?int $scale = 2, ?bool $grouping = true, ?int $roundingMode = \NumberFormatter::ROUND_HALFUP, ?int $divisor = 1, string $locale = null)
+ public function __construct(?int $scale = 2, ?bool $grouping = true, ?int $roundingMode = \NumberFormatter::ROUND_HALFUP, ?int $divisor = 1, ?string $locale = null)
{
parent::__construct($scale ?? 2, $grouping ?? true, $roundingMode, $locale);
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
index 53e564b139eeb..f06fd80a118a9 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
@@ -65,7 +65,7 @@ class NumberToLocalizedStringTransformer implements DataTransformerInterface
private $scale;
private $locale;
- public function __construct(int $scale = null, ?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_HALFUP, string $locale = null)
+ public function __construct(?int $scale = null, ?bool $grouping = false, ?int $roundingMode = \NumberFormatter::ROUND_HALFUP, ?string $locale = null)
{
$this->scale = $scale;
$this->grouping = $grouping ?? false;
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php
index 5b97f0190f4ae..fdeed2231cce5 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php
@@ -44,7 +44,7 @@ class PercentToLocalizedStringTransformer implements DataTransformerInterface
*
* @throws UnexpectedTypeException if the given value of type is unknown
*/
- public function __construct(int $scale = null, string $type = null, int $roundingMode = null, bool $html5Format = false)
+ public function __construct(?int $scale = null, ?string $type = null, ?int $roundingMode = null, bool $html5Format = false)
{
if (null === $type) {
$type = self::FRACTIONAL;
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php
index 27e60b4306336..e79b66988811c 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/StringToFloatTransformer.php
@@ -18,7 +18,7 @@ class StringToFloatTransformer implements DataTransformerInterface
{
private $scale;
- public function __construct(int $scale = null)
+ public function __construct(?int $scale = null)
{
$this->scale = $scale;
}
diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/TransformationFailureListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/TransformationFailureListener.php
index 70a7c19c22fa1..fb8f0c0b5fb8a 100644
--- a/src/Symfony/Component/Form/Extension/Core/EventListener/TransformationFailureListener.php
+++ b/src/Symfony/Component/Form/Extension/Core/EventListener/TransformationFailureListener.php
@@ -24,7 +24,7 @@ class TransformationFailureListener implements EventSubscriberInterface
{
private $translator;
- public function __construct(TranslatorInterface $translator = null)
+ public function __construct(?TranslatorInterface $translator = null)
{
$this->translator = $translator;
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
index c5f27b2f4811a..4a61c7f1b35b0 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
@@ -55,7 +55,7 @@ class ChoiceType extends AbstractType
/**
* @param TranslatorInterface $translator
*/
- public function __construct(ChoiceListFactoryInterface $choiceListFactory = null, $translator = null)
+ public function __construct(?ChoiceListFactoryInterface $choiceListFactory = null, $translator = null)
{
$this->choiceListFactory = $choiceListFactory ?? new CachingFactoryDecorator(
new PropertyAccessDecorator(
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ColorType.php b/src/Symfony/Component/Form/Extension/Core/Type/ColorType.php
index 4609a1aff0770..1dbdfc31736ca 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ColorType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ColorType.php
@@ -29,7 +29,7 @@ class ColorType extends AbstractType
private $translator;
- public function __construct(TranslatorInterface $translator = null)
+ public function __construct(?TranslatorInterface $translator = null)
{
$this->translator = $translator;
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
index b66b7ff5d28ce..67f5992d10b10 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
@@ -35,7 +35,7 @@ class FileType extends AbstractType
private $translator;
- public function __construct(TranslatorInterface $translator = null)
+ public function __construct(?TranslatorInterface $translator = null)
{
$this->translator = $translator;
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
index bd8ba13a3e7a5..f7d28010213cc 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
@@ -31,7 +31,7 @@ class FormType extends BaseType
{
private $dataMapper;
- public function __construct(PropertyAccessorInterface $propertyAccessor = null)
+ public function __construct(?PropertyAccessorInterface $propertyAccessor = null)
{
$this->dataMapper = new DataMapper(new ChainAccessor([
new CallbackAccessor(),
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
index 31b5df5c3c9c9..6ee109ad6c781 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
@@ -126,7 +126,7 @@ private static function getPhpTimezones(string $input): array
return $timezones;
}
- private static function getIntlTimezones(string $input, string $locale = null): array
+ private static function getIntlTimezones(string $input, ?string $locale = null): array
{
$timezones = array_flip(Timezones::getNames($locale));
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TransformationFailureExtension.php b/src/Symfony/Component/Form/Extension/Core/Type/TransformationFailureExtension.php
index f766633c9b469..4de50a90af869 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TransformationFailureExtension.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TransformationFailureExtension.php
@@ -23,7 +23,7 @@ class TransformationFailureExtension extends AbstractTypeExtension
{
private $translator;
- public function __construct(TranslatorInterface $translator = null)
+ public function __construct(?TranslatorInterface $translator = null)
{
$this->translator = $translator;
}
diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php
index 609a371ea05d9..d86574ed67a2e 100644
--- a/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php
+++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php
@@ -26,7 +26,7 @@ class CsrfExtension extends AbstractExtension
private $translator;
private $translationDomain;
- public function __construct(CsrfTokenManagerInterface $tokenManager, TranslatorInterface $translator = null, string $translationDomain = null)
+ public function __construct(CsrfTokenManagerInterface $tokenManager, ?TranslatorInterface $translator = null, ?string $translationDomain = null)
{
$this->tokenManager = $tokenManager;
$this->translator = $translator;
diff --git a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
index 37548ef55053d..89eb5c4ff8b58 100644
--- a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
+++ b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
@@ -40,7 +40,7 @@ public static function getSubscribedEvents()
];
}
- public function __construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, TranslatorInterface $translator = null, string $translationDomain = null, ServerParams $serverParams = null)
+ public function __construct(string $fieldName, CsrfTokenManagerInterface $tokenManager, string $tokenId, string $errorMessage, ?TranslatorInterface $translator = null, ?string $translationDomain = null, ?ServerParams $serverParams = null)
{
$this->fieldName = $fieldName;
$this->tokenManager = $tokenManager;
diff --git a/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php b/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
index cd17b8e94a869..dfb3fec46b81f 100644
--- a/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
+++ b/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
@@ -35,7 +35,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension
private $translationDomain;
private $serverParams;
- public function __construct(CsrfTokenManagerInterface $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '_token', TranslatorInterface $translator = null, string $translationDomain = null, ServerParams $serverParams = null)
+ public function __construct(CsrfTokenManagerInterface $defaultTokenManager, bool $defaultEnabled = true, string $defaultFieldName = '_token', ?TranslatorInterface $translator = null, ?string $translationDomain = null, ?ServerParams $serverParams = null)
{
$this->defaultTokenManager = $defaultTokenManager;
$this->defaultEnabled = $defaultEnabled;
diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
index 2fe2fbed1aa39..8d4f8e0ea71be 100644
--- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
+++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php
@@ -81,7 +81,7 @@ public function __construct(FormDataExtractorInterface $dataExtractor)
/**
* Does nothing. The data is collected during the form event listeners.
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null)
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
}
@@ -298,7 +298,7 @@ private function &recursiveBuildPreliminaryFormTree(FormInterface $form, array &
return $output;
}
- private function &recursiveBuildFinalFormTree(FormInterface $form = null, FormView $view, array &$outputByHash)
+ private function &recursiveBuildFinalFormTree(?FormInterface $form, FormView $view, array &$outputByHash)
{
$viewHash = spl_object_hash($view);
$formHash = null;
diff --git a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
index 54358d5d49aa1..89aac42286257 100644
--- a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
+++ b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
@@ -82,7 +82,7 @@ public function createBuilder(FormFactoryInterface $factory, string $name, array
/**
* {@inheritdoc}
*/
- public function createView(FormInterface $form, FormView $parent = null)
+ public function createView(FormInterface $form, ?FormView $parent = null)
{
return $this->proxiedType->createView($form, $parent);
}
diff --git a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php
index 068d5cc0bf75b..c59271461a2fb 100644
--- a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php
+++ b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeFactoryDataCollectorProxy.php
@@ -36,7 +36,7 @@ public function __construct(ResolvedFormTypeFactoryInterface $proxiedFactory, Fo
/**
* {@inheritdoc}
*/
- public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null)
+ public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ?ResolvedFormTypeInterface $parent = null)
{
return new ResolvedTypeDataCollectorProxy(
$this->proxiedFactory->createResolvedType($type, $typeExtensions, $parent),
diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php b/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
index 90723fd8b48a9..a047729fa8e85 100644
--- a/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
+++ b/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
@@ -31,7 +31,7 @@ class HttpFoundationRequestHandler implements RequestHandlerInterface
{
private $serverParams;
- public function __construct(ServerParams $serverParams = null)
+ public function __construct(?ServerParams $serverParams = null)
{
$this->serverParams = $serverParams ?? new ServerParams();
}
diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
index 0d77f06ce3fd8..b789af22935b8 100644
--- a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
+++ b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
@@ -24,7 +24,7 @@ class FormTypeHttpFoundationExtension extends AbstractTypeExtension
{
private $requestHandler;
- public function __construct(RequestHandlerInterface $requestHandler = null)
+ public function __construct(?RequestHandlerInterface $requestHandler = null)
{
$this->requestHandler = $requestHandler ?? new HttpFoundationRequestHandler();
}
diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
index d4c520ce86c91..58d1b758a88e2 100644
--- a/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
@@ -31,7 +31,7 @@ class FormTypeValidatorExtension extends BaseValidatorExtension
private $violationMapper;
private $legacyErrorMessages;
- public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null)
+ public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, ?FormRendererInterface $formRenderer = null, ?TranslatorInterface $translator = null)
{
$this->validator = $validator;
$this->violationMapper = new ViolationMapper($formRenderer, $translator);
diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php
index 21e4fe20eaf69..2915d538f0be4 100644
--- a/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php
@@ -26,7 +26,7 @@ class UploadValidatorExtension extends AbstractTypeExtension
private $translator;
private $translationDomain;
- public function __construct(TranslatorInterface $translator, string $translationDomain = null)
+ public function __construct(TranslatorInterface $translator, ?string $translationDomain = null)
{
$this->translator = $translator;
$this->translationDomain = $translationDomain;
diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
index 3a5728a827875..16b84eb2c40bc 100644
--- a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
@@ -31,7 +31,7 @@ class ValidatorExtension extends AbstractExtension
private $translator;
private $legacyErrorMessages;
- public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null)
+ public function __construct(ValidatorInterface $validator, bool $legacyErrorMessages = true, ?FormRendererInterface $formRenderer = null, ?TranslatorInterface $translator = null)
{
$this->legacyErrorMessages = $legacyErrorMessages;
diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php
index 1fb1d1fb03257..6ecc284c4ffe7 100644
--- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php
+++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php
@@ -32,7 +32,7 @@ class ViolationMapper implements ViolationMapperInterface
private $translator;
private $allowNonSynchronized = false;
- public function __construct(FormRendererInterface $formRenderer = null, TranslatorInterface $translator = null)
+ public function __construct(?FormRendererInterface $formRenderer = null, ?TranslatorInterface $translator = null)
{
$this->formRenderer = $formRenderer;
$this->translator = $translator;
diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php
index 0c36032f13ffe..9410051a5cf80 100644
--- a/src/Symfony/Component/Form/Form.php
+++ b/src/Symfony/Component/Form/Form.php
@@ -275,7 +275,7 @@ public function isDisabled()
/**
* {@inheritdoc}
*/
- public function setParent(FormInterface $parent = null)
+ public function setParent(?FormInterface $parent = null)
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot set the parent of a submitted form.');
@@ -850,7 +850,7 @@ public function all()
/**
* {@inheritdoc}
*/
- public function add($child, string $type = null, array $options = [])
+ public function add($child, ?string $type = null, array $options = [])
{
if ($this->submitted) {
throw new AlreadySubmittedException('You cannot add children to a submitted form.');
@@ -1045,7 +1045,7 @@ public function count()
/**
* {@inheritdoc}
*/
- public function createView(FormView $parent = null)
+ public function createView(?FormView $parent = null)
{
if (null === $parent && $this->parent) {
$parent = $this->parent->createView();
diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php
index 37fca950a77cb..3881cc56deb52 100644
--- a/src/Symfony/Component/Form/FormBuilder.php
+++ b/src/Symfony/Component/Form/FormBuilder.php
@@ -50,7 +50,7 @@ public function __construct(?string $name, ?string $dataClass, EventDispatcherIn
/**
* {@inheritdoc}
*/
- public function add($child, string $type = null, array $options = [])
+ public function add($child, ?string $type = null, array $options = [])
{
if ($this->locked) {
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
@@ -83,7 +83,7 @@ public function add($child, string $type = null, array $options = [])
/**
* {@inheritdoc}
*/
- public function create($name, string $type = null, array $options = [])
+ public function create($name, ?string $type = null, array $options = [])
{
if ($this->locked) {
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
diff --git a/src/Symfony/Component/Form/FormBuilderInterface.php b/src/Symfony/Component/Form/FormBuilderInterface.php
index 52bf5b67922bf..014bfbdff2628 100644
--- a/src/Symfony/Component/Form/FormBuilderInterface.php
+++ b/src/Symfony/Component/Form/FormBuilderInterface.php
@@ -30,7 +30,7 @@ interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuild
*
* @return static
*/
- public function add($child, string $type = null, array $options = []);
+ public function add($child, ?string $type = null, array $options = []);
/**
* Creates a form builder.
@@ -41,7 +41,7 @@ public function add($child, string $type = null, array $options = []);
*
* @return self
*/
- public function create(string $name, string $type = null, array $options = []);
+ public function create(string $name, ?string $type = null, array $options = []);
/**
* Returns a child by name.
diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php
index b511c2f1364fb..1dddd71e302df 100644
--- a/src/Symfony/Component/Form/FormConfigBuilder.php
+++ b/src/Symfony/Component/Form/FormConfigBuilder.php
@@ -501,7 +501,7 @@ public function setAttributes(array $attributes)
/**
* {@inheritdoc}
*/
- public function setDataMapper(DataMapperInterface $dataMapper = null)
+ public function setDataMapper(?DataMapperInterface $dataMapper = null)
{
if ($this->locked) {
throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
diff --git a/src/Symfony/Component/Form/FormConfigBuilderInterface.php b/src/Symfony/Component/Form/FormConfigBuilderInterface.php
index 757fa2584968e..86d6171c220fa 100644
--- a/src/Symfony/Component/Form/FormConfigBuilderInterface.php
+++ b/src/Symfony/Component/Form/FormConfigBuilderInterface.php
@@ -102,7 +102,7 @@ public function setAttributes(array $attributes);
*
* @return $this
*/
- public function setDataMapper(DataMapperInterface $dataMapper = null);
+ public function setDataMapper(?DataMapperInterface $dataMapper = null);
/**
* Sets whether the form is disabled.
diff --git a/src/Symfony/Component/Form/FormError.php b/src/Symfony/Component/Form/FormError.php
index e03f3eef5ba4a..07fbb8c00e9be 100644
--- a/src/Symfony/Component/Form/FormError.php
+++ b/src/Symfony/Component/Form/FormError.php
@@ -47,7 +47,7 @@ class FormError
*
* @see \Symfony\Component\Translation\Translator
*/
- public function __construct(string $message, string $messageTemplate = null, array $messageParameters = [], int $messagePluralization = null, $cause = null)
+ public function __construct(string $message, ?string $messageTemplate = null, array $messageParameters = [], ?int $messagePluralization = null, $cause = null)
{
$this->message = $message;
$this->messageTemplate = $messageTemplate ?: $message;
diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php
index 016d2ccfb1f74..7ecc9b612a409 100644
--- a/src/Symfony/Component/Form/FormInterface.php
+++ b/src/Symfony/Component/Form/FormInterface.php
@@ -34,7 +34,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
* @throws Exception\LogicException when trying to set a parent for a form with
* an empty name
*/
- public function setParent(self $parent = null);
+ public function setParent(?self $parent = null);
/**
* Returns the parent form.
@@ -56,7 +56,7 @@ public function getParent();
* @throws Exception\LogicException when trying to add a child to a non-compound form
* @throws Exception\UnexpectedTypeException if $child or $type has an unexpected type
*/
- public function add($child, string $type = null, array $options = []);
+ public function add($child, ?string $type = null, array $options = []);
/**
* Returns the child with the given name.
@@ -324,5 +324,5 @@ public function isRoot();
/**
* @return FormView
*/
- public function createView(FormView $parent = null);
+ public function createView(?FormView $parent = null);
}
diff --git a/src/Symfony/Component/Form/FormRenderer.php b/src/Symfony/Component/Form/FormRenderer.php
index 2f8f35199098e..0be517e4f7ecf 100644
--- a/src/Symfony/Component/Form/FormRenderer.php
+++ b/src/Symfony/Component/Form/FormRenderer.php
@@ -31,7 +31,7 @@ class FormRenderer implements FormRendererInterface
private $hierarchyLevelMap = [];
private $variableStack = [];
- public function __construct(FormRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null)
+ public function __construct(FormRendererEngineInterface $engine, ?CsrfTokenManagerInterface $csrfTokenManager = null)
{
$this->engine = $engine;
$this->csrfTokenManager = $csrfTokenManager;
diff --git a/src/Symfony/Component/Form/FormView.php b/src/Symfony/Component/Form/FormView.php
index 0162208e64784..49ab5b92162a8 100644
--- a/src/Symfony/Component/Form/FormView.php
+++ b/src/Symfony/Component/Form/FormView.php
@@ -54,7 +54,7 @@ class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
private $methodRendered = false;
- public function __construct(self $parent = null)
+ public function __construct(?self $parent = null)
{
$this->parent = $parent;
}
diff --git a/src/Symfony/Component/Form/NativeRequestHandler.php b/src/Symfony/Component/Form/NativeRequestHandler.php
index 1afa6a6ba734f..d3e34042751a6 100644
--- a/src/Symfony/Component/Form/NativeRequestHandler.php
+++ b/src/Symfony/Component/Form/NativeRequestHandler.php
@@ -35,7 +35,7 @@ class NativeRequestHandler implements RequestHandlerInterface
'type',
];
- public function __construct(ServerParams $params = null)
+ public function __construct(?ServerParams $params = null)
{
$this->serverParams = $params ?? new ServerParams();
}
diff --git a/src/Symfony/Component/Form/PreloadedExtension.php b/src/Symfony/Component/Form/PreloadedExtension.php
index c6767dc3e3e6a..1e8dd085bb483 100644
--- a/src/Symfony/Component/Form/PreloadedExtension.php
+++ b/src/Symfony/Component/Form/PreloadedExtension.php
@@ -30,7 +30,7 @@ class PreloadedExtension implements FormExtensionInterface
* @param FormTypeInterface[] $types The types that the extension should support
* @param FormTypeExtensionInterface[][] $typeExtensions The type extensions that the extension should support
*/
- public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null)
+ public function __construct(array $types, array $typeExtensions, ?FormTypeGuesserInterface $typeGuesser = null)
{
$this->typeExtensions = $typeExtensions;
$this->typeGuesser = $typeGuesser;
diff --git a/src/Symfony/Component/Form/ResolvedFormType.php b/src/Symfony/Component/Form/ResolvedFormType.php
index b484c9149288b..d76ce9d6f2a0b 100644
--- a/src/Symfony/Component/Form/ResolvedFormType.php
+++ b/src/Symfony/Component/Form/ResolvedFormType.php
@@ -46,7 +46,7 @@ class ResolvedFormType implements ResolvedFormTypeInterface
/**
* @param FormTypeExtensionInterface[] $typeExtensions
*/
- public function __construct(FormTypeInterface $innerType, array $typeExtensions = [], ResolvedFormTypeInterface $parent = null)
+ public function __construct(FormTypeInterface $innerType, array $typeExtensions = [], ?ResolvedFormTypeInterface $parent = null)
{
foreach ($typeExtensions as $extension) {
if (!$extension instanceof FormTypeExtensionInterface) {
@@ -114,7 +114,7 @@ public function createBuilder(FormFactoryInterface $factory, string $name, array
/**
* {@inheritdoc}
*/
- public function createView(FormInterface $form, FormView $parent = null)
+ public function createView(FormInterface $form, ?FormView $parent = null)
{
return $this->newView($parent);
}
@@ -217,7 +217,7 @@ protected function newBuilder(string $name, ?string $dataClass, FormFactoryInter
*
* @return FormView
*/
- protected function newView(FormView $parent = null)
+ protected function newView(?FormView $parent = null)
{
return new FormView($parent);
}
diff --git a/src/Symfony/Component/Form/ResolvedFormTypeFactory.php b/src/Symfony/Component/Form/ResolvedFormTypeFactory.php
index d93d1c06dfdf3..b20cde2a10bd3 100644
--- a/src/Symfony/Component/Form/ResolvedFormTypeFactory.php
+++ b/src/Symfony/Component/Form/ResolvedFormTypeFactory.php
@@ -19,7 +19,7 @@ class ResolvedFormTypeFactory implements ResolvedFormTypeFactoryInterface
/**
* {@inheritdoc}
*/
- public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null)
+ public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ?ResolvedFormTypeInterface $parent = null)
{
return new ResolvedFormType($type, $typeExtensions, $parent);
}
diff --git a/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php b/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php
index 4f133e0395e4a..47d2eb2790fc7 100644
--- a/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php
+++ b/src/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php
@@ -32,5 +32,5 @@ interface ResolvedFormTypeFactoryInterface
* @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string
* @throws Exception\InvalidArgumentException if the types parent cannot be retrieved from any extension
*/
- public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null);
+ public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ?ResolvedFormTypeInterface $parent = null);
}
diff --git a/src/Symfony/Component/Form/ResolvedFormTypeInterface.php b/src/Symfony/Component/Form/ResolvedFormTypeInterface.php
index 6074af9cb6dd6..4d0d67454755b 100644
--- a/src/Symfony/Component/Form/ResolvedFormTypeInterface.php
+++ b/src/Symfony/Component/Form/ResolvedFormTypeInterface.php
@@ -62,7 +62,7 @@ public function createBuilder(FormFactoryInterface $factory, string $name, array
*
* @return FormView
*/
- public function createView(FormInterface $form, FormView $parent = null);
+ public function createView(FormInterface $form, ?FormView $parent = null);
/**
* Configures a form builder for the type hierarchy.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.af.xlf b/src/Symfony/Component/Form/Resources/translations/validators.af.xlf
index 58cd939cf793f..c726e93b9e2a2 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.af.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.af.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ar.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ar.xlf
index e30daaf1dff5d..d18b4691e1f69 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ar.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ar.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.az.xlf b/src/Symfony/Component/Form/Resources/translations/validators.az.xlf
index b9269706db3e8..87791b6d423c2 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.az.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.az.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.be.xlf b/src/Symfony/Component/Form/Resources/translations/validators.be.xlf
index 0513ca1dc9f7f..b24976e13cc7f 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.be.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.be.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.bg.xlf b/src/Symfony/Component/Form/Resources/translations/validators.bg.xlf
index 32fa9433108c1..19b80f5f8f2b7 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.bg.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.bg.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf b/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf
index 319f91544d50c..d360635dfc348 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.bs.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ca.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ca.xlf
index 69379608048c9..76df58246b328 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ca.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ca.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.cs.xlf b/src/Symfony/Component/Form/Resources/translations/validators.cs.xlf
index 3c4052b1ca496..829fea17b1a07 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.cs.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.cs.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.cy.xlf b/src/Symfony/Component/Form/Resources/translations/validators.cy.xlf
new file mode 100644
index 0000000000000..48f18afe7c1ea
--- /dev/null
+++ b/src/Symfony/Component/Form/Resources/translations/validators.cy.xlf
@@ -0,0 +1,139 @@
+
+
+
+
+
+ This form should not contain extra fields.
+ Ni ddylai'r ffurflen gynnwys meysydd ychwanegol.
+
+
+ The uploaded file was too large. Please try to upload a smaller file.
+ Roedd y ffeil a uwchlwythwyd yn rhy fawr. Ceisiwch uwchlwytho ffeil llai.
+
+
+ The CSRF token is invalid. Please try to resubmit the form.
+ Mae'r tocyn CSRF yn annilys. Ceisiwch ailgyflwyno'r ffurflen.
+
+
+ This value is not a valid HTML5 color.
+ Nid yw'r gwerth hwn yn lliw HTML5 dilys.
+
+
+ Please enter a valid birthdate.
+ Nodwch ddyddiad geni dilys.
+
+
+ The selected choice is invalid.
+ Mae'r dewis a ddewiswyd yn annilys.
+
+
+ The collection is invalid.
+ Mae'r casgliad yn annilys.
+
+
+ Please select a valid color.
+ Dewiswch liw dilys.
+
+
+ Please select a valid country.
+ Dewiswch wlad ddilys.
+
+
+ Please select a valid currency.
+ Dewiswch arian cyfred dilys.
+
+
+ Please choose a valid date interval.
+ Dewiswch ystod dyddiadau dilys.
+
+
+ Please enter a valid date and time.
+ Nodwch ddyddiad ac amser dilys.
+
+
+ Please enter a valid date.
+ Nodwch ddyddiad dilys.
+
+
+ Please select a valid file.
+ Dewiswch ffeil ddilys.
+
+
+ The hidden field is invalid.
+ Mae'r maes cudd yn annilys.
+
+
+ Please enter an integer.
+ Nodwch rif cyfan.
+
+
+ Please select a valid language.
+ Dewiswch iaith ddilys.
+
+
+ Please select a valid locale.
+ Dewiswch leoliad dilys.
+
+
+ Please enter a valid money amount.
+ Nodwch swm arian dilys.
+
+
+ Please enter a number.
+ Nodwch rif.
+
+
+ The password is invalid.
+ Mae'r cyfrinair yn annilys.
+
+
+ Please enter a percentage value.
+ Nodwch werth canran.
+
+
+ The values do not match.
+ Nid yw'r gwerthoedd yn cyfateb.
+
+
+ Please enter a valid time.
+ Nodwch amser dilys.
+
+
+ Please select a valid timezone.
+ Dewiswch barth amser dilys.
+
+
+ Please enter a valid URL.
+ Nodwch URL dilys.
+
+
+ Please enter a valid search term.
+ Nodwch derm chwilio dilys.
+
+
+ Please provide a valid phone number.
+ Darparwch rif ffôn dilys.
+
+
+ The checkbox has an invalid value.
+ Mae gan y blwch ticio werth annilys.
+
+
+ Please enter a valid email address.
+ Nodwch gyfeiriad e-bost dilys.
+
+
+ Please select a valid option.
+ Dewiswch opsiwn dilys.
+
+
+ Please select a valid range.
+ Dewiswch ystod ddilys.
+
+
+ Please enter a valid week.
+ Nodwch wythnos ddilys.
+
+
+
+
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.da.xlf b/src/Symfony/Component/Form/Resources/translations/validators.da.xlf
index b4f078ff35f40..36f49b2c89ec5 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.da.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.da.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.de.xlf b/src/Symfony/Component/Form/Resources/translations/validators.de.xlf
index 7b30839f9183d..759fa2a19cee9 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.de.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.de.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.el.xlf b/src/Symfony/Component/Form/Resources/translations/validators.el.xlf
index 595630e76f453..b544dcbc61698 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.el.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.el.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.en.xlf b/src/Symfony/Component/Form/Resources/translations/validators.en.xlf
index e556c40b647f6..57d3da969f36b 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.en.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.en.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.es.xlf b/src/Symfony/Component/Form/Resources/translations/validators.es.xlf
index c143e009e1938..301e2b33f7ed3 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.es.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.es.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.et.xlf b/src/Symfony/Component/Form/Resources/translations/validators.et.xlf
index 6524c86b144ee..0767220efa346 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.et.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.et.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.eu.xlf b/src/Symfony/Component/Form/Resources/translations/validators.eu.xlf
index f43ab35a49f93..a73c63abb73f7 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.eu.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.eu.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -11,8 +11,8 @@
Igotako fitxategia handiegia da. Mesedez saiatu fitxategi txikiago bat igotzen.
- The CSRF token is invalid.
- CSRF tokena ez da egokia.
+ The CSRF token is invalid. Please try to resubmit the form.
+ CSRF tokena baliogabea da. Mesedez, saiatu berriro formularioa bidaltzen.
This value is not a valid HTML5 color.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf
index 4a98eea8eb314..2ebb1cc2bb93f 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.fa.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.fi.xlf b/src/Symfony/Component/Form/Resources/translations/validators.fi.xlf
index 7ad87b5468261..438365404ed47 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.fi.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.fi.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.fr.xlf b/src/Symfony/Component/Form/Resources/translations/validators.fr.xlf
index d65826467229f..cbfb4f83cd5be 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.fr.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.fr.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.gl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.gl.xlf
index 5ef404a481a45..e3427f8d28cac 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.gl.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.gl.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.he.xlf b/src/Symfony/Component/Form/Resources/translations/validators.he.xlf
index efd68b8807bfd..41428ac70f69f 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.he.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.he.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf
index 9f17b5ea1eb37..e3aa7b2b9cf59 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.hr.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.hu.xlf b/src/Symfony/Component/Form/Resources/translations/validators.hu.xlf
index 3b70461d394b7..0ea74fea91277 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.hu.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.hu.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf b/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf
index 10ac326fb1600..ccca2473538fc 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.hy.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.id.xlf b/src/Symfony/Component/Form/Resources/translations/validators.id.xlf
index 535f9e6b15860..e4b43f7e3aa36 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.id.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.id.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.it.xlf b/src/Symfony/Component/Form/Resources/translations/validators.it.xlf
index 1a8eee3ac8e26..bdea7132f5938 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.it.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.it.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf
index ea2226ce4182f..5728d9b1d4af7 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ja.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -15,125 +15,125 @@
CSRFトークンが無効です、再送信してください。
- This value is not a valid HTML5 color.
- 有効なHTML5の色ではありません。
-
-
- Please enter a valid birthdate.
- 有効な生年月日を入力してください。
-
-
- The selected choice is invalid.
- 選択した値は無効です。
-
-
- The collection is invalid.
- コレクションは無効です。
-
-
- Please select a valid color.
- 有効な色を選択してください。
-
-
- Please select a valid country.
- 有効な国を選択してください。
-
-
- Please select a valid currency.
- 有効な通貨を選択してください。
-
-
- Please choose a valid date interval.
- 有効な日付間隔を選択してください。
-
-
- Please enter a valid date and time.
- 有効な日時を入力してください。
-
-
- Please enter a valid date.
- 有効な日付を入力してください。
-
-
- Please select a valid file.
- 有効なファイルを選択してください。
-
-
- The hidden field is invalid.
- 隠しフィールドが無効です。
-
-
- Please enter an integer.
- 整数で入力してください。
-
-
- Please select a valid language.
- 有効な言語を選択してください。
-
-
- Please select a valid locale.
- 有効なロケールを選択してください。
-
-
- Please enter a valid money amount.
- 有効な金額を入力してください。
-
-
- Please enter a number.
- 数値で入力してください。
-
-
- The password is invalid.
- パスワードが無効です。
-
-
- Please enter a percentage value.
- パーセント値で入力してください。
-
-
- The values do not match.
- 値が一致しません。
-
-
- Please enter a valid time.
- 有効な時間を入力してください。
-
-
- Please select a valid timezone.
- 有効なタイムゾーンを選択してください。
-
-
- Please enter a valid URL.
- 有効なURLを入力してください。
-
-
- Please enter a valid search term.
- 有効な検索語を入力してください。
-
-
- Please provide a valid phone number.
- 有効な電話番号を入力してください。
-
-
- The checkbox has an invalid value.
- チェックボックスの値が無効です。
-
-
- Please enter a valid email address.
- 有効なメールアドレスを入力してください。
-
-
- Please select a valid option.
- 有効な値を選択してください。
-
-
- Please select a valid range.
- 有効な範囲を選択してください。
-
-
- Please enter a valid week.
- 有効な週を入力してください。
-
+ This value is not a valid HTML5 color.
+ 有効なHTML5の色ではありません。
+
+
+ Please enter a valid birthdate.
+ 有効な生年月日を入力してください。
+
+
+ The selected choice is invalid.
+ 選択した値は無効です。
+
+
+ The collection is invalid.
+ コレクションは無効です。
+
+
+ Please select a valid color.
+ 有効な色を選択してください。
+
+
+ Please select a valid country.
+ 有効な国を選択してください。
+
+
+ Please select a valid currency.
+ 有効な通貨を選択してください。
+
+
+ Please choose a valid date interval.
+ 有効な日付間隔を選択してください。
+
+
+ Please enter a valid date and time.
+ 有効な日時を入力してください。
+
+
+ Please enter a valid date.
+ 有効な日付を入力してください。
+
+
+ Please select a valid file.
+ 有効なファイルを選択してください。
+
+
+ The hidden field is invalid.
+ 隠しフィールドが無効です。
+
+
+ Please enter an integer.
+ 整数で入力してください。
+
+
+ Please select a valid language.
+ 有効な言語を選択してください。
+
+
+ Please select a valid locale.
+ 有効なロケールを選択してください。
+
+
+ Please enter a valid money amount.
+ 有効な金額を入力してください。
+
+
+ Please enter a number.
+ 数値で入力してください。
+
+
+ The password is invalid.
+ パスワードが無効です。
+
+
+ Please enter a percentage value.
+ パーセント値で入力してください。
+
+
+ The values do not match.
+ 値が一致しません。
+
+
+ Please enter a valid time.
+ 有効な時間を入力してください。
+
+
+ Please select a valid timezone.
+ 有効なタイムゾーンを選択してください。
+
+
+ Please enter a valid URL.
+ 有効なURLを入力してください。
+
+
+ Please enter a valid search term.
+ 有効な検索語を入力してください。
+
+
+ Please provide a valid phone number.
+ 有効な電話番号を入力してください。
+
+
+ The checkbox has an invalid value.
+ チェックボックスの値が無効です。
+
+
+ Please enter a valid email address.
+ 有効なメールアドレスを入力してください。
+
+
+ Please select a valid option.
+ 有効な値を選択してください。
+
+
+ Please select a valid range.
+ 有効な範囲を選択してください。
+
+
+ Please enter a valid week.
+ 有効な週を入力してください。
+
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.lb.xlf b/src/Symfony/Component/Form/Resources/translations/validators.lb.xlf
index e989264f962b8..1f4ee820b28cb 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.lb.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.lb.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf b/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf
index 5613c42b5bf16..aba1120e3ef1a 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.lt.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.lv.xlf b/src/Symfony/Component/Form/Resources/translations/validators.lv.xlf
index 54711cb5f88b0..fb358dccf25b5 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.lv.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.lv.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.mk.xlf b/src/Symfony/Component/Form/Resources/translations/validators.mk.xlf
index ea86b304cee25..5f2af85eb57b4 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.mk.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.mk.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf b/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf
index 620112d8814a9..2e6d09bc6b350 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.mn.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.my.xlf b/src/Symfony/Component/Form/Resources/translations/validators.my.xlf
index b0180c551172f..9ecb9d368a6b1 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.my.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.my.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf
index 1d8385086aa82..193306b7191ed 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -11,8 +11,8 @@
Den opplastede filen var for stor. Vennligst last opp en mindre fil.
- The CSRF token is invalid.
- CSRF nøkkelen er ugyldig.
+ The CSRF token is invalid. Please try to resubmit the form.
+ CSRF-tokenen er ugyldig. Vennligst prøv å sende inn skjemaet på nytt.
This value is not a valid HTML5 color.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.nl.xlf
index 7aa56ebf1bda4..6330ecf8a3336 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.nl.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.nl.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf
index 9fac1bf34e34f..0722b456879f4 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.nn.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -11,8 +11,8 @@
Fila du lasta opp var for stor. Last opp ei mindre fil.
- The CSRF token is invalid.
- CSRF-nøkkelen er ikkje gyldig.
+ The CSRF token is invalid. Please try to resubmit the form.
+ CSRF-teiknet er ugyldig. Ver venleg og prøv å sende inn skjemaet på nytt.
This value is not a valid HTML5 color.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.no.xlf b/src/Symfony/Component/Form/Resources/translations/validators.no.xlf
index 1d8385086aa82..193306b7191ed 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.no.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.no.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -11,8 +11,8 @@
Den opplastede filen var for stor. Vennligst last opp en mindre fil.
- The CSRF token is invalid.
- CSRF nøkkelen er ugyldig.
+ The CSRF token is invalid. Please try to resubmit the form.
+ CSRF-tokenen er ugyldig. Vennligst prøv å sende inn skjemaet på nytt.
This value is not a valid HTML5 color.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.pl.xlf
index d553f2a179a97..767f05d29f85a 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.pl.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.pl.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.pt.xlf b/src/Symfony/Component/Form/Resources/translations/validators.pt.xlf
index 6ce1c3242cab3..755108f357f5a 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.pt.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.pt.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -14,7 +14,7 @@
The CSRF token is invalid. Please try to resubmit the form.
O token CSRF está inválido. Por favor, tente enviar o formulário novamente.
-
+
This value is not a valid HTML5 color.
Este valor não é uma cor HTML5 válida.
@@ -50,7 +50,7 @@
Please enter a valid date and time.
Por favor, informe uma data e horário válidos.
-
+
Please enter a valid date.
Por favor, informe uma data válida.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf b/src/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf
index 37717fe983dd9..c386ab304932c 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ro.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ro.xlf
index a7dc62b579c6b..63b4c551ff637 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ro.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ro.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf
index b11b7cef57a31..26535d26d33fe 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ru.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sk.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sk.xlf
index 06b2bbdbead5f..72ecd13e183ce 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.sk.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.sk.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sl.xlf
index 7e6a3fb85016c..c19949d713b98 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.sl.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.sl.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sq.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sq.xlf
index 3224f6e38ad0a..2c730bcfefc69 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.sq.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.sq.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
@@ -68,7 +68,7 @@
Please select a valid language.
- Please select a valid language.
+ Ju lutem zgjidhni një gjuhë të vlefshme.
Please select a valid locale.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf
index a5610e0ead295..4b3e5b9b8e17f 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf
index 02fb5aa56ead4..6f64f5634d849 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf b/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf
index 43e925628a488..052a569605d61 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.sv.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.th.xlf b/src/Symfony/Component/Form/Resources/translations/validators.th.xlf
index 060dc9ec48094..82d417d955775 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.th.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.th.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf b/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf
index 272e331298a2f..6aeef41e1e94f 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.tl.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.tr.xlf b/src/Symfony/Component/Form/Resources/translations/validators.tr.xlf
index d1ddc1d0ef33d..71a469619c530 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.tr.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.tr.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.uk.xlf b/src/Symfony/Component/Form/Resources/translations/validators.uk.xlf
index ca707bcffa916..c6bbca1857733 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.uk.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.uk.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+
This form should not contain extra fields.
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.ur.xlf b/src/Symfony/Component/Form/Resources/translations/validators.ur.xlf
index 1ec61be6d840c..42b891bbf3849 100644
--- a/src/Symfony/Component/Form/Resources/translations/validators.ur.xlf
+++ b/src/Symfony/Component/Form/Resources/translations/validators.ur.xlf
@@ -1,6 +1,6 @@
-
-
-
+
+
+