diff --git a/.github/rm-invalid-lowest-lock-files.php b/.github/rm-invalid-lowest-lock-files.php index 3105942a09030..c036fd356f045 100644 --- a/.github/rm-invalid-lowest-lock-files.php +++ b/.github/rm-invalid-lowest-lock-files.php @@ -104,8 +104,7 @@ function getContentHash(array $composerJson) } } -if (!$referencedCommits || (isset($_SERVER['TRAVIS_PULL_REQUEST']) && 'false' !== $_SERVER['TRAVIS_PULL_REQUEST'])) { - // cached commits cannot be stale for PRs +if (!$referencedCommits) { return; } diff --git a/.php_cs.dist b/.php_cs.dist index c832b99114352..8398c437127e8 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -11,6 +11,7 @@ return PhpCsFixer\Config::create() '@PHPUnit48Migration:risky' => true, 'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice 'array_syntax' => array('syntax' => 'long'), + 'fopen_flags' => false, 'ordered_imports' => true, 'protected_to_private' => false, // rule disabled due to https://bugs.php.net/bug.php?id=60573 bug; @@ -18,6 +19,8 @@ return PhpCsFixer\Config::create() 'self_accessor' => false, // Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading 'native_function_invocation' => array('include' => array('@compiler_optimized'), 'scope' => 'namespaced'), + // Part of future @Symfony ruleset in PHP-CS-Fixer To be removed from the config file once upgrading + 'phpdoc_types_order' => array('null_adjustment' => 'always_last', 'sort_algorithm' => 'none'), )) ->setRiskyAllowed(true) ->setFinder( diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 1e7eae64e3ea0..358b477b1467b 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,19 @@ in 2.8 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/v2.8.0...v2.8.1 +* 2.8.47 (2018-11-03) + + * bug #29020 Fix ini_get() for boolean values (deguif) + * bug #28861 [DependencyInjection] Skip empty proxy code (olvlvl) + * bug #28801 Convert InsufficientAuthenticationException to HttpException with 401 status code (vincentchalamon) + * bug #28840 add missing double-quotes to extra_fields output message (danielkay) + * bug #28712 [Form] reverse transform RFC 3339 formatted dates (xabbuh) + * bug #28813 Fix for race condition in console output stream write (rudolfratusinski) + * bug #27772 [Console] Fixes multiselect choice question defaults in non-interactive mode (veewee) + * bug #28689 [Process] fix locking of pipe files on Windows (nicolas-grekas) + * bug #28704 [Form] fix multi-digit seconds fraction handling (xabbuh) + * bug #28648 [PHPUnitBridge] Fix ClockMock microtime() format (acasademont) + * 2.8.46 (2018-09-30) * bug #28376 [TwigBundle] Fixed caching of templates in src/Resources//views on cache warmup (yceruto) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000000..d211dd419d064 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,83 @@ +Code of Conduct +=============== + +Our Pledge +---------- + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnic origin, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +religion, or sexual identity and orientation. + +Our Standards +------------- + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +Our Responsibilities +-------------------- + +[CoC Active Response Ensurers, or CARE][1], are responsible for clarifying the +standards of acceptable behavior and are expected to take appropriate and fair +corrective action in response to any instances of unacceptable behavior. + +CARE team members have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +Scope +----- + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by CARE team members. + +Enforcement +----------- + +Instances of abusive, harassing, or otherwise unacceptable behavior +[may be reported][2] by contacting the [CARE team members][1]. +All complaints will be reviewed and investigated and will result in a response +that is deemed necessary and appropriate to the circumstances. The CARE team is +obligated to maintain confidentiality with regard to the reporter of an +incident. Further details of specific enforcement policies may be posted +separately. + +CARE team members who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by the +[core team][3]. + +Attribution +----------- + +This Code of Conduct is adapted from the [Contributor Covenant version 1.4][4]. + +[1]: https://symfony.com/doc/current/contributing/code_of_conduct/care_team.html +[2]: https://symfony.com/doc/current/contributing/code_of_conduct/reporting_guidelines.html +[3]: https://symfony.com/doc/current/contributing/code/core_team.html +[4]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 66d9da5983a99..969c6a424cefc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -14,23 +14,23 @@ Symfony is the result of the work of many people who made the code better - Victor Berchet (victor) - Robin Chalas (chalas_r) - Kévin Dunglas (dunglas) - - Johannes S (johannes) - Jakub Zalas (jakubzalas) + - Johannes S (johannes) - Maxime Steinhausser (ogizanagi) - Kris Wallsmith (kriswallsmith) - Ryan Weaver (weaverryan) - Javier Eguiluz (javier.eguiluz) - Grégoire Pineau (lyrixx) - Hugo Hamon (hhamon) - - Abdellatif Ait boudad (aitboudad) - Roland Franssen (ro0) + - Abdellatif Ait boudad (aitboudad) - Romain Neutron (romain) - Pascal Borreli (pborreli) - Wouter De Jong (wouterj) - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - - Lukas Kahwe Smith (lsmith) - Samuel ROZE (sroze) + - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) @@ -43,9 +43,9 @@ Symfony is the result of the work of many people who made the code better - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Hamza Amrouche (simperfit) + - Tobias Nyholm (tobias) - Diego Saint Esteben (dosten) - Iltar van der Berg (kjarli) - - Tobias Nyholm (tobias) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -72,11 +72,12 @@ Symfony is the result of the work of many people who made the code better - Titouan Galopin (tgalopin) - Michel Weimerskirch (mweimerskirch) - Andrej Hudec (pulzarraider) + - Konstantin Myakshin (koc) - Eric Clemmons (ericclemmons) - Jáchym Toušek (enumag) - Charles Sarrazin (csarrazi) - David Maicher (dmaicher) - - Konstantin Myakshin (koc) + - Vladimir Reznichenko (kalessil) - Christian Raue - Issei Murasawa (issei_m) - Arnout Boks (aboks) @@ -84,13 +85,12 @@ Symfony is the result of the work of many people who made the code better - Henrik Westphal (snc) - Dariusz Górecki (canni) - Douglas Greenshields (shieldo) - - Vladimir Reznichenko (kalessil) + - Dariusz Ruminski - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Graham Campbell (graham) - Daniel Holmes (dholmes) - - Dariusz Ruminski - Toni Uebernickel (havvg) - Grégoire Paris (greg0ire) - Bart van den Burg (burgov) @@ -98,6 +98,7 @@ Symfony is the result of the work of many people who made the code better - Jérôme Tamarelle (gromnan) - John Wards (johnwards) - Fran Moreno (franmomu) + - Valentin Udaltsov (vudaltsov) - Antoine Hérault (herzult) - Paráda József (paradajozsef) - Arnaud Le Blanc (arnaud-lb) @@ -106,9 +107,9 @@ Symfony is the result of the work of many people who made the code better - gadelat (gadelat) - Tim Nagel (merk) - Brice BERNARD (brikou) - - Valentin Udaltsov (vudaltsov) - Baptiste Clavié (talus) - marc.weistroff + - David Buchmann (dbu) - lenar - Alexander Schwenn (xelaris) - Włodzimierz Gajda (gajdaw) @@ -119,12 +120,12 @@ Symfony is the result of the work of many people who made the code better - Adrien Brault (adrienbrault) - Tomáš Votruba (tomas_votruba) - Joshua Thijssen - - David Buchmann (dbu) - excelwebzone - Gordon Franke (gimler) - Fabien Pennequin (fabienpennequin) - Eric GELOEN (gelo) - Sebastiaan Stok (sstok) + - Jérôme Vasseur (jvasseur) - Lars Strojny (lstrojny) - Daniel Wehner (dawehner) - Tugdual Saunier (tucksaun) @@ -134,7 +135,6 @@ Symfony is the result of the work of many people who made the code better - Florian Lonqueu-Brochard (florianlb) - Chris Wilkinson (thewilkybarkid) - Stefano Sala (stefano.sala) - - Jérôme Vasseur (jvasseur) - Evgeniy (ewgraf) - Alex Pott - Vincent AUBERT (vincent) @@ -142,6 +142,7 @@ Symfony is the result of the work of many people who made the code better - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) + - Gabriel Caruso - Hidenori Goto (hidenorigoto) - Arnaud Kleinpeter (nanocom) - Jannik Zschiesche (apfelbox) @@ -165,6 +166,7 @@ Symfony is the result of the work of many people who made the code better - Clemens Tolboom - Helmer Aaviksoo - Hiromi Hishida (77web) + - Niels Keurentjes (curry684) - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - Dawid Nowak @@ -177,16 +179,16 @@ Symfony is the result of the work of many people who made the code better - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent) - James Halsall (jaitsu) - Matthieu Napoli (mnapoli) - - Gabriel Caruso - Warnar Boekkooi (boekkooi) + - Alessandro Chitolina (alekitto) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) - - Niels Keurentjes (curry684) - Daniel Espendiller - Possum - Dorian Villet (gnutix) - Sergey Linnik (linniksa) - Richard Miller (mr_r_miller) + - Albert Casademont (acasademont) - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) - DQNEO @@ -204,6 +206,7 @@ Symfony is the result of the work of many people who made the code better - sun (sun) - Larry Garfield (crell) - Michaël Perrin (michael.perrin) + - Nikolay Labinskiy (e-moe) - Martin Schuhfuß (usefulthink) - apetitpa - Matthieu Bontemps (mbontemps) @@ -225,15 +228,12 @@ Symfony is the result of the work of many people who made the code better - Tom Van Looy (tvlooy) - Sven Paulus (subsven) - Rui Marinho (ruimarinho) - - Alessandro Chitolina - Eugene Wissner - Pascal Montoya - Julien Brochet (mewt) - Leo Feyer - Tristan Darricau (nicofuma) - - Nikolay Labinskiy (e-moe) - Marcel Beerta (mazen) - - Albert Casademont (acasademont) - Pavel Batanov (scaytrase) - Loïc Faugeron - Hidde Wieringa (hiddewie) @@ -248,6 +248,7 @@ Symfony is the result of the work of many people who made the code better - Francois Zaninotto - Alexander Kotynia (olden) - Daniel Tschinder + - Christian Schmidt - Marcos Sánchez - Elnur Abdurrakhimov (elnur) - Manuel Reinhard (sprain) @@ -258,6 +259,7 @@ Symfony is the result of the work of many people who made the code better - Roman Marintšenko (inori) - Xavier Montaña Carreras (xmontana) - Mickaël Andrieu (mickaelandrieu) + - Maxime Veber (nek-) - Xavier Perez - Arjen Brouwer (arjenjb) - Katsuhiro OGAWA @@ -291,8 +293,8 @@ Symfony is the result of the work of many people who made the code better - Wodor Wodorski - Thomas Lallement (raziel057) - mcfedr (mcfedr) + - Colin O'Dell (colinodell) - Giorgio Premi - - Christian Schmidt - Beau Simensen (simensen) - Michael Hirschler (mvhirsch) - Robert Kiss (kepten) @@ -303,10 +305,10 @@ Symfony is the result of the work of many people who made the code better - Jérôme Parmentier (lctrs) - Michael Babker (mbabker) - Peter Kruithof (pkruithof) + - François-Xavier de Guillebon (de-gui_f) - Michael Holm (hollo) - Marc Weistroff (futurecat) - Christian Schmidt - - Maxime Veber (nek-) - MatTheCat - Chad Sikorra (chadsikorra) - Chris Smith (cs278) @@ -317,6 +319,7 @@ Symfony is the result of the work of many people who made the code better - rudy onfroy (ronfroy) - Andrew Moore (finewolf) - Bertrand Zuchuat (garfield-fr) + - Sullivan SENECHAL (soullivaneuh) - Gabor Toth (tgabi333) - realmfoo - Thomas Tourlourat (armetiz) @@ -346,8 +349,9 @@ Symfony is the result of the work of many people who made the code better - Thierry Thuon (lepiaf) - Ricard Clau (ricardclau) - Mark Challoner (markchalloner) - - Colin O'Dell (colinodell) - Gennady Telegin (gtelegin) + - Jan Schädlich (jschaedl) + - Fabien Bourigault (fbourigault) - Ben Davies (bendavies) - Erin Millard - Artur Melo (restless) @@ -363,7 +367,6 @@ Symfony is the result of the work of many people who made the code better - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) - Artur Eshenbrener - - François-Xavier de Guillebon (de-gui_f) - Damien Alexandre (damienalexandre) - Thomas Perez (scullwm) - Felix Labrecque @@ -384,7 +387,6 @@ Symfony is the result of the work of many people who made the code better - Grzegorz (Greg) Zdanowski (kiler129) - Kirill chEbba Chebunin (chebba) - Greg Thornton (xdissent) - - Sullivan SENECHAL (soullivaneuh) - Costin Bereveanu (schniper) - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) @@ -393,16 +395,19 @@ Symfony is the result of the work of many people who made the code better - Tamas Szijarto - Michele Locati - Pavel Volokitin (pvolok) + - Smaine Milianni (ismail1432) - Arthur de Moulins (4rthem) - Nicolas Dewez (nicolas_dewez) - Endre Fejes - Tobias Naumann (tna) + - George Mponos (gmponos) - Daniel Beyer - Shein Alexey - Alex Rock Ancelet (pierstoval) - Romain Gautier (mykiwi) - Joe Lencioni - Daniel Tschinder + - vladimir.reznichenko - Kai - Lee Rowlands - Krzysztof Piasecki (krzysztek) @@ -437,13 +442,13 @@ Symfony is the result of the work of many people who made the code better - Jan Schumann - Niklas Fiekas - Markus Bachmann (baachi) - - Jan Schädlich - lancergr - Zan Baldwin - Mihai Stancu - Olivier Dolbeau (odolbeau) - Jan Rosier (rosier) - Alessandro Lai (jean85) + - Pascal Luna (skalpa) - Arturs Vonda - Josip Kruslin - Asmir Mustafic (goetas) @@ -457,6 +462,7 @@ Symfony is the result of the work of many people who made the code better - Chris Sedlmayr (catchamonkey) - Mateusz Sip (mateusz_sip) - Remon van de Kamp + - Kamil Kokot (pamil) - Seb Koelen - Christoph Mewes (xrstf) - Vitaliy Tverdokhlib (vitaliytv) @@ -506,6 +512,7 @@ Symfony is the result of the work of many people who made the code better - Roy Van Ginneken (rvanginneken) - ondrowan - Barry vd. Heuvel (barryvdh) + - Craig Duncan (duncan3dc) - Sébastien Alfaiate (seb33300) - Evan S Kaufman (evanskaufman) - mcben @@ -513,7 +520,6 @@ Symfony is the result of the work of many people who made the code better - Maks Slesarenko - Filip Procházka (fprochazka) - mmoreram - - Smaine Milianni (ismail1432) - Markus Lanthaler (lanthaler) - Remi Collet - Vicent Soria Durá (vicentgodella) @@ -529,7 +535,6 @@ Symfony is the result of the work of many people who made the code better - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) - Almog Baku (almogbaku) - - George Mponos (gmponos) - Scott Arciszewski - Xavier HAUSHERR - Norbert Orzechowicz (norzechowicz) @@ -543,6 +548,7 @@ Symfony is the result of the work of many people who made the code better - Nate (frickenate) - Timothée Barray (tyx) - jhonnyL + - Grenier Kévin (mcsky_biig) - sasezaki - Dawid Pakuła (zulusx) - Florian Rey (nervo) @@ -579,6 +585,7 @@ Symfony is the result of the work of many people who made the code better - Jan Behrens - Mantas Var (mvar) - Sebastian Krebs + - Laurent VOULLEMIER (lvo) - Jean-Christophe Cuvelier [Artack] - Simon DELICATA - alcaeus @@ -625,12 +632,10 @@ Symfony is the result of the work of many people who made the code better - Erkhembayar Gantulga (erheme318) - Michal Trojanowski - David Fuhr - - Kamil Kokot (pamil) - Max Grigorian (maxakawizard) - DerManoMann - Rostyslav Kinash - Maciej Malarz (malarzm) - - Pascal Luna (skalpa) - Daisuke Ohata - Vincent Simonin - Alex Bogomazov (alebo) @@ -638,6 +643,7 @@ Symfony is the result of the work of many people who made the code better - adev - Stefan Warman - Arkadius Stefanski (arkadius) + - Gonzalo Vilaseca (gonzalovilaseca) - Tristan Maindron (tmaindron) - Wesley Lancel - Ke WANG (yktd26) @@ -645,6 +651,7 @@ Symfony is the result of the work of many people who made the code better - Strate - Anton A. Sumin - Israel J. Carberry + - Tim Goudriaan (codedmonkey) - Miquel Rodríguez Telep (mrtorrent) - Sergey Kolodyazhnyy (skolodyazhnyy) - umpirski @@ -665,6 +672,7 @@ Symfony is the result of the work of many people who made the code better - Jaroslav Kuba - Stephan Vock - Benjamin Zikarsky (bzikarsky) + - Roberto Espinoza (respinoza) - Simon Schick (simonsimcity) - redstar504 - Tristan Roussel @@ -716,7 +724,7 @@ Symfony is the result of the work of many people who made the code better - Pierre Rineau - Vladyslav Petrovych - Alex Xandra Albert Sim - - Craig Duncan (duncan3dc) + - Alexander Schranz (alexander-schranz) - Carson Full - Sergey Yastrebov - Trent Steel (trsteel88) @@ -787,14 +795,17 @@ Symfony is the result of the work of many people who made the code better - Patrick Dawkins (pjcdawkins) - Paul Kamer (pkamer) - Rafał Wrzeszcz (rafalwrzeszcz) + - Vincent CHALAMON (vincentchalamon) - Reen Lokum - Martin Parsiegla (spea) + - Nguyen Xuan Quynh (xuanquynh) - Quentin Schuler - Pierre Vanliefland (pvanliefland) - Sofiane HADDAG (sofhad) - frost-nzcr4 - Bozhidar Hristov - Ivan Nikolaev (destillat) + - Laurent Bassin (lbassin) - andrey1s - Abhoryo - Fabian Vogler (fabian) @@ -819,7 +830,6 @@ Symfony is the result of the work of many people who made the code better - Ivan Menshykov - David Romaní - Patrick Allaert - - Fabien Bourigault (fbourigault) - Gustavo Falco (gfalco) - Matt Robinson (inanimatt) - Ruud Kamphuis (ruudk) @@ -830,6 +840,7 @@ Symfony is the result of the work of many people who made the code better - Jörn Lang (j.lang) - Omar Yepez (oyepez003) - Gawain Lynch (gawain) + - Samuel NELA (snela) - mwsaz - Jelle Kapitein - Benoît Bourgeois @@ -838,6 +849,7 @@ Symfony is the result of the work of many people who made the code better - grizlik - Derek ROTH - Ben Johnson + - mweimerskirch - Dmytro Boiko (eagle) - Shin Ohno (ganchiku) - Geert De Deckere (geertdd) @@ -870,6 +882,7 @@ Symfony is the result of the work of many people who made the code better - Adán Lobato (adanlobato) - Ian Jenkins (jenkoian) - Matthew Davis (mdavis1982) + - Sam Fleming (sam_fleming) - Maks - Antoine LA - den @@ -880,6 +893,7 @@ Symfony is the result of the work of many people who made the code better - David Lima - Brian Freytag (brianfreytag) - Brunet Laurent (lbrunet) + - Florent Viel (luxifer) - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) - Robert Gruendler (pulse00) @@ -891,8 +905,10 @@ Symfony is the result of the work of many people who made the code better - Erik Saunier (snickers) - Rootie - Kyle + - Daniel Alejandro Castro Arellano (lexcast) - Raul Fraile (raulfraile) - sensio + - Baptiste Leduc (bleduc) - Sebastien Morel (plopix) - Patrick Kaufmann - Piotr Stankowski @@ -1023,6 +1039,7 @@ Symfony is the result of the work of many people who made the code better - Michał Strzelecki - hugofonseca (fonsecas72) - Martynas Narbutas + - Toon Verwerft (veewee) - Bailey Parker - Eddie Jaoude - Antanas Arvasevicius @@ -1056,13 +1073,14 @@ Symfony is the result of the work of many people who made the code better - Alexander Cheprasov - Rodrigo Díez Villamuera (rodrigodiez) - e-ivanov - - Roberto Espinoza (respinoza) - Einenlum - Jochen Bayer (jocl) - Patrick Carlo-Hickman + - Bruno MATEU - Alex Bowers - Jeremy Bush - wizhippo + - Mathias STRASSER (roukmoute) - Thomason, James - Viacheslav Sychov - Helmut Hummel (helhum) @@ -1105,6 +1123,7 @@ Symfony is the result of the work of many people who made the code better - Pawel Smolinski - Oxan van Leeuwen - pkowalczyk + - Soner Sayakci - Max Voloshin (maxvoloshin) - Nicolas Fabre (nfabre) - Raul Rodriguez (raul782) @@ -1117,6 +1136,7 @@ Symfony is the result of the work of many people who made the code better - Felicitus - Krzysztof Przybyszewski - alexpozzi + - Frederic Godfrin - Paul Matthews - Jakub Kisielewski - Vacheslav Silyutin @@ -1206,6 +1226,7 @@ Symfony is the result of the work of many people who made the code better - Juanmi Rodriguez Cerón - Andy Raines - Anthony Ferrara + - Geoffrey Pécro (gpekz) - Klaas Cuvelier (kcuvelier) - Mathieu TUDISCO (mathieutu) - markusu49 @@ -1231,12 +1252,12 @@ Symfony is the result of the work of many people who made the code better - Andreas Frömer - Philip Frank - Lance McNearney - - Gonzalo Vilaseca (gonzalovilaseca) - Giorgio Premi - Andrew Berry - ncou - Ian Carroll - caponica + - Daniel Kay (danielkay-cp) - Matt Daum (daum) - Alberto Pirovano (geezmo) - Nicolas LEFEVRE (nicoweb) @@ -1271,7 +1292,6 @@ Symfony is the result of the work of many people who made the code better - Max Romanovsky (maxromanovsky) - Mathieu Morlon - Daniel Tschinder - - Alexander Schranz - Arnaud CHASSEUX - Rafał Muszyński (rafmus90) - Sébastien Decrême (sebdec) @@ -1368,6 +1388,8 @@ Symfony is the result of the work of many people who made the code better - Jakub Simon - Bouke Haarsma - Evert Harmeling + - mschop + - Alan Poulain - Martin Eckhardt - natechicago - Jonathan Poston @@ -1403,12 +1425,14 @@ Symfony is the result of the work of many people who made the code better - Jake Bishop (yakobeyak) - Dan Blows - Matt Wells + - Sander van der Vlugt - Nicolas Appriou - stloyd - Andreas - Chris Tickner - BoShurik - Andrew Coulton + - Ulugbek Miniyarov - Jeremy Benoist - Michal Gebauer - Gleb Sidora @@ -1441,9 +1465,9 @@ Symfony is the result of the work of many people who made the code better - Kamil Madejski - Jeremiah VALERIE - Mike Francis + - Gerd Christian Kunze (derdu) - Christoph Nissle (derstoffel) - Ionel Scutelnicu (ionelscutelnicu) - - Grenier Kévin (mcsky_biig) - Nicolas Tallefourtané (nicolab) - Botond Dani (picur) - Thierry Marianne (thierrymarianne) @@ -1461,6 +1485,7 @@ Symfony is the result of the work of many people who made the code better - Maksym Slesarenko (maksym_slesarenko) - Michal Kurzeja (mkurzeja) - Nicolas Bastien (nicolas_bastien) + - Nikola Svitlica (thecelavi) - Denis (yethee) - Andrew Zhilin (zhil) - Sjors Ottjes @@ -1504,6 +1529,7 @@ Symfony is the result of the work of many people who made the code better - Robin Duval (robin-duval) - Grinbergs Reinis (shima5) - Artem Lopata (bumz) + - alex - Nicole Cordes - Roman Orlov - VolCh @@ -1530,6 +1556,7 @@ Symfony is the result of the work of many people who made the code better - Dmitry Korotovsky - mcorteel - Michael van Tricht + - ReScO - Tim Strehle - Sam Ward - Walther Lalk @@ -1553,8 +1580,10 @@ Symfony is the result of the work of many people who made the code better - Dmitriy Fedorenko - vlakoff - bertillon + - Rudolf Ratusiński - Bertalan Attila - AmsTaFF (amstaff) + - Simon Müller (boscho) - Yannick Bensacq (cibou) - Frédéric G. Marand (fgm) - Freek Van der Herten (freekmurze) @@ -1569,6 +1598,7 @@ Symfony is the result of the work of many people who made the code better - Rares Vlaseanu (raresvla) - tante kinast (tante) - Vincent LEFORT (vlefort) + - Darryl Hein (xmmedia) - Sadicov Vladimir (xtech) - Kevin EMO (zarcox) - Alexander Zogheb @@ -1620,6 +1650,7 @@ Symfony is the result of the work of many people who made the code better - Matthieu Prat - Ion Bazan - Grummfy + - Paul Le Corre - Filipe Guerra - Jean Ragouin - Gerben Wijnja @@ -1636,7 +1667,7 @@ Symfony is the result of the work of many people who made the code better - Erik van Wingerden - Valouleloup - Dane Powell - - mweimerskirch + - Alexis MARQUIS - Gerrit Drost - Linnaea Von Lavia - Simon Mönch @@ -1655,6 +1686,7 @@ Symfony is the result of the work of many people who made the code better - Klaas Naaijkens - Daniel González Cerviño - Rafał + - Achilles Kaloeridis (achilles) - Adria Lopez (adlpz) - Aaron Scherer (aequasi) - Rosio (ben-rosio) @@ -1688,6 +1720,7 @@ Symfony is the result of the work of many people who made the code better - mlpo (mlpo) - Marek Šimeček (mssimi) - Cayetano Soriano Gallego (neoshadybeat) + - Olivier Laviale (olvlvl) - Ondrej Machulda (ondram) - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) @@ -1798,7 +1831,6 @@ Symfony is the result of the work of many people who made the code better - Guillaume Aveline - Adrian Philipp - James Michael DuPont - - Tim Goudriaan - Kasperki - Tammy D - Daniel STANCU @@ -1875,6 +1907,7 @@ Symfony is the result of the work of many people who made the code better - phc - Дмитрий Пацура - ilyes kooli + - Marko Kaznovac - Matthias Althaus - Michaël VEROUX - Julia @@ -1937,7 +1970,6 @@ Symfony is the result of the work of many people who made the code better - samuel laulhau (lalop) - Laurent Bachelier (laurentb) - Luís Cobucci (lcobucci) - - Florent Viel (luxifer) - Matthieu Mota (matthieumota) - Matthieu Moquet (mattketmo) - Moritz Borgmann (mborgmann) @@ -1982,7 +2014,6 @@ Symfony is the result of the work of many people who made the code better - Moritz Kraft (userfriendly) - Víctor Mateo (victormateo) - Vincent (vincent1870) - - Vincent CHALAMON (vincentchalamon) - David Herrmann (vworldat) - Eugene Babushkin (warl) - Wouter Sioen (wouter_sioen) @@ -2025,13 +2056,11 @@ Symfony is the result of the work of many people who made the code better - Henne Van Och (hennevo) - Jeroen De Dauw (jeroendedauw) - Jonathan Scheiber (jmsche) - - Daniel Alejandro Castro Arellano (lexcast) - Maxime COLIN (maximecolin) - Muharrem Demirci (mdemirci) - Evgeny Z (meze) - Nicolas de Marqué (nicola) - Pierre Geyer (ptheg) - - Sam Fleming (sam_fleming) - Thomas BERTRAND (sevrahk) - Matej Žilák (teo_sk) - Vladislav Vlastovskiy (vlastv) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 9ec4987b3b73e..5d36e2675a525 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -681,7 +681,7 @@ UPGRADE FROM 2.x to 3.0 As a value for the option you must provide the fully-qualified class name (FQCN) now as well. - * The `FormIntegrationTestCase` and `FormPerformanceTestCase` classes were moved form the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace. + * The `FormIntegrationTestCase` and `FormPerformanceTestCase` classes were moved from the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace. * The constants `ROUND_HALFEVEN`, `ROUND_HALFUP` and `ROUND_HALFDOWN` in class `NumberToLocalizedStringTransformer` were renamed to `ROUND_HALF_EVEN`, diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index 736fa17bd142f..7a2a7adab0cf1 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -453,7 +453,7 @@ abstract protected function getMappingResourceExtension(); /** * Search for a manager that is declared as 'auto_mapping' = true. * - * @return null|string The name of the manager. If no one manager is found, returns null + * @return string|null The name of the manager. If no one manager is found, returns null * * @throws \LogicException */ diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php index 43120c6258577..ab92e61edd068 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php @@ -45,7 +45,7 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface * @param ObjectManager $manager The object manager * @param string $class The class name of the loaded objects * @param IdReader $idReader The reader for the object IDs - * @param null|EntityLoaderInterface $objectLoader The objects loader + * @param EntityLoaderInterface|null $objectLoader The objects loader */ public function __construct(ChoiceListFactoryInterface $factory, ObjectManager $manager, $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null) { diff --git a/src/Symfony/Bridge/PhpUnit/ClockMock.php b/src/Symfony/Bridge/PhpUnit/ClockMock.php index 5cd3531d6b67d..962649bcd6281 100644 --- a/src/Symfony/Bridge/PhpUnit/ClockMock.php +++ b/src/Symfony/Bridge/PhpUnit/ClockMock.php @@ -66,7 +66,7 @@ public static function microtime($asFloat = false) return self::$now; } - return sprintf('%0.6f %d', self::$now - (int) self::$now, (int) self::$now); + return sprintf('%0.6f00 %d', self::$now - (int) self::$now, (int) self::$now); } public static function register($class) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php b/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php new file mode 100644 index 0000000000000..82cfb6f566d9e --- /dev/null +++ b/src/Symfony/Bridge/PhpUnit/Tests/ClockMockTest.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\PhpUnit\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Bridge\PhpUnit\ClockMock; + +/** + * @author Dominic Tubach + * + * @covers \Symfony\Bridge\PhpUnit\ClockMock + */ +class ClockMockTest extends TestCase +{ + public static function setUpBeforeClass() + { + ClockMock::register(__CLASS__); + } + + protected function setUp() + { + ClockMock::withClockMock(1234567890.125); + } + + public function testTime() + { + $this->assertSame(1234567890, time()); + } + + public function testSleep() + { + sleep(2); + $this->assertSame(1234567892, time()); + } + + public function testMicrotime() + { + $this->assertSame('0.12500000 1234567890', microtime()); + } + + public function testMicrotimeAsFloat() + { + $this->assertSame(1234567890.125, microtime(true)); + } + + public function testUsleep() + { + usleep(2); + $this->assertSame(1234567890.125002, microtime(true)); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 909a4842a31e0..8c11c0cd214ed 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $address = $input->getArgument('address'); if (false === strpos($address, ':')) { - $address = $address.':'.$input->getOption('port'); + $address .= ':'.$input->getOption('port'); } if ($this->isOtherServerProcessRunning($address)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php index 5b80cce2533df..f4e902e9ca665 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStartCommand.php @@ -112,7 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $address = $input->getArgument('address'); if (false === strpos($address, ':')) { - $address = $address.':'.$input->getOption('port'); + $address .= ':'.$input->getOption('port'); } if (!$input->getOption('force') && $this->isOtherServerProcessRunning($address)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php index 31f7078b1da08..a07cf4ba903e1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStatusCommand.php @@ -49,7 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $address = $input->getArgument('address'); if (false === strpos($address, ':')) { - $address = $address.':'.$input->getOption('port'); + $address .= ':'.$input->getOption('port'); } // remove an orphaned lock file diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStopCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStopCommand.php index 81c65868a43d1..6d98da6d475a7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerStopCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerStopCommand.php @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $address = $input->getArgument('address'); if (false === strpos($address, ':')) { - $address = $address.':'.$input->getOption('port'); + $address .= ':'.$input->getOption('port'); } $lockFile = $this->getLockFile($address); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php index ad8646f9c4679..1a0e1ed8a6a1b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php @@ -263,7 +263,7 @@ private function extractMessages($locale, $transPaths) { $extractedCatalogue = new MessageCatalogue($locale); foreach ($transPaths as $path) { - $path = $path.'views'; + $path .= 'views'; if (is_dir($path)) { $this->getContainer()->get('translation.extractor')->extract($path, $extractedCatalogue); } @@ -283,7 +283,7 @@ private function loadCurrentMessages($locale, $transPaths, TranslationLoader $lo { $currentCatalogue = new MessageCatalogue($locale); foreach ($transPaths as $path) { - $path = $path.'translations'; + $path .= 'translations'; if (is_dir($path)) { $loader->loadMessages($path, $currentCatalogue); } @@ -311,7 +311,7 @@ private function loadFallbackCatalogues($locale, $transPaths, TranslationLoader $fallbackCatalogue = new MessageCatalogue($fallbackLocale); foreach ($transPaths as $path) { - $path = $path.'translations'; + $path .= 'translations'; if (is_dir($path)) { $loader->loadMessages($path, $fallbackCatalogue); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index fa6ef6d106e98..0115943685b25 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $currentName = $transPaths[0]; if (!is_dir($transPaths[0])) { - throw new \InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0])); + throw new \InvalidArgumentException(sprintf('"%s" is neither an enabled bundle nor a directory.', $transPaths[0])); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php index 1071e14b71178..c12f36c06131a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpStringTokenParser.php @@ -89,7 +89,7 @@ public static function parse($str) * Parses escape sequences in strings (all string types apart from single quoted). * * @param string $str String without quotes - * @param null|string $quote Quote type + * @param string|null $quote Quote type * * @return string String with escape sequences parsed */ diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php index df3642b553530..466af4b57fecc 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php @@ -112,6 +112,6 @@ private function determineEntryPoint($defaultEntryPointId, array $config) } // we have multiple entry points - we must ask them to configure one - throw new \LogicException(sprintf('Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)', implode(', ', $authenticatorIds))); + throw new \LogicException(sprintf('Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (%s)', implode(', ', $authenticatorIds))); } } diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 61cb8b3a6b286..7ef554e7cde5a 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -264,7 +264,7 @@ public function testUserCheckerConfigWithNoCheckers() protected function getContainer($file) { - $file = $file.'.'.$this->getFileExtension(); + $file .= '.'.$this->getFileExtension(); if (isset(self::$containerCache[$file])) { return self::$containerCache[$file]; diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 19073ba574831..b96a4af63943f 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -53,7 +53,7 @@ public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = $classes = array_diff($classes, $declared); // the cache is different depending on which classes are already declared - $name = $name.'-'.substr(hash('sha256', implode('|', $classes)), 0, 5); + $name .= '-'.substr(hash('sha256', implode('|', $classes)), 0, 5); } $classes = array_unique($classes); diff --git a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php index a0350b4f48e6e..0b83eee741392 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ApcClassLoaderTest.php @@ -19,7 +19,7 @@ class ApcClassLoaderTest extends TestCase { protected function setUp() { - if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) { + if (!(filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) { $this->markTestSkipped('The apc extension is not enabled.'); } else { apcu_clear_cache(); @@ -28,7 +28,7 @@ protected function setUp() protected function tearDown() { - if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) { + if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { apcu_clear_cache(); } } diff --git a/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php index 6e100cf609f62..471437e3b405e 100644 --- a/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php @@ -21,7 +21,7 @@ class LegacyApcUniversalClassLoaderTest extends TestCase { protected function setUp() { - if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) { + if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { apcu_clear_cache(); } else { $this->markTestSkipped('APC is not enabled.'); @@ -30,7 +30,7 @@ protected function setUp() protected function tearDown() { - if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) { + if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { apcu_clear_cache(); } } diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php index 52ae833d44182..81c1b972734c7 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php @@ -151,7 +151,7 @@ public function write($content, array $metadata = null) } } - if (\function_exists('opcache_invalidate') && ini_get('opcache.enable')) { + if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { @opcache_invalidate($this->file, true); } } diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 70b4546fde41c..00df2d445462b 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -140,7 +140,7 @@ protected function configure() * execute() method, you set the code to execute by passing * a Closure to the setCode() method. * - * @return null|int null or 0 if everything went fine, or an error code + * @return int|null null or 0 if everything went fine, or an error code * * @throws LogicException When this abstract method is not implemented * @@ -303,14 +303,13 @@ public function mergeApplicationDefinition($mergeArgs = true) $this->definition->addOptions($this->application->getDefinition()->getOptions()); + $this->applicationDefinitionMerged = true; + if ($mergeArgs) { $currentArguments = $this->definition->getArguments(); $this->definition->setArguments($this->application->getDefinition()->getArguments()); $this->definition->addArguments($currentArguments); - } - $this->applicationDefinitionMerged = true; - if ($mergeArgs) { $this->applicationDefinitionMergedWithArgs = true; } } @@ -363,10 +362,12 @@ public function getNativeDefinition() /** * Adds an argument. * - * @param string $name The argument name - * @param int $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL + * @param string $description A description text + * @param string|string[]|null $default The default value (for self::OPTIONAL mode only) + * + * @throws InvalidArgumentException When argument mode is not valid * * @return $this */ @@ -380,11 +381,13 @@ public function addArgument($name, $mode = null, $description = '', $default = n /** * Adds an option. * - * @param string $name The option name - * @param string $shortcut The shortcut (can be null) - * @param int $mode The option mode: One of the InputOption::VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) + * @param string $name The option name + * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE) + * + * @throws InvalidArgumentException If option mode is invalid or incompatible * * @return $this */ diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php index 61e3945c18cb7..8c219f1372da6 100644 --- a/src/Symfony/Component/Console/Helper/QuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php @@ -46,13 +46,23 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu } if (!$input->isInteractive()) { - if ($question instanceof ChoiceQuestion) { + $default = $question->getDefault(); + + if (null !== $default && $question instanceof ChoiceQuestion) { $choices = $question->getChoices(); - return $choices[$question->getDefault()]; + if (!$question->isMultiselect()) { + return isset($choices[$default]) ? $choices[$default] : $default; + } + + $default = explode(',', $default); + foreach ($default as $k => $v) { + $v = trim($v); + $default[$k] = isset($choices[$v]) ? $choices[$v] : $v; + } } - return $question->getDefault(); + return $default; } if (!$question->getValidator()) { @@ -109,7 +119,7 @@ public function getName() * * This method is public for PHP 5.3 compatibility, it should be private. * - * @return bool|mixed|null|string + * @return bool|mixed|string|null * * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden */ diff --git a/src/Symfony/Component/Console/Input/InputArgument.php b/src/Symfony/Component/Console/Input/InputArgument.php index 2330cdc2ea565..5b3b98ba707e0 100644 --- a/src/Symfony/Component/Console/Input/InputArgument.php +++ b/src/Symfony/Component/Console/Input/InputArgument.php @@ -31,10 +31,10 @@ class InputArgument private $description; /** - * @param string $name The argument name - * @param int $mode The argument mode: self::REQUIRED or self::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for self::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL + * @param string $description A description text + * @param string|string[]|null $default The default value (for self::OPTIONAL mode only) * * @throws InvalidArgumentException When argument mode is not valid */ @@ -86,7 +86,7 @@ public function isArray() /** * Sets the default value. * - * @param string|string[] $default The default value + * @param string|string[]|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -110,7 +110,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return string|string[] The default value + * @return string|string[]|null The default value */ public function getDefault() { diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index 72f784cebb8b8..7d40881b191ae 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -390,7 +390,7 @@ public function getSynopsis($short = false) if (!$argument->isRequired()) { $element = '['.$element.']'; } elseif ($argument->isArray()) { - $element = $element.' ('.$element.')'; + $element .= ' ('.$element.')'; } if ($argument->isArray()) { diff --git a/src/Symfony/Component/Console/Input/InputInterface.php b/src/Symfony/Component/Console/Input/InputInterface.php index 354d198e046cf..7a4efbe71c595 100644 --- a/src/Symfony/Component/Console/Input/InputInterface.php +++ b/src/Symfony/Component/Console/Input/InputInterface.php @@ -83,7 +83,7 @@ public function getArguments(); * * @param string $name The argument name * - * @return string|string[] The argument value + * @return string|string[]|null The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -92,8 +92,8 @@ public function getArgument($name); /** * Sets an argument value by name. * - * @param string $name The argument name - * @param string|string[] $value The argument value + * @param string $name The argument name + * @param string|string[]|null $value The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -120,7 +120,7 @@ public function getOptions(); * * @param string $name The option name * - * @return string|string[]|bool The option value + * @return string|string[]|bool|null The option value * * @throws InvalidArgumentException When option given doesn't exist */ @@ -129,8 +129,8 @@ public function getOption($name); /** * Sets an option value by name. * - * @param string $name The option name - * @param string|string[]|bool $value The option value + * @param string $name The option name + * @param string|string[]|bool|null $value The option value * * @throws InvalidArgumentException When option given doesn't exist */ diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index 429c9f037d981..20c9d2ea5929b 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -33,11 +33,11 @@ class InputOption private $description; /** - * @param string $name The option name - * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int $mode The option mode: One of the VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for self::VALUE_NONE) + * @param string $name The option name + * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ @@ -149,7 +149,7 @@ public function isArray() /** * Sets the default value. * - * @param string|string[]|bool $default The default value + * @param string|string[]|int|bool|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -173,7 +173,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return string|string[]|bool The default value + * @return string|string[]|int|bool|null The default value */ public function getDefault() { diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 47da3270f1a1b..7ff602763e9da 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -70,7 +70,11 @@ public function getStream() */ protected function doWrite($message, $newline) { - if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + if ($newline) { + $message .= PHP_EOL; + } + + if (false === @fwrite($this->stream, $message)) { // should never happen throw new RuntimeException('Unable to write output.'); } diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index b0f3a695ba735..61c769af0ab03 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -117,7 +117,7 @@ public function setHiddenFallback($fallback) /** * Gets values for the autocompleter. * - * @return null|iterable + * @return iterable|null */ public function getAutocompleterValues() { @@ -127,7 +127,7 @@ public function getAutocompleterValues() /** * Sets values for the autocompleter. * - * @param null|iterable $values + * @param iterable|null $values * * @return $this * @@ -156,7 +156,7 @@ public function setAutocompleterValues($values) /** * Sets a validator for the question. * - * @param null|callable $validator + * @param callable|null $validator * * @return $this */ @@ -170,7 +170,7 @@ public function setValidator($validator) /** * Gets the validator for the question. * - * @return null|callable + * @return callable|null */ public function getValidator() { @@ -182,7 +182,7 @@ public function getValidator() * * Null means an unlimited number of attempts. * - * @param null|int $attempts + * @param int|null $attempts * * @return $this * @@ -204,7 +204,7 @@ public function setMaxAttempts($attempts) * * Null means an unlimited number of attempts. * - * @return null|int + * @return int|null */ public function getMaxAttempts() { diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 8eb01d9f59f86..81391ea9b3b52 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -780,8 +780,7 @@ public function testRunDispatchesIntegerExitCode() // We can assume here that some other test asserts that the event is dispatched at all $dispatcher = new EventDispatcher(); - $self = $this; - $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($self, &$passedRightValue) { + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) { $passedRightValue = (4 === $event->getExitCode()); }); @@ -820,8 +819,7 @@ public function testRunDispatchesExitCodeOneForExceptionCodeZero() // We can assume here that some other test asserts that the event is dispatched at all $dispatcher = new EventDispatcher(); - $self = $this; - $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($self, &$passedRightValue) { + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) { $passedRightValue = (1 === $event->getExitCode()); }); diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php index 6ae987e484255..ef5bd7702631b 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php @@ -1,6 +1,5 @@ assertEquals('Superman', $questionHelper->ask($this->createInputInterfaceMock(true), $this->createOutputInterface(), $question)); } + public function testAskChoiceNonInteractive() + { + $questionHelper = new QuestionHelper(); + + $helperSet = new HelperSet(array(new FormatterHelper())); + $questionHelper->setHelperSet($helperSet); + $questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n")); + + $heroes = array('Superman', 'Batman', 'Spiderman'); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0'); + + $this->assertSame('Superman', $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 'Batman'); + $this->assertSame('Batman', $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $this->assertNull($questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0'); + $question->setValidator(null); + $this->assertSame('Superman', $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + try { + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question); + } catch (\InvalidArgumentException $e) { + $this->assertSame('Value "" is invalid', $e->getMessage()); + } + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1'); + $question->setMultiselect(true); + $this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1'); + $question->setMultiselect(true); + $question->setValidator(null); + $this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, Batman'); + $question->setMultiselect(true); + $this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, null); + $question->setMultiselect(true); + $this->assertNull($questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question)); + + try { + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, ''); + $question->setMultiselect(true); + $questionHelper->ask($this->createInputInterfaceMock(false), $this->createOutputInterface(), $question); + } catch (\InvalidArgumentException $e) { + $this->assertSame('Value "" is invalid', $e->getMessage()); + } + } + public function testAsk() { $dialog = new QuestionHelper(); diff --git a/src/Symfony/Component/CssSelector/Node/ElementNode.php b/src/Symfony/Component/CssSelector/Node/ElementNode.php index bcdce7a7a5207..54869af6cd30a 100644 --- a/src/Symfony/Component/CssSelector/Node/ElementNode.php +++ b/src/Symfony/Component/CssSelector/Node/ElementNode.php @@ -37,7 +37,7 @@ public function __construct($namespace = null, $element = null) } /** - * @return null|string + * @return string|null */ public function getNamespace() { @@ -45,7 +45,7 @@ public function getNamespace() } /** - * @return null|string + * @return string|null */ public function getElement() { diff --git a/src/Symfony/Component/CssSelector/Node/SelectorNode.php b/src/Symfony/Component/CssSelector/Node/SelectorNode.php index 5ef2be62a41b4..057107f6f5b57 100644 --- a/src/Symfony/Component/CssSelector/Node/SelectorNode.php +++ b/src/Symfony/Component/CssSelector/Node/SelectorNode.php @@ -28,7 +28,7 @@ class SelectorNode extends AbstractNode /** * @param NodeInterface $tree - * @param null|string $pseudoElement + * @param string|null $pseudoElement */ public function __construct(NodeInterface $tree, $pseudoElement = null) { @@ -45,7 +45,7 @@ public function getTree() } /** - * @return null|string + * @return string|null */ public function getPseudoElement() { diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index 24e8634ad6b86..d2aee541cd0c6 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -142,7 +142,7 @@ public function getNextIdentifier() /** * Returns nex identifier or star delimiter token. * - * @return null|string The identifier token value or null if star found + * @return string|null The identifier token value or null if star found * * @throws SyntaxErrorException If next token is not an identifier or a star delimiter */ diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php index dcf9071ed9586..f8585a057daba 100644 --- a/src/Symfony/Component/CssSelector/XPath/Translator.php +++ b/src/Symfony/Component/CssSelector/XPath/Translator.php @@ -89,7 +89,7 @@ public static function getXpathLiteral($element) } } - return sprintf('concat(%s)', implode($parts, ', ')); + return sprintf('concat(%s)', implode(', ', $parts)); } /** diff --git a/src/Symfony/Component/Debug/Debug.php b/src/Symfony/Component/Debug/Debug.php index 6377854e917e1..aafaf1d62080c 100644 --- a/src/Symfony/Component/Debug/Debug.php +++ b/src/Symfony/Component/Debug/Debug.php @@ -45,7 +45,7 @@ public static function enable($errorReportingLevel = null, $displayErrors = true if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { ini_set('display_errors', 0); ExceptionHandler::register(); - } elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) { + } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) { // CLI - display errors only if they're not already logged to STDERR ini_set('display_errors', 1); } diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 5606fd422e8ef..43d09ccd1c318 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -115,7 +115,7 @@ class ErrorHandler /** * Registers the error handler. * - * @param self|null|int $handler The handler to register, or @deprecated (since version 2.6, to be removed in 3.0) bit field of thrown levels + * @param self|int|null $handler The handler to register, or @deprecated (since version 2.6, to be removed in 3.0) bit field of thrown levels * @param bool $replace Whether to replace or not any existing handler * * @return self The registered error handler diff --git a/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt b/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt index 7211afbdf85ea..9cd44388c3166 100644 --- a/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt +++ b/src/Symfony/Component/Debug/Tests/phpt/decorate_exception_hander.phpt @@ -1,5 +1,7 @@ --TEST-- Test catching fatal errors when handlers are nested +--INI-- +display_errors=0 --FILE-- --EXPECTF-- -Fatal error: Class 'Symfony\Component\Debug\missing' not found in %s on line %d object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) { ["message":protected]=> string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug". diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 0880646b34abd..d9c37ea50420d 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -142,8 +142,8 @@ public function setFactoryMethod($factoryMethod) /** * Sets the service that this service is decorating. * - * @param null|string $id The decorated service id, use null to remove decoration - * @param null|string $renamedId The new decorated service id + * @param string|null $id The decorated service id, use null to remove decoration + * @param string|null $renamedId The new decorated service id * @param int $priority The priority of decoration * * @return $this @@ -168,7 +168,7 @@ public function setDecoratedService($id, $renamedId = null, $priority = 0) /** * Gets the service that this service is decorating. * - * @return null|array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated + * @return array|null An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated */ public function getDecoratedService() { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index fc8092f4a34ec..2e2de19aac568 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -233,7 +233,9 @@ private function addProxyClasses() $strip = '' === $this->docStar && method_exists('Symfony\Component\HttpKernel\Kernel', 'stripComments'); foreach ($definitions as $definition) { - $proxyCode = "\n".$this->getProxyDumper()->getProxyCode($definition); + if ("\n" === $proxyCode = "\n".$this->getProxyDumper()->getProxyCode($definition)) { + continue; + } if ($strip) { $proxyCode = "subject = new \stdClass(); $this->event = new GenericEvent($this->subject, array('name' => 'Event')); } @@ -44,8 +42,6 @@ protected function tearDown() { $this->subject = null; $this->event = null; - - parent::tearDown(); } public function testConstruct() diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 5df92e733d366..df316205619fc 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -578,7 +578,7 @@ public function tempnam($dir, $prefix) * * @param string $filename The file to be written to * @param string $content The data to write into the file - * @param null|int $mode The file mode (octal). If null, file permissions are not modified + * @param int|null $mode The file mode (octal). If null, file permissions are not modified * Deprecated since version 2.3.12, to be removed in 3.0. * * @throws IOException if the file cannot be written to diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php index d7832753131d9..b72e6ae9ee0c6 100644 --- a/src/Symfony/Component/Form/Button.php +++ b/src/Symfony/Component/Form/Button.php @@ -368,7 +368,7 @@ public function handleRequest($request = null) /** * Submits data to the button. * - * @param null|string $submittedData The data + * @param string|null $submittedData The data * @param bool $clearMissing Not used * * @return $this diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php index c66ce0f028d37..eae2abf411772 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php @@ -32,7 +32,7 @@ interface ChoiceListFactoryInterface * argument. * * @param iterable $choices The choices - * @param null|callable $value The callable generating the choice + * @param callable|null $value The callable generating the choice * values * * @return ChoiceListInterface The choice list @@ -51,7 +51,7 @@ public function createListFromChoices($choices, $value = null); * argument. * * @param array|\Traversable $choices The choices - * @param null|callable $value The callable generating the choice + * @param callable|null $value The callable generating the choice * values * * @return ChoiceListInterface The choice list @@ -69,7 +69,7 @@ public function createListFromFlippedChoices($choices, $value = null); * argument. * * @param ChoiceLoaderInterface $loader The choice loader - * @param null|callable $value The callable generating the choice + * @param callable|null $value The callable generating the choice * values * * @return ChoiceListInterface The choice list @@ -103,14 +103,14 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul * attributes that should be added to the respective choice. * * @param ChoiceListInterface $list The choice list - * @param null|array|callable $preferredChoices The preferred choices - * @param null|callable $label The callable generating the + * @param array|callable|null $preferredChoices The preferred choices + * @param callable|null $label The callable generating the * choice labels - * @param null|callable $index The callable generating the + * @param callable|null $index The callable generating the * view indices - * @param null|callable $groupBy The callable generating the + * @param callable|null $groupBy The callable generating the * group names - * @param null|array|callable $attr The callable generating the + * @param array|callable|null $attr The callable generating the * HTML attributes * * @return ChoiceListView The choice list view diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php index ee749ca029ae2..01e138411ced7 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php @@ -60,7 +60,7 @@ public function getDecoratedFactory() * {@inheritdoc} * * @param iterable $choices The choices - * @param null|callable|string|PropertyPath $value The callable or path for + * @param callable|string|PropertyPath|null $value The callable or path for * generating the choice values * * @return ChoiceListInterface The choice list @@ -91,7 +91,7 @@ public function createListFromChoices($choices, $value = null) * {@inheritdoc} * * @param array|\Traversable $choices The choices - * @param null|callable|string|PropertyPath $value The callable or path for + * @param callable|string|PropertyPath|null $value The callable or path for * generating the choice values * * @return ChoiceListInterface The choice list @@ -110,7 +110,7 @@ public function createListFromFlippedChoices($choices, $value = null, $triggerDe * {@inheritdoc} * * @param ChoiceLoaderInterface $loader The choice loader - * @param null|callable|string|PropertyPath $value The callable or path for + * @param callable|string|PropertyPath|null $value The callable or path for * generating the choice values * * @return ChoiceListInterface The choice list @@ -141,11 +141,11 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul * {@inheritdoc} * * @param ChoiceListInterface $list The choice list - * @param null|array|callable|string|PropertyPath $preferredChoices The preferred choices - * @param null|callable|string|PropertyPath $label The callable or path generating the choice labels - * @param null|callable|string|PropertyPath $index The callable or path generating the view indices - * @param null|callable|string|PropertyPath $groupBy The callable or path generating the group names - * @param null|array|callable|string|PropertyPath $attr The callable or path generating the HTML attributes + * @param array|callable|string|PropertyPath|null $preferredChoices The preferred choices + * @param callable|string|PropertyPath|null $label The callable or path generating the choice labels + * @param callable|string|PropertyPath|null $index The callable or path generating the view indices + * @param callable|string|PropertyPath|null $groupBy The callable or path generating the group names + * @param array|callable|string|PropertyPath|null $attr The callable or path generating the HTML attributes * * @return ChoiceListView The choice list view */ diff --git a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php index ee00284bc4cf8..406fdd53053ae 100644 --- a/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php +++ b/src/Symfony/Component/Form/ChoiceList/LazyChoiceList.php @@ -34,7 +34,7 @@ class LazyChoiceList implements ChoiceListInterface * * If null, choices are simply cast to strings. * - * @var null|callable + * @var callable|null */ private $value; @@ -51,7 +51,7 @@ class LazyChoiceList implements ChoiceListInterface * argument. * * @param ChoiceLoaderInterface $loader The choice loader - * @param null|callable $value The callable generating the choice values + * @param callable|null $value The callable generating the choice values */ public function __construct(ChoiceLoaderInterface $loader, $value = null) { diff --git a/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php b/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php index 573cc2d6e3c07..63e5f65210392 100644 --- a/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php +++ b/src/Symfony/Component/Form/ChoiceList/Loader/ChoiceLoaderInterface.php @@ -31,7 +31,7 @@ interface ChoiceLoaderInterface * The callable receives the choice as first and the array key as the second * argument. * - * @param null|callable $value The callable which generates the values + * @param callable|null $value The callable which generates the values * from choices * * @return ChoiceListInterface The loaded choice list @@ -50,7 +50,7 @@ public function loadChoiceList($value = null); * * @param string[] $values An array of choice values. Non-existing * values in this array are ignored - * @param null|callable $value The callable generating the choice values + * @param callable|null $value The callable generating the choice values * * @return array An array of choices */ @@ -68,7 +68,7 @@ public function loadChoicesForValues(array $values, $value = null); * * @param array $choices An array of choices. Non-existing choices in * this array are ignored - * @param null|callable $value The callable generating the choice values + * @param callable|null $value The callable generating the choice values * * @return string[] An array of choice values */ diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php index ed90331266443..280e4d4293df2 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php @@ -81,7 +81,9 @@ public function reverseTransform($dateTimeLocal) return; } - if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?$/', $dateTimeLocal, $matches)) { + // to maintain backwards compatibility we do not strictly validate the submitted date + // see https://github.com/symfony/symfony/issues/28699 + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?/', $dateTimeLocal, $matches)) { throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $dateTimeLocal)); } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php index 8d1a92af8b4bc..59e3a765d5ab6 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -69,7 +69,7 @@ public function reverseTransform($rfc3339) return; } - if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339)); } diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php index 99f8d824858c7..a577608fa719f 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php +++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php @@ -32,7 +32,7 @@ class CsrfExtension extends AbstractExtension /** * @param CsrfTokenManagerInterface $tokenManager The CSRF token manager * @param TranslatorInterface $translator The translator for translating error messages - * @param null|string $translationDomain The translation domain for translating + * @param string|null $translationDomain The translation domain for translating */ public function __construct($tokenManager, TranslatorInterface $translator = null, $translationDomain = null) { diff --git a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php index 6dc5599e84933..70c4595268815 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php +++ b/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php @@ -51,7 +51,7 @@ public static function getSubscribedEvents() * same session and with the same tokenId * @param string $errorMessage The message displayed in case of an error * @param TranslatorInterface $translator - * @param null|string $translationDomain + * @param string|null $translationDomain * @param ServerParams $serverParams */ public function __construct($fieldName, $tokenManager, $tokenId, $errorMessage, TranslatorInterface $translator = null, $translationDomain = null, ServerParams $serverParams = null) diff --git a/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php b/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php index 8ff1a061c9f68..d27160bb641d9 100644 --- a/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php +++ b/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php @@ -47,7 +47,7 @@ class FormTypeCsrfExtension extends AbstractTypeExtension * @param bool $defaultEnabled * @param string $defaultFieldName * @param TranslatorInterface $translator - * @param null|string $translationDomain + * @param string|null $translationDomain * @param ServerParams $serverParams */ public function __construct($defaultTokenManager, $defaultEnabled = true, $defaultFieldName = '_token', TranslatorInterface $translator = null, $translationDomain = null, ServerParams $serverParams = null) diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index fc6f2abe51679..ea56f0d47cc5c 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -162,13 +162,13 @@ public function validate($form, Constraint $constraint) if ($this->context instanceof ExecutionContextInterface) { $this->context->setConstraint($constraint); $this->context->buildViolation($config->getOption('extra_fields_message')) - ->setParameter('{{ extra_fields }}', implode('", "', array_keys($form->getExtraData()))) + ->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"') ->setInvalidValue($form->getExtraData()) ->setCode(Form::NO_SUCH_FIELD_ERROR) ->addViolation(); } else { $this->buildViolation($config->getOption('extra_fields_message')) - ->setParameter('{{ extra_fields }}', implode('", "', array_keys($form->getExtraData()))) + ->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"') ->setInvalidValue($form->getExtraData()) ->setCode(Form::NO_SUCH_FIELD_ERROR) ->addViolation(); diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php index 0147afcac232c..04e60f6cd3b09 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php +++ b/src/Symfony/Component/Form/Extension/Validator/Type/UploadValidatorExtension.php @@ -27,7 +27,7 @@ class UploadValidatorExtension extends AbstractTypeExtension /** * @param TranslatorInterface $translator The translator for translating error messages - * @param null|string $translationDomain The translation domain for translating + * @param string|null $translationDomain The translation domain for translating */ public function __construct(TranslatorInterface $translator, $translationDomain = null) { diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php index 98cb0de6a5594..590f7df2d8b58 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php @@ -51,7 +51,7 @@ public function getOrigin() * * @param string $propertyPath The property path to match against the rule * - * @return null|FormInterface The mapped form or null + * @return FormInterface|null The mapped form or null */ public function match($propertyPath) { diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php index b635646f6896b..9671082a651cc 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php @@ -144,7 +144,7 @@ public function mapViolation(ConstraintViolation $violation, FormInterface $form * @param FormInterface $form The form to search * @param PropertyPathIteratorInterface $it The iterator at its current position * - * @return null|FormInterface The found match or null + * @return FormInterface|null The found match or null */ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it) { diff --git a/src/Symfony/Component/Form/FormConfigBuilderInterface.php b/src/Symfony/Component/Form/FormConfigBuilderInterface.php index 31e5a82210998..f422840a82c45 100644 --- a/src/Symfony/Component/Form/FormConfigBuilderInterface.php +++ b/src/Symfony/Component/Form/FormConfigBuilderInterface.php @@ -146,7 +146,7 @@ public function setRequired($required); /** * Sets the property path that the form should be mapped to. * - * @param null|string|PropertyPathInterface $propertyPath The property path or null if the path should be set + * @param string|PropertyPathInterface|null $propertyPath The property path or null if the path should be set * automatically based on the form's name * * @return $this The configuration object diff --git a/src/Symfony/Component/Form/FormConfigInterface.php b/src/Symfony/Component/Form/FormConfigInterface.php index b7083544a436b..ce9171f3d496b 100644 --- a/src/Symfony/Component/Form/FormConfigInterface.php +++ b/src/Symfony/Component/Form/FormConfigInterface.php @@ -38,7 +38,7 @@ public function getName(); /** * Returns the property path that the form should be mapped to. * - * @return null|PropertyPathInterface The property path + * @return PropertyPathInterface|null The property path */ public function getPropertyPath(); @@ -167,7 +167,7 @@ public function getData(); /** * Returns the class of the form data or null if the data is scalar or an array. * - * @return null|string The data class or null + * @return string|null The data class or null */ public function getDataClass(); diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Component/Form/FormTypeInterface.php index 0ad9cae7b7e4a..3c095ab2bb01e 100644 --- a/src/Symfony/Component/Form/FormTypeInterface.php +++ b/src/Symfony/Component/Form/FormTypeInterface.php @@ -90,7 +90,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver); * Symfony 2.8 and will be unsupported as of Symfony 3.0. Return the * fully-qualified class name of the parent type instead. * - * @return string|null|FormTypeInterface The name of the parent type if any, null otherwise + * @return string|FormTypeInterface|null The name of the parent type if any, null otherwise */ public function getParent(); diff --git a/src/Symfony/Component/Form/SubmitButton.php b/src/Symfony/Component/Form/SubmitButton.php index 2422e11cd898a..a838542f975d8 100644 --- a/src/Symfony/Component/Form/SubmitButton.php +++ b/src/Symfony/Component/Form/SubmitButton.php @@ -34,7 +34,7 @@ public function isClicked() /** * Submits data to the button. * - * @param null|string $submittedData The data + * @param string|null $submittedData The data * @param bool $clearMissing Not used * * @return $this diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php index 5dac998ad16a5..6046022e45899 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php @@ -51,6 +51,10 @@ public function reverseTransformProvider() array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05'), array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05'), array('Europe/Amsterdam', 'Europe/Amsterdam', '2013-08-21 10:30:00 Europe/Amsterdam', '2013-08-21T10:30:00'), + array('UTC', 'UTC', '2018-09-15T10:00:00Z', '2018-09-15T10:00:00Z'), + array('Europe/Berlin', 'Europe/Berlin', '2018-09-15T10:00:00+02:00', '2018-09-15T10:00:00+02:00'), + array('Europe/Berlin', 'Europe/Berlin', '2018-09-15T10:00:00+0200', '2018-09-15T10:00:00+0200'), + array('UTC', 'UTC', '2018-10-03T10:00:00.000Z', '2018-10-03T10:00:00.000Z'), ); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php index 5f4043523e73f..dc1633b844965 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -67,6 +67,7 @@ public function reverseTransformProvider() array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'), array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'), array('Europe/Amsterdam', 'Europe/Amsterdam', '2013-08-21 10:30:00 Europe/Amsterdam', '2013-08-21T08:30:00Z'), + array('UTC', 'UTC', '2018-10-03T10:00:00.000Z', '2018-10-03T10:00:00.000Z'), )); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index e3885735e4558..a508a1687fafd 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -620,12 +620,33 @@ public function testViolationIfExtraData() $this->validator->validate($form, new Form()); $this->buildViolation('Extra!') - ->setParameter('{{ extra_fields }}', 'foo') + ->setParameter('{{ extra_fields }}', '"foo"') ->setInvalidValue(array('foo' => 'bar')) ->setCode(Form::NO_SUCH_FIELD_ERROR) ->assertRaised(); } + public function testViolationFormatIfMultipleExtraFields() + { + $form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!')) + ->setCompound(true) + ->setDataMapper($this->getDataMapper()) + ->add($this->getBuilder('child')) + ->getForm(); + + $form->submit(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz')); + + $this->expectNoValidate(); + + $this->validator->validate($form, new Form()); + + $this->buildViolation('Extra!') + ->setParameter('{{ extra_fields }}', '"foo", "baz", "quux"') + ->setInvalidValue(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz')) + ->setCode(Form::NO_SUCH_FIELD_ERROR) + ->assertRaised(); + } + public function testNoViolationIfAllowExtraData() { $context = $this->getMockExecutionContext(); diff --git a/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php b/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php index ea576af8f51a8..556166f5547ed 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php @@ -11,9 +11,7 @@ class AlternatingRowType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { - $formFactory = $builder->getFormFactory(); - - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory) { + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { $form = $event->getForm(); $type = 0 === $form->getName() % 2 ? 'Symfony\Component\Form\Extension\Core\Type\TextType' diff --git a/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php b/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php index 2103fa40e55d0..86c68ba3313d3 100644 --- a/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php +++ b/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php @@ -35,7 +35,7 @@ public function testTrimUtf8Separators($hex) // Convert UCS-2BE to UTF-8 $symbol = mb_convert_encoding($binary, 'UTF-8', 'UCS-2BE'); - $symbol = $symbol."ab\ncd".$symbol; + $symbol .= "ab\ncd".$symbol; $this->assertSame("ab\ncd", StringUtil::trim($symbol)); } diff --git a/src/Symfony/Component/Form/Util/ServerParams.php b/src/Symfony/Component/Form/Util/ServerParams.php index 3d5b76a7c27c8..57b54a9c6e06e 100644 --- a/src/Symfony/Component/Form/Util/ServerParams.php +++ b/src/Symfony/Component/Form/Util/ServerParams.php @@ -41,7 +41,7 @@ public function hasPostMaxSizeBeenExceeded() /** * Returns maximum post size in bytes. * - * @return null|int The maximum post size in bytes + * @return int|null The maximum post size in bytes */ public function getPostMaxSize() { diff --git a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php index fe7b08bcad996..c9506574de869 100644 --- a/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php +++ b/src/Symfony/Component/HttpFoundation/AcceptHeaderItem.php @@ -65,7 +65,7 @@ public static function fromString($itemValue) } /** - * Returns header value's string representation. + * Returns header value's string representation. * * @return string */ diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index c0fd95ea6b661..f11515969a4b5 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -40,7 +40,7 @@ class BinaryFileResponse extends Response * @param int $status The response status code * @param array $headers An array of response headers * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set */ @@ -60,7 +60,7 @@ public function __construct($file, $status = 200, $headers = array(), $public = * @param int $status The response status code * @param array $headers An array of response headers * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set * diff --git a/src/Symfony/Component/HttpFoundation/HeaderBag.php b/src/Symfony/Component/HttpFoundation/HeaderBag.php index 06c9e9a0c7c54..0ef7428254f97 100644 --- a/src/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/HeaderBag.php @@ -197,7 +197,7 @@ public function remove($key) * @param string $key The parameter key * @param \DateTime $default The default value * - * @return null|\DateTime The parsed DateTime or the default value if the header does not exist + * @return \DateTime|null The parsed DateTime or the default value if the header does not exist * * @throws \RuntimeException When the HTTP header is not parseable */ diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index 85b5a53f4fb10..49121d465148d 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -351,7 +351,7 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo if (isset($components['port'])) { $server['SERVER_PORT'] = $components['port']; - $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; + $server['HTTP_HOST'] .= ':'.$components['port']; } if (isset($components['user'])) { @@ -1120,7 +1120,7 @@ public function getRelativeUriForPath($path) } $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path); + $targetDirs = explode('/', substr($path, 1)); array_pop($sourceDirs); $targetFile = array_pop($targetDirs); diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 1756ae564808a..aed690377d829 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -71,7 +71,7 @@ class PdoSessionHandler implements \SessionHandlerInterface private $pdo; /** - * @var string|null|false DSN string or null for session.save_path or false when lazy connection disabled + * @var string|false|null DSN string or null for session.save_path or false when lazy connection disabled */ private $dsn = false; diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index ed1c5ff3ece19..44f654aef665e 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -17,7 +17,7 @@ * A StreamedResponse uses a callback for its content. * * The callback should use the standard PHP functions like echo - * to stream the response back to the client. The flush() method + * to stream the response back to the client. The flush() function * can also be used if needed. * * @see flush() diff --git a/src/Symfony/Component/HttpKernel/Config/FileLocator.php b/src/Symfony/Component/HttpKernel/Config/FileLocator.php index fb1f913bdff5d..c047ba3dac389 100644 --- a/src/Symfony/Component/HttpKernel/Config/FileLocator.php +++ b/src/Symfony/Component/HttpKernel/Config/FileLocator.php @@ -26,7 +26,7 @@ class FileLocator extends BaseFileLocator /** * @param KernelInterface $kernel A KernelInterface instance - * @param null|string $path The path the global resource directory + * @param string|null $path The path the global resource directory * @param array $paths An array of paths where to look for resources */ public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 8d8ea1a3e33f6..851875c155b30 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -63,10 +63,10 @@ public function collect(Request $request, Response $response, \Exception $except 'php_version' => PHP_VERSION, 'xdebug_enabled' => \extension_loaded('xdebug'), 'eaccel_enabled' => \extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), - 'apc_enabled' => \extension_loaded('apc') && ini_get('apc.enabled'), - 'xcache_enabled' => \extension_loaded('xcache') && ini_get('xcache.cacher'), - 'wincache_enabled' => \extension_loaded('wincache') && ini_get('wincache.ocenabled'), - 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && ini_get('opcache.enable'), + 'apc_enabled' => \extension_loaded('apc') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), + 'xcache_enabled' => \extension_loaded('xcache') && filter_var(ini_get('xcache.cacher'), FILTER_VALIDATE_BOOLEAN), + 'wincache_enabled' => \extension_loaded('wincache') && filter_var(ini_get('wincache.ocenabled'), FILTER_VALIDATE_BOOLEAN), + 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), 'bundles' => array(), 'sapi_name' => \PHP_SAPI, ); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index b6db6ee97cd89..e8c3182b4a9d2 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,11 +59,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.46'; - const VERSION_ID = 20846; + const VERSION = '2.8.47'; + const VERSION_ID = 20847; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 46; + const RELEASE_VERSION = 47; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; diff --git a/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php b/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php index 22b309cd6f3d7..19970f9b72236 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php +++ b/src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php @@ -235,7 +235,7 @@ private function getProfile(array $data) /** * @param string $dsn * - * @return null|array Array($server, $database, $collection) + * @return array|null Array($server, $database, $collection) */ private function parseDsn($dsn) { diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profile.php b/src/Symfony/Component/HttpKernel/Profiler/Profile.php index 5ebaae4f8d4ff..1f2796d537d34 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profile.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profile.php @@ -92,7 +92,7 @@ public function getParent() /** * Returns the parent token. * - * @return null|string The parent token + * @return string|null The parent token */ public function getParentToken() { diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 0ac4d3cfbc7e8..6f30cc93fe12b 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -45,13 +45,13 @@ public function testCollect() // if else clause because we don't know it if (((\extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) || - (\extension_loaded('apc') && ini_get('apc.enabled')) + (\extension_loaded('apc') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN)) || - (\extension_loaded('Zend OPcache') && ini_get('opcache.enable')) + (\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) || - (\extension_loaded('xcache') && ini_get('xcache.cacher')) + (\extension_loaded('xcache') && filter_var(ini_get('xcache.cacher'), FILTER_VALIDATE_BOOLEAN)) || - (\extension_loaded('wincache') && ini_get('wincache.ocenabled')))) { + (\extension_loaded('wincache') && filter_var(ini_get('wincache.ocenabled'), FILTER_VALIDATE_BOOLEAN)))) { $this->assertTrue($c->hasAccelerator()); } else { $this->assertFalse($c->hasAccelerator()); diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 102d7644ed3e0..ccbe412e81819 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -964,8 +964,7 @@ public function testUsesCacheToRespondToHeadRequestsWhenFresh() public function testSendsNoContentWhenFresh() { $time = \DateTime::createFromFormat('U', time()); - $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); diff --git a/src/Symfony/Component/Intl/Intl.php b/src/Symfony/Component/Intl/Intl.php index 7777b0bb57153..b4af8fb359fe2 100644 --- a/src/Symfony/Component/Intl/Intl.php +++ b/src/Symfony/Component/Intl/Intl.php @@ -187,7 +187,7 @@ public static function getRegionBundle() /** * Returns the version of the installed ICU library. * - * @return null|string The ICU version or NULL if it could not be determined + * @return string|null The ICU version or NULL if it could not be determined */ public static function getIcuVersion() { diff --git a/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php b/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php index 642d1d5e22fac..fe97b0fbef8e2 100644 --- a/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php +++ b/src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php @@ -32,9 +32,7 @@ protected function setUp() public function testSetLazyOption() { - $test = $this; - - $this->options->set('foo', function (Options $options) use ($test) { + $this->options->set('foo', function (Options $options) { return 'dynamic'; }); @@ -89,7 +87,7 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument() }); // defined by subclass, no $previousValue argument defined! - $this->options->overload('foo', function (Options $options) use ($test) { + $this->options->overload('foo', function (Options $options) { return 'dynamic'; }); diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index f81f65facae16..0b2a76387fdf9 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -28,6 +28,7 @@ class WindowsPipes extends AbstractPipes { private $files = array(); private $fileHandles = array(); + private $lockHandles = array(); private $readBytes = array( Process::STDOUT => 0, Process::STDERR => 0, @@ -47,31 +48,33 @@ public function __construct($disableOutput, $input) Process::STDOUT => Process::OUT, Process::STDERR => Process::ERR, ); - $tmpCheck = false; $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); for ($i = 0;; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); - if (file_exists($file) && !unlink($file)) { - continue 2; - } - $h = fopen($file, 'xb'); - if (!$h) { - $error = $lastError; - if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) { - continue; - } + + if (!$h = fopen($file.'.lock', 'w')) { restore_error_handler(); - throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error)); + throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError)); } - if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) { + if (!flock($h, LOCK_EX | LOCK_NB)) { continue 2; } - if (isset($this->files[$pipe])) { - unlink($this->files[$pipe]); + if (isset($this->lockHandles[$pipe])) { + flock($this->lockHandles[$pipe], LOCK_UN); + fclose($this->lockHandles[$pipe]); } + $this->lockHandles[$pipe] = $h; + + if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) { + flock($this->lockHandles[$pipe], LOCK_UN); + fclose($this->lockHandles[$pipe]); + unset($this->lockHandles[$pipe]); + continue 2; + } + $this->fileHandles[$pipe] = $h; $this->files[$pipe] = $file; } break; @@ -85,7 +88,6 @@ public function __construct($disableOutput, $input) public function __destruct() { $this->close(); - $this->removeFiles(); } /** @@ -145,8 +147,11 @@ public function readAndWrite($blocking, $close = false) $read[$type] = $data; } if ($close) { + ftruncate($fileHandle, 0); fclose($fileHandle); - unset($this->fileHandles[$type]); + flock($this->lockHandles[$type], LOCK_UN); + fclose($this->lockHandles[$type]); + unset($this->fileHandles[$type], $this->lockHandles[$type]); } } @@ -167,10 +172,13 @@ public function areOpen() public function close() { parent::close(); - foreach ($this->fileHandles as $handle) { + foreach ($this->fileHandles as $type => $handle) { + ftruncate($handle, 0); fclose($handle); + flock($this->lockHandles[$type], LOCK_UN); + fclose($this->lockHandles[$type]); } - $this->fileHandles = array(); + $this->fileHandles = $this->lockHandles = array(); } /** @@ -185,17 +193,4 @@ public static function create(Process $process, $input) { return new static($process->isOutputDisabled(), $input); } - - /** - * Removes temporary files. - */ - private function removeFiles() - { - foreach ($this->files as $filename) { - if (file_exists($filename)) { - @unlink($filename); - } - } - $this->files = array(); - } } diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index b0a5916adfcaa..a261ea5340b1f 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -567,7 +567,7 @@ public function clearErrorOutput() /** * Returns the exit code returned by the process. * - * @return null|int The exit status code, null if the Process is not terminated + * @return int|null The exit status code, null if the Process is not terminated * * @throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled */ @@ -588,7 +588,7 @@ public function getExitCode() * This method relies on the Unix exit code status standardization * and might not be relevant for other operating systems. * - * @return null|string A string representation for the exit status code, null if the Process is not terminated + * @return string|null A string representation for the exit status code, null if the Process is not terminated * * @see http://tldp.org/LDP/abs/html/exitcodes.html * @see http://en.wikipedia.org/wiki/Unix_signal @@ -1044,7 +1044,7 @@ public function getStdin() /** * Gets the Process input. * - * @return null|string The Process input + * @return string|null The Process input */ public function getInput() { diff --git a/src/Symfony/Component/Process/ProcessBuilder.php b/src/Symfony/Component/Process/ProcessBuilder.php index f246c871b87b7..1bac780d6329b 100644 --- a/src/Symfony/Component/Process/ProcessBuilder.php +++ b/src/Symfony/Component/Process/ProcessBuilder.php @@ -99,7 +99,7 @@ public function setArguments(array $arguments) /** * Sets the working directory. * - * @param null|string $cwd The working directory + * @param string|null $cwd The working directory * * @return $this */ @@ -131,7 +131,7 @@ public function inheritEnvironmentVariables($inheritEnv = true) * defined environment variable. * * @param string $name The variable name - * @param null|string $value The variable value + * @param string|null $value The variable value * * @return $this */ diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php index 8afff96727fbd..485d88c8c5333 100644 --- a/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -1224,9 +1224,9 @@ public function provideVariousIncrementals() /** * @param string $commandline - * @param null|string $cwd - * @param null|array $env - * @param null|string $input + * @param string|null $cwd + * @param array|null $env + * @param string|null $input * @param int $timeout * @param array $options * diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index c14afc2dd9449..0c05fa88c272c 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -170,7 +170,6 @@ public function setValue(&$objectOrArray, $propertyPath, $value) // '[a][b][c]' => 'old-value' // If you want to change its value to 'new-value', // you only need set value for '[a][b][c]' and it's safe to ignore '[a][b]' and '[a]' - // if ($overwrite) { $property = $propertyPath->getElement($i); diff --git a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php index 12e6f5e5247a4..e17c53c0d2129 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPathBuilder.php @@ -24,7 +24,7 @@ class PropertyPathBuilder /** * Creates a new property path builder. * - * @param null|PropertyPathInterface|string $path The path to initially store + * @param PropertyPathInterface|string|null $path The path to initially store * in the builder. Optional. */ public function __construct($path = null) diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index 721cdf6e7c5e4..50400f87332c6 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -29,7 +29,7 @@ class Route implements \Serializable private $condition = ''; /** - * @var null|CompiledRoute + * @var CompiledRoute|null */ private $compiled; diff --git a/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php b/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php index 861f228e155c8..450387a057899 100644 --- a/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php +++ b/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php @@ -31,7 +31,7 @@ class CsrfTokenManager implements CsrfTokenManagerInterface private $namespace; /** - * @param null|string|RequestStack|callable $namespace + * @param string|RequestStack|callable|null $namespace * * null: generates a namespace using $_SERVER['HTTPS'] * * string: uses the given string * * RequestStack: generates a namespace using the current master request diff --git a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php index 26f06ab5bedce..3d830f55084e5 100644 --- a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php +++ b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php @@ -91,7 +91,7 @@ private function executeGuardAuthenticator($uniqueGuardKey, GuardAuthenticatorIn $request = $event->getRequest(); try { if (null !== $this->logger) { - $this->logger->debug('Calling getCredentials() on guard configurator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator))); + $this->logger->debug('Calling getCredentials() on guard authenticator.', array('firewall_key' => $this->providerKey, 'authenticator' => \get_class($guardAuthenticator))); } // allow the authenticator to fetch authentication info from the request diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 194e2e1908666..f2c7f7c212740 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -73,7 +73,7 @@ public function authenticateWithToken(TokenInterface $token, Request $request/*, * @param GuardAuthenticatorInterface $guardAuthenticator * @param string $providerKey The provider (i.e. firewall) key * - * @return null|Response + * @return Response|null */ public function handleAuthenticationSuccess(TokenInterface $token, Request $request, GuardAuthenticatorInterface $guardAuthenticator, $providerKey) { @@ -118,7 +118,7 @@ public function authenticateUserAndHandleSuccess(UserInterface $user, Request $r * @param GuardAuthenticatorInterface $guardAuthenticator * @param string $providerKey The key of the firewall * - * @return null|Response + * @return Response|null */ public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, GuardAuthenticatorInterface $guardAuthenticator, $providerKey) { diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php index b6187f2e37dd3..58f5a5e88fa05 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php @@ -134,12 +134,6 @@ protected function setUp() ->setDefaultSuccessRedirectUrl(self::DEFAULT_SUCCESS_URL) ; } - - protected function tearDown() - { - $this->request = null; - $this->requestWithSession = null; - } } class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index c7a3d8cd95641..6c1a170db7f15 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; @@ -171,7 +172,7 @@ private function handleLogoutException(LogoutException $exception) private function startAuthentication(Request $request, AuthenticationException $authException) { if (null === $this->authenticationEntryPoint) { - throw $authException; + throw new HttpException(Response::HTTP_UNAUTHORIZED, $authException->getMessage(), $authException, array(), $authException->getCode()); } if (null !== $this->logger) { diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php index 271988c13ace7..4b0f358cdafec 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Security\Core\Authentication\AuthenticationTrustResolverInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; @@ -30,7 +31,7 @@ class ExceptionListenerTest extends TestCase /** * @dataProvider getAuthenticationExceptionProvider */ - public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException = null) + public function testAuthenticationExceptionWithoutEntryPoint(\Exception $exception, \Exception $eventException) { $event = $this->createEvent($exception); @@ -38,7 +39,7 @@ public function testAuthenticationExceptionWithoutEntryPoint(\Exception $excepti $listener->onKernelException($event); $this->assertNull($event->getResponse()); - $this->assertSame(null === $eventException ? $exception : $eventException, $event->getException()); + $this->assertEquals($eventException, $event->getException()); } /** @@ -58,11 +59,11 @@ public function testAuthenticationExceptionWithEntryPoint(\Exception $exception, public function getAuthenticationExceptionProvider() { return array( - array(new AuthenticationException()), - array(new \LogicException('random', 0, $e = new AuthenticationException()), $e), - array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), $e), - array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), $e), - array(new AuthenticationException('random', 0, new \LogicException())), + array($e = new AuthenticationException(), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)), + array(new \LogicException('random', 0, $e = new AuthenticationException()), new HttpException(Response::HTTP_UNAUTHORIZED, '', $e, array(), 0)), + array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AuthenticationException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)), + array(new \LogicException('random', 0, $e = new AuthenticationException('embed', 0, new AccessDeniedException())), new HttpException(Response::HTTP_UNAUTHORIZED, 'embed', $e, array(), 0)), + array($e = new AuthenticationException('random', 0, new \LogicException()), new HttpException(Response::HTTP_UNAUTHORIZED, 'random', $e, array(), 0)), ); } diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index 3e3468feb8597..0a862add4966d 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -55,7 +55,10 @@ "autoload": { "psr-4": { "Symfony\\Component\\Security\\": "" }, "exclude-from-classmap": [ - "/Tests/" + "/Core/Tests/", + "/Csrf/Tests/", + "/Guard/Tests/", + "/Http/Tests/" ] }, "minimum-stability": "dev", diff --git a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php index 9241d40357268..dbbb2410a6259 100644 --- a/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php +++ b/src/Symfony/Component/Serializer/NameConverter/CamelCaseToSnakeCaseNameConverter.php @@ -22,7 +22,7 @@ class CamelCaseToSnakeCaseNameConverter implements NameConverterInterface private $lowerCamelCase; /** - * @param null|array $attributes The list of attributes to rename or null for all attributes + * @param array|null $attributes The list of attributes to rename or null for all attributes * @param bool $lowerCamelCase Use lowerCamelCase style */ public function __construct(array $attributes = null, $lowerCamelCase = true) diff --git a/src/Symfony/Component/Stopwatch/Section.php b/src/Symfony/Component/Stopwatch/Section.php index fe658a57e6645..2cddddb94dd4f 100644 --- a/src/Symfony/Component/Stopwatch/Section.php +++ b/src/Symfony/Component/Stopwatch/Section.php @@ -24,7 +24,7 @@ class Section private $events = array(); /** - * @var null|float + * @var float|null */ private $origin; diff --git a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php index 0a94476ab7b31..1acb7f76af813 100644 --- a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php +++ b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php @@ -29,7 +29,7 @@ abstract class AbstractOperation implements OperationInterface protected $result; /** - * @var null|array The domains affected by this operation + * @var array|null The domains affected by this operation */ private $domains; diff --git a/src/Symfony/Component/Translation/Dumper/MoFileDumper.php b/src/Symfony/Component/Translation/Dumper/MoFileDumper.php index 39dc2bade4b77..0ba69e841fb90 100644 --- a/src/Symfony/Component/Translation/Dumper/MoFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/MoFileDumper.php @@ -67,7 +67,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } - $output = implode(array_map(array($this, 'writeLong'), $header)) + $output = implode('', array_map(array($this, 'writeLong'), $header)) .$sourceOffsets .$targetOffsets .$sources diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php index d38d33747a752..548a4db1c15b0 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php @@ -88,7 +88,7 @@ public function buildViolation($message, array $parameters = array()); * { * $validator = $this->context->getValidator(); * - * $violations = $validator->validateValue($value, new Length(array('min' => 3))); + * $violations = $validator->validate($value, new Length(array('min' => 3))); * * if (count($violations) > 0) { * // ... diff --git a/src/Symfony/Component/Validator/ExecutionContext.php b/src/Symfony/Component/Validator/ExecutionContext.php index 1eb322d997a97..8d93e69eec0d9 100644 --- a/src/Symfony/Component/Validator/ExecutionContext.php +++ b/src/Symfony/Component/Validator/ExecutionContext.php @@ -41,7 +41,7 @@ class ExecutionContext implements ExecutionContextInterface * * @param GlobalExecutionContextInterface $globalContext The global context storing node-independent state * @param TranslatorInterface $translator The translator for translating violation messages - * @param null|string $translationDomain The domain of the validation messages + * @param string|null $translationDomain The domain of the validation messages * @param MetadataInterface $metadata The metadata of the validated node * @param mixed $value The value of the validated node * @param string $group The current validation group @@ -255,7 +255,7 @@ private function executeConstraintValidators($value, array $constraints) /** * Returns an array of group names. * - * @param null|string|string[] $groups The groups to resolve. If a single string is + * @param string|string[]|null $groups The groups to resolve. If a single string is * passed, it is converted to an array. If null * is passed, an array containing the current * group of the context is returned. diff --git a/src/Symfony/Component/Validator/ExecutionContextInterface.php b/src/Symfony/Component/Validator/ExecutionContextInterface.php index 08979cb964f6c..4d5d2f6f65f9b 100644 --- a/src/Symfony/Component/Validator/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/ExecutionContextInterface.php @@ -134,7 +134,7 @@ public function addViolationAt($subPath, $message, array $parameters = array(), * * @param mixed $value The value to validate * @param string $subPath The path to append to the context's property path - * @param null|string|string[] $groups The groups to validate in. If you don't pass any + * @param string|string[]|null $groups The groups to validate in. If you don't pass any * groups here, the current group of the context * will be used. * @param bool $traverse Whether to traverse the value if it is an array @@ -166,7 +166,7 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals * @param mixed $value The value to validate * @param Constraint|Constraint[] $constraints The constraint(s) to validate against * @param string $subPath The path to append to the context's property path - * @param null|string|string[] $groups The groups to validate in. If you don't pass any + * @param string|string[]|null $groups The groups to validate in. If you don't pass any * groups here, the current group of the context * will be used. * diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index 3d173846a54f1..4bb2760b418e3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -322,6 +322,10 @@ This is not a valid UUID. This is not a valid UUID. + + This value should be a multiple of {{ compared_value }}. + This value should be a multiple of {{ compared_value }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf index 4a06dbd45b7b5..bdbc9da09c88c 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.lb.xlf @@ -318,6 +318,10 @@ Error Feeler + + This is not a valid UUID. + Dëst ass keng gëlteg UUID. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index f33274e6e6ce9..e7ad1eca8de23 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -318,6 +318,14 @@ Error Błąd + + This is not a valid UUID. + To nie jest poprawne UUID. + + + This value should be a multiple of {{ compared_value }}. + Ta wartość powinna być wielokrotnością {{ compared_value }}. + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf index fa043ea23a309..40dd63e293ca3 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.sv.xlf @@ -52,7 +52,7 @@ This value is not a valid email address. - Värdet är inte en giltig epost-adress. + Värdet är inte en giltig e-postadress. The file could not be found. diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php index 8e6e1bf7b448e..7102474e8444f 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php @@ -22,7 +22,7 @@ class LegacyApcCacheTest extends TestCase { protected function setUp() { - if (!ini_get('apc.enabled') || !ini_get('apc.enable_cli')) { + if (!filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('APC is not enabled.'); } } diff --git a/src/Symfony/Component/Validator/Validator.php b/src/Symfony/Component/Validator/Validator.php index c151d92e3a4a4..1aa5fd18d6f5e 100644 --- a/src/Symfony/Component/Validator/Validator.php +++ b/src/Symfony/Component/Validator/Validator.php @@ -197,7 +197,7 @@ private function createVisitor($root) } /** - * @param null|string|string[] $groups + * @param string|string[]|null $groups * * @return string[] */ diff --git a/src/Symfony/Component/Validator/ValidatorBuilder.php b/src/Symfony/Component/Validator/ValidatorBuilder.php index 98ecddc7aee96..c99de8cc790f0 100644 --- a/src/Symfony/Component/Validator/ValidatorBuilder.php +++ b/src/Symfony/Component/Validator/ValidatorBuilder.php @@ -70,7 +70,7 @@ class ValidatorBuilder implements ValidatorBuilderInterface private $translator; /** - * @var null|string + * @var string|null */ private $translationDomain; diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 4288837bdb08a..639ff4a79ac14 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -234,7 +234,7 @@ public static function parseScalar($scalar, $delimiters = null, $stringDelimiter if (null !== $delimiters) { $tmp = ltrim(substr($scalar, $i), ' '); if ('' === $tmp) { - throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode($delimiters))); + throw new ParseException(sprintf('Unexpected end of line, expected one of "%s".', implode('', $delimiters))); } if (!\in_array($tmp[0], $delimiters)) { throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i)));