diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e5e58745ee337..7b86916e7bc14 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | master for features / 3.4, 4.4, 5.0 or 5.1 for bug fixes +| Branch? | master for features / 3.4, 4.4 or 5.1 for bug fixes | Bug fix? | yes/no | New feature? | yes/no | Deprecations? | yes/no diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index 2f51e38874c8f..f899cac51ac7f 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,70 @@ in 4.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/v4.4.0...v4.4.1 +* 4.4.11 (2020-07-24) + + * bug #37590 Allows RedisClusterProxy instance in Lock RedisStore (jderusse) + * bug #37583 [Mime] Fix EmailHeaderSame to make use of decoded value (evertharmeling) + * bug #37569 [Messenger] Allow same middleware to be used multiple times with different arguments (HypeMC) + * bug #37624 [Cache] Connect to RedisCluster with password auth (mforbak) + * bug #37635 [Cache] fix catching auth errors (nicolas-grekas) + * bug #37628 [Serializer] Support multiple levels of discriminator mapping (jeroennoten) + * bug #37572 [FrameworkBundle] set default session.handler alias if handler_id is not provided (Youssef BENHSSAIEN) + * bug #37607 Fix checks for phpunit releases on Composer 2 (colinodell) + * bug #37594 Use hexadecimal numerals instead of hexadecimals in strings to repres… (arekzb) + * bug #37576 [WebProfilerBundle] modified url generation to use absolute urls (smatyas) + * bug #36888 [Mailer] Fix mandrill raw http request setting from email/name (JohJohan) + * bug #37527 [Mailer] Fix reply-to functionality in the SendgridApiTransport (jt2k) + * bug #37581 [Mime] Fix compat with HTTP requests (fabpot) + * bug #37580 [Mime] Keep Sender full address when used by non-SMTP transports (fabpot) + * bug #37511 [DependencyInjection][Config] Use several placeholder unique prefixes for dynamic placeholder values (fancyweb) + * bug #37562 [Cache] Use the default expiry when saving (not when creating) items (philipp-kolesnikov) + * bug #37563 Fix DBAL deprecation (nicolas-grekas) + * bug #37521 [Form] Fix ChoiceType translation domain (VincentLanglet) + * bug #37550 [OptionsResolver] Fix force prepend normalizer (hason) + * bug #37520 [Form] silently ignore uninitialized properties when mapping data to forms (ph-fritsche) + * bug #37526 [Cache][Config] ensure compatibility with PHP 8 stack traces (xabbuh) + * bug #37513 [PhpUnitBridge] ExcludeList usage for PHPUnit 9.4 (gennadigennadigennadi) + * bug #37461 [Process] Fix Permission Denied error when writing sf_proc_00 lock files on Windows (JasonStephensTAMU) + * bug #37505 [Form] fix handling null as empty data (xabbuh) + * bug #37385 [Console] Fixes question input encoding on Windows (YaFou) + * bug #37491 [HttpClient] Fix promise behavior in HttplugClient (brentybh) + * bug #37469 [Console] always use stty when possible to ask hidden questions (nicolas-grekas) + * bug #37486 [HttpClient] fix parsing response headers in CurlResponse (nicolas-grekas) + * bug #37484 [HttpClient][CurlHttpClient] Fix http_version option usage (fancyweb) + * bug #37447 [Validator] fix validating lazy properties that evaluate to null (xabbuh) + * bug #37464 [ErrorHandler] fix throwing from __toString() (nicolas-grekas) + * bug #37449 [Translation] Fix caching of parent locales file in translator (jvasseur) + * bug #37418 [PhpUnitBridge] Fix compatibility with phpunit 9.3 (Gennadi Janzen) + * bug #37441 [DoctrineBridge] work around Connection::ping() deprecation (nicolas-grekas) + * bug #37291 [MimeType] Duplicated MimeType due to PHP Bug (juanmrad) + * bug #37429 [DI] fix parsing of argument type=binary in xml (Tobion) + * bug #37425 [Form] fix guessing form types for DateTime types (xabbuh) + * bug #37392 [Validator] fix handling typed properties as constraint options (xabbuh) + * bug #37358 Directly use the driverConnection executeUpdate method (TristanPouliquen) + * bug #37389 [HttpFondation] Change file extension of "audio/mpeg" from "mpga" to "mp3" (YaFou) + * bug #37379 [HttpClient] Support for cURL handler objects (derrabus) + * bug #37383 [VarDumper] Support for cURL handler objects (derrabus) + * bug #37395 add .body wrapper element (Nemo64) + * bug #37400 [HttpClient] unset activity list when creating CurlResponse (nicolas-grekas) + * bug #36304 Check whether path is file in DataPart::fromPath() (freiondrej) + * bug #37345 [Form] collect all transformation failures (xabbuh) + * bug #37362 [SecurityBundle] Drop cache.security_expression_language service if invalid (chalasr) + * bug #37353 [DI] disable preload.php on the CLI (nicolas-grekas) + * bug #37268 [Messenger] Fix precedence of DSN options for 4.4 (jderusse) + * bug #37341 Fix support for PHP8 union types (nicolas-grekas) + * bug #37271 [FrameworkBundle] preserve dots in query-string when redirecting (nicolas-grekas) + * bug #37340 Fix support for PHP8 union types (nicolas-grekas) + * bug #37275 [DI] tighten detection of local dirs to prevent false positives (nicolas-grekas) + * bug #37090 [PhpUnitBridge] Streamline ansi/no-ansi of composer according to phpunit --colors option (kick-the-bucket) + * bug #36230 [VarDumper] Fix CliDumper coloration on light arrays (l-vo) + * bug #37270 [FrameworkBundle] preserve dots in query-string when redirecting (nicolas-grekas) + * bug #37319 [HttpClient] Convert CurlHttpClient::handlePush() to instance method (mpesari) + * bug #37342 [Cache] fix compat with DBAL v3 (nicolas-grekas) + * bug #37286 [Console] Reset question validator attempts only for actual stdin (bis) (nicolas-grekas) + * bug #37160 Reset question validator attempts only for actual stdin (ostrolucky) + * bug #36975 [PropertyInfo] Make PhpDocExtractor compatible with phpDocumentor v5 (DerManoMann) + * 4.4.10 (2020-06-12) * bug #37227 [DependencyInjection][CheckTypeDeclarationsPass] Handle unresolved parameters pointing to environment variables (fancyweb) diff --git a/CHANGELOG-5.1.md b/CHANGELOG-5.1.md index f039fe5634879..224809fbdbad0 100644 --- a/CHANGELOG-5.1.md +++ b/CHANGELOG-5.1.md @@ -7,6 +7,64 @@ in 5.1 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.1.0...v5.1.1 +* 5.1.4 (2020-08-31) + + * bug #37966 [HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response (fancyweb) + * bug #37971 [PropertyInfo] Backport support for typed properties (PHP 7.4) (dunglas) + * bug #37970 [PhpUnitBridge] Polyfill new phpunit 9.1 assertions (phpfour) + * bug #37960 [PhpUnit] Add polyfill for assertMatchesRegularExpression() (dunglas) + * bug #37941 [TwigBridge] allow null for $message of filter method `trans` (Flinsch) + * bug #37622 [PropertyAccess] Fix accessing dynamic properties (andreyserdjuk) + * bug #37927 [HttpClient] fix chaining promises returned by HttplugClient (CthulhuDen) + * bug #37953 [DI] fix dumping lazy non-shared services (nicolas-grekas) + * bug #37949 [Yaml] fix more numeric cases changing in PHP 8 (xabbuh) + * bug #37943 [Security] Fixed RememberMeAuthenticator::autoLogin() logic in the authenticator (wouterj) + * bug #37921 [Yaml] account for is_numeric() behavior changes in PHP 8 (xabbuh) + * bug #37913 [Mailer] Support Return-Path in SesApiAsyncAwsTransport (cvmiert) + * bug #37912 [ExpressionLanguage] fix passing arguments to call_user_func_array() on PHP 8 (xabbuh) + * bug #37907 [Messenger] stop using the deprecated schema synchronizer API (xabbuh) + * bug #37899 [Mailer] Support reply-to in SesApiAsyncAwsTransport (cvmiert) + * bug #37900 [Mailer] Fixed mandrill api header structure (wulff) + * bug #37890 [Notifier] Fixed base_uri while call auth/time API (leblanc-simon) + * bug #37888 [Mailer] Reorder headers used to determine Sender (cvmiert) + * bug #37857 [PropertyInfo] Fix ReflectionExtractor + minor tweaks (ogizanagi) + * bug #37868 [Lock] MongoDbStore handle duplicate querystring keys in mongodb uri when stripping (kralos) + * bug #37872 [Sendgrid-Mailer] Fixed envelope recipients on sendgridApiTransport (arendjantetteroo) + * bug #37860 [Serializer][ClassDiscriminatorMapping] Fix getMappedObjectType() when a discriminator child extends another one (fancyweb) + * bug #37826 [Messenger] Fix BC layer for stamps moved into separate packages (ogizanagi) + * bug #37853 [Validator] ensure that the validator is a mock object for backwards-compatibility (xabbuh) + * bug #36340 [Serializer] Fix configuration of the cache key (dunglas) + * bug #36810 [Messenger] Do not stack retry stamp (jderusse) + * bug #37849 [FrameworkBundle] Add missing mailer transports in xsd (l-vo) + * bug #37218 [Lock] MongoDbStore skim non-standard options from uri (kralos) + * bug #37586 [ErrorHandler][DebugClassLoader] Add mixed and static return types support (fancyweb) + * bug #37845 [Serializer] Fix variadic support when using type hints (fabpot) + * bug #37841 [VarDumper] Backport handler lock when using VAR_DUMPER_FORMAT (ogizanagi) + * bug #37821 Postpone Range BC layer removal to 6.0. (l-vo) + * bug #37725 [Form] Fix Guess phpdoc return type (franmomu) + * bug #37771 Use PHPUnit 9.3 on php 8 (derrabus) + * bug #36140 [Validator] Add BC layer for notInRangeMessage when min and max are set (l-vo) + * bug #35843 [Validator] Add target guards for Composite nested constraints (ogizanagi) + * bug #37803 Fix for issue #37681 (Rav) + * bug #37744 [Yaml] Fix for #36624; Allow PHP constant as first key in block (jnye) + * bug #37767 [Form] fix mapping errors from unmapped forms (xabbuh) + * bug #37731 [Console] Table: support cells with newlines after a cell with colspan >= 2 (GMTA) + * bug #37791 Fix redis connect with empty password (alexander-schranz) + * bug #37790 Fix deprecated libxml_disable_entity_loader (fabpot) + * bug #37763 Fix deprecated libxml_disable_entity_loader (jderusse) + * bug #37774 [Console] Make sure we pass a numeric array of arguments to call_user_func_array() (derrabus) + * bug #37770 [String] We cannot have a "provides" function in test cases (derrabus) + * bug #37729 [FrameworkBundle] fail properly when the required service is not defined (xabbuh) + * bug #37701 [Serializer] Fix that it will never reach DOMNode (TNAJanssen) + * bug #37671 [Cache] fix saving no-expiry items with ArrayAdapter (philipp-kolesnikov) + * bug #37102 [WebProfilerBundle] Fix error with custom function and web profiler routing tab (JakeFr) + * bug #37560 [Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account (Jeroeny) + * bug #37700 [VarDumper] Improve previous fix on light array coloration (l-vo) + * bug #37654 [Messenger] Fix invalid option sslmode in AmazonSqs bridge (jderusse) + * bug #37705 [Mailer] Added the missing reset tag to mailer.logger_message_listener (vudaltsov) + * bug #37697 [Messenger] reduce column length for MySQL 5.6 compatibility (xabbuh) + * bug #37690 HttpClient profiler error (noniagriconomie) + * 5.1.3 (2020-07-24) * bug #37590 Allows RedisClusterProxy instance in Lock RedisStore (jderusse) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index cd95879aaaa07..7b94a4e1e090e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -15,15 +15,15 @@ Symfony is the result of the work of many people who made the code better - Jordi Boggiano (seldaek) - Victor Berchet (victor) - Maxime Steinhausser (ogizanagi) - - Ryan Weaver (weaverryan) - Grégoire Pineau (lyrixx) + - Ryan Weaver (weaverryan) - Javier Eguiluz (javier.eguiluz) - Roland Franssen (ro0) - Jakub Zalas (jakubzalas) - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - - Yonel Ceruto (yonelceruto) - Wouter de Jong (wouterj) + - Yonel Ceruto (yonelceruto) - Hugo Hamon (hhamon) - Thomas Calvet (fancyweb) - Alexander M. Turek (derrabus) @@ -35,21 +35,21 @@ Symfony is the result of the work of many people who made the code better - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - Jules Pietri (heah) - - Hamza Amrouche (simperfit) - Martin Hasoň (hason) + - Hamza Amrouche (simperfit) - Jérémy DERUSSÉ (jderusse) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Eriksen Costa (eriksencosta) - - Guilhem Niot (energetick) - Tobias Nyholm (tobias) + - Guilhem Niot (energetick) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Lynn van der Berg (kjarli) - - Diego Saint Esteben (dosten) - Matthias Pigulla (mpdude) + - Diego Saint Esteben (dosten) - Pierre du Plessis (pierredup) - Alexandre Salomé (alexandresalome) - William Durand (couac) @@ -63,16 +63,16 @@ Symfony is the result of the work of many people who made the code better - Valentin Udaltsov (vudaltsov) - Bulat Shakirzyanov (avalanche123) - Kevin Bond (kbond) + - Jan Schädlich (jschaedl) - Saša Stamenković (umpirsky) - Peter Rehm (rpet) - - Gábor Egyed (1ed) - Gabriel Ostrolucký (gadelat) + - Gábor Egyed (1ed) - Henrik Bjørnskov (henrikbjorn) - - Miha Vrhovnik - David Maicher (dmaicher) + - Miha Vrhovnik - Titouan Galopin (tgalopin) - Diego Saint Esteben (dii3g0) - - Jan Schädlich (jschaedl) - Konstantin Kudryashov (everzet) - Vladimir Reznichenko (kalessil) - Bilal Amarni (bamarni) @@ -113,10 +113,11 @@ Symfony is the result of the work of many people who made the code better - Tim Nagel (merk) - Chris Wilkinson (thewilkybarkid) - Brice BERNARD (brikou) + - Jérôme Vasseur (jvasseur) - marc.weistroff - Tomáš Votruba (tomas_votruba) - Peter Kokot (maastermedia) - - Jérôme Vasseur (jvasseur) + - Alex Pott - lenar - Alexander Schwenn (xelaris) - Włodzimierz Gajda (gajdaw) @@ -128,7 +129,6 @@ Symfony is the result of the work of many people who made the code better - Oskar Stark (oskarstark) - Javier Spagnoletti (phansys) - Joshua Thijssen - - Alex Pott - Daniel Wehner (dawehner) - Tugdual Saunier (tucksaun) - excelwebzone @@ -137,6 +137,7 @@ Symfony is the result of the work of many people who made the code better - Joel Wurtz (brouznouf) - Fabien Pennequin (fabienpennequin) - Théo FIDRY (theofidry) + - Alexander Schranz (alexander-schranz) - Przemysław Bogusz (przemyslaw-bogusz) - Eric GELOEN (gelo) - Lars Strojny (lstrojny) @@ -144,13 +145,13 @@ Symfony is the result of the work of many people who made the code better - Robert Schönthal (digitalkaoz) - Gregor Harlan (gharlan) - Florian Lonqueu-Brochard (florianlb) - - Alexander Schranz (alexander-schranz) - Gabriel Caruso (carusogabriel) - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) - Julien Falque (julienfalque) - Vincent AUBERT (vincent) - Juti Noppornpitak (shiroyuki) + - Laurent VOULLEMIER (lvo) - Anthony MARTIN (xurudragon) - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) @@ -161,9 +162,9 @@ Symfony is the result of the work of many people who made the code better - Yanick Witschi (toflar) - Arnaud Kleinpeter (nanocom) - Guilherme Blanco (guilhermeblanco) - - Laurent VOULLEMIER (lvo) - SpacePossum - Pablo Godel (pgodel) + - Richard van Laak (rvanlaak) - Jérémie Augustin (jaugustin) - François-Xavier de Guillebon (de-gui_f) - Oleg Voronkovich @@ -171,26 +172,26 @@ Symfony is the result of the work of many people who made the code better - Rafael Dohms (rdohms) - jwdeitch - Ahmed TAILOULOUTE (ahmedtai) + - jeremyFreeAgent (jeremyfreeagent) - Mikael Pajunen - Arman Hosseini (arman) - Niels Keurentjes (curry684) - Vyacheslav Pavlov - - Richard van Laak (rvanlaak) + - George Mponos (gmponos) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Vincent Touzet (vincenttouzet) - - jeremyFreeAgent (jeremyfreeagent) - Rouven Weßling (realityking) - Jérôme Parmentier (lctrs) - Ben Davies (bendavies) - Andreas Schempp (aschempp) - Clemens Tolboom - Helmer Aaviksoo + - Antoine M (amakdessi) - Hiromi Hishida (77web) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - Dawid Nowak - - George Mponos (gmponos) - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba @@ -202,7 +203,6 @@ Symfony is the result of the work of many people who made the code better - James Halsall (jaitsu) - Matthieu Napoli (mnapoli) - Florent Mata (fmata) - - Antoine Makdessi (amakdessi) - Warnar Boekkooi (boekkooi) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) @@ -220,6 +220,7 @@ Symfony is the result of the work of many people who made the code better - Dennis Benkert (denderello) - DQNEO - Andre Rømcke (andrerom) + - Mathias Arlaud (mtarld) - mcfedr (mcfedr) - Ruben Gonzalez (rubenrua) - Benjamin Dulau (dbenjamin) @@ -247,10 +248,10 @@ Symfony is the result of the work of many people who made the code better - David Prévot - fivestar - Dominique Bongiraud + - Hidde Wieringa (hiddewie) - Jeremy Livingston (jeremylivingston) - Michael Lee (zerustech) - Matthieu Auger (matthieuauger) - - Mathias Arlaud (mtarld) - Leszek Prabucki (l3l0) - Fabien Bourigault (fbourigault) - François Zaninotto (fzaninotto) @@ -262,12 +263,14 @@ Symfony is the result of the work of many people who made the code better - Blanchon Vincent (blanchonvincent) - Michele Orselli (orso) - Sven Paulus (subsven) + - Baptiste Lafontaine (magnetik) - Maxime Veber (nek-) - Rui Marinho (ruimarinho) - Eugene Wissner - Edi Modrić (emodric) - Pascal Montoya - Julien Brochet (mewt) + - François Pluchino (francoispluchino) - Leo Feyer - Tristan Darricau (nicofuma) - Victor Bocharsky (bocharsky_bw) @@ -279,7 +282,6 @@ Symfony is the result of the work of many people who made the code better - Pavel Batanov (scaytrase) - Mantis Development - Loïc Faugeron - - Hidde Wieringa (hiddewie) - dFayet - Marco Pivetta (ocramius) - Rob Frawley 2nd (robfrawley) @@ -315,7 +317,6 @@ Symfony is the result of the work of many people who made the code better - Kristen Gilden (kgilden) - Pierre-Yves LEBECQ (pylebecq) - Jordan Samouh (jordansamouh) - - Baptiste Lafontaine (magnetik) - Jakub Kucharovic (jkucharovic) - Loick Piera (pyrech) - Uwe Jäger (uwej711) @@ -328,7 +329,6 @@ Symfony is the result of the work of many people who made the code better - Jan Sorgalla (jsor) - Ray - Chekote - - François Pluchino (francoispluchino) - Thomas Adam - Jhonny Lidfors (jhonne) - Diego Agulló (aeoris) @@ -352,6 +352,7 @@ Symfony is the result of the work of many people who made the code better - Roumen Damianoff (roumen) - Emanuele Panzeri (thepanz) - Kim Hemsø Rasmussen (kimhemsoe) + - Alessandro Lai (jean85) - Pascal Luna (skalpa) - Wouter Van Hecke - Peter Kruithof (pkruithof) @@ -409,6 +410,7 @@ Symfony is the result of the work of many people who made the code better - Berny Cantos (xphere81) - Thierry Thuon (lepiaf) - Guilhem N (guilhemn) + - Sebastien Morel (plopix) - Ricard Clau (ricardclau) - Mark Challoner (markchalloner) - Philippe Segatori @@ -423,7 +425,6 @@ Symfony is the result of the work of many people who made the code better - Oleg Andreyev - Langlet Vincent (deviling) - Mateusz Sip (mateusz_sip) - - Alessandro Lai (jean85) - Francesco Levorato - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) @@ -439,9 +440,11 @@ Symfony is the result of the work of many people who made the code better - Felix Labrecque - Yaroslav Kiliba - Terje Bråten + - Daniel STANCU - Robbert Klarenbeek (robbertkl) - soyuka - Eric Masoero (eric-masoero) + - Ion Bazan (ionbazan) - Denis Brumann (dbrumann) - Gocha Ossinkine (ossinkine) - JhonnyL @@ -510,19 +513,21 @@ Symfony is the result of the work of many people who made the code better - Sander Toonen (xatoo) - Anthon Pang (robocoder) - Marko Kaznovac (kaznovac) + - Thomas Landauer (thomas-landauer) - Sébastien Santoro (dereckson) - Brian King - Michel Salib (michelsalib) + - quentin neyrat (qneyrat) - Chris Tanaskoski - geoffrey - Steffen Roßkamp - Alexandru Furculita (afurculita) - Valentin Jonovs (valentins-jonovs) - - Sebastien Morel (plopix) - Jeanmonod David (jeanmonod) - Christopher Davis (chrisguitarguy) - Webnet team (webnet) - Joe Bennett (kralos) + - Ahmed Raafat - Farhad Safarov - Jan Schumann - Niklas Fiekas @@ -531,15 +536,18 @@ Symfony is the result of the work of many people who made the code better - Erkhembayar Gantulga (erheme318) - Islam93 - lancergr + - Tri Pham (phamuyentri) - Mihai Stancu - Ivan Nikolaev (destillat) - Gildas Quéméner (gquemener) + - Claude Khedhiri (ck-developer) - Desjardins Jérôme (jewome62) - Arturs Vonda - Josip Kruslin - Matthew Smeets - Toni Rudolf (toooni) - Asmir Mustafic (goetas) + - DerManoMann - Nicolas Philippe (nikophil) - vagrant - Aurimas Niekis (gcds) @@ -551,6 +559,7 @@ Symfony is the result of the work of many people who made the code better - Vlad Gregurco (vgregurco) - Boris Vujicic (boris.vujicic) - Artem Lopata + - Judicaël RUFFIEUX (axanagor) - Chris Sedlmayr (catchamonkey) - Kamil Kokot (pamil) - Seb Koelen @@ -564,7 +573,6 @@ Symfony is the result of the work of many people who made the code better - Jonas Flodén (flojon) - Tobias Weichart - Gonzalo Vilaseca (gonzalovilaseca) - - Daniel STANCU - Tarmo Leppänen (tarlepp) - Marcin Sikoń (marphi) - Dominik Zogg (dominik.zogg) @@ -583,6 +591,7 @@ Symfony is the result of the work of many people who made the code better - Adam Harvey - Anton Bakai - Martin Auswöger + - Christian Scheb - Rhodri Pugh (rodnaph) - battye - Sam Fleming (sam_fleming) @@ -685,7 +694,6 @@ Symfony is the result of the work of many people who made the code better - Jeremy Benoist - fritzmg - Lenar Lõhmus - - Ion Bazan (ionbazan) - Benjamin Laugueux (yzalis) - Zach Badgett (zachbadgett) - Chi-teck @@ -693,7 +701,6 @@ Symfony is the result of the work of many people who made the code better - Pavel Campr (pcampr) - Andrii Dembitskyi - Johnny Robeson (johnny) - - Thomas Landauer (thomas-landauer) - Guilliam Xavier - Disquedur - Michiel Boeckaert (milio) @@ -721,6 +728,7 @@ Symfony is the result of the work of many people who made the code better - Andrey Sevastianov - Sebastian Blum - Alexis Lefebvre + - Dmitriy Mamontov (mamontovdmitriy) - aubx - Julien Turby - Marvin Butkereit @@ -772,7 +780,6 @@ Symfony is the result of the work of many people who made the code better - David Fuhr - Mathias STRASSER (roukmoute) - Max Grigorian (maxakawizard) - - DerManoMann - Rostyslav Kinash - Dennis Fridrich (dfridrich) - Mardari Dorel (dorumd) @@ -795,9 +802,11 @@ Symfony is the result of the work of many people who made the code better - umpirski - M. Vondano - Quentin de Longraye (quentinus95) + - Bohan Yang (brentybh) - Chris Heng (gigablah) - Shaun Simmons (simshaun) - Richard Bradley + - Mathieu Santostefano - Ulumuddin Yunus (joenoez) - rtek - Ivan Grigoriev @@ -812,6 +821,7 @@ Symfony is the result of the work of many people who made the code better - Szijarto Tamas - Robin Lehrmann (robinlehrmann) - Catalin Dan + - Marco Petersen (ocrampete16) - Soner Sayakci - Jaroslav Kuba - Kristijan Kanalas @@ -905,12 +915,10 @@ Symfony is the result of the work of many people who made the code better - Jonatan Männchen - Dennis Hotson - Andrew Tchircoff (andrewtch) - - Ahmed Raafat - michaelwilliams - Martin Kirilov - 1emming - Nykopol (nykopol) - - Tri Pham (phamuyentri) - Jordan Deitch - Casper Valdemar Poulsen - Laurent Masforné (heisenberg) @@ -939,6 +947,7 @@ Symfony is the result of the work of many people who made the code better - Jon Dufresne - possum - Denis Zunke (donalberto) + - Phil Taylor (prazgod) - Ahmadou Waly Ndiaye (waly) - Jonathan Johnson (jrjohnson) - Olivier Maisonneuve (olineuve) @@ -999,7 +1008,9 @@ Symfony is the result of the work of many people who made the code better - Mathieu MARCHOIS - Cyril Quintin (cyqui) - Gerard van Helden (drm) + - flack (flack) - Johnny Peck (johnnypeck) + - Michael Voříšek - Stefan Kruppa - Ivan Menshykov - David Romaní @@ -1035,6 +1046,7 @@ Symfony is the result of the work of many people who made the code better - Jérémy M (th3mouk) - Simone Di Maulo (toretto460) - Christian Morgan + - YaFou - Alexander Miehe (engerim) - Morgan Auchede (mauchede) - Sascha Dens (saschadens) @@ -1064,6 +1076,7 @@ Symfony is the result of the work of many people who made the code better - Matthew Davis (mdavis1982) - Paulo Ribeiro (paulo) - Markus S. (staabm) + - Marc Laporte - Benjamin Morel - Maks - Antoine LA @@ -1106,14 +1119,19 @@ Symfony is the result of the work of many people who made the code better - Renan Taranto (renan-taranto) - Rikijs Murgs - Uladzimir Tsykun + - iamvar - Ben Ramsey (ramsey) - Amaury Leroux de Lens (amo__) - Christian Jul Jensen - Alexandre GESLIN (alexandregeslin) - The Whole Life to Learn + - Alex Vo (votanlean) - Mikkel Paulson - ergiegonzaga + - Daniel González - Liverbool (liverbool) + - Malte Schlüter + - Jules Matsounga (hyoa) - Sam Malone - Phan Thanh Ha (haphan) - Chris Jones (leek) @@ -1121,6 +1139,7 @@ Symfony is the result of the work of many people who made the code better - xaav - Mahmoud Mostafa (mahmoud) - Antonio Jose Cerezo (ajcerezo) + - Anthony Moutte - Ahmed Abdou - Daniel Iwaniec - Thomas Ferney @@ -1141,9 +1160,11 @@ Symfony is the result of the work of many people who made the code better - Iliya Miroslavov Iliev (i.miroslavov) - Safonov Nikita (ns3777k) - Ross Motley (rossmotley) + - Krystian Marcisz (simivar) - ttomor - Mei Gwilym (meigwilym) - Michael H. Arieli (excelwebzone) + - Nicolas Martin (cocorambo) - Tom Panier (neemzy) - Fred Cox - Luciano Mammino (loige) @@ -1156,6 +1177,7 @@ Symfony is the result of the work of many people who made the code better - Lorenzo Millucci - Andreas Kleemann - Manuele Menozzi + - Philipp Kolesnikov - zairig imad (zairigimad) - Anton Babenko (antonbabenko) - Irmantas Šiupšinskas (irmantas) @@ -1166,6 +1188,7 @@ Symfony is the result of the work of many people who made the code better - Arnaud PETITPAS (apetitpa) - Ken Stanley - Zachary Tong (polyfractal) + - linh - Mario Blažek (marioblazek) - Ashura - Hryhorii Hrebiniuk @@ -1199,11 +1222,11 @@ Symfony is the result of the work of many people who made the code better - Patrick Luca Fazzi (ap3ir0n) - Danijel Obradović - Pablo Borowicz - - Mathieu Santostefano - Arjan Keeman - Máximo Cuadros (mcuadros) - Lukas Mencl - tamirvs + - Mohammad Emran Hasan (phpfour) - gauss - julien.galenski - Christian Neff @@ -1230,7 +1253,6 @@ Symfony is the result of the work of many people who made the code better - gr1ev0us - mlazovla - Alejandro Diaz Torres - - quentin neyrat (qneyrat) - Max Beutel - Jan Vernieuwe (vernija) - Antanas Arvasevicius @@ -1259,10 +1281,12 @@ Symfony is the result of the work of many people who made the code better - Dominic Tubach - Nikita Konstantinov - Martijn Evers + - Philipp Fritsche - Vitaliy Ryaboy (vitaliy) - Benjamin Paap (benjaminpaap) - Claus Due (namelesscoder) - Christian + - Alexandru Patranescu - Denis Golubovskiy (bukashk0zzz) - Sergii Smertin (nfx) - Mikkel Paulson @@ -1313,10 +1337,12 @@ Symfony is the result of the work of many people who made the code better - James Hudson - Stephen Clouse - e-ivanov + - Carlos Pereira De Amorim (epitre) - Benjamin Dos Santos - Einenlum - Jérémy Jarrié (gagnar) - Jochen Bayer (jocl) + - Tomas Javaisis - Patrick Carlo-Hickman - Bruno MATEU - Jeremy Bush @@ -1334,7 +1360,6 @@ Symfony is the result of the work of many people who made the code better - Péter Buri (burci) - John VanDeWeghe - kaiwa - - Claude Khedhiri (ck-developer) - Charles Sanquer (csanquer) - Albert Ganiev (helios-ag) - Neil Katin @@ -1368,6 +1393,7 @@ Symfony is the result of the work of many people who made the code better - Nathan PAGE (nathix) - Ryan Rogers - Klaus Purer + - Dmitrii Lozhkin - arnaud (arnooo999) - Gilles Doge (gido) - Oscar Esteve (oesteve) @@ -1382,6 +1408,7 @@ Symfony is the result of the work of many people who made the code better - Dmitriy Simushev - Pawel Smolinski - Tomasz (timitao) + - Nguyen Tuan Minh (tuanminhgp) - Oxan van Leeuwen - pkowalczyk - Soner Sayakci @@ -1411,6 +1438,7 @@ Symfony is the result of the work of many people who made the code better - David Legatt (dlegatt) - Alain Flaus (halundra) - tsufeki + - dangkhoagms - Philipp Strube - Clement Herreman (clemherreman) - Dan Ionut Dumitriu (danionut90) @@ -1473,6 +1501,7 @@ Symfony is the result of the work of many people who made the code better - Andrei Igna - Adam Prickett - azine + - Javier Espinosa - Anton Kroshilin - Dawid Sajdak - Ludek Stepan @@ -1527,6 +1556,7 @@ Symfony is the result of the work of many people who made the code better - Jules Lamur - Renato Mendes Figueiredo - Benjamin RICHARD + - Gennadi Janzen - pdommelen - Eric Stern - ShiraNai7 @@ -1551,8 +1581,10 @@ Symfony is the result of the work of many people who made the code better - Philip Frank - David Brooks - Lance McNearney + - Florian Caron (shalalalala) - Serhiy Lunak (slunak) - Giorgio Premi + - Mikko Pesari - Aurélien Fontaine - ncou - Ian Carroll @@ -1592,6 +1624,7 @@ Symfony is the result of the work of many people who made the code better - Jay Severson - Benny Born - Emirald Mateli + - Tristan Pouliquen - René Kerner - Nathaniel Catchpole - Adrien Samson (adriensamson) @@ -1627,6 +1660,7 @@ Symfony is the result of the work of many people who made the code better - Peter Bouwdewijn - mlively - Wouter Diesveld + - Vincent Langlet - Amine Matmati - caalholm - Nouhail AL FIDI (alfidi) @@ -1641,6 +1675,7 @@ Symfony is the result of the work of many people who made the code better - rkerner - Alex Silcock - Qingshan Luo + - Gijs van Lammeren - Ergie Gonzaga - Matthew J Mucklo - AnrDaemon @@ -1691,6 +1726,7 @@ Symfony is the result of the work of many people who made the code better - LubenZA - Victor Garcia - Olivier + - Juan Mrad - Denis Yuzhanin - knezmilos13 - Cyril PASCAL @@ -1759,6 +1795,7 @@ Symfony is the result of the work of many people who made the code better - 2manypeople - Wing - Thomas Bibb + - kick-the-bucket - Matt Farmer - catch - Alexandre Segura @@ -1812,6 +1849,7 @@ Symfony is the result of the work of many people who made the code better - Thomas Chmielowiec - shdev - Andrey Ryaguzov + - Gennadi Janzen - Stefan - Peter Bex - Manatsawin Hanmongkolchai @@ -1822,7 +1860,6 @@ Symfony is the result of the work of many people who made the code better - Dennis Væversted - Timon van der Vorm - nuncanada - - flack - František Bereň - Kamil Madejski - Jeremiah VALERIE @@ -1833,6 +1870,7 @@ Symfony is the result of the work of many people who made the code better - Denys Voronin (hurricane) - Ionel Scutelnicu (ionelscutelnicu) - Mathieu Dewet (mdewet) + - none (nelexa) - Nicolas Tallefourtané (nicolab) - Botond Dani (picur) - Rémi Faivre (rfv) @@ -1869,6 +1907,7 @@ Symfony is the result of the work of many people who made the code better - Adrien Wilmet - Martin - nietonfir + - Taylor Otwell - alefranz - David Barratt - Andrea Giannantonio @@ -1954,7 +1993,6 @@ Symfony is the result of the work of many people who made the code better - Tim Strehle - Sébastien COURJEAN - Sam Ward - - Michael Voříšek - Walther Lalk - Adam - Ivo @@ -1964,7 +2002,6 @@ Symfony is the result of the work of many people who made the code better - Ali Tavafi - Trevor Suarez - gedrox - - Bohan Yang - Alan Bondarchuk - Pchol - dropfen @@ -1998,7 +2035,6 @@ Symfony is the result of the work of many people who made the code better - Andrew Marcinkevičius (ifdattic) - Ioana Hazsda (ioana-hazsda) - Jan Marek (janmarek) - - Dmitriy Mamontov (mamontovdmitriy) - Mark de Haan (markdehaan) - Dan Patrick (mdpatrick) - naitsirch (naitsirch) @@ -2082,7 +2118,7 @@ Symfony is the result of the work of many people who made the code better - Rowan Manning - Per Modin - David Windell - - Christian Scheb + - Ondřej Frei - Gabriel Birke - skafandri - Derek Bonner @@ -2120,6 +2156,7 @@ Symfony is the result of the work of many people who made the code better - Klaas Naaijkens - Daniel González Cerviño - Rafał + - Ahmad El-Bardan (absahmad) - Achilles Kaloeridis (achilles) - Adria Lopez (adlpz) - Aaron Scherer (aequasi) @@ -2180,6 +2217,7 @@ Symfony is the result of the work of many people who made the code better - Ondrej Mirtes - akimsko - Youpie + - Jason Stephens - srsbiz - Taylan Kasap - Michael Orlitzky @@ -2237,6 +2275,7 @@ Symfony is the result of the work of many people who made the code better - Nardberjean - Karolis - Myke79 + - jersoe - Brian Debuire - Eric Grimois - Piers Warmers @@ -2344,6 +2383,7 @@ Symfony is the result of the work of many people who made the code better - Sema - Elan Ruusamäe - Thorsten Hallwas + - Marco Pfeiffer - Alex Nostadt - Michael Squires - Egor Gorbachev @@ -2480,7 +2520,6 @@ Symfony is the result of the work of many people who made the code better - Ala Eddine Khefifi (nayzo) - emilienbouard (neime) - Nicholas Byfleet (nickbyfleet) - - Marco Petersen (ocrampete16) - ollie harridge (ollietb) - Paul Andrieux (paulandrieux) - Paweł Szczepanek (pauluz) @@ -2491,7 +2530,6 @@ Symfony is the result of the work of many people who made the code better - Alex Carol (picard89) - Daniel Perez Pinazo (pitiflautico) - Igor Tarasov (polosatus) - - Phil Taylor (prazgod) - Maxim Pustynnikov (pustynnikov) - Ralf Kuehnel (ralfkuehnel) - Brayden Williams (redstar504) @@ -2570,6 +2608,7 @@ Symfony is the result of the work of many people who made the code better - Bogdan Rancichi (devck) - Daniel Kolvik (dkvk) - Marc Lemay (flug) + - Gabriel Solomon (gabrielsolomon) - Henne Van Och (hennevo) - Jeroen De Dauw (jeroendedauw) - Jonathan Scheiber (jmsche) diff --git a/README.md b/README.md index da9e6156c00d7..11d1932da94e9 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Community * [Join the Symfony Community][11] and meet other members at the [Symfony events][12]. * [Get Symfony support][13] on Stack Overflow, Slack, IRC, etc. * Follow us on [GitHub][14], [Twitter][15] and [Facebook][16]. -* Read our [Code of Conduct][24] and meet the [CARE Team][25] +* Read our [Code of Conduct][24] and meet the [CARE Team][25]. Contributing ------------ diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index c0ebfb213a417..075b5d9fc46a7 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -237,7 +237,7 @@ FrameworkBundle * The `Templating\Helper\TranslatorHelper::transChoice()` method has been removed, use the `trans()` one instead with a `%count%` parameter. * Removed support for legacy translations directories `src/Resources/translations/` and `src/Resources//translations/`, use `translations/` instead. * Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been removed. - * Removed the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead. + * Removed the `Psr\SimpleCache\CacheInterface` / `cache.app.simple` service, use `Symfony\Contracts\Cache\CacheInterface` / `cache.app` instead. * Removed support for `templating` engine in `TemplateController`, use Twig instead * Removed `ResolveControllerNameSubscriber`. * Removed `routing.loader.service`. @@ -260,7 +260,7 @@ HttpFoundation * The `$size` argument of the `UploadedFile` constructor has been removed. * The `getClientSize()` method of the `UploadedFile` class has been removed. * The `getSession()` method of the `Request` class throws an exception when session is null. - * The default value of the "$secure" and "$samesite" arguments of Cookie's constructor + * The default value of the `$secure` and `$samesite` arguments of Cookie's constructor changed respectively from "false" to "null" and from "null" to "lax". * The `MimeTypeGuesserInterface` and `ExtensionGuesserInterface` interfaces have been removed, use `Symfony\Component\Mime\MimeTypesInterface` instead. @@ -561,7 +561,7 @@ TwigBridge ---------- * Removed argument `$rootDir` from the `DebugCommand::__construct()` method and the 5th argument must be an instance of `FileLinkFormatter` - * removed the `$requestStack` and `$requestContext` arguments of the + * Removed the `$requestStack` and `$requestContext` arguments of the `HttpFoundationExtension`, pass a `Symfony\Component\HttpFoundation\UrlHelper` instance as the only argument instead * Removed support for implicit STDIN usage in the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit. @@ -681,4 +681,4 @@ WebProfilerBundle WebServerBundle --------------- - * The bundle has been removed. + * The bundle has been deprecated and can be installed separately. You may also use the Symfony Local Web Server instead. diff --git a/composer.json b/composer.json index 8dc3e7dcbba18..0dfefb3475e7a 100644 --- a/composer.json +++ b/composer.json @@ -112,7 +112,7 @@ "doctrine/cache": "~1.6", "doctrine/collections": "~1.0", "doctrine/data-fixtures": "^1.1", - "doctrine/dbal": "~2.4", + "doctrine/dbal": "~2.4|^3.0", "doctrine/orm": "~2.4,>=2.4.5", "doctrine/reflection": "~1.0", "doctrine/doctrine-bundle": "^2.0", @@ -127,7 +127,7 @@ "psr/http-client": "^1.0", "psr/simple-cache": "^1.0", "egulias/email-validator": "~1.2,>=1.2.8|~2.0", - "symfony/phpunit-bridge": "^5.0.8", + "symfony/phpunit-bridge": "^5.2", "symfony/security-acl": "~2.8|~3.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "twig/cssinliner-extra": "^2.12", diff --git a/link b/link index 1525ab0cb9bbf..c48c64c49d289 100755 --- a/link +++ b/link @@ -18,19 +18,22 @@ require __DIR__.'/src/Symfony/Component/Filesystem/Filesystem.php'; use Symfony\Component\Filesystem\Filesystem; /** - * Links dependencies to components to a local clone of the main symfony/symfony GitHub repository. + * Links dependencies of a project to a local clone of the main symfony/symfony GitHub repository. * * @author Kévin Dunglas */ $copy = false !== $k = array_search('--copy', $argv, true); $copy && array_splice($argv, $k, 1); +$rollback = false !== $k = array_search('--rollback', $argv, true); +$rollback && array_splice($argv, $k, 1); $pathToProject = $argv[1] ?? getcwd(); if (!is_dir("$pathToProject/vendor/symfony")) { - echo 'Link (or copy) dependencies to components to a local clone of the main symfony/symfony GitHub repository.'.PHP_EOL.PHP_EOL; + echo 'Links dependencies of a project to a local clone of the main symfony/symfony GitHub repository.'.PHP_EOL.PHP_EOL; echo "Usage: $argv[0] /path/to/the/project".PHP_EOL; echo ' Use `--copy` to copy dependencies instead of symlink'.PHP_EOL.PHP_EOL; + echo ' Use `--rollback` to rollback'.PHP_EOL.PHP_EOL; echo "The directory \"$pathToProject\" does not exist or the dependencies are not installed, did you forget to run \"composer install\" in your project?".PHP_EOL; exit(1); } @@ -53,12 +56,19 @@ foreach ($directories as $dir) { foreach (glob("$pathToProject/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as $dir) { $package = 'symfony/'.basename($dir); - if (!$copy && is_link($dir)) { - echo "\"$package\" is already a symlink, skipping.".PHP_EOL; + + if (!isset($sfPackages[$package])) { continue; } - if (!isset($sfPackages[$package])) { + if ($rollback) { + $filesystem->remove($dir); + echo "\"$package\" has been rollback from \"$sfPackages[$package]\".".PHP_EOL; + continue; + } + + if (!$copy && is_link($dir)) { + echo "\"$package\" is already a symlink, skipping.".PHP_EOL; continue; } @@ -78,3 +88,7 @@ foreach (glob("$pathToProject/vendor/symfony/*", GLOB_ONLYDIR | GLOB_NOSORT) as foreach (glob("$pathToProject/var/cache/*", GLOB_NOSORT) as $cacheDir) { $filesystem->remove($cacheDir); } + +if ($rollback) { + echo PHP_EOL."Rollback done, do not forget to run \"composer install\" in your project \"$pathToProject\".".PHP_EOL; +} diff --git a/phpunit b/phpunit index 713594fc19edd..2b4412dc4d4fc 100755 --- a/phpunit +++ b/phpunit @@ -12,7 +12,11 @@ if (!getenv('SYMFONY_PHPUNIT_VERSION')) { if (false === getenv('SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT') && false !== strpos(@file_get_contents(__DIR__.'/src/Symfony/Component/HttpKernel/Kernel.php'), 'const MAJOR_VERSION = 3;')) { putenv('SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT=1'); } - putenv('SYMFONY_PHPUNIT_VERSION=8.3'); + if (\PHP_VERSION_ID >= 80000) { + putenv('SYMFONY_PHPUNIT_VERSION=9.3'); + } else { + putenv('SYMFONY_PHPUNIT_VERSION=8.3'); + } } elseif (\PHP_VERSION_ID >= 70000) { putenv('SYMFONY_PHPUNIT_VERSION=6.5'); } diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php index 54c2654d7ee7d..ca75617326331 100644 --- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php +++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php @@ -60,12 +60,15 @@ public function guessType(string $class, string $property) switch ($metadata->getTypeOfField($property)) { case self::$useDeprecatedConstants ? Type::TARRAY : Types::ARRAY: + // no break case self::$useDeprecatedConstants ? Type::SIMPLE_ARRAY : Types::SIMPLE_ARRAY: return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CollectionType', [], Guess::MEDIUM_CONFIDENCE); case self::$useDeprecatedConstants ? Type::BOOLEAN : Types::BOOLEAN: return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\CheckboxType', [], Guess::HIGH_CONFIDENCE); case self::$useDeprecatedConstants ? Type::DATETIME : Types::DATETIME_MUTABLE: + // no break case self::$useDeprecatedConstants ? Type::DATETIMETZ : Types::DATETIMETZ_MUTABLE: + // no break case 'vardatetime': return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', [], Guess::HIGH_CONFIDENCE); case 'datetime_immutable': @@ -86,7 +89,9 @@ public function guessType(string $class, string $property) case self::$useDeprecatedConstants ? Type::FLOAT : Types::FLOAT: return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\NumberType', [], Guess::MEDIUM_CONFIDENCE); case self::$useDeprecatedConstants ? Type::INTEGER : Types::INTEGER: + // no break case self::$useDeprecatedConstants ? Type::BIGINT : Types::BIGINT: + // no break case self::$useDeprecatedConstants ? Type::SMALLINT : Types::SMALLINT: return new TypeGuess('Symfony\Component\Form\Extension\Core\Type\IntegerType', [], Guess::MEDIUM_CONFIDENCE); case self::$useDeprecatedConstants ? Type::STRING : Types::STRING: diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php index 7464f03fe2a28..1829cdbcdb747 100644 --- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php +++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php @@ -142,8 +142,11 @@ public function getTypes(string $class, string $property, array $context = []) case Type::BUILTIN_TYPE_OBJECT: switch ($typeOfField) { case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE: + // no break case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE: + // no break case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE: + // no break case 'vardatetime': case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE: return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable, 'DateTime')]; @@ -162,6 +165,7 @@ public function getTypes(string $class, string $property, array $context = []) case Type::BUILTIN_TYPE_ARRAY: switch ($typeOfField) { case self::$useDeprecatedConstants ? DBALType::TARRAY : Types::ARRAY: + // no break case 'json_array': return [new Type(Type::BUILTIN_TYPE_ARRAY, $nullable, null, true)]; @@ -241,6 +245,7 @@ private function getPhpType(string $doctrineType): ?string { switch ($doctrineType) { case self::$useDeprecatedConstants ? DBALType::SMALLINT : Types::SMALLINT: + // no break case self::$useDeprecatedConstants ? DBALType::INTEGER : Types::INTEGER: return Type::BUILTIN_TYPE_INT; @@ -248,9 +253,13 @@ private function getPhpType(string $doctrineType): ?string return Type::BUILTIN_TYPE_FLOAT; case self::$useDeprecatedConstants ? DBALType::BIGINT : Types::BIGINT: + // no break case self::$useDeprecatedConstants ? DBALType::STRING : Types::STRING: + // no break case self::$useDeprecatedConstants ? DBALType::TEXT : Types::TEXT: + // no break case self::$useDeprecatedConstants ? DBALType::GUID : Types::GUID: + // no break case self::$useDeprecatedConstants ? DBALType::DECIMAL : Types::DECIMAL: return Type::BUILTIN_TYPE_STRING; @@ -258,15 +267,21 @@ private function getPhpType(string $doctrineType): ?string return Type::BUILTIN_TYPE_BOOL; case self::$useDeprecatedConstants ? DBALType::BLOB : Types::BLOB: + // no break case 'binary': return Type::BUILTIN_TYPE_RESOURCE; case self::$useDeprecatedConstants ? DBALType::OBJECT : Types::OBJECT: + // no break case self::$useDeprecatedConstants ? DBALType::DATE : Types::DATE_MUTABLE: + // no break case self::$useDeprecatedConstants ? DBALType::DATETIME : Types::DATETIME_MUTABLE: + // no break case self::$useDeprecatedConstants ? DBALType::DATETIMETZ : Types::DATETIMETZ_MUTABLE: + // no break case 'vardatetime': case self::$useDeprecatedConstants ? DBALType::TIME : Types::TIME_MUTABLE: + // no break case 'date_immutable': case 'datetime_immutable': case 'datetimetz_immutable': @@ -275,7 +290,9 @@ private function getPhpType(string $doctrineType): ?string return Type::BUILTIN_TYPE_OBJECT; case self::$useDeprecatedConstants ? DBALType::TARRAY : Types::ARRAY: + // no break case self::$useDeprecatedConstants ? DBALType::SIMPLE_ARRAY : Types::SIMPLE_ARRAY: + // no break case 'json_array': return Type::BUILTIN_TYPE_ARRAY; } diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 0a7adf16d7d1b..b12d62110577d 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -46,7 +46,7 @@ "doctrine/cache": "~1.6", "doctrine/collections": "~1.0", "doctrine/data-fixtures": "^1.1", - "doctrine/dbal": "~2.4", + "doctrine/dbal": "~2.4|^3.0", "doctrine/orm": "^2.6.3", "doctrine/reflection": "~1.0" }, diff --git a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php index 99ba3bbc3d94a..612350200e3d6 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php @@ -41,8 +41,8 @@ */ class ElasticsearchLogstashHandler extends AbstractHandler { - use ProcessableHandlerTrait; use FormattableHandlerTrait; + use ProcessableHandlerTrait; private $endpoint; private $index; diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php index 5a59d2934679d..fc4559277e1a0 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php @@ -112,14 +112,12 @@ public function testVerbosityChanged() { $output = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); $output - ->expects($this->at(0)) + ->expects($this->exactly(2)) ->method('getVerbosity') - ->willReturn(OutputInterface::VERBOSITY_QUIET) - ; - $output - ->expects($this->at(1)) - ->method('getVerbosity') - ->willReturn(OutputInterface::VERBOSITY_DEBUG) + ->willReturnOnConsecutiveCalls( + OutputInterface::VERBOSITY_QUIET, + OutputInterface::VERBOSITY_DEBUG + ) ; $handler = new ConsoleHandler($output); $this->assertFalse($handler->isHandling(['level' => Logger::NOTICE]), diff --git a/src/Symfony/Bridge/PhpUnit/CHANGELOG.md b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md index 6da53d30a017e..2808ad0c50903 100644 --- a/src/Symfony/Bridge/PhpUnit/CHANGELOG.md +++ b/src/Symfony/Bridge/PhpUnit/CHANGELOG.md @@ -25,7 +25,7 @@ CHANGELOG ----- * added `ClassExistsMock` - * bumped PHP version from 5.3.3 to 5.5.9 + * bumped PHP version from 5.3.3 to 5.5.9 * split simple-phpunit bin into php file with code and a shell script 4.1.0 diff --git a/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillAssertTrait.php b/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillAssertTrait.php index 69a01d292704e..1f05bbe58400f 100644 --- a/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillAssertTrait.php +++ b/src/Symfony/Bridge/PhpUnit/Legacy/PolyfillAssertTrait.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\Constraint\IsEqual; use PHPUnit\Framework\Constraint\LogicalNot; +use PHPUnit\Framework\Constraint\RegularExpression; use PHPUnit\Framework\Constraint\StringContains; use PHPUnit\Framework\Constraint\TraversableContains; @@ -276,6 +277,17 @@ public static function assertNotIsReadable($filename, $message = '') static::assertFalse(is_readable($filename), $message ? $message : "Failed asserting that $filename is not readable."); } + /** + * @param string $filename + * @param string $message + * + * @return void + */ + public static function assertIsNotReadable($filename, $message = '') + { + static::assertNotIsReadable($filename, $message); + } + /** * @param string $filename * @param string $message @@ -300,6 +312,17 @@ public static function assertNotIsWritable($filename, $message = '') static::assertFalse(is_writable($filename), $message ? $message : "Failed asserting that $filename is not writable."); } + /** + * @param string $filename + * @param string $message + * + * @return void + */ + public static function assertIsNotWritable($filename, $message = '') + { + static::assertNotIsWritable($filename, $message); + } + /** * @param string $directory * @param string $message @@ -324,6 +347,17 @@ public static function assertDirectoryNotExists($directory, $message = '') static::assertFalse(is_dir($directory), $message ? $message : "Failed asserting that $directory does not exist."); } + /** + * @param string $directory + * @param string $message + * + * @return void + */ + public static function assertDirectoryDoesNotExist($directory, $message = '') + { + static::assertDirectoryNotExists($directory, $message); + } + /** * @param string $directory * @param string $message @@ -348,6 +382,17 @@ public static function assertDirectoryNotIsReadable($directory, $message = '') static::assertNotIsReadable($directory, $message); } + /** + * @param string $directory + * @param string $message + * + * @return void + */ + public static function assertDirectoryIsNotReadable($directory, $message = '') + { + static::assertDirectoryNotIsReadable($directory, $message); + } + /** * @param string $directory * @param string $message @@ -372,6 +417,17 @@ public static function assertDirectoryNotIsWritable($directory, $message = '') static::assertNotIsWritable($directory, $message); } + /** + * @param string $directory + * @param string $message + * + * @return void + */ + public static function assertDirectoryIsNotWritable($directory, $message = '') + { + static::assertDirectoryNotIsWritable($directory, $message); + } + /** * @param string $filename * @param string $message @@ -396,6 +452,17 @@ public static function assertFileNotExists($filename, $message = '') static::assertFalse(file_exists($filename), $message ? $message : "Failed asserting that $filename does not exist."); } + /** + * @param string $filename + * @param string $message + * + * @return void + */ + public static function assertFileDoesNotExist($filename, $message = '') + { + static::assertFileNotExists($filename, $message); + } + /** * @param string $filename * @param string $message @@ -420,6 +487,17 @@ public static function assertFileNotIsReadable($filename, $message = '') static::assertNotIsReadable($filename, $message); } + /** + * @param string $filename + * @param string $message + * + * @return void + */ + public static function assertFileIsNotReadable($filename, $message = '') + { + static::assertFileNotIsReadable($filename, $message); + } + /** * @param string $filename * @param string $message @@ -443,4 +521,39 @@ public static function assertFileNotIsWritable($filename, $message = '') static::assertFileExists($filename, $message); static::assertNotIsWritable($filename, $message); } + + /** + * @param string $filename + * @param string $message + * + * @return void + */ + public static function assertFileIsNotWritable($filename, $message = '') + { + static::assertFileNotIsWritable($filename, $message); + } + + /** + * @param string $pattern + * @param string $string + * @param string $message + * + * @return void + */ + public static function assertMatchesRegularExpression($pattern, $string, $message = '') + { + static::assertRegExp($pattern, $string, $message); + } + + /** + * @param string $pattern + * @param string $string + * @param string $message + * + * @return void + */ + public static function assertDoesNotMatchRegularExpression($pattern, $string, $message = '') + { + static::assertNotRegExp($pattern, $string, $message); + } } diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php index f14759f5faca6..39b61ca5e13c4 100644 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php @@ -284,6 +284,16 @@ class SymfonyExcludeListPhpunit {} chdir($oldPwd); } +// Create a symlink with a predictable path pointing to the currently used version. +// This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes +// and for other testing libraries such as Behat using PHPUnit's assertions. +chdir($PHPUNIT_DIR); +if (file_exists('phpunit')) { + @unlink('phpunit'); +} +@symlink($PHPUNIT_VERSION_DIR, 'phpunit'); +chdir($oldPwd); + if ($PHPUNIT_VERSION < 8.0) { $argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php index 2ff31bbda353b..54d0483f7d8b0 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php @@ -66,7 +66,7 @@ public function generate(\ReflectionClass $originalClass, ClassGenerator $classG if (null !== $docBlock = $method->getDocBlock()) { $code = substr($code, \strlen($docBlock->generate())); } - $refAmp = (strpos($code, '&') ?: \PHP_INT_MAX) <= strpos($code, '(') ? '&' : ''; + $refAmp = (strpos($code, '&') ?: PHP_INT_MAX) <= strpos($code, '(') ? '&' : ''; $body = preg_replace( '/\nreturn (\$this->valueHolder[0-9a-f]++)(->[^;]++);$/', "\nif ($1 === \$returnValue = {$refAmp}$1$2) {\n \$returnValue = \$this;\n}\n\nreturn \$returnValue;", diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index ad160413567b5..d65578608d1aa 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -92,8 +92,12 @@ public function getTranslationNodeVisitor(): TranslationNodeVisitor return $this->translationNodeVisitor ?: $this->translationNodeVisitor = new TranslationNodeVisitor(); } - public function trans(string $message, array $arguments = [], string $domain = null, string $locale = null, int $count = null): string + public function trans(?string $message, array $arguments = [], string $domain = null, string $locale = null, int $count = null): string { + if (null === $message || '' === $message) { + return ''; + } + if (null !== $count) { $arguments['%count%'] = $count; } diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index 8970bb497764e..f2789542ff551 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -43,7 +43,7 @@ public function testLintIncorrectFile() $ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay())); + $this->assertMatchesRegularExpression('/ERROR in \S+ \(line /', trim($tester->getDisplay())); } public function testLintFileNotReadable() @@ -64,7 +64,7 @@ public function testLintFileCompileTimeException() $ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay())); + $this->assertMatchesRegularExpression('/ERROR in \S+ \(line /', trim($tester->getDisplay())); } /** @@ -91,7 +91,7 @@ public function testLintFileWithReportedDeprecation() $ret = $tester->execute(['filename' => [$filename], '--show-deprecations' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]); $this->assertEquals(1, $ret, 'Returns 1 in case of error'); - $this->assertRegExp('/ERROR in \S+ \(line 1\)/', trim($tester->getDisplay())); + $this->assertMatchesRegularExpression('/ERROR in \S+ \(line 1\)/', trim($tester->getDisplay())); $this->assertStringContainsString('Filter "deprecated_filter" is deprecated', trim($tester->getDisplay())); } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php index 35f3baa1b9b99..8e100deae10a6 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/StopwatchExtensionTest.php @@ -57,18 +57,22 @@ protected function getStopwatch($events = []) $events = \is_array($events) ? $events : [$events]; $stopwatch = $this->getMockBuilder('Symfony\Component\Stopwatch\Stopwatch')->getMock(); - $i = -1; + $expectedCalls = 0; + $expectedStartCalls = []; + $expectedStopCalls = []; foreach ($events as $eventName) { - $stopwatch->expects($this->at(++$i)) - ->method('start') - ->with($this->equalTo($eventName), 'template') - ; - $stopwatch->expects($this->at(++$i)) - ->method('stop') - ->with($this->equalTo($eventName)) - ; + ++$expectedCalls; + $expectedStartCalls[] = [$this->equalTo($eventName), 'template']; + $expectedStopCalls[] = [$this->equalTo($eventName)]; } + $startInvocationMocker = $stopwatch->expects($this->exactly($expectedCalls)) + ->method('start'); + \call_user_func_array([$startInvocationMocker, 'withConsecutive'], $expectedStartCalls); + $stopInvocationMocker = $stopwatch->expects($this->exactly($expectedCalls)) + ->method('stop'); + \call_user_func_array([$stopInvocationMocker, 'withConsecutive'], $expectedStopCalls); + return $stopwatch; } } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index f384fa59c5d7b..28149e1315549 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -118,6 +118,10 @@ public function getTransTests() ['{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|trans(count=count) }}', 'There is 5 apples', ['count' => 5]], ['{{ text|trans(count=5, arguments={\'%name%\': \'Symfony\'}) }}', 'There is 5 apples (Symfony)', ['text' => '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%)']], ['{{ "{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples"|trans({}, "messages", "fr", count) }}', 'There is 5 apples', ['count' => 5]], + + // trans filter with null message + ['{{ null|trans }}', ''], + ['{{ foo|trans }}', '', ['foo' => null]], ]; } diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php index 734ed5ffb6309..fa87952621c87 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/CachePoolClearerCacheWarmer.php @@ -19,7 +19,7 @@ * * Do not use in production! * - * @author Kévin Dunglas + * @author Teoh Han Hui * * @internal */ diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php index 6769fa19c918f..e2ea9dfa7a931 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php @@ -81,7 +81,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ['PHP'], new TableSeparator(), ['Version', PHP_VERSION], - ['Architecture', (PHP_INT_SIZE * 8).' bits'], + ['Architecture', (\PHP_INT_SIZE * 8).' bits'], ['Intl locale', class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a'], ['Timezone', date_default_timezone_get().' ('.(new \DateTime())->format(\DateTime::W3C).')'], ['OPcache', \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false'], diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index 23ae45754456f..00f606662ad53 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -207,30 +207,30 @@ protected function addFlash(string $type, $message): void } /** - * Checks if the attributes are granted against the current authentication token and optionally supplied subject. + * Checks if the attribute is granted against the current authentication token and optionally supplied subject. * * @throws \LogicException */ - protected function isGranted($attributes, $subject = null): bool + protected function isGranted($attribute, $subject = null): bool { if (!$this->container->has('security.authorization_checker')) { throw new \LogicException('The SecurityBundle is not registered in your application. Try running "composer require symfony/security-bundle".'); } - return $this->container->get('security.authorization_checker')->isGranted($attributes, $subject); + return $this->container->get('security.authorization_checker')->isGranted($attribute, $subject); } /** - * Throws an exception unless the attributes are granted against the current authentication token and optionally + * Throws an exception unless the attribute is granted against the current authentication token and optionally * supplied subject. * * @throws AccessDeniedException */ - protected function denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.'): void + protected function denyAccessUnlessGranted($attribute, $subject = null, string $message = 'Access Denied.'): void { - if (!$this->isGranted($attributes, $subject)) { + if (!$this->isGranted($attribute, $subject)) { $exception = $this->createAccessDeniedException($message); - $exception->setAttributes($attributes); + $exception->setAttributes($attribute); $exception->setSubject($subject); throw $exception; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 300e56ac270aa..bf1bcec63fcd8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -1927,9 +1927,12 @@ private function registerHttpClientConfiguration(array $config, ContainerBuilder unset($scopeConfig['scope']); if (null === $scope) { + $baseUri = $scopeConfig['base_uri']; + unset($scopeConfig['base_uri']); + $container->register($name, ScopingHttpClient::class) ->setFactory([ScopingHttpClient::class, 'forBaseUri']) - ->setArguments([new Reference($httpClientId), $scopeConfig['base_uri'], $scopeConfig]) + ->setArguments([new Reference($httpClientId), $baseUri, $scopeConfig]) ->addTag('http_client.client') ; } else { diff --git a/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php b/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php index bcfb180eaf27e..6e44657cf8181 100644 --- a/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php +++ b/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php @@ -45,7 +45,7 @@ public function __construct(KernelInterface $kernel, array $server = [], History /** * Returns the container. * - * @return ContainerInterface|null Returns null when the Kernel has been shutdown or not started yet + * @return ContainerInterface */ public function getContainer() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer.xml index 560556c7ff0c5..b7a6cbc11897d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer.xml @@ -41,6 +41,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 71eb751a5d414..e2bc23f936b83 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -95,6 +95,7 @@ + @@ -159,12 +160,6 @@ - - - - - - @@ -559,12 +554,17 @@ + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/week_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/week_widget.html.php deleted file mode 100644 index 610b6e0c19eac..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/week_widget.html.php +++ /dev/null @@ -1,14 +0,0 @@ - - block($form, 'form_widget_simple'); ?> - - ['size' => 1]] : [] ?> -
block($form, 'widget_container_attributes') ?>> - widget($form['year'], $vars); - echo '-'; - echo $view['form']->widget($form['week'], $vars); - ?> -
- diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php b/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php index b51dabe808aad..d0ca84e25ae7a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/MailerAssertionsTrait.php @@ -118,10 +118,10 @@ public static function getMailerMessage(int $index = 0, string $transport = null private static function getMessageMailerEvents(): MessageEvents { - if (!$logger = self::$container->get('mailer.logger_message_listener')) { + if (!self::$container->has('mailer.logger_message_listener')) { static::fail('A client must have Mailer enabled to make email assertions. Did you forget to require symfony/mailer?'); } - return $logger->getEvents(); + return self::$container->get('mailer.logger_message_listener')->getEvents(); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php index 118a14e84e958..4b557011a9d26 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php @@ -81,6 +81,6 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup() $containerRef = new \ReflectionClass(require $containerFile); $containerFile = str_replace('tes_'.\DIRECTORY_SEPARATOR, 'test'.\DIRECTORY_SEPARATOR, $containerRef->getFileName()); - $this->assertRegExp(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container'); + $this->assertMatchesRegularExpression(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container'); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php index 69a4ff5a789d6..84e12759ce2fa 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php @@ -28,7 +28,7 @@ public function testDebugMissingMessages() $tester = $this->createCommandTester(['foo' => 'foo']); $res = $tester->execute(['locale' => 'en', 'bundle' => 'foo']); - $this->assertRegExp('/missing/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/missing/', $tester->getDisplay()); $this->assertEquals(TranslationDebugCommand::EXIT_CODE_MISSING, $res); } @@ -37,7 +37,7 @@ public function testDebugUnusedMessages() $tester = $this->createCommandTester([], ['foo' => 'foo']); $res = $tester->execute(['locale' => 'en', 'bundle' => 'foo']); - $this->assertRegExp('/unused/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/unused/', $tester->getDisplay()); $this->assertEquals(TranslationDebugCommand::EXIT_CODE_UNUSED, $res); } @@ -46,7 +46,7 @@ public function testDebugFallbackMessages() $tester = $this->createCommandTester(['foo' => 'foo'], ['foo' => 'foo']); $res = $tester->execute(['locale' => 'fr', 'bundle' => 'foo']); - $this->assertRegExp('/fallback/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/fallback/', $tester->getDisplay()); $this->assertEquals(TranslationDebugCommand::EXIT_CODE_FALLBACK, $res); } @@ -55,7 +55,7 @@ public function testNoDefinedMessages() $tester = $this->createCommandTester(); $res = $tester->execute(['locale' => 'fr', 'bundle' => 'test']); - $this->assertRegExp('/No defined or extracted messages for locale "fr"/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/No defined or extracted messages for locale "fr"/', $tester->getDisplay()); $this->assertEquals(TranslationDebugCommand::EXIT_CODE_GENERAL_ERROR, $res); } @@ -65,8 +65,8 @@ public function testDebugDefaultDirectory() $res = $tester->execute(['locale' => 'en']); $expectedExitStatus = TranslationDebugCommand::EXIT_CODE_MISSING | TranslationDebugCommand::EXIT_CODE_UNUSED; - $this->assertRegExp('/missing/', $tester->getDisplay()); - $this->assertRegExp('/unused/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/missing/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/unused/', $tester->getDisplay()); $this->assertEquals($expectedExitStatus, $res); } @@ -83,8 +83,8 @@ public function testDebugDefaultRootDirectory() $tester = $this->createCommandTester(['foo' => 'foo'], ['bar' => 'bar'], null, [$this->translationDir.'/trans'], [$this->translationDir.'/views']); $res = $tester->execute(['locale' => 'en']); - $this->assertRegExp('/missing/', $tester->getDisplay()); - $this->assertRegExp('/unused/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/missing/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/unused/', $tester->getDisplay()); $this->assertEquals($expectedExitStatus, $res); } @@ -103,8 +103,8 @@ public function testDebugCustomDirectory() $tester = $this->createCommandTester(['foo' => 'foo'], ['bar' => 'bar'], $kernel); $res = $tester->execute(['locale' => 'en', 'bundle' => $this->translationDir.'/customDir']); - $this->assertRegExp('/missing/', $tester->getDisplay()); - $this->assertRegExp('/unused/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/missing/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/unused/', $tester->getDisplay()); $this->assertEquals($expectedExitStatus, $res); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index 67002f78c25ef..5d10d321c7cfe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -28,39 +28,39 @@ public function testDumpMessagesAndClean() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true]); - $this->assertRegExp('/foo/', $tester->getDisplay()); - $this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/foo/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay()); } public function testDumpSortedMessagesAndClean() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort' => 'asc']); - $this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay())); - $this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay())); + $this->assertMatchesRegularExpression('/3 messages were successfully extracted/', $tester->getDisplay()); } public function testDumpReverseSortedMessagesAndClean() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort' => 'desc']); - $this->assertRegExp("/\*test\*foo\*bar/", preg_replace('/\s+/', '', $tester->getDisplay())); - $this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression("/\*test\*foo\*bar/", preg_replace('/\s+/', '', $tester->getDisplay())); + $this->assertMatchesRegularExpression('/3 messages were successfully extracted/', $tester->getDisplay()); } public function testDumpSortWithoutValueAndClean() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort']); - $this->assertRegExp("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay())); - $this->assertRegExp('/3 messages were successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression("/\*bar\*foo\*test/", preg_replace('/\s+/', '', $tester->getDisplay())); + $this->assertMatchesRegularExpression('/3 messages were successfully extracted/', $tester->getDisplay()); } public function testDumpWrongSortAndClean() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'test' => 'test', 'bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--sort' => 'test']); - $this->assertRegExp('/\[ERROR\] Wrong sort order/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/\[ERROR\] Wrong sort order/', $tester->getDisplay()); } public function testDumpMessagesAndCleanInRootDirectory() @@ -72,32 +72,32 @@ public function testDumpMessagesAndCleanInRootDirectory() $tester = $this->createCommandTester(['messages' => ['foo' => 'foo']], [], null, [$this->translationDir.'/trans'], [$this->translationDir.'/views']); $tester->execute(['command' => 'translation:update', 'locale' => 'en', '--dump-messages' => true, '--clean' => true]); - $this->assertRegExp('/foo/', $tester->getDisplay()); - $this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/foo/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay()); } public function testDumpTwoMessagesAndClean() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo', 'bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true]); - $this->assertRegExp('/foo/', $tester->getDisplay()); - $this->assertRegExp('/bar/', $tester->getDisplay()); - $this->assertRegExp('/2 messages were successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/foo/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/bar/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/2 messages were successfully extracted/', $tester->getDisplay()); } public function testDumpMessagesForSpecificDomain() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo'], 'mydomain' => ['bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--dump-messages' => true, '--clean' => true, '--domain' => 'mydomain']); - $this->assertRegExp('/bar/', $tester->getDisplay()); - $this->assertRegExp('/1 message was successfully extracted/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/bar/', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/1 message was successfully extracted/', $tester->getDisplay()); } public function testWriteMessages() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true]); - $this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay()); } public function testWriteMessagesInRootDirectory() @@ -109,14 +109,14 @@ public function testWriteMessagesInRootDirectory() $tester = $this->createCommandTester(['messages' => ['foo' => 'foo']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', '--force' => true]); - $this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay()); } public function testWriteMessagesForSpecificDomain() { $tester = $this->createCommandTester(['messages' => ['foo' => 'foo'], 'mydomain' => ['bar' => 'bar']]); $tester->execute(['command' => 'translation:update', 'locale' => 'en', 'bundle' => 'foo', '--force' => true, '--domain' => 'mydomain']); - $this->assertRegExp('/Translation files were successfully updated./', $tester->getDisplay()); + $this->assertMatchesRegularExpression('/Translation files were successfully updated./', $tester->getDisplay()); } protected function setUp(): void diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php index afa02e08a967a..ca18462634fb4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/ApplicationTest.php @@ -209,19 +209,19 @@ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd() public function testSuggestingPackagesWithExactMatch() { $result = $this->createEventForSuggestingPackages('doctrine:fixtures', []); - $this->assertRegExp('/You may be looking for a command provided by/', $result); + $this->assertMatchesRegularExpression('/You may be looking for a command provided by/', $result); } public function testSuggestingPackagesWithPartialMatchAndNoAlternatives() { $result = $this->createEventForSuggestingPackages('server', []); - $this->assertRegExp('/You may be looking for a command provided by/', $result); + $this->assertMatchesRegularExpression('/You may be looking for a command provided by/', $result); } public function testSuggestingPackagesWithPartialMatchAndAlternatives() { $result = $this->createEventForSuggestingPackages('server', ['server:run']); - $this->assertNotRegExp('/You may be looking for a command provided by/', $result); + $this->assertDoesNotMatchRegularExpression('/You may be looking for a command provided by/', $result); } private function createEventForSuggestingPackages(string $command, array $alternatives = []): string diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php new file mode 100644 index 0000000000000..7eec06a9a0e50 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_dsn.php @@ -0,0 +1,15 @@ +extension('framework', [ + 'mailer' => [ + 'dsn' => 'smtp://example.com', + 'envelope' => [ + 'sender' => 'sender@example.org', + 'recipients' => ['redirected@example.org', 'redirected1@example.org'], + ], + ], + ]); +}; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php new file mode 100644 index 0000000000000..1bc79f3dd204c --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/mailer_with_transports.php @@ -0,0 +1,18 @@ +extension('framework', [ + 'mailer' => [ + 'transports' => [ + 'transport1' => 'smtp://example1.com', + 'transport2' => 'smtp://example2.com', + ], + 'envelope' => [ + 'sender' => 'sender@example.org', + 'recipients' => ['redirected@example.org', 'redirected1@example.org'], + ], + ], + ]); +}; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer.xml rename to src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_dsn.xml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml new file mode 100644 index 0000000000000..a6eb67dc81024 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/mailer_with_transports.xml @@ -0,0 +1,20 @@ + + + + + + + smtp://example1.com + smtp://example2.com + + sender@example.org + redirected@example.org + redirected1@example.org + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer.yml rename to src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_dsn.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml new file mode 100644 index 0000000000000..6035988d76e59 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/mailer_with_transports.yml @@ -0,0 +1,10 @@ +framework: + mailer: + transports: + transport1: 'smtp://example1.com' + transport2: 'smtp://example2.com' + envelope: + sender: sender@example.org + recipients: + - redirected@example.org + - redirected1@example.org diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index fa227290c74af..2fb91c36f0673 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1370,7 +1370,6 @@ public function testHttpClientOverrideDefaultOptions() $this->assertSame('http://example.com', $container->getDefinition('foo')->getArgument(1)); $expected = [ - 'base_uri' => 'http://example.com', 'headers' => [ 'bar' => 'baz', ], @@ -1423,13 +1422,29 @@ public function testHttpClientFullDefaultOptions() ], $defaultOptions['peer_fingerprint']); } - public function testMailer(): void + public function provideMailer(): array { - $container = $this->createContainerFromFile('mailer'); + return [ + ['mailer_with_dsn', ['main' => 'smtp://example.com']], + ['mailer_with_transports', [ + 'transport1' => 'smtp://example1.com', + 'transport2' => 'smtp://example2.com', + ]], + ]; + } + + /** + * @dataProvider provideMailer + */ + public function testMailer(string $configFile, array $expectedTransports): void + { + $container = $this->createContainerFromFile($configFile); $this->assertTrue($container->hasAlias('mailer')); + $this->assertTrue($container->hasDefinition('mailer.transports')); + $this->assertSame($expectedTransports, $container->getDefinition('mailer.transports')->getArgument(0)); $this->assertTrue($container->hasDefinition('mailer.default_transport')); - $this->assertSame('smtp://example.com', $container->getDefinition('mailer.default_transport')->getArgument(0)); + $this->assertSame(current($expectedTransports), $container->getDefinition('mailer.default_transport')->getArgument(0)); $this->assertTrue($container->hasDefinition('mailer.envelope_listener')); $l = $container->getDefinition('mailer.envelope_listener'); $this->assertSame('sender@example.org', $l->getArgument(0)); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php index 1f82930b26da2..f29d3c9623a7d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php @@ -146,17 +146,18 @@ public function testResourceFilesOptionLoadsBeforeOtherAddedResources($debug, $e $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); - $loader->expects($this->at(0)) + $loader->expects($this->exactly(2)) ->method('load') - /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */ - ->with('messages.some_locale.loader', 'some_locale', 'messages') - ->willReturn($someCatalogue); - - $loader->expects($this->at(1)) - ->method('load') - /* This resource is added by an addResource() call and shall be loaded after the resource_files */ - ->with('second_resource.some_locale.loader', 'some_locale', 'messages') - ->willReturn($someCatalogue); + ->withConsecutive( + /* The "messages.some_locale.loader" is passed via the resource_file option and shall be loaded first */ + ['messages.some_locale.loader', 'some_locale', 'messages'], + /* This resource is added by an addResource() call and shall be loaded after the resource_files */ + ['second_resource.some_locale.loader', 'some_locale', 'messages'] + ) + ->willReturnOnConsecutiveCalls( + $someCatalogue, + $someCatalogue + ); $options = [ 'resource_files' => ['some_locale' => ['messages.some_locale.loader']], @@ -263,55 +264,33 @@ protected function getLoader() { $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock(); $loader - ->expects($this->at(0)) - ->method('load') - ->willReturn($this->getCatalogue('fr', [ - 'foo' => 'foo (FR)', - ])) - ; - $loader - ->expects($this->at(1)) - ->method('load') - ->willReturn($this->getCatalogue('en', [ - 'foo' => 'foo (EN)', - 'bar' => 'bar (EN)', - 'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)', - ])) - ; - $loader - ->expects($this->at(2)) - ->method('load') - ->willReturn($this->getCatalogue('es', [ - 'foobar' => 'foobar (ES)', - ])) - ; - $loader - ->expects($this->at(3)) - ->method('load') - ->willReturn($this->getCatalogue('pt-PT', [ - 'foobarfoo' => 'foobarfoo (PT-PT)', - ])) - ; - $loader - ->expects($this->at(4)) - ->method('load') - ->willReturn($this->getCatalogue('pt_BR', [ - 'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)', - ])) - ; - $loader - ->expects($this->at(5)) - ->method('load') - ->willReturn($this->getCatalogue('fr.UTF-8', [ - 'foobarbaz' => 'foobarbaz (fr.UTF-8)', - ])) - ; - $loader - ->expects($this->at(6)) + ->expects($this->exactly(7)) ->method('load') - ->willReturn($this->getCatalogue('sr@latin', [ - 'foobarbax' => 'foobarbax (sr@latin)', - ])) + ->willReturnOnConsecutiveCalls( + $this->getCatalogue('fr', [ + 'foo' => 'foo (FR)', + ]), + $this->getCatalogue('en', [ + 'foo' => 'foo (EN)', + 'bar' => 'bar (EN)', + 'choice' => '{0} choice 0 (EN)|{1} choice 1 (EN)|]1,Inf] choice inf (EN)', + ]), + $this->getCatalogue('es', [ + 'foobar' => 'foobar (ES)', + ]), + $this->getCatalogue('pt-PT', [ + 'foobarfoo' => 'foobarfoo (PT-PT)', + ]), + $this->getCatalogue('pt_BR', [ + 'other choice' => '{0} other choice 0 (PT-BR)|{1} other choice 1 (PT-BR)|]1,Inf] other choice inf (PT-BR)', + ]), + $this->getCatalogue('fr.UTF-8', [ + 'foobarbaz' => 'foobarbaz (fr.UTF-8)', + ]), + $this->getCatalogue('sr@latin', [ + 'foobarbax' => 'foobarbax (sr@latin)', + ]) + ) ; return $loader; diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php index 4058d3228b512..4a1497aec1640 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php @@ -29,7 +29,7 @@ interface SecurityFactoryInterface * - the listener id * - the entry point id */ - public function create(ContainerBuilder $container, string $id, array $config, string $userProvider, ?string $defaultEntryPoint); + public function create(ContainerBuilder $container, string $id, array $config, string $userProviderId, ?string $defaultEntryPointId); /** * Defines the position at which the provider is called. diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php index 9b3828317ce19..ed7d8cf88cf72 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\WebProfilerBundle\Controller; +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; @@ -36,12 +37,18 @@ class RouterController private $matcher; private $routes; - public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null) + /** + * @var ExpressionFunctionProviderInterface[] + */ + private $expressionLanguageProviders = []; + + public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = []) { $this->profiler = $profiler; $this->twig = $twig; $this->matcher = $matcher; $this->routes = (null === $routes && $matcher instanceof RouterInterface) ? $matcher->getRouteCollection() : $routes; + $this->expressionLanguageProviders = $expressionLanguageProviders; } /** @@ -92,6 +99,9 @@ private function getTraces(RequestDataCollector $request, string $method): array $context = $this->matcher->getContext(); $context->setMethod($method); $matcher = new TraceableUrlMatcher($this->routes, $context); + foreach ($this->expressionLanguageProviders as $provider) { + $matcher->addExpressionLanguageProvider($provider); + } return $matcher->getTracesForRequest($traceRequest); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml index 0903f3fe15aeb..c1409f9ff809a 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml @@ -20,6 +20,8 @@ + null + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/http_client.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/http_client.html.twig index 7315b4eb9d0a1..8496ef186dfd6 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/http_client.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/http_client.html.twig @@ -15,7 +15,7 @@
HTTP errors - {{ collector.errorCount }} + {{ collector.errorCount }}
{% endset %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index c6631376d2458..db3791abdab6f 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -1,5 +1,5 @@ -{# This file is partially duplicated in TwigBundle/Resources/views/base_js.html.twig. If you - make any change in this file, verify the same change is needed in the other file. #} +{# This file is partially duplicated in src/Symfony/Component/ErrorHandler/Resources/assets/js/exception.js. + If you make any change in this file, verify the same change is needed in the other file. #} /*assertRegExp('~.*~s', file_get_contents($iconFilePath), sprintf('The SVG metadata of the %s icon is different than expected (use the same as the other icons).', $iconFilePath)); + $this->assertMatchesRegularExpression('~.*~s', file_get_contents($iconFilePath), sprintf('The SVG metadata of the %s icon is different than expected (use the same as the other icons).', $iconFilePath)); } public function provideIconFilePaths() diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index 83ea1018b6add..46f7e646f59e8 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -196,6 +196,10 @@ public function save(CacheItemInterface $item) $now = microtime(true); + if (0 === $expiry) { + $expiry = PHP_INT_MAX; + } + if (null !== $expiry && $expiry <= $now) { $this->deleteItem($key); diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php index d80cd89d62df1..278152bc8fce6 100644 --- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php @@ -452,7 +452,6 @@ private function getConnection(): object switch (true) { case $driver instanceof \Doctrine\DBAL\Driver\Mysqli\Driver: throw new \LogicException(sprintf('The adapter "%s" does not support the mysqli driver, use pdo_mysql instead.', static::class)); - case $driver instanceof \Doctrine\DBAL\Driver\AbstractMySQLDriver: $this->driver = 'mysql'; break; diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php index 82a2deaf08c04..c6667a9fbc3ce 100644 --- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php @@ -25,8 +25,8 @@ */ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterface, ResettableInterface { - use ProxyTrait; use ContractsTrait; + use ProxyTrait; private $namespace; private $namespaceLen; diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 10375f7c07dcd..daa5089df0e82 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -27,8 +27,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac { const TAGS_PREFIX = "\0tags\0"; - use ProxyTrait; use ContractsTrait; + use ProxyTrait; private $deferred = []; private $createCacheItem; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php index 4aaba13425b72..5600d8b72b970 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php @@ -76,7 +76,7 @@ public function testBadOptions($name, $value) $this->expectExceptionMessage('constant(): Couldn\'t find constant Memcached::'); } else { $this->expectException('Error'); - $this->expectExceptionMessage('Undefined class constant \'Memcached::'); + $this->expectExceptionMessage('Undefined constant Memcached::'); } MemcachedAdapter::createConnection([], [$name => $value]); diff --git a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php index 933774c8f92e2..54ae56375c7a3 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/PdoDbalAdapterTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Cache\Tests\Adapter; use Doctrine\DBAL\Connection; -use Doctrine\DBAL\Driver; use Doctrine\DBAL\Driver\AbstractMySQLDriver; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php index be8a8f486d6e4..e0111c1d6cc57 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/TagAwareAdapterTest.php @@ -15,6 +15,7 @@ use Psr\Cache\CacheItemInterface; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\AdapterInterface; +use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\TagAwareAdapter; use Symfony\Component\Cache\PruneableInterface; @@ -162,6 +163,25 @@ public function testHasItemReturnsFalseWhenPoolDoesNotHaveItemAndOnlyHasTags() $this->assertFalse($anotherPool->hasItem($itemKey)); } + public function testInvalidateTagsWithArrayAdapter() + { + $adapter = new TagAwareAdapter(new ArrayAdapter()); + + $item = $adapter->getItem('foo'); + + $this->assertFalse($item->isHit()); + + $item->tag('bar'); + $item->expiresAfter(100); + $adapter->save($item); + + $this->assertTrue($adapter->getItem('foo')->isHit()); + + $adapter->invalidateTags(['bar']); + + $this->assertFalse($adapter->getItem('foo')->isHit()); + } + public function testGetItemReturnsCacheMissWhenPoolDoesNotHaveItemAndOnlyHasTags() { $pool = $this->createCachePool(); diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php index ab548f2513088..7910f95c40c84 100644 --- a/src/Symfony/Component/Cache/Traits/RedisTrait.php +++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php @@ -103,6 +103,10 @@ public static function createConnection($dsn, array $options = []) $params = preg_replace_callback('#^'.$scheme.':(//)?(?:(?:[^:@]*+:)?([^@]*+)@)?#', function ($m) use (&$auth) { if (isset($m[2])) { $auth = $m[2]; + + if ('' === $auth) { + $auth = null; + } } return 'file:'.($m[1] ?? ''); diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index e5f3a28975aa2..b113686e66a42 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -200,10 +200,10 @@ public function setRequired(bool $boolean) * * @param string $package The name of the composer package that is triggering the deprecation * @param string $version The version of the package that introduced the deprecation - * @param string $message The deprecation message to use + * @param string $message the deprecation message to use * * You can use %node% and %path% placeholders in your message to display, - * respectively, the node name and its complete path. + * respectively, the node name and its complete path */ public function setDeprecated(?string $package/*, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.' */) { diff --git a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php index 2551abc5fdebc..6ac04a1651067 100644 --- a/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php @@ -161,10 +161,10 @@ public function isRequired() * * @param string $package The name of the composer package that is triggering the deprecation * @param string $version The version of the package that introduced the deprecation - * @param string $message The deprecation message to use + * @param string $message the deprecation message to use * * You can use %node% and %path% placeholders in your message to display, - * respectively, the node name and its complete path. + * respectively, the node name and its complete path * * @return $this */ diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index 2aecdf8259c65..a82e939d91cd5 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -81,7 +81,7 @@ public function testLoadFile() XmlUtils::loadFile($fixtures.'valid.xml', [$mock, 'validate']); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertRegExp('/The XML file ".+" is not valid\./', $e->getMessage()); + $this->assertMatchesRegularExpression('/The XML file ".+" is not valid\./', $e->getMessage()); } $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', [$mock, 'validate'])); @@ -199,7 +199,9 @@ public function testLoadEmptyXmlFile() // test for issue https://github.com/symfony/symfony/issues/9731 public function testLoadWrongEmptyXMLWithErrorHandler() { - $originalDisableEntities = libxml_disable_entity_loader(false); + if (LIBXML_VERSION < 20900) { + $originalDisableEntities = libxml_disable_entity_loader(false); + } $errorReporting = error_reporting(-1); set_error_handler(function ($errno, $errstr) { @@ -219,12 +221,13 @@ public function testLoadWrongEmptyXMLWithErrorHandler() error_reporting($errorReporting); } - $disableEntities = libxml_disable_entity_loader(true); - libxml_disable_entity_loader($disableEntities); - - libxml_disable_entity_loader($originalDisableEntities); + if (LIBXML_VERSION < 20900) { + $disableEntities = libxml_disable_entity_loader(true); + libxml_disable_entity_loader($disableEntities); - $this->assertFalse($disableEntities); + libxml_disable_entity_loader($originalDisableEntities); + $this->assertFalse($disableEntities); + } // should not throw an exception XmlUtils::loadFile(__DIR__.'/../Fixtures/Util/valid.xml', __DIR__.'/../Fixtures/Util/schema.xsd'); diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index 5c8d387a704a0..a31347272278f 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -51,13 +51,17 @@ public static function parse(string $content, $schemaOrCallable = null) } $internalErrors = libxml_use_internal_errors(true); - $disableEntities = libxml_disable_entity_loader(true); + if (LIBXML_VERSION < 20900) { + $disableEntities = libxml_disable_entity_loader(true); + } libxml_clear_errors(); $dom = new \DOMDocument(); $dom->validateOnParse = true; if (!$dom->loadXML($content, LIBXML_NONET | (\defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { - libxml_disable_entity_loader($disableEntities); + if (LIBXML_VERSION < 20900) { + libxml_disable_entity_loader($disableEntities); + } throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors))); } @@ -65,7 +69,9 @@ public static function parse(string $content, $schemaOrCallable = null) $dom->normalizeDocument(); libxml_use_internal_errors($internalErrors); - libxml_disable_entity_loader($disableEntities); + if (LIBXML_VERSION < 20900) { + libxml_disable_entity_loader($disableEntities); + } foreach ($dom->childNodes as $child) { if (XML_DOCUMENT_TYPE_NODE === $child->nodeType) { diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php index ef6d8afe19b8f..bde620bfa7f86 100644 --- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php @@ -212,7 +212,7 @@ protected function describeApplication(Application $application, array $options // calculate max. width based on available commands per namespace $width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) { return array_intersect($namespace['commands'], array_keys($commands)); - }, $namespaces)))); + }, array_values($namespaces))))); if ($describedNamespace) { $this->writeText(sprintf('Available commands for the "%s" namespace:', $describedNamespace), $options); diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 7f3d4a3b6d584..fee5a416b73d9 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -562,6 +562,9 @@ private function buildTableRows(array $rows): TableRows if (0 === $lineKey) { $rows[$rowKey][$column] = $line; } else { + if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) { + $unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey); + } $unmergedRows[$rowKey][$lineKey][$column] = $line; } } @@ -573,8 +576,8 @@ private function buildTableRows(array $rows): TableRows yield $this->fillCells($row); if (isset($unmergedRows[$rowKey])) { - foreach ($unmergedRows[$rowKey] as $row) { - yield $row; + foreach ($unmergedRows[$rowKey] as $unmergedRow) { + yield $this->fillCells($unmergedRow); } } } @@ -658,6 +661,7 @@ private function fillNextRows(array $rows, int $line): array private function fillCells($row) { $newRow = []; + foreach ($row as $column => $cell) { $newRow[] = $cell; if ($cell instanceof TableCell && $cell->getColspan() > 1) { diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index a37031f4b1eb9..38b7bf76cc630 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -559,9 +559,9 @@ public function testFindAlternativeExceptionMessageMultiple() $this->fail('->find() throws a CommandNotFoundException if command does not exist, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); - $this->assertRegExp('/Did you mean one of these/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); - $this->assertRegExp('/foo1:bar/', $e->getMessage()); - $this->assertRegExp('/foo:bar/', $e->getMessage()); + $this->assertMatchesRegularExpression('/Did you mean one of these/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); + $this->assertMatchesRegularExpression('/foo1:bar/', $e->getMessage()); + $this->assertMatchesRegularExpression('/foo:bar/', $e->getMessage()); } // Namespace + plural @@ -570,8 +570,8 @@ public function testFindAlternativeExceptionMessageMultiple() $this->fail('->find() throws a CommandNotFoundException if command does not exist, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); - $this->assertRegExp('/Did you mean one of these/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); - $this->assertRegExp('/foo1/', $e->getMessage()); + $this->assertMatchesRegularExpression('/Did you mean one of these/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); + $this->assertMatchesRegularExpression('/foo1/', $e->getMessage()); } $application->add(new \Foo3Command()); @@ -583,8 +583,8 @@ public function testFindAlternativeExceptionMessageMultiple() $this->fail('->find() should throw an Symfony\Component\Console\Exception\CommandNotFoundException if a command is ambiguous because of a subnamespace, with alternatives'); } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e); - $this->assertRegExp('/foo3:bar/', $e->getMessage()); - $this->assertRegExp('/foo3:bar:toh/', $e->getMessage()); + $this->assertMatchesRegularExpression('/foo3:bar/', $e->getMessage()); + $this->assertMatchesRegularExpression('/foo3:bar:toh/', $e->getMessage()); } } @@ -613,10 +613,10 @@ public function testFindAlternativeCommands() } catch (\Exception $e) { $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if command does not exist'); $this->assertSame(['afoobar1', 'foo:bar1'], $e->getAlternatives()); - $this->assertRegExp(sprintf('/Command "%s" is not defined./', $commandName), $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); - $this->assertRegExp('/afoobar1/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternative : "afoobar1"'); - $this->assertRegExp('/foo:bar1/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternative : "foo:bar1"'); - $this->assertNotRegExp('/foo:bar(?!1)/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, without "foo:bar" alternative'); + $this->assertMatchesRegularExpression(sprintf('/Command "%s" is not defined./', $commandName), $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternatives'); + $this->assertMatchesRegularExpression('/afoobar1/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternative : "afoobar1"'); + $this->assertMatchesRegularExpression('/foo:bar1/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, with alternative : "foo:bar1"'); + $this->assertDoesNotMatchRegularExpression('/foo:bar(?!1)/', $e->getMessage(), '->find() throws a CommandNotFoundException if command does not exist, without "foo:bar" alternative'); } } @@ -664,10 +664,10 @@ public function testFindAlternativeNamespace() $this->assertContains('foo', $e->getAlternatives()); $this->assertContains('foo1', $e->getAlternatives()); $this->assertContains('foo3', $e->getAlternatives()); - $this->assertRegExp('/There are no commands defined in the "foo2" namespace./', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative'); - $this->assertRegExp('/foo/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo"'); - $this->assertRegExp('/foo1/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo1"'); - $this->assertRegExp('/foo3/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo3"'); + $this->assertMatchesRegularExpression('/There are no commands defined in the "foo2" namespace./', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative'); + $this->assertMatchesRegularExpression('/foo/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo"'); + $this->assertMatchesRegularExpression('/foo1/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo1"'); + $this->assertMatchesRegularExpression('/foo3/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo3"'); } } @@ -698,7 +698,7 @@ public function testFindAlternativesOutput() $this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if command is not defined'); $this->assertSame($expectedAlternatives, $e->getAlternatives()); - $this->assertRegExp('/Command "foo" is not defined\..*Did you mean one of these\?.*/Ums', $e->getMessage()); + $this->assertMatchesRegularExpression('/Command "foo" is not defined\..*Did you mean one of these\?.*/Ums', $e->getMessage()); } } @@ -799,9 +799,9 @@ public function testRenderException() $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getErrorOutput(true), '->renderException() renders a pretty exceptions with previous exceptions'); $tester->run(['command' => 'foo3:bar'], ['decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE]); - $this->assertRegExp('/\[Exception\]\s*First exception/', $tester->getDisplay(), '->renderException() renders a pretty exception without code exception when code exception is default and verbosity is verbose'); - $this->assertRegExp('/\[Exception\]\s*Second exception/', $tester->getDisplay(), '->renderException() renders a pretty exception without code exception when code exception is 0 and verbosity is verbose'); - $this->assertRegExp('/\[Exception \(404\)\]\s*Third exception/', $tester->getDisplay(), '->renderException() renders a pretty exception with code exception when code exception is 404 and verbosity is verbose'); + $this->assertMatchesRegularExpression('/\[Exception\]\s*First exception/', $tester->getDisplay(), '->renderException() renders a pretty exception without code exception when code exception is default and verbosity is verbose'); + $this->assertMatchesRegularExpression('/\[Exception\]\s*Second exception/', $tester->getDisplay(), '->renderException() renders a pretty exception without code exception when code exception is 0 and verbosity is verbose'); + $this->assertMatchesRegularExpression('/\[Exception \(404\)\]\s*Third exception/', $tester->getDisplay(), '->renderException() renders a pretty exception with code exception when code exception is 404 and verbosity is verbose'); $tester->run(['command' => 'foo3:bar'], ['decorated' => true]); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); @@ -883,8 +883,7 @@ public function testRenderAnonymousException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new class('') extends \InvalidArgumentException { - }; + throw new class('') extends \InvalidArgumentException { }; }); $tester = new ApplicationTester($application); @@ -894,8 +893,7 @@ public function testRenderAnonymousException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { - }))); + throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { }))); }); $tester = new ApplicationTester($application); @@ -908,8 +906,7 @@ public function testRenderExceptionStackTraceContainsRootException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new class('') extends \InvalidArgumentException { - }; + throw new class('') extends \InvalidArgumentException { }; }); $tester = new ApplicationTester($application); @@ -919,8 +916,7 @@ public function testRenderExceptionStackTraceContainsRootException() $application = new Application(); $application->setAutoExit(false); $application->register('foo')->setCode(function () { - throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { - }))); + throw new \InvalidArgumentException(sprintf('Dummy type "%s" is invalid.', \get_class(new class() { }))); }); $tester = new ApplicationTester($application); @@ -1448,8 +1444,8 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEvent() $application->setCatchExceptions(false); $application->setDispatcher(new EventDispatcher()); - $application->register('dym')->setCode(function (InputInterface $input, OutputInterface $output) { - new \UnknownClass(); + $application->register('dym')->setCode(function () { + throw new \Error('Something went wrong.'); }); $tester = new ApplicationTester($application); @@ -1458,7 +1454,7 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEvent() $tester->run(['command' => 'dym']); $this->fail('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent.'); } catch (\Error $e) { - $this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found'); + $this->assertSame('Something went wrong.', $e->getMessage()); } } @@ -1753,8 +1749,8 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn $application->setAutoExit(false); $application->setDispatcher(new EventDispatcher()); - $application->register('dym')->setCode(function (InputInterface $input, OutputInterface $output) { - new \UnknownClass(); + $application->register('dym')->setCode(function () { + throw new \Error('Something went wrong.'); }); $tester = new ApplicationTester($application); @@ -1763,7 +1759,7 @@ public function testErrorIsRethrownIfNotHandledByConsoleErrorEventWithCatchingEn $tester->run(['command' => 'dym']); $this->fail('->run() should rethrow PHP errors if not handled via ConsoleErrorEvent.'); } catch (\Error $e) { - $this->assertSame($e->getMessage(), 'Class \'UnknownClass\' not found'); + $this->assertSame('Something went wrong.', $e->getMessage()); } } diff --git a/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php b/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php index 57687d4c60342..3908ca5bb21f2 100644 --- a/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php @@ -23,7 +23,7 @@ public function testExecuteListsCommands() $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(['command' => $command->getName()], ['decorated' => false]); - $this->assertRegExp('/help\s{2,}Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); + $this->assertMatchesRegularExpression('/help\s{2,}Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands'); } public function testExecuteListsCommandsWithXmlOption() @@ -31,7 +31,7 @@ public function testExecuteListsCommandsWithXmlOption() $application = new Application(); $commandTester = new CommandTester($command = $application->get('list')); $commandTester->execute(['command' => $command->getName(), '--format' => 'xml']); - $this->assertRegExp('/