diff --git a/.github/composer-config.json b/.github/composer-config.json index 752047dbb681d..6e17bc21e4582 100644 --- a/.github/composer-config.json +++ b/.github/composer-config.json @@ -4,6 +4,7 @@ "preferred-install": { "symfony/form": "source", "symfony/http-kernel": "source", + "symfony/proxy-manager-bridge": "source", "symfony/validator": "source", "*": "dist" } diff --git a/.github/patch-types.php b/.github/patch-types.php index 95e56b5984a4e..4d49778403fc3 100644 --- a/.github/patch-types.php +++ b/.github/patch-types.php @@ -25,13 +25,16 @@ case false !== strpos($file = realpath($file), '/vendor/'): case false !== strpos($file, '/src/Symfony/Bridge/PhpUnit/'): case false !== strpos($file, '/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Article.php'): + case false !== strpos($file, '/src/Symfony/Component/Cache/Tests/Fixtures/DriverWrapper.php'): case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadFileName.php'): case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/BadParent.php'): case false !== strpos($file, '/src/Symfony/Component/Config/Tests/Fixtures/ParseError.php'): case false !== strpos($file, '/src/Symfony/Component/Debug/Tests/Fixtures/'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Compiler/OptionalServiceClass.php'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php'): + case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/intersectiontype_classes.php'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/MultipleArgumentsOptionalScalarNotReallyOptional.php'): + case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/IntersectionConstructor.php'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ParentNotExists.php'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Preload/'): case false !== strpos($file, '/src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/BadClasses/MissingParent.php'): @@ -41,6 +44,7 @@ case false !== strpos($file, '/src/Symfony/Component/PropertyInfo/Tests/Fixtures/ParentDummy.php'): case false !== strpos($file, '/src/Symfony/Component/Serializer/Tests/Normalizer/Features/ObjectOuter.php'): case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/NotLoadableClass.php'): + case false !== strpos($file, '/src/Symfony/Component/VarDumper/Tests/Fixtures/ReflectionIntersectionTypeFixture.php'): continue 2; } diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 97946446e959b..4074f78d39356 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -72,14 +72,14 @@ jobs: with: coverage: "none" extensions: "memcached,redis,xsl,ldap" - ini-values: "memory_limit=-1" + ini-values: date.timezone=Europe/Paris,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 php-version: "${{ matrix.php }}" - name: Load fixtures uses: docker://bitnami/openldap with: entrypoint: /bin/bash - args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com" + args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -H ldap://ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -H ldap://ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -H ldap://ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com" - name: Install dependencies run: | diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index ceffbe310240c..430d67c4c8cda 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -41,13 +41,12 @@ jobs: run: | echo "extensions=mbstring" >> $GITHUB_ENV composer config platform.php 8.0.99 - composer require --dev --no-update masterminds/html5:~2.7.5@dev - name: Setup PHP uses: shivammathur/setup-php@v2 with: coverage: "none" - ini-values: date.timezone=Europe/Paris,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1 + ini-values: date.timezone=Europe/Paris,memory_limit=-1,default_socket_timeout=10,session.gc_probability=0,apc.enable_cli=1,zend.assertions=1 php-version: "${{ matrix.php }}" extensions: "${{ env.extensions }}" tools: flex @@ -140,7 +139,7 @@ jobs: if: "${{ matrix.php == '8.0' && ! matrix.mode }}" run: | sed -i 's/"\*\*\/Tests\/"//' composer.json - composer install --optimize-autoloader + composer install -q --optimize-autoloader SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php SYMFONY_PATCH_TYPE_DECLARATIONS=force=1 php .github/patch-types.php # ensure the script is idempotent echo PHPUNIT="$PHPUNIT,legacy" >> $GITHUB_ENV @@ -185,10 +184,12 @@ jobs: # matrix.mode = high-deps echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + # get a list of the patched components (relies on .github/build-packages.php being called in the previous step) (cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json) - COMPONENTS=$(git diff --name-only src/ | grep composer.json || true) + PATCHED_COMPONENTS=$(git diff --name-only src/ | grep composer.json || true) - if [[ $COMPONENTS && $SYMFONY_VERSION = *.4 ]]; then + # for x.4 branches, checkout and test previous major with the patched components (only for patched components) + if [[ $PATCHED_COMPONENTS && $SYMFONY_VERSION = *.4 ]]; then export FLIP='^' SYMFONY_VERSION=$(echo $SYMFONY_VERSION | awk '{print $1 - 1}') echo -e "\\n\\e[33;1mChecking out Symfony $SYMFONY_VERSION and running tests with patched components as deps\\e[0m" @@ -196,13 +197,13 @@ jobs: export SYMFONY_REQUIRE=">=$SYMFONY_VERSION" git fetch --depth=2 origin $SYMFONY_VERSION git checkout -m FETCH_HEAD - COMPONENTS=$(echo "$COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort || true) + PATCHED_COMPONENTS=$(echo "$PATCHED_COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort || true) (cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb) - if [[ $COMPONENTS ]]; then + if [[ $PATCHED_COMPONENTS ]]; then echo "::group::install phpunit" ./phpunit install echo "::endgroup::" - echo "$COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 + echo "$PATCHED_COMPONENTS" | parallel -j +3 "_run_tests {} 'cd {} && rm composer.lock vendor/ -Rf && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1 fi fi diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 583be2ac59363..fdb481fd190a8 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -11,6 +11,7 @@ '@Symfony' => true, '@Symfony:risky' => true, 'protected_to_private' => false, + 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => false], ]) ->setRiskyAllowed(true) ->setFinder( diff --git a/CHANGELOG-4.4.md b/CHANGELOG-4.4.md index d31628e66bc8a..51296d5ce65cb 100644 --- a/CHANGELOG-4.4.md +++ b/CHANGELOG-4.4.md @@ -7,6 +7,36 @@ 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.27 (2021-07-26) + + * bug #42212 [Lock] Handle lock with long key (jderusse) + * bug #42223 [Debug][ErrorHandler] Do not use the php80 polyfill (nicolas-grekas) + * bug #42207 [Console] fix table setHeaderTitle without headers (a1812) + * bug #42130 [Translation] fix fallback to Locale::getDefault() (nicolas-grekas) + * bug #42184 [Mailer] Make sure Http TransportException is not leaking (Nyholm) + * bug #42150 [Form] Fix 'invalid_message' use in multiple ChoiceType (alexandre-daubois) + * bug #42174 Indicate compatibility with psr/log 2 and 3 (derrabus) + * bug #42112 [HttpFoundation] fix FileBag under PHP 8.1 (alexpott) + * bug #42131 [PhpUnitBridge] Fix composer resolution on Windows (Rainrider) + * bug #42097 [DependencyInjection] Support for intersection types (derrabus) + * bug #42114 [HttpFoundation] Fix return types of SessionHandler::gc() (derrabus) + * bug #42099 [VarDumper] Support for intersection types (derrabus) + * bug #42011 [Cache] Support decorated Dbal drivers in PdoAdapter (Jeroeny) + * bug #42068 Add a Special Case for Translating Choices in en_US_POSIX (chrisguitarguy) + * bug #42074 Fix ctype_digit deprecation (alexpott) + * bug #42084 [WebProfilerBundle] Fix the values of some CSS properties (javiereguiluz) + * bug #42079 [FrameworkBundle] Fixed file operations in Sodium vault seal (javiereguiluz) + * bug #42054 [DoctrineBridge] fix setting default mapping type to attribute/annotation on php 8/7 respectively (nicolas-grekas) + * bug #42049 [TwigBridge] do not render the same label id attribute twice (xabbuh) + * bug #42032 [HttpKernel] recover from failed deserializations (xabbuh) + * bug #41990 [Lock] fix derivating semaphore from key (nicolas-grekas) + * bug #40529 [Translation] Missing translations from traits (insekticid) + * bug #41384 Fix SkippedTestSuite (jderusse) + * bug #41966 [Console] Revert "bug #41952 fix handling positional arguments" (chalasr, nicolas-grekas) + * bug #41905 [EventDispatcher] Correct the called event listener method case (JJsty1e) + * bug #41952 [Console] fix handling positional arguments (nicolas-grekas) + * bug #41887 [PhpUnitBridge] Fix deprecation handler with PHPUnit 10 (YaFou) + * 4.4.26 (2021-06-30) * bug #41893 [Filesystem] Workaround cannot dumpFile into "protected" folders on Windows (arnegroskurth) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 275042f9e08f6..8e58e8b338eb2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -8,26 +8,26 @@ The Symfony Connect username in parenthesis allows to get more information - Nicolas Grekas (nicolas-grekas) - Christian Flothmann (xabbuh) - Bernhard Schussek (bschussek) - - Tobias Schultze (tobion) - Alexander M. Turek (derrabus) + - Tobias Schultze (tobion) - Robin Chalas (chalas_r) - Christophe Coevoet (stof) - - Maxime Steinhausser (ogizanagi) - Jérémy DERUSSÉ (jderusse) + - Maxime Steinhausser (ogizanagi) - Kévin Dunglas (dunglas) - - Grégoire Pineau (lyrixx) - Wouter De Jong (wouterj) + - Grégoire Pineau (lyrixx) - Jordi Boggiano (seldaek) - Victor Berchet (victor) + - Javier Eguiluz (javier.eguiluz) - Ryan Weaver (weaverryan) - Roland Franssen (ro0) - - Javier Eguiluz (javier.eguiluz) - Thomas Calvet (fancyweb) - Jakub Zalas (jakubzalas) - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - - Yonel Ceruto González (yonelceruto) - Tobias Nyholm (tobias) + - Yonel Ceruto González (yonelceruto) - Oskar Stark (oskarstark) - Hugo Hamon (hhamon) - Ait Boudad Abdellatif (aitboudad) @@ -54,9 +54,9 @@ The Symfony Connect username in parenthesis allows to get more information - Jonathan Wage (jwage) - Valentin Udaltsov (vudaltsov) - Matthias Pigulla (mpdude) + - Vasilij Duško (staff) - Diego Saint Esteben (dosten) - Grégoire Paris (greg0ire) - - Vasilij Duško (staff) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -84,11 +84,11 @@ The Symfony Connect username in parenthesis allows to get more information - Florin Patan (florinpatan) - Jáchym Toušek (enumag) - Jérôme Tamarelle (gromnan) + - Alex Pott - Michel Weimerskirch (mweimerskirch) - Andrej Hudec (pulzarraider) - Christian Raue - Issei Murasawa (issei_m) - - Alex Pott - Eric Clemmons (ericclemmons) - Charles Sarrazin (csarrazi) - Vasilij Dusko @@ -99,8 +99,8 @@ The Symfony Connect username in parenthesis allows to get more information - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Fran Moreno (franmomu) - Antoine M (amakdessi) + - Fran Moreno (franmomu) - Dariusz Ruminski - Jérôme Vasseur (jvasseur) - Lee McDermott @@ -120,17 +120,18 @@ The Symfony Connect username in parenthesis allows to get more information - Przemysław Bogusz (przemyslaw-bogusz) - Maxime STEINHAUSSER - Michal Piotrowski (eventhorizon) + - Tomáš Votruba (tomas_votruba) - Massimiliano Arione (garak) - Mathias Arlaud (mtarld) - Tim Nagel (merk) + - Vincent Langlet (deviling) - Chris Wilkinson (thewilkybarkid) - - Tomáš Votruba (tomas_votruba) + - Tomas Norkūnas (norkunas) - Peter Kokot (maastermedia) - Lars Strojny (lstrojny) - Brice BERNARD (brikou) - Ahmed TAILOULOUTE (ahmedtai) - Gregor Harlan (gharlan) - - Vincent Langlet (deviling) - marc.weistroff - lenar - Alexander Schwenn (xelaris) @@ -138,7 +139,6 @@ The Symfony Connect username in parenthesis allows to get more information - Włodzimierz Gajda (gajdaw) - Christian Scheb - Adrien Brault (adrienbrault) - - Tomas Norkūnas (norkunas) - Julien Falque (julienfalque) - Jacob Dreesen (jdreesen) - Malte Schlüter (maltemaltesich) @@ -159,11 +159,13 @@ The Symfony Connect username in parenthesis allows to get more information - Fabien Pennequin (fabienpennequin) - Théo FIDRY (theofidry) - Olivier Dolbeau (odolbeau) + - Alexandre Daubois (alexandre-daubois) - Eric GELOEN (gelo) - Matthieu Napoli (mnapoli) - Jannik Zschiesche (apfelbox) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) + - Richard van Laak (rvanlaak) - Tigran Azatyan (tigranazatyan) - Gary PEGEOT (gary-p) - Gabriel Caruso (carusogabriel) @@ -173,7 +175,6 @@ The Symfony Connect username in parenthesis allows to get more information - Maxime Helias (maxhelias) - Vincent AUBERT (vincent) - Juti Noppornpitak (shiroyuki) - - Richard van Laak (rvanlaak) - Anthony MARTIN (xurudragon) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) @@ -183,10 +184,12 @@ The Symfony Connect username in parenthesis allows to get more information - Albert Casademont (acasademont) - Arnaud Kleinpeter (nanocom) - Guilherme Blanco (guilhermeblanco) + - Mathieu Santostefano (welcomattic) - Smaine Milianni (ismail1432) - SpacePossum - Pablo Godel (pgodel) - Andreas Braun + - YaFou - Jérémie Augustin (jaugustin) - François-Xavier de Guillebon (de-gui_f) - Oleg Voronkovich @@ -195,22 +198,20 @@ The Symfony Connect username in parenthesis allows to get more information - Rafael Dohms (rdohms) - George Mponos (gmponos) - jwdeitch + - Jeroen Spee (jeroens) - Fabien Bourigault (fbourigault) + - Joe Bennett (kralos) - Alexander Menshchikov (zmey_kk) - - YaFou - Mikael Pajunen - Andreas Schempp (aschempp) - Romaric Drigon (romaricdrigon) - Arman Hosseini (arman) - - Alexandre Daubois (alexandre-daubois) - Niels Keurentjes (curry684) - Vyacheslav Pavlov - Richard Shank (iampersistent) - Wouter J - Thomas Rabaix (rande) - Chi-teck - - Mathieu Santostefano (welcomattic) - - Jeroen Spee (jeroens) - Timo Bakx (timobakx) - Marco Pivetta (ocramius) - Vincent Touzet (vincenttouzet) @@ -235,8 +236,8 @@ The Symfony Connect username in parenthesis allows to get more information - GDIBass - Samuel NELA (snela) - David Prévot + - Hugo Monteiro (monteiro) - Dmitrii Poddubnyi (karser) - - Joe Bennett (kralos) - Michael Babker (mbabker) - Tien Vo (tienvx) - Timothée Barray (tyx) @@ -260,7 +261,6 @@ The Symfony Connect username in parenthesis allows to get more information - Christopher Hertel (chertel) - DQNEO - Hidde Wieringa (hiddewie) - - Hugo Monteiro (monteiro) - Antonio Pauletich (x-coder264) - Andre Rømcke (andrerom) - Nate Wiebe (natewiebe13) @@ -274,12 +274,14 @@ The Symfony Connect username in parenthesis allows to get more information - Benjamin Dulau (dbenjamin) - Baptiste Lafontaine (magnetik) - Mathieu Lemoine (lemoinem) + - Denis Brumann (dbrumann) - Christian Schmidt - Andreas Hucks (meandmymonkey) - Tom Van Looy (tvlooy) - Guillaume Pédelagrabe - Noel Guilbert (noel) - Anthony GRASSIOT (antograssiot) + - Ion Bazan (ionbazan) - Stadly - Stepan Anchugov (kix) - François Pluchino (francoispluchino) @@ -313,24 +315,25 @@ The Symfony Connect username in parenthesis allows to get more information - John Kary (johnkary) - Justin Hileman (bobthecow) - Blanchon Vincent (blanchonvincent) - - Denis Brumann (dbrumann) - Michele Orselli (orso) - Sven Paulus (subsven) - Daniel STANCU - Maxime Veber (nek-) - - Ion Bazan (ionbazan) - Loick Piera (pyrech) - Clara van Miert - Valentine Boineau (valentineboineau) - Bastien Jaillot (bastnic) - Rui Marinho (ruimarinho) + - Patrick Landolt (scube) - Eugene Wissner - Bohan Yang (brentybh) - Pascal Montoya - Julien Brochet (mewt) - Gocha Ossinkine (ossinkine) + - Roman Martinuk (a2a4) - Tristan Darricau (nicofuma) - Victor Bocharsky (bocharsky_bw) + - Bozhidar Hristov (warxcell) - Marcel Beerta (mazen) - Pavel Batanov (scaytrase) - Mantis Development @@ -388,7 +391,6 @@ The Symfony Connect username in parenthesis allows to get more information - Nguyen Xuan Quynh (xuanquynh) - Jan Sorgalla (jsor) - Ray - - Bozhidar Hristov (warxcell) - Chekote - Thomas Adam - Jhonny Lidfors (jhonne) @@ -435,7 +437,6 @@ The Symfony Connect username in parenthesis allows to get more information - Gonzalo Vilaseca (gonzalovilaseca) - Ben Hakim - Haralan Dobrev (hkdobrev) - - Patrick Landolt (scube) - MatTheCat - Vilius Grigaliūnas - David Badura (davidbadura) @@ -454,7 +455,6 @@ The Symfony Connect username in parenthesis allows to get more information - Bertrand Zuchuat (garfield-fr) - Gabor Toth (tgabi333) - realmfoo - - Roman Martinuk (a2a4) - Thomas Tourlourat (armetiz) - Andrey Esaulov (andremaha) - Grégoire Passault (gregwar) @@ -484,11 +484,13 @@ The Symfony Connect username in parenthesis allows to get more information - Chris Tanaskoski - James Hemery - Berny Cantos (xphere81) + - Andrii Bodnar - Thierry Thuon (lepiaf) - Ricard Clau (ricardclau) - Mark Challoner (markchalloner) - Loïc Frémont (loic425) - Oleksandr Barabolia (oleksandrbarabolia) + - Christopher Davis (chrisguitarguy) - ivan - Artem Henvald (artemgenvald) - Greg Anderson @@ -555,6 +557,7 @@ The Symfony Connect username in parenthesis allows to get more information - Marek Kalnik (marekkalnik) - Vyacheslav Salakhutdinov (megazoll) - Sébastien Alfaiate (seb33300) + - Phil Taylor (prazgod) - Hassan Amouhzi - Tamas Szijarto - Michele Locati @@ -612,12 +615,11 @@ The Symfony Connect username in parenthesis allows to get more information - Steffen Roßkamp - Alexandru Furculita (afurculita) - Valentin Jonovs (valentins-jonovs) - - Andrii Bodnar - Bastien DURAND (deamon) - Jeanmonod David (jeanmonod) - - Christopher Davis (chrisguitarguy) - Andrey Sevastianov - Webnet team (webnet) + - Urinbayev Shakhobiddin (shokhaa) - marie - Jan Schumann - Noémi Salaün (noemi-salaun) @@ -744,7 +746,6 @@ The Symfony Connect username in parenthesis allows to get more information - ondrowan - Barry vd. Heuvel (barryvdh) - Jon Dufresne - - Phil Taylor (prazgod) - Evan S Kaufman (evanskaufman) - Alex Bacart - mcben @@ -785,6 +786,7 @@ The Symfony Connect username in parenthesis allows to get more information - DUPUCH (bdupuch) - Nate (frickenate) - Joachim Løvgaard (loevgaard) + - Stefan Kruppa - jhonnyL - sasezaki - Jonathan Scheiber (jmsche) @@ -864,7 +866,6 @@ The Symfony Connect username in parenthesis allows to get more information - Antonio Jose Cerezo (ajcerezo) - Mátyás Somfai (smatyas) - Alexandre Tranchant (alexandre_t) - - Urinbayev Shakhobiddin (shokhaa) - Anthony Moutte - Thomas Ferney (thomasf) - Simon DELICATA @@ -877,6 +878,7 @@ The Symfony Connect username in parenthesis allows to get more information - Safonov Nikita (ns3777k) - vitaliytv - Nicolas Martin (cocorambo) + - Adrian Nguyen (vuphuong87) - Dalibor Karlović (dkarlovi) - Sebastian Blum - Alexis Lefebvre @@ -952,6 +954,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mardari Dorel (dorumd) - Daisuke Ohata - Vincent Simonin + - Yoann RENARD (yrenard) - Alex Bogomazov (alebo) - maxime.steinhausser - Claus Due (namelesscoder) @@ -967,6 +970,7 @@ The Symfony Connect username in parenthesis allows to get more information - Nilmar Sanchez Muguercia - Ivo Bathke (ivoba) - scyzoryck + - Ippei SUmida (ippey_s) - David Molineus - Strate - Jon Green @@ -1127,6 +1131,7 @@ The Symfony Connect username in parenthesis allows to get more information - Jakub Kulhan (jakubkulhan) - Shaharia Azam - avorobiev + - Gerben Oolbekkink - Kai - Bartłomiej Zając - stoccc @@ -1177,6 +1182,7 @@ The Symfony Connect username in parenthesis allows to get more information - Krzysiek Łabuś - Juraj Surman - Camille Dejoye + - 1ma (jautenim) - Douglas Hammond (wizhippo) - Xavier Lacot (xavier) - possum @@ -1212,6 +1218,7 @@ The Symfony Connect username in parenthesis allows to get more information - Zhuravlev Alexander (scif) - Stefano Degenkamp (steef) - James Michael DuPont + - Jake (jakesoft) - Flinsch - Quentin Dreyer - Jordan de Laune (jdelaune) @@ -1258,6 +1265,7 @@ The Symfony Connect username in parenthesis allows to get more information - Loïc Beurlet - Sébastien COURJEAN - Daniel Gorgan + - Ana Raro - Tony Malzhacker - Pchol - Mathieu MARCHOIS @@ -1265,7 +1273,7 @@ The Symfony Connect username in parenthesis allows to get more information - Cyrille Bourgois (cyrilleb) - Gerard van Helden (drm) - Johnny Peck (johnnypeck) - - Stefan Kruppa + - Marcos Rezende (rezehnde) - Ivan Menshykov - David Romaní - Patrick Allaert @@ -1419,6 +1427,8 @@ The Symfony Connect username in parenthesis allows to get more information - Mikkel Paulson - ergiegonzaga - Liverbool (liverbool) + - Valentin Nazarov + - Jérôme Nadaud (jnadaud) - Sam Malone - Phan Thanh Ha (haphan) - Chris Jones (leek) @@ -1486,7 +1496,6 @@ The Symfony Connect username in parenthesis allows to get more information - Tero Alén (tero) - Stanislav Kocanda - DerManoMann - - Ippei SUmida (ippey_s) - Guillaume Royer - Artem (digi) - boite @@ -1502,6 +1511,7 @@ The Symfony Connect username in parenthesis allows to get more information - Wojciech Sznapka - Luis Pabon (luispabon) - Gavin Staniforth + - boulei_n - Anna Filina (afilina) - Ksaveras Šakys (xawiers) - Ariel J. Birnbaum @@ -1630,6 +1640,7 @@ The Symfony Connect username in parenthesis allows to get more information - Patrick Carlo-Hickman - Bruno MATEU - Jeremy Bush + - Lucas Bäuerle - wizhippo - Thomason, James - Dario Savella @@ -1779,7 +1790,6 @@ The Symfony Connect username in parenthesis allows to get more information - Sebastian Göttschkes (sgoettschkes) - Tatsuya Tsuruoka - Ross Tuck - - Gerben Oolbekkink - Kévin Gomez (kevin) - Mihai Nica (redecs) - Andrei Igna @@ -1851,6 +1861,7 @@ The Symfony Connect username in parenthesis allows to get more information - Fleuv - Sandro Hopf - Łukasz Makuch + - Arne Groskurth - George Giannoulopoulos - Alexander Pasichnick - Luis Ramirez (luisdeimos) @@ -1988,7 +1999,6 @@ The Symfony Connect username in parenthesis allows to get more information - Yannick Snobbert - Kevin Dew - James Cowgill - - 1ma (jautenim) - Nicolas Schwartz (nicoschwartz) - Patrik Gmitter (patie) - Peter Schultz @@ -1996,6 +2006,7 @@ The Symfony Connect username in parenthesis allows to get more information - Benhssaein Youssef - bill moll - Benjamin Bender + - PaoRuby - Jared Farrish - karl.rixon - raplider @@ -2022,6 +2033,7 @@ The Symfony Connect username in parenthesis allows to get more information - Denis Yuzhanin - Youssef BENHSSAIEN - knezmilos13 + - alireza - Cyril PASCAL - Michael Bessolov - pscheit @@ -2184,6 +2196,7 @@ The Symfony Connect username in parenthesis allows to get more information - Christopher Parotat - Dennis Haarbrink - me_shaon + - Maximilian Bösing - 蝦米 - Grayson Koonce (breerly) - Andrey Helldar (helldar) @@ -2203,7 +2216,6 @@ The Symfony Connect username in parenthesis allows to get more information - Luiz “Felds” Liscia - Johan - Thomas Rothe - - Ana Raro - Martin - nietonfir - alefranz @@ -2254,7 +2266,6 @@ The Symfony Connect username in parenthesis allows to get more information - Philip Dahlstrøm (phidah) - Milos Colakovic (project2481) - Rénald Casagraude (rcasagraude) - - Marcos Rezende (rezehnde) - Robin Duval (robin-duval) - Grinbergs Reinis (shima5) - Artem Lopata (bumz) @@ -2369,6 +2380,7 @@ The Symfony Connect username in parenthesis allows to get more information - Tom Maguire - Mateusz Lerczak - Richard Quadling + - Rainrider - David Zuelke - Adrian - Oleg Andreyev @@ -2408,6 +2420,7 @@ The Symfony Connect username in parenthesis allows to get more information - hadriengem - timaschew - Jochen Mandl + - elattariyassine - Marin Nicolae - Alessandro Loffredo - Ian Phillips @@ -2415,6 +2428,7 @@ The Symfony Connect username in parenthesis allows to get more information - Haritz - Matthieu Prat - Grummfy + - zors1 - Paul Le Corre - Noel Light-Hilary - Filipe Guerra @@ -2426,9 +2440,11 @@ The Symfony Connect username in parenthesis allows to get more information - Frank Jogeleit - Ondřej Frei - Gabriel Birke + - Daniel Tiringer - skafandri - Derek Bonner - martijn + - Storkeus - Alan Chen - Anton Zagorskii - insidestyles @@ -2440,6 +2456,7 @@ The Symfony Connect username in parenthesis allows to get more information - Erik van Wingerden - Valouleloup - robmro27 + - Vallel Blanco - Alexis MARQUIS - Gerrit Drost - Linnaea Von Lavia @@ -2458,6 +2475,7 @@ The Symfony Connect username in parenthesis allows to get more information - Kuba Werłos - Gyula Szucs - Tomas Liubinas + - Ivo Valchev - Alex - Jan Hort - Klaas Naaijkens @@ -2507,6 +2525,7 @@ The Symfony Connect username in parenthesis allows to get more information - Artem (nexim) - Nicolas ASSING (nicolasassing) - Olivier Laviale (olvlvl) + - Petr Duda (petrduda) - Pierre Gasté (pierre_g) - Pablo Monterde Perez (plebs) - Pierre-Olivier Vares (povares) @@ -2517,6 +2536,7 @@ The Symfony Connect username in parenthesis allows to get more information - Wim Godden (wimg) - Yorkie Chadwick (yorkie76) - Maxime Aknin (3m1x4m) + - Exploit.cz - GuillaumeVerdon - Philipp Keck - Angel Fernando Quiroz Campos @@ -2713,6 +2733,7 @@ The Symfony Connect username in parenthesis allows to get more information - Benjamin Long - Ben Miller - Peter Gribanov + - Ash014 - kwiateusz - jspee - Ilya Bulakh @@ -2822,8 +2843,10 @@ The Symfony Connect username in parenthesis allows to get more information - Laurent Bachelier (laurentb) - Luís Cobucci (lcobucci) - Mehdi Achour (machour) + - Mamikon Arakelyan (mamikon) - Matthieu Moquet (mattketmo) - Moritz Borgmann (mborgmann) + - Mathias Brodala (mbrodala) - Michal Čihař (mcihar) - Matt Drollette (mdrollette) - Adam Monsen (meonkeys) diff --git a/composer.json b/composer.json index c3ef535f772d1..da8e66b784de0 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "psr/event-dispatcher-implementation": "1.0", "psr/http-client-implementation": "1.0", "psr/link-implementation": "1.0", - "psr/log-implementation": "1.0", + "psr/log-implementation": "1.0|2.0", "psr/simple-cache-implementation": "1.0", "symfony/cache-implementation": "1.0|2.0", "symfony/event-dispatcher-implementation": "1.1", @@ -41,7 +41,7 @@ "psr/cache": "^1.0|^2.0", "psr/container": "^1.0", "psr/link": "^1.0", - "psr/log": "~1.0", + "psr/log": "^1|^2", "symfony/contracts": "^1.1.8", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-icu": "~1.0", @@ -49,7 +49,7 @@ "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php72": "~1.5", "symfony/polyfill-php73": "^1.11", - "symfony/polyfill-php80": "^1.15", + "symfony/polyfill-php80": "^1.16", "symfony/polyfill-php81": "^1.22" }, "replace": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d7f495fac7216..c4e152a05938f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -28,6 +28,7 @@ ./src/Symfony/Bridge/*/Tests/ ./src/Symfony/Component/*/Tests/ ./src/Symfony/Component/*/*/Tests/ + ./src/Symfony/Component/*/*/*/Tests/ ./src/Symfony/Contract/*/Tests/ ./src/Symfony/Bundle/*/Tests/ diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 1ee4f54ded8e1..48385c93ac19e 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -54,7 +54,7 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null) return; } - $eventArgs = null === $eventArgs ? EventArgs::getEmptyInstance() : $eventArgs; + $eventArgs = $eventArgs ?? EventArgs::getEmptyInstance(); if (!isset($this->initialized[$eventName])) { $this->initializeListeners($eventName); diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index f67ecd35c9f5b..383462ca95ee7 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Doctrine\DependencyInjection; +use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -88,6 +89,25 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder if (!$mappingConfig) { continue; } + } elseif (!$mappingConfig['type'] && \PHP_VERSION_ID < 80000) { + $mappingConfig['type'] = 'annotation'; + } elseif (!$mappingConfig['type']) { + $mappingConfig['type'] = 'attribute'; + + $glob = new GlobResource($mappingConfig['dir'], '*', true); + $container->addResource($glob); + + foreach ($glob as $file) { + $content = file_get_contents($file); + + if (preg_match('/^#\[.*Entity\b/m', $content)) { + break; + } + if (preg_match('/^ \* @.*Entity\b/m', $content)) { + $mappingConfig['type'] = 'annotation'; + break; + } + } } $this->assertValidMappingConfiguration($mappingConfig, $objectManager['name']); @@ -208,7 +228,7 @@ protected function registerMappingDrivers($objectManager, ContainerBuilder $cont ]); } $mappingDriverDef->setPublic(false); - if (false !== strpos($mappingDriverDef->getClass(), 'yml') || false !== strpos($mappingDriverDef->getClass(), 'xml')) { + if (str_contains($mappingDriverDef->getClass(), 'yml') || str_contains($mappingDriverDef->getClass(), 'xml')) { $mappingDriverDef->setArguments([array_flip($driverPaths)]); $mappingDriverDef->addMethodCall('setGlobalBasename', ['mapping']); } diff --git a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php index a0459aa970903..879e87979499c 100644 --- a/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php +++ b/src/Symfony/Bridge/Doctrine/PropertyInfo/DoctrineExtractor.php @@ -68,7 +68,7 @@ public function getProperties($class, array $context = []) if ($metadata instanceof ClassMetadataInfo && class_exists(\Doctrine\ORM\Mapping\Embedded::class) && $metadata->embeddedClasses) { $properties = array_filter($properties, function ($property) { - return false === strpos($property, '.'); + return !str_contains($property, '.'); }); $properties = array_merge($properties, array_keys($metadata->embeddedClasses)); diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php index 5dd3889e8eb15..213af6f36a235 100644 --- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php @@ -144,7 +144,7 @@ private function getClass(): string if (null === $this->class) { $class = $this->classOrAlias; - if (false !== strpos($class, ':')) { + if (str_contains($class, ':')) { $class = $this->getClassMetadata()->getName(); } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php index afe595c7d3e19..004eec8201336 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php @@ -29,17 +29,17 @@ class DoctrineChoiceLoaderTest extends TestCase { /** - * @var ChoiceListFactoryInterface|MockObject + * @var MockObject&ChoiceListFactoryInterface */ private $factory; /** - * @var ObjectManager|MockObject + * @var MockObject&ObjectManager */ private $om; /** - * @var ObjectRepository|MockObject + * @var MockObject&ObjectRepository */ private $repository; @@ -49,12 +49,12 @@ class DoctrineChoiceLoaderTest extends TestCase private $class; /** - * @var IdReader|MockObject + * @var MockObject&IdReader */ private $idReader; /** - * @var EntityLoaderInterface|MockObject + * @var MockObject&EntityLoaderInterface */ private $objectLoader; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index d082ba5492b17..7dc883badb0e1 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -59,7 +59,7 @@ class EntityTypeTest extends BaseTypeTest private $em; /** - * @var MockObject|ManagerRegistry + * @var MockObject&ManagerRegistry */ private $emRegistry; @@ -1312,7 +1312,10 @@ public function testLoaderCachingWithParameters() $this->assertSame($choiceLoader1, $choiceLoader3); } - protected function createRegistryMock($name, $em) + /** + * @return MockObject&ManagerRegistry + */ + protected function createRegistryMock($name, $em): ManagerRegistry { $registry = $this->createMock(ManagerRegistry::class); $registry->expects($this->any()) diff --git a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php index 5ddd60df8e857..a004935a6afdc 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php @@ -19,9 +19,6 @@ class ManagerRegistryTest extends TestCase { public static function setUpBeforeClass(): void { - if (!class_exists(\PHPUnit_Framework_TestCase::class)) { - self::markTestSkipped('proxy-manager-bridge is not yet compatible with namespaced phpunit versions.'); - } $test = new PhpDumperTest(); $test->testDumpContainerWithProxyServiceWillShareProxies(); } diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index 399a18d90c7fe..df17e0eedd4c8 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -163,7 +163,7 @@ public function validate($entity, Constraint $constraint) return; } - $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; + $errorPath = $constraint->errorPath ?? $fields[0]; $invalidValue = $criteria[$errorPath] ?? $criteria[$fields[0]]; $this->context->buildViolation($constraint->message) diff --git a/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php b/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php index ca9eb4fab168c..f0f9a95652399 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php +++ b/src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php @@ -104,7 +104,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool } if (null === $lengthConstraint) { - if (isset($mapping['originalClass']) && false === strpos($mapping['declaredField'], '.')) { + if (isset($mapping['originalClass']) && !str_contains($mapping['declaredField'], '.')) { $metadata->addPropertyConstraint($mapping['declaredField'], new Valid()); $loaded = true; } elseif (property_exists($className, $mapping['fieldName'])) { diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json index 17a83e7d12e7c..0da77033b3334 100644 --- a/src/Symfony/Bridge/Doctrine/composer.json +++ b/src/Symfony/Bridge/Doctrine/composer.json @@ -21,6 +21,7 @@ "doctrine/persistence": "^1.3|^2", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2" }, "require-dev": { diff --git a/src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php b/src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php index 977be786e5b71..0e5fddc222875 100644 --- a/src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php +++ b/src/Symfony/Bridge/Monolog/Command/ServerLogCommand.php @@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output) 'multiline' => OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity(), ])); - if (false === strpos($host = $input->getOption('host'), '://')) { + if (!str_contains($host = $input->getOption('host'), '://')) { $host = 'tcp://'.$host; } diff --git a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php index d232d68cd9404..4b87c264e4d5a 100644 --- a/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php +++ b/src/Symfony/Bridge/Monolog/Formatter/ConsoleFormatter.php @@ -163,7 +163,7 @@ private function replacePlaceHolder(array $record): array { $message = $record['message']; - if (false === strpos($message, '{')) { + if (!str_contains($message, '{')) { return $record; } diff --git a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php index c31dba880295c..a59825f6ab1f4 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php @@ -129,6 +129,9 @@ private function sendToElasticsearch(array $records) $this->wait(false); } + /** + * @return array + */ public function __sleep() { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); diff --git a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php index 4b92b088f7dac..8101178d66c03 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php @@ -32,7 +32,7 @@ public function __construct(string $host, $level = Logger::DEBUG, bool $bubble = { parent::__construct($level, $bubble); - if (false === strpos($host, '://')) { + if (!str_contains($host, '://')) { $host = 'tcp://'.$host; } diff --git a/src/Symfony/Bridge/Monolog/Tests/Processor/ConsoleCommandProcessorTest.php b/src/Symfony/Bridge/Monolog/Tests/Processor/ConsoleCommandProcessorTest.php index 6ee30da38a993..424f9ce10d597 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Processor/ConsoleCommandProcessorTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Processor/ConsoleCommandProcessorTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Event\ConsoleEvent; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; class ConsoleCommandProcessorTest extends TestCase { @@ -66,10 +67,7 @@ private function getConsoleEvent(): ConsoleEvent $input->method('getOptions')->willReturn(self::TEST_OPTIONS); $command = $this->createMock(Command::class); $command->method('getName')->willReturn(self::TEST_NAME); - $consoleEvent = $this->createMock(ConsoleEvent::class); - $consoleEvent->method('getCommand')->willReturn($command); - $consoleEvent->method('getInput')->willReturn($input); - return $consoleEvent; + return new ConsoleEvent($command, $input, $this->createMock(OutputInterface::class)); } } diff --git a/src/Symfony/Bridge/Monolog/composer.json b/src/Symfony/Bridge/Monolog/composer.json index fee9fe256ab73..613b619b450ed 100644 --- a/src/Symfony/Bridge/Monolog/composer.json +++ b/src/Symfony/Bridge/Monolog/composer.json @@ -19,7 +19,8 @@ "php": ">=7.1.3", "monolog/monolog": "^1.25.1", "symfony/service-contracts": "^1.1|^2", - "symfony/http-kernel": "^4.3" + "symfony/http-kernel": "^4.3", + "symfony/polyfill-php80": "^1.16" }, "require-dev": { "symfony/console": "^3.4|^4.0|^5.0", diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 19c6691dbec3e..518a76425377e 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\PhpUnit; use PHPUnit\Framework\TestResult; +use PHPUnit\Util\Error\Handler; use PHPUnit\Util\ErrorHandler; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Configuration; use Symfony\Bridge\PhpUnit\DeprecationErrorHandler\Deprecation; @@ -51,7 +52,7 @@ class DeprecationErrorHandler ]; private static $isRegistered = false; - private static $isAtLeastPhpUnit83; + private static $errorHandler; /** * Registers and configures the deprecation handler. @@ -335,16 +336,23 @@ private function displayDeprecations($groups, $configuration) private static function getPhpUnitErrorHandler() { - if (!isset(self::$isAtLeastPhpUnit83)) { - self::$isAtLeastPhpUnit83 = class_exists(ErrorHandler::class) && method_exists(ErrorHandler::class, '__invoke'); + if (!$eh = self::$errorHandler) { + if (class_exists(Handler::class)) { + $eh = self::$errorHandler = Handler::class; + } elseif (method_exists(ErrorHandler::class, '__invoke')) { + $eh = self::$errorHandler = ErrorHandler::class; + } else { + return self::$errorHandler = 'PHPUnit\Util\ErrorHandler::handleError'; + } } - if (!self::$isAtLeastPhpUnit83) { - return 'PHPUnit\Util\ErrorHandler::handleError'; + + if ('PHPUnit\Util\ErrorHandler::handleError' === $eh) { + return $eh; } foreach (debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { if (isset($frame['object']) && $frame['object'] instanceof TestResult) { - return new ErrorHandler( + return new $eh( $frame['object']->getConvertDeprecationsToExceptions(), $frame['object']->getConvertErrorsToExceptions(), $frame['object']->getConvertNoticesToExceptions(), diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php index fdc898a9316f5..d122de44090a8 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler/Deprecation.php @@ -13,11 +13,14 @@ use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestSuite; +use PHPUnit\Metadata\Api\Groups; use PHPUnit\Util\Test; use Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor; use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader; use Symfony\Component\ErrorHandler\DebugClassLoader; +class_exists(Groups::class); + /** * @internal */ @@ -192,12 +195,13 @@ public function isLegacy() } $method = $this->originatingMethod(); + $groups = class_exists(Groups::class, false) ? [new Groups(), 'groups'] : [Test::class, 'getGroups']; return 0 === strpos($method, 'testLegacy') || 0 === strpos($method, 'provideLegacy') || 0 === strpos($method, 'getLegacy') || strpos($this->originClass, '\Legacy') - || \in_array('legacy', Test::getGroups($this->originClass, $method), true); + || \in_array('legacy', $groups($this->originClass, $method), true); } /** diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php index 6558f910b0a3b..c43a1ccff1e04 100644 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php @@ -150,14 +150,13 @@ putenv('SYMFONY_DEPRECATIONS_HELPER=disabled'); } -if (false === $COMPOSER = getenv('COMPOSER_BINARY')) { - $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') - || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`))) - || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`))) - || file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar') - ? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang - : 'composer'; -} +$COMPOSER = ($COMPOSER = getenv('COMPOSER_BINARY')) + || file_exists($COMPOSER = $oldPwd.'/composer.phar') + || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar 2> NUL`) : `which composer.phar 2> /dev/null`))) + || ($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer 2> NUL`) : `which composer 2> /dev/null`))) + || file_exists($COMPOSER = rtrim((string) ('\\' === \DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`)).\DIRECTORY_SEPARATOR.'composer.phar') + ? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang + : 'composer'; $prevCacheDir = getenv('COMPOSER_CACHE_DIR'); if ($prevCacheDir) { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php index 141147a64c00b..d665070f02454 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php @@ -28,12 +28,12 @@ public function generate(\ReflectionClass $originalClass, ClassGenerator $classG parent::generate($originalClass, $classGenerator, $proxyOptions); foreach ($classGenerator->getMethods() as $method) { - if (0 === strpos($originalClass->getFilename(), __FILE__)) { + if (str_starts_with($originalClass->getFilename(), __FILE__)) { $method->setBody(str_replace(var_export($originalClass->name, true), '__CLASS__', $method->getBody())); } } - if (0 === strpos($originalClass->getFilename(), __FILE__)) { + if (str_starts_with($originalClass->getFilename(), __FILE__)) { $interfaces = $classGenerator->getImplementedInterfaces(); array_pop($interfaces); $classGenerator->setImplementedInterfaces(array_merge($interfaces, $originalClass->getInterfaceNames())); diff --git a/src/Symfony/Bridge/ProxyManager/composer.json b/src/Symfony/Bridge/ProxyManager/composer.json index c96e2b7b772fc..09692b8c89d74 100644 --- a/src/Symfony/Bridge/ProxyManager/composer.json +++ b/src/Symfony/Bridge/ProxyManager/composer.json @@ -19,7 +19,8 @@ "php": ">=7.1.3", "composer/package-versions-deprecated": "^1.8", "friendsofphp/proxy-manager-lts": "^1.0.2", - "symfony/dependency-injection": "^4.0|^5.0" + "symfony/dependency-injection": "^4.0|^5.0", + "symfony/polyfill-php80": "^1.16" }, "require-dev": { "symfony/config": "^3.4|^4.0|^5.0" diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index 966532b422f43..a6a1e9a2cebde 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -225,7 +225,7 @@ private function displayGeneralText(SymfonyStyle $io, string $filter = null) foreach ($types as $index => $type) { $items = []; foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) { - if (!$filter || false !== strpos($name, $filter)) { + if (!$filter || str_contains($name, $filter)) { $items[$name] = $name.$this->getPrettyMetadata($type, $entity, $decorated); } } @@ -259,7 +259,7 @@ private function displayGeneralJson(SymfonyStyle $io, ?string $filter) $data = []; foreach ($types as $type) { foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) { - if (!$filter || false !== strpos($name, $filter)) { + if (!$filter || str_contains($name, $filter)) { $data[$type][$name] = $this->getMetadata($type, $entity); } } @@ -409,7 +409,7 @@ private function findWrongBundleOverrides(): array $folders = glob($this->rootDir.'/Resources/*/views', \GLOB_ONLYDIR); $relativePath = ltrim(substr($this->rootDir.\DIRECTORY_SEPARATOR.'Resources/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); $bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) { - if (0 === strpos($absolutePath, $this->projectDir)) { + if (str_starts_with($absolutePath, $this->projectDir)) { $name = basename(\dirname($absolutePath)); $path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR); $carry[$name] = $path; @@ -425,7 +425,7 @@ private function findWrongBundleOverrides(): array $folders = glob($this->twigDefaultPath.'/bundles/*', \GLOB_ONLYDIR); $relativePath = ltrim(substr($this->twigDefaultPath.'/bundles/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); $bundleNames = array_reduce($folders, function ($carry, $absolutePath) use ($relativePath) { - if (0 === strpos($absolutePath, $this->projectDir)) { + if (str_starts_with($absolutePath, $this->projectDir)) { $name = basename($absolutePath); $path = ltrim($relativePath.$name, \DIRECTORY_SEPARATOR); $carry[$name] = $path; @@ -555,7 +555,7 @@ private function findAlternatives(string $name, array $collection): array $alternatives = []; foreach ($collection as $item) { $lev = levenshtein($name, $item); - if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) { + if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) { $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; } } @@ -569,7 +569,7 @@ private function findAlternatives(string $name, array $collection): array private function getRelativePath(string $path): string { - if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) { + if (null !== $this->projectDir && str_starts_with($path, $this->projectDir)) { return ltrim(substr($path, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR); } diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 7f60b542bff40..54b43caca2cb3 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -71,7 +71,7 @@ public function abbrClass($class) public function abbrMethod($method) { - if (false !== strpos($method, '::')) { + if (str_contains($method, '::')) { [$class, $method] = explode('::', $method, 2); $result = sprintf('%s::%s()', $this->abbrClass($class), $method); } elseif ('Closure' === $method) { @@ -219,7 +219,7 @@ public function getFileRelative(string $file): ?string { $file = str_replace('\\', '/', $file); - if (null !== $this->projectDir && 0 === strpos($file, $this->projectDir)) { + if (null !== $this->projectDir && str_starts_with($file, $this->projectDir)) { return ltrim(substr($file, \strlen($this->projectDir)), '/'); } @@ -238,7 +238,7 @@ public function formatFileFromText($text) */ public function formatLogMessage(string $message, array $context): string { - if ($context && false !== strpos($message, '{')) { + if ($context && str_contains($message, '{')) { $replacements = []; foreach ($context as $key => $val) { if (is_scalar($val)) { diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig index 7db2a0dadd3e3..00ca8694c704a 100644 --- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig +++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig @@ -122,7 +122,7 @@ <{{ element|default('div') }} class="custom-file"> {%- set type = type|default('file') -%} {{- block('form_widget_simple') -}} - {%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim }) -%} + {%- set label_attr = label_attr|merge({ class: (label_attr.class|default('') ~ ' custom-file-label')|trim })|filter((value, key) => key != 'id') -%}