diff --git a/CHANGELOG-5.4.md b/CHANGELOG-5.4.md index 3760dbcc28667..d3f4945eb5436 100644 --- a/CHANGELOG-5.4.md +++ b/CHANGELOG-5.4.md @@ -7,6 +7,23 @@ in 5.4 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v5.4.0...v5.4.1 +* 5.4.31 (2023-11-10) + + * security #cve-2023-46734 [TwigBridge] Ensure CodeExtension's filters properly escape their input (nicolas-grekas, GromNaN) + * security #cve-2023-46733 [Security] Fix possible session fixation when only the *token* changes (RobertMe) + * bug #52506 [SecurityBundle] wire the secret for Symfony 6.4 compatibility (xabbuh) + * bug #52502 [Config] Prefixing `FileExistenceResource::__toString()` to avoid conflict with `FileResource` (weaverryan) + * bug #52491 [String] Method toByteString conversion using iconv is unreachable (Vincentv92) + * bug #52488 [HttpKernel] Fix PHP deprecation (nicolas-grekas) + * bug #52476 [Messenger] fix compatibility with Doctrine DBAL 4 (xabbuh) + * bug #52474 [HttpFoundation] ensure string type with mbstring func overloading enabled (xabbuh) + * bug #52457 [Cache][HttpFoundation][Lock] Fix empty username/password for PDO PostgreSQL (HypeMC) + * bug #52443 [Yaml] Fix uid binary parsing (mRoca) + * bug #52444 Remove full DSNs from exception messages (nicolas-grekas) + * bug #52428 [HttpKernel] Preventing error 500 when function putenv is disabled (ShaiMagal) + * bug #52408 [Yaml] Fix block scalar array parsing (NickSdot) + * bug #52329 [HttpClient] Psr18Client: parse HTTP Reason Phrase for Response (Hanmac) + * 5.4.30 (2023-10-29) * bug #52332 [Yaml] Fix deprecated passing null to trim() (javaDeveloperKid) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 4e0d9c4150104..b7f58c00c8501 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -15,39 +15,39 @@ The Symfony Connect username in parenthesis allows to get more information - Thomas Calvet (fancyweb) - Christophe Coevoet (stof) - Jordi Boggiano (seldaek) - - Maxime Steinhausser (ogizanagi) - Wouter de Jong (wouterj) + - Maxime Steinhausser (ogizanagi) - Kévin Dunglas (dunglas) - Victor Berchet (victor) - Ryan Weaver (weaverryan) - Jérémy DERUSSÉ (jderusse) - - Roland Franssen - Javier Eguiluz (javier.eguiluz) + - Roland Franssen - Johannes S (johannes) - Kris Wallsmith (kriswallsmith) - Jakub Zalas (jakubzalas) - - Yonel Ceruto (yonelceruto) + - Alexandre Daubois (alexandre-daubois) - Jules Pietri (heah) - Oskar Stark (oskarstark) - - Tobias Nyholm (tobias) + - Yonel Ceruto (yonelceruto) - Hugo Hamon (hhamon) - - Alexandre Daubois (alexandre-daubois) + - Tobias Nyholm (tobias) - Samuel ROZE (sroze) - Pascal Borreli (pborreli) - Romain Neutron - Joseph Bielawski (stloyd) - Drak (drak) - Abdellatif Ait boudad (aitboudad) + - Jérôme Tamarelle (gromnan) - Lukas Kahwe Smith (lsmith) + - Antoine Lamirault (alamirault) - Hamza Amrouche (simperfit) - - Martin Hasoň (hason) - Kevin Bond (kbond) - - Jérôme Tamarelle (gromnan) + - Martin Hasoň (hason) + - HypeMC (hypemc) - Jeremy Mikola (jmikola) - - Antoine Lamirault (alamirault) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - - HypeMC (hypemc) - Igor Wiedler - Jan Schädlich (jschaedl) - Mathieu Lechat (mat_the_cat) @@ -76,28 +76,30 @@ The Symfony Connect username in parenthesis allows to get more information - Mathieu Piot (mpiot) - Alexander Schranz (alexander-schranz) - Vasilij Duško (staff) + - Vincent Langlet (deviling) - Sarah Khalil (saro0h) - Laurent VOULLEMIER (lvo) - Konstantin Kudryashov (everzet) - - Vincent Langlet (deviling) - Guilhem N (guilhemn) - Bilal Amarni (bamarni) - Eriksen Costa + - Gary PEGEOT (gary-p) - Mathieu Santostefano (welcomattic) - Florin Patan (florinpatan) - Vladimir Reznichenko (kalessil) - Peter Rehm (rpet) - Henrik Bjørnskov (henrikbjorn) + - Allison Guilhem (a_guilhem) - Andrej Hudec (pulzarraider) - Jáchym Toušek (enumag) - David Buchmann (dbu) + - Dariusz Ruminski - Christian Raue - Eric Clemmons (ericclemmons) - Denis (yethee) - Michel Weimerskirch (mweimerskirch) - Issei Murasawa (issei_m) - Douglas Greenshields (shieldo) - - Gary PEGEOT (gary-p) - Alex Pott - Fran Moreno (franmomu) - Arnout Boks (aboks) @@ -105,9 +107,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ruud Kamphuis (ruudk) - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Allison Guilhem (a_guilhem) - Ener-Getick - - Dariusz Ruminski - Graham Campbell (graham) - Tugdual Saunier (tucksaun) - Lee McDermott @@ -134,7 +134,9 @@ The Symfony Connect username in parenthesis allows to get more information - Joel Wurtz (brouznouf) - Sebastiaan Stok (sstok) - Maxime STEINHAUSSER + - Frank A. Fiebig (fafiebig) - gnito-org + - Baldini - Tim Nagel (merk) - Chris Wilkinson (thewilkybarkid) - Jérôme Vasseur (jvasseur) @@ -178,8 +180,6 @@ The Symfony Connect username in parenthesis allows to get more information - Ion Bazan (ionbazan) - OGAWA Katsuhiro (fivestar) - Jhonny Lidfors (jhonne) - - Frank A. Fiebig (fafiebig) - - Baldini - Juti Noppornpitak (shiroyuki) - Gregor Harlan (gharlan) - Michael Babker (mbabker) @@ -237,6 +237,7 @@ The Symfony Connect username in parenthesis allows to get more information - Alessandro Lai (jean85) - 77web - Gocha Ossinkine (ossinkine) + - Martin Auswöger - Jesse Rushlow (geeshoe) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) @@ -251,12 +252,14 @@ The Symfony Connect username in parenthesis allows to get more information - Roland Franssen :) - GDIBass - Samuel NELA (snela) + - Tac Tacelosky (tacman1123) - Vincent AUBERT (vincent) - Fabien Bourigault (fbourigault) - Michael Voříšek - zairig imad (zairigimad) - Colin O'Dell (colinodell) - Sébastien Alfaiate (seb33300) + - Valtteri R (valtzu) - James Halsall (jaitsu) - Christian Scheb - Guillaume (guill) @@ -298,7 +301,6 @@ The Symfony Connect username in parenthesis allows to get more information - Andreas Hucks (meandmymonkey) - Jan Rosier (rosier) - Noel Guilbert (noel) - - Martin Auswöger - Stadly - Stepan Anchugov (kix) - bronze1man @@ -329,7 +331,6 @@ The Symfony Connect username in parenthesis allows to get more information - François Zaninotto (fzaninotto) - Dustin Whittle (dustinwhittle) - Timothée Barray (tyx) - - Valtteri R (valtzu) - jeff - Bob van de Vijver (bobvandevijver) - John Kary (johnkary) @@ -340,6 +341,7 @@ The Symfony Connect username in parenthesis allows to get more information - Marcin Sikoń (marphi) - Michele Orselli (orso) - Sven Paulus (subsven) + - Tomasz Kowalczyk (thunderer) - Daniel Burger - Maxime Veber (nek-) - Bastien Jaillot (bastnic) @@ -448,7 +450,6 @@ The Symfony Connect username in parenthesis allows to get more information - Wouter Van Hecke - Baptiste Lafontaine (magnetik) - Iker Ibarguren (ikerib) - - Tomasz Kowalczyk (thunderer) - Indra Gunawan (indragunawan) - Michael Holm (hollo) - Arjen van der Meijden @@ -537,6 +538,7 @@ The Symfony Connect username in parenthesis allows to get more information - Artur Eshenbrener - Harm van Tilborg (hvt) - Thomas Perez (scullwm) + - Cédric Anne - smoench - Felix Labrecque - mondrake (mondrake) @@ -577,6 +579,7 @@ The Symfony Connect username in parenthesis allows to get more information - SiD (plbsid) - Greg Thornton (xdissent) - Alex Bowers + - Michel Roca (mroca) - Fabien S (bafs) - Costin Bereveanu (schniper) - Andrii Dembitskyi @@ -618,6 +621,7 @@ The Symfony Connect username in parenthesis allows to get more information - Oscar Cubo Medina (ocubom) - Karel Souffriau - Christophe L. (christophelau) + - a.dmitryuk - Anthon Pang (robocoder) - Julien Galenski (ruian) - Ben Scott (bpscott) @@ -685,7 +689,6 @@ The Symfony Connect username in parenthesis allows to get more information - Dries Vints - Judicaël RUFFIEUX (axanagor) - Chris Sedlmayr (catchamonkey) - - Cédric Anne - DerManoMann - Jérôme Tanghe (deuchnord) - Mathias STRASSER (roukmoute) @@ -735,6 +738,7 @@ The Symfony Connect username in parenthesis allows to get more information - Axel Guckelsberger (guite) - Sam Fleming (sam_fleming) - Alex Bakhturin + - Belhassen Bouchoucha (crownbackend) - Patrick Reimers (preimers) - Brayden Williams (redstar504) - insekticid @@ -860,7 +864,6 @@ The Symfony Connect username in parenthesis allows to get more information - Ilija Tovilo (ilijatovilo) - Sander Toonen (xatoo) - Zach Badgett (zachbadgett) - - a.dmitryuk - Loïc Faugeron - Aurélien Fredouelle - Pavel Campr (pcampr) @@ -872,7 +875,6 @@ The Symfony Connect username in parenthesis allows to get more information - Benjamin Morel - Guilherme Ferreira - Geoffrey Tran (geoff) - - Tac Tacelosky (tacman1123) - Jannik Zschiesche - Bernd Stellwag - Jan Ole Behrens (deegital) @@ -1050,6 +1052,7 @@ The Symfony Connect username in parenthesis allows to get more information - Ruben Jacobs (rubenj) - Simon Schick (simonsimcity) - Tristan Roussel + - NickSdot - Niklas Keller - Alexandre parent - Cameron Porter @@ -1094,7 +1097,6 @@ The Symfony Connect username in parenthesis allows to get more information - Raphaëll Roussel - Michael Lutz - jochenvdv - - Michel Roca (mroca) - Reedy - Arturas Smorgun (asarturas) - Aleksandr Volochnev (exelenz) @@ -1141,7 +1143,6 @@ The Symfony Connect username in parenthesis allows to get more information - kylekatarnls (kylekatarnls) - Steve Grunwell - Yuen-Chi Lian - - Belhassen Bouchoucha (crownbackend) - Mathias Brodala (mbrodala) - Robert Fischer (sandoba) - Tarjei Huse (tarjei) @@ -1222,6 +1223,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mike Meier (mykon) - Pedro Miguel Maymone de Resende (pedroresende) - stlrnz + - javaDeveloperKid - Masterklavi - Adrien Wilmet (adrienfr) - Franco Traversaro (belinde) @@ -1361,6 +1363,7 @@ The Symfony Connect username in parenthesis allows to get more information - Simon Heimberg (simon_heimberg) - Morten Wulff (wulff) - Don Pinkster + - Jonas Elfering - Maksim Muruev - Emil Einarsson - 243083df @@ -1390,6 +1393,7 @@ The Symfony Connect username in parenthesis allows to get more information - Markus S. (staabm) - Marc Laporte - Michał Jusięga + - Dominik Ulrich - den - Gábor Tóth - ouardisoft @@ -1668,6 +1672,7 @@ The Symfony Connect username in parenthesis allows to get more information - Vedran Mihočinec (v-m-i) - Sergey Novikov (s12v) - creiner + - Jan Pintr - ProgMiner - Marcos Quesada (marcos_quesada) - Matthew (mattvick) @@ -1714,6 +1719,7 @@ The Symfony Connect username in parenthesis allows to get more information - Mikkel Paulson - Michał Strzelecki - Bert Ramakers + - Hans Mackowiak - Hugo Fonseca (fonsecas72) - Marc Duboc (icemad) - Martynas Narbutas @@ -2200,6 +2206,7 @@ The Symfony Connect username in parenthesis allows to get more information - Evan C - BrokenSourceCode - Fabian Haase + - roog - parinz1234 - Romain Geissler - Adrien Moiruad @@ -2269,7 +2276,6 @@ The Symfony Connect username in parenthesis allows to get more information - Thomas Counsell - BilgeXA - mmokhi - - javaDeveloperKid - Serhii Smirnov - Robert Queck - Peter Bouwdewijn @@ -2488,6 +2494,7 @@ The Symfony Connect username in parenthesis allows to get more information - AntoineDly - Konstantinos Alexiou - Andrii Boiko + - louismariegaborit - Dilek Erkut - Harold Iedema - WaiSkats diff --git a/psalm.xml b/psalm.xml index f34d4dd4281d8..eef4f912449df 100644 --- a/psalm.xml +++ b/psalm.xml @@ -9,6 +9,7 @@ errorBaseline=".github/psalm/psalm.baseline.xml" findUnusedBaselineEntry="false" findUnusedCode="false" + findUnusedIssueHandlerSuppression="false" > diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php index da09dc906763e..aa36885cad44e 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php @@ -197,7 +197,7 @@ public function testMappingTypeDetection() $this->assertSame($mappingType, \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute'); } - public static function providerBasicDrivers() + public static function providerBasicDrivers(): array { return [ ['doctrine.orm.cache.apc.class', ['type' => 'apc']], @@ -276,7 +276,7 @@ public function testUnrecognizedCacheDriverException() $this->invokeLoadCacheDriver($objectManager, $container, $cacheName); } - public static function providerBundles() + public static function providerBundles(): iterable { yield ['AnnotationsBundle', \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute', '/Entity']; yield ['AnnotationsOneLineBundle', \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute', '/Entity']; diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index d8491588fe357..75102ee331410 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -158,7 +158,7 @@ public function testChoiceTranslationDomainIsDisabledByDefault($expanded) } } - public static function choiceTranslationDomainProvider() + public static function choiceTranslationDomainProvider(): array { return [ [false], @@ -240,8 +240,6 @@ public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder() return new \stdClass(); }, ]); - - $field->submit('2'); } public function testConfigureQueryBuilderWithClosureReturningNullUseDefault() diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 66849208fd44b..75eae2c311d9f 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -479,7 +479,7 @@ public function testValidateResultTypes($entity1, $result) $this->assertNoViolation(); } - public static function resultTypesProvider() + public static function resultTypesProvider(): array { $entity = new SingleIntIdEntity(1, 'foo'); diff --git a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php index e3d06b52f4035..4ddaddbde1218 100644 --- a/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/Handler/ConsoleHandlerTest.php @@ -89,7 +89,7 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map $this->assertFalse($handler->handle($infoRecord), 'The handler finished handling the log.'); } - public static function provideVerbosityMappingTests() + public static function provideVerbosityMappingTests(): array { return [ [OutputInterface::VERBOSITY_QUIET, Logger::ERROR, true], diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php index 6116fbe9f0260..726f397f919b3 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php @@ -249,8 +249,8 @@ public function testToleratesForIndividualGroups(string $deprecationsHelper, arr } } - public static function provideDataForToleratesForGroup() { - + public static function provideDataForToleratesForGroup(): iterable + { yield 'total threshold not reached' => ['max[total]=1', [ 'unsilenced' => 0, 'self' => 0, diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php index 5c7cf991b3f2f..01d418ef23829 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/DeprecationTest.php @@ -97,7 +97,7 @@ public function testItMutesOnlySpecificErrorMessagesWhenTheCallingCodeIsInPhpuni $this->assertSame($muted, $deprecation->isMuted()); } - public static function mutedProvider() + public static function mutedProvider(): iterable { yield 'not from phpunit, and not a whitelisted message' => [ false, @@ -147,7 +147,7 @@ public function testItTakesMutesDeprecationFromPhpUnitFiles() $this->assertTrue($deprecation->isMuted()); } - public static function providerGetTypeDetectsSelf() + public static function providerGetTypeDetectsSelf(): array { return [ 'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', __FILE__], @@ -182,7 +182,7 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st $this->assertSame($expectedType, $deprecation->getType()); } - public static function providerGetTypeUsesRightTrace() + public static function providerGetTypeUsesRightTrace(): array { $vendorDir = self::getVendorDir(); $fakeTrace = [ diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 59845396cfe40..353bd84f3f6f7 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -42,8 +42,8 @@ public function __construct($fileLinkFormat, string $projectDir, string $charset public function getFilters(): array { return [ - new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html']]), - new TwigFilter('abbr_method', [$this, 'abbrMethod'], ['is_safe' => ['html']]), + new TwigFilter('abbr_class', [$this, 'abbrClass'], ['is_safe' => ['html'], 'pre_escape' => 'html']), + new TwigFilter('abbr_method', [$this, 'abbrMethod'], ['is_safe' => ['html'], 'pre_escape' => 'html']), new TwigFilter('format_args', [$this, 'formatArgs'], ['is_safe' => ['html']]), new TwigFilter('format_args_as_text', [$this, 'formatArgsAsText']), new TwigFilter('file_excerpt', [$this, 'fileExcerpt'], ['is_safe' => ['html']]), @@ -85,22 +85,23 @@ public function formatArgs(array $args): string $result = []; foreach ($args as $key => $item) { if ('object' === $item[0]) { + $item[1] = htmlspecialchars($item[1], \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset); $parts = explode('\\', $item[1]); $short = array_pop($parts); $formattedValue = sprintf('object(%s)', $item[1], $short); } elseif ('array' === $item[0]) { - $formattedValue = sprintf('array(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); + $formattedValue = sprintf('array(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)); } elseif ('null' === $item[0]) { $formattedValue = 'null'; } elseif ('boolean' === $item[0]) { - $formattedValue = ''.strtolower(var_export($item[1], true)).''; + $formattedValue = ''.strtolower(htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)).''; } elseif ('resource' === $item[0]) { $formattedValue = 'resource'; } else { $formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)); } - $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue); + $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", htmlspecialchars($key, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), $formattedValue); } return implode(', ', $result); @@ -166,11 +167,14 @@ public function formatFile(string $file, int $line, string $text = null): string $file = trim($file); if (null === $text) { - $text = $file; - if (null !== $rel = $this->getFileRelative($text)) { - $rel = explode('/', $rel, 2); - $text = sprintf('%s%s', $this->projectDir, $rel[0], '/'.($rel[1] ?? '')); + if (null !== $rel = $this->getFileRelative($file)) { + $rel = explode('/', htmlspecialchars($rel, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), 2); + $text = sprintf('%s%s', htmlspecialchars($this->projectDir, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset), $rel[0], '/'.($rel[1] ?? '')); + } else { + $text = htmlspecialchars($file, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset); } + } else { + $text = htmlspecialchars($text, \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset); } if (0 < $line) { diff --git a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php index ea3fbfda3a659..9378e87c46939 100644 --- a/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php +++ b/src/Symfony/Bridge/Twig/Tests/AppVariableTest.php @@ -43,7 +43,7 @@ public function testDebug($debugFlag) $this->assertEquals($debugFlag, $this->appVariable->getDebug()); } - public static function debugDataProvider() + public static function debugDataProvider(): array { return [ 'debug on' => [true], diff --git a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php index a898680fdd3e3..18d09b20b2d95 100644 --- a/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php @@ -150,7 +150,7 @@ public function testComplete(array $input, array $expectedSuggestions) $this->assertSame($expectedSuggestions, $tester->complete($input)); } - public static function provideCompletionSuggestions() + public static function provideCompletionSuggestions(): iterable { yield 'option' => [['--format', ''], ['txt', 'json', 'github']]; } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php index 38983cbd697f1..c7c859f067c7a 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php @@ -14,6 +14,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Bridge\Twig\Extension\CodeExtension; use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Twig\Environment; +use Twig\Loader\ArrayLoader; class CodeExtensionTest extends TestCase { @@ -28,42 +30,136 @@ public function testFileRelative() $this->assertEquals('file.txt', $this->getExtension()->getFileRelative(\DIRECTORY_SEPARATOR.'project'.\DIRECTORY_SEPARATOR.'file.txt')); } - /** - * @dataProvider getClassNameProvider - */ - public function testGettingClassAbbreviation($class, $abbr) + public function testClassAbbreviationIntegration() { - $this->assertEquals($this->getExtension()->abbrClass($class), $abbr); + $data = [ + 'fqcn' => 'F\Q\N\Foo', + 'xss' => '