Merge branch '3.1' into 3.2

* 3.1: (31 commits)
  fixed CS
  fixed CS
  fixed CS fixer config
  fixed typo
  Revert "fixed typo"
  fixed typo
  fixed CS
  Avoid setting request attributes from signature arguments in AnnotationClassLoader
  [DependencyInjection] Add some missing typehints in YamlFileLoader
  [DependencyInjection] minor: Fix a DocBlock
  [HttpKernel] Give higher priority to adding request formats
  [PropertyInfo] Don't try to access a property thru a static method
  [PropertyInfo] Exclude static methods form properties guessing
  [FrameworkBundle] Fix third level headers for MarkdownDescriptor
  [Ldap] Using Ldap stored username instead of form submitted one
  [Ldap] load users with the good username case
  [DoctrineBridge] Fixed invalid unique value as composite key
  [Doctrine Bridge] fix UniqueEntityValidator for composite object primary keys
  [TwigBundle] do not lose already set method calls
  #20411 fix Yaml parsing for very long quoted strings
  ...
This commit is contained in:
Fabien Potencier 2017-01-21 09:06:35 -08:00
commit ebdbd96449
51 changed files with 439 additions and 157 deletions

View File

@ -8,33 +8,34 @@ return PhpCsFixer\Config::create()
'no_unreachable_default_argument_value' => false, 'no_unreachable_default_argument_value' => false,
'braces' => array('allow_single_line_closure' => true), 'braces' => array('allow_single_line_closure' => true),
'heredoc_to_nowdoc' => false, 'heredoc_to_nowdoc' => false,
'phpdoc_annotation_without_dot' => false,
)) ))
->setRiskyAllowed(true) ->setRiskyAllowed(true)
->setFinder( ->setFinder(
PhpCsFixer\Finder::create() PhpCsFixer\Finder::create()
->in(__DIR__) ->in(__DIR__.'/src')
->exclude(array( ->exclude(array(
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
'src/Symfony/Component/DependencyInjection/Tests/Fixtures', 'Symfony/Component/DependencyInjection/Tests/Fixtures',
'src/Symfony/Component/Routing/Tests/Fixtures/dumper', 'Symfony/Component/Routing/Tests/Fixtures/dumper',
// fixture templates // fixture templates
'src/Symfony/Component/Templating/Tests/Fixtures/templates', 'Symfony/Component/Templating/Tests/Fixtures/templates',
'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', 'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
// generated fixtures // generated fixtures
'src/Symfony/Component/VarDumper/Tests/Fixtures', 'Symfony/Component/VarDumper/Tests/Fixtures',
// resource templates // resource templates
'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form', 'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
)) ))
// file content autogenerated by `var_export` // file content autogenerated by `var_export`
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php') ->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php')
// autogenerated xmls // autogenerated xmls
->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_1.xml') ->notPath('Symfony/Component/Console/Tests/Fixtures/application_1.xml')
->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_2.xml') ->notPath('Symfony/Component/Console/Tests/Fixtures/application_2.xml')
// yml // yml
->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') ->notPath('Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
// test template // test template
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php')
// explicit heredoc test // explicit heredoc test
->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php')
) )
; ;

View File

@ -27,18 +27,18 @@ Symfony is the result of the work of many people who made the code better
- Karma Dordrak (drak) - Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith) - Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason) - Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
- Grégoire Pineau (lyrixx) - Grégoire Pineau (lyrixx)
- Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon) - Jean-François Simon (jfsimon)
- Benjamin Eberlei (beberlei) - Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw) - Igor Wiedler (igorw)
- Eriksen Costa (eriksencosta) - Eriksen Costa (eriksencosta)
- Jules Pietri (heah)
- Maxime Steinhausser (ogizanagi) - Maxime Steinhausser (ogizanagi)
- Jules Pietri (heah)
- Robin Chalas (chalas_r)
- Sarah Khalil (saro0h) - Sarah Khalil (saro0h)
- Jonathan Wage (jwage) - Jonathan Wage (jwage)
- Diego Saint Esteben (dosten) - Diego Saint Esteben (dosten)
- Robin Chalas (chalas_r)
- Alexandre Salomé (alexandresalome) - Alexandre Salomé (alexandresalome)
- William Durand (couac) - William Durand (couac)
- ornicar - ornicar
@ -49,11 +49,12 @@ Symfony is the result of the work of many people who made the code better
- Saša Stamenković (umpirsky) - Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn) - Henrik Bjørnskov (henrikbjorn)
- Miha Vrhovnik - Miha Vrhovnik
- Diego Saint Esteben (dii3g0)
- Ener-Getick (energetick) - Ener-Getick (energetick)
- Diego Saint Esteben (dii3g0)
- Konstantin Kudryashov (everzet) - Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
- Iltar van der Berg (kjarli) - Iltar van der Berg (kjarli)
- Roland Franssen (ro0)
- Bilal Amarni (bamarni)
- Florin Patan (florinpatan) - Florin Patan (florinpatan)
- Peter Rehm (rpet) - Peter Rehm (rpet)
- Kevin Bond (kbond) - Kevin Bond (kbond)
@ -69,19 +70,18 @@ Symfony is the result of the work of many people who made the code better
- Henrik Westphal (snc) - Henrik Westphal (snc)
- Dariusz Górecki (canni) - Dariusz Górecki (canni)
- Douglas Greenshields (shieldo) - Douglas Greenshields (shieldo)
- Titouan Galopin (tgalopin)
- Konstantin Myakshin (koc) - Konstantin Myakshin (koc)
- Lee McDermott - Lee McDermott
- Brandon Turner - Brandon Turner
- Luis Cordova (cordoval) - Luis Cordova (cordoval)
- Graham Campbell (graham) - Graham Campbell (graham)
- Titouan Galopin (tgalopin)
- Daniel Holmes (dholmes) - Daniel Holmes (dholmes)
- Pierre du Plessis (pierredup) - Pierre du Plessis (pierredup)
- Toni Uebernickel (havvg) - Toni Uebernickel (havvg)
- Bart van den Burg (burgov) - Bart van den Burg (burgov)
- Jordan Alliot (jalliot) - Jordan Alliot (jalliot)
- John Wards (johnwards) - John Wards (johnwards)
- Roland Franssen (ro0)
- Fran Moreno (franmomu) - Fran Moreno (franmomu)
- Jáchym Toušek (enumag) - Jáchym Toušek (enumag)
- Antoine Hérault (herzult) - Antoine Hérault (herzult)
@ -98,6 +98,7 @@ Symfony is the result of the work of many people who made the code better
- lenar - lenar
- Włodzimierz Gajda (gajdaw) - Włodzimierz Gajda (gajdaw)
- Baptiste Clavié (talus) - Baptiste Clavié (talus)
- Maxime STEINHAUSSER
- Alexander Schwenn (xelaris) - Alexander Schwenn (xelaris)
- Florian Voutzinos (florianv) - Florian Voutzinos (florianv)
- Colin Frei - Colin Frei
@ -114,13 +115,13 @@ Symfony is the result of the work of many people who made the code better
- Eric GELOEN (gelo) - Eric GELOEN (gelo)
- David Buchmann (dbu) - David Buchmann (dbu)
- Tugdual Saunier (tucksaun) - Tugdual Saunier (tucksaun)
- Maxime STEINHAUSSER
- Théo FIDRY (theofidry) - Théo FIDRY (theofidry)
- Robert Schönthal (digitalkaoz) - Robert Schönthal (digitalkaoz)
- Florian Lonqueu-Brochard (florianlb) - Florian Lonqueu-Brochard (florianlb)
- Stefano Sala (stefano.sala) - Stefano Sala (stefano.sala)
- Evgeniy (ewgraf) - Evgeniy (ewgraf)
- Juti Noppornpitak (shiroyuki) - Juti Noppornpitak (shiroyuki)
- Tobias Nyholm (tobias)
- Tigran Azatyan (tigranazatyan) - Tigran Azatyan (tigranazatyan)
- Sebastian Hörl (blogsh) - Sebastian Hörl (blogsh)
- Daniel Gomes (danielcsgomes) - Daniel Gomes (danielcsgomes)
@ -130,12 +131,11 @@ Symfony is the result of the work of many people who made the code better
- Pablo Godel (pgodel) - Pablo Godel (pgodel)
- Jérémie Augustin (jaugustin) - Jérémie Augustin (jaugustin)
- Andréia Bohner (andreia) - Andréia Bohner (andreia)
- Yonel Ceruto González (yonelceruto)
- Rafael Dohms (rdohms) - Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom) - Arnaud Kleinpeter (nanocom)
- jwdeitch - jwdeitch
- Tobias Nyholm (tobias)
- Joel Wurtz (brouznouf) - Joel Wurtz (brouznouf)
- Yonel Ceruto González (yonelceruto)
- Philipp Wahala (hifi) - Philipp Wahala (hifi)
- Vyacheslav Pavlov - Vyacheslav Pavlov
- Javier Spagnoletti (phansys) - Javier Spagnoletti (phansys)
@ -179,6 +179,7 @@ Symfony is the result of the work of many people who made the code better
- fivestar - fivestar
- Dominique Bongiraud - Dominique Bongiraud
- Jeremy Livingston (jeremylivingston) - Jeremy Livingston (jeremylivingston)
- Michael Lee (zerustech)
- Matthieu Auger (matthieuauger) - Matthieu Auger (matthieuauger)
- Leszek Prabucki (l3l0) - Leszek Prabucki (l3l0)
- François Zaninotto (fzaninotto) - François Zaninotto (fzaninotto)
@ -187,6 +188,7 @@ Symfony is the result of the work of many people who made the code better
- John Kary (johnkary) - John Kary (johnkary)
- Justin Hileman (bobthecow) - Justin Hileman (bobthecow)
- Blanchon Vincent (blanchonvincent) - Blanchon Vincent (blanchonvincent)
- Chris Wilkinson (thewilkybarkid)
- Michele Orselli (orso) - Michele Orselli (orso)
- Tom Van Looy (tvlooy) - Tom Van Looy (tvlooy)
- Sven Paulus (subsven) - Sven Paulus (subsven)
@ -195,6 +197,7 @@ Symfony is the result of the work of many people who made the code better
- Dawid Nowak - Dawid Nowak
- Eugene Wissner - Eugene Wissner
- Julien Brochet (mewt) - Julien Brochet (mewt)
- Tristan Darricau (nicofuma)
- Sergey Linnik (linniksa) - Sergey Linnik (linniksa)
- Michaël Perrin (michael.perrin) - Michaël Perrin (michael.perrin)
- Marcel Beerta (mazen) - Marcel Beerta (mazen)
@ -202,7 +205,6 @@ Symfony is the result of the work of many people who made the code better
- Jannik Zschiesche (apfelbox) - Jannik Zschiesche (apfelbox)
- Marco Pivetta (ocramius) - Marco Pivetta (ocramius)
- julien pauli (jpauli) - julien pauli (jpauli)
- Michael Lee (zerustech)
- Lorenz Schori - Lorenz Schori
- Sébastien Lavoie (lavoiesl) - Sébastien Lavoie (lavoiesl)
- Francois Zaninotto - Francois Zaninotto
@ -216,20 +218,20 @@ Symfony is the result of the work of many people who made the code better
- Roman Marintšenko (inori) - Roman Marintšenko (inori)
- Christian Schmidt - Christian Schmidt
- Xavier Montaña Carreras (xmontana) - Xavier Montaña Carreras (xmontana)
- Chris Wilkinson (thewilkybarkid)
- Mickaël Andrieu (mickaelandrieu) - Mickaël Andrieu (mickaelandrieu)
- Xavier Perez - Xavier Perez
- Arjen Brouwer (arjenjb) - Arjen Brouwer (arjenjb)
- Katsuhiro OGAWA - Katsuhiro OGAWA
- Patrick McDougle (patrick-mcdougle)
- James Halsall (jaitsu) - James Halsall (jaitsu)
- Alif Rachmawadi - Alif Rachmawadi
- Kristen Gilden (kgilden) - Kristen Gilden (kgilden)
- SpacePossum
- Pierre-Yves LEBECQ (pylebecq) - Pierre-Yves LEBECQ (pylebecq)
- Alex Pott - Alex Pott
- Jakub Kucharovic (jkucharovic) - Jakub Kucharovic (jkucharovic)
- Eugene Leonovich (rybakit) - Eugene Leonovich (rybakit)
- Filippo Tessarotto - Filippo Tessarotto
- Tristan Darricau (nicofuma)
- Joseph Rouff (rouffj) - Joseph Rouff (rouffj)
- Félix Labrecque (woodspire) - Félix Labrecque (woodspire)
- GordonsLondon - GordonsLondon
@ -259,7 +261,6 @@ Symfony is the result of the work of many people who made the code better
- Peter Kruithof (pkruithof) - Peter Kruithof (pkruithof)
- Michael Holm (hollo) - Michael Holm (hollo)
- Marc Weistroff (futurecat) - Marc Weistroff (futurecat)
- SpacePossum
- Hidde Wieringa (hiddewie) - Hidde Wieringa (hiddewie)
- Chris Smith (cs278) - Chris Smith (cs278)
- Florian Klein (docteurklein) - Florian Klein (docteurklein)
@ -278,12 +279,14 @@ Symfony is the result of the work of many people who made the code better
- Ismael Ambrosi (iambrosi) - Ismael Ambrosi (iambrosi)
- Uwe Jäger (uwej711) - Uwe Jäger (uwej711)
- Aurelijus Valeiša (aurelijus) - Aurelijus Valeiša (aurelijus)
- Victor Bocharsky (bocharsky_bw)
- Jan Decavele (jandc) - Jan Decavele (jandc)
- Gustavo Piltcher - Gustavo Piltcher
- Stepan Tanasiychuk (stfalcon) - Stepan Tanasiychuk (stfalcon)
- Tiago Ribeiro (fixe) - Tiago Ribeiro (fixe)
- Hidde Boomsma (hboomsma) - Hidde Boomsma (hboomsma)
- John Bafford (jbafford) - John Bafford (jbafford)
- Pavel Batanov (scaytrase)
- Bob den Otter (bopp) - Bob den Otter (bopp)
- Adrian Rudnik (kreischweide) - Adrian Rudnik (kreischweide)
- Francesc Rosàs (frosas) - Francesc Rosàs (frosas)
@ -304,6 +307,7 @@ Symfony is the result of the work of many people who made the code better
- Matthew Lewinski (lewinski) - Matthew Lewinski (lewinski)
- Magnus Nordlander (magnusnordlander) - Magnus Nordlander (magnusnordlander)
- alquerci - alquerci
- Adam Prager (padam87)
- Francesco Levorato - Francesco Levorato
- Vitaliy Zakharov (zakharovvi) - Vitaliy Zakharov (zakharovvi)
- Tobias Sjösten (tobiassjosten) - Tobias Sjösten (tobiassjosten)
@ -324,6 +328,7 @@ Symfony is the result of the work of many people who made the code better
- Clément Gautier (clementgautier) - Clément Gautier (clementgautier)
- Eduardo Gulias (egulias) - Eduardo Gulias (egulias)
- giulio de donato (liuggio) - giulio de donato (liuggio)
- ShinDarth
- Stéphane PY (steph_py) - Stéphane PY (steph_py)
- Philipp Kräutli (pkraeutli) - Philipp Kräutli (pkraeutli)
- Kirill chEbba Chebunin (chebba) - Kirill chEbba Chebunin (chebba)
@ -336,9 +341,9 @@ Symfony is the result of the work of many people who made the code better
- Hassan Amouhzi - Hassan Amouhzi
- Tamas Szijarto - Tamas Szijarto
- Pavel Volokitin (pvolok) - Pavel Volokitin (pvolok)
- François Pluchino (francoispluchino)
- Nicolas Dewez (nicolas_dewez) - Nicolas Dewez (nicolas_dewez)
- Endre Fejes - Endre Fejes
- Victor Bocharsky (bocharsky_bw)
- Tobias Naumann (tna) - Tobias Naumann (tna)
- Daniel Beyer - Daniel Beyer
- Shein Alexey - Shein Alexey
@ -355,7 +360,6 @@ Symfony is the result of the work of many people who made the code better
- Xavier HAUSHERR - Xavier HAUSHERR
- Albert Jessurum (ajessu) - Albert Jessurum (ajessu)
- Laszlo Korte - Laszlo Korte
- Pavel Batanov (scaytrase)
- Miha Vrhovnik - Miha Vrhovnik
- Alessandro Desantis - Alessandro Desantis
- hubert lecorche (hlecorche) - hubert lecorche (hlecorche)
@ -412,6 +416,7 @@ Symfony is the result of the work of many people who made the code better
- boombatower - boombatower
- Fabrice Bernhard (fabriceb) - Fabrice Bernhard (fabriceb)
- Jérôme Macias (jeromemacias) - Jérôme Macias (jeromemacias)
- Andrey Astakhov (aast)
- Fabian Lange (codingfabian) - Fabian Lange (codingfabian)
- Frank Neff (fneff) - Frank Neff (fneff)
- Roman Lapin (memphys) - Roman Lapin (memphys)
@ -422,6 +427,7 @@ Symfony is the result of the work of many people who made the code better
- Pablo Díez (pablodip) - Pablo Díez (pablodip)
- Kevin McBride - Kevin McBride
- Sergio Santoro - Sergio Santoro
- Robin van der Vleuten (robinvdvleuten)
- Philipp Rieber (bicpi) - Philipp Rieber (bicpi)
- Manuel de Ruiter (manuel) - Manuel de Ruiter (manuel)
- Eduardo Oliveira (entering) - Eduardo Oliveira (entering)
@ -478,7 +484,6 @@ Symfony is the result of the work of many people who made the code better
- Alexander Deruwe (aderuwe) - Alexander Deruwe (aderuwe)
- Alain Hippolyte (aloneh) - Alain Hippolyte (aloneh)
- Dave Hulbert (dave1010) - Dave Hulbert (dave1010)
- François Pluchino (francoispluchino)
- Ivan Rey (ivanrey) - Ivan Rey (ivanrey)
- Marcin Chyłek (songoq) - Marcin Chyłek (songoq)
- Ned Schwartz - Ned Schwartz
@ -512,6 +517,7 @@ Symfony is the result of the work of many people who made the code better
- Konstantin S. M. Möllers (ksmmoellers) - Konstantin S. M. Möllers (ksmmoellers)
- Sinan Eldem - Sinan Eldem
- Alexandre Dupuy (satchette) - Alexandre Dupuy (satchette)
- Rob Frawley 2nd
- Nahuel Cuesta (ncuesta) - Nahuel Cuesta (ncuesta)
- Chris Boden (cboden) - Chris Boden (cboden)
- Asmir Mustafic (goetas) - Asmir Mustafic (goetas)
@ -522,6 +528,7 @@ Symfony is the result of the work of many people who made the code better
- Åsmund Garfors - Åsmund Garfors
- Maxime Douailin - Maxime Douailin
- Jean Pasdeloup (pasdeloup) - Jean Pasdeloup (pasdeloup)
- Benjamin Cremer (bcremer)
- Javier López (loalf) - Javier López (loalf)
- Andreas Braun - Andreas Braun
- Reinier Kip - Reinier Kip
@ -551,7 +558,6 @@ Symfony is the result of the work of many people who made the code better
- umpirski - umpirski
- Chris Heng (gigablah) - Chris Heng (gigablah)
- Ulumuddin Yunus (joenoez) - Ulumuddin Yunus (joenoez)
- Adam Prager (padam87)
- Luc Vieillescazes (iamluc) - Luc Vieillescazes (iamluc)
- Johann Saunier (prophet777) - Johann Saunier (prophet777)
- Samuel ROZE (sroze) - Samuel ROZE (sroze)
@ -586,6 +592,7 @@ Symfony is the result of the work of many people who made the code better
- develop - develop
- ReenExe - ReenExe
- Mark Sonnabaum - Mark Sonnabaum
- Thomas Royer (cydonia7)
- Richard Quadling - Richard Quadling
- jochenvdv - jochenvdv
- Arturas Smorgun (asarturas) - Arturas Smorgun (asarturas)
@ -593,6 +600,7 @@ Symfony is the result of the work of many people who made the code better
- Michael Piecko - Michael Piecko
- yclian - yclian
- twifty - twifty
- Indra Gunawan (guind)
- Peter Ward - Peter Ward
- Julien DIDIER (juliendidier) - Julien DIDIER (juliendidier)
- Dominik Ritter (dritter) - Dominik Ritter (dritter)
@ -600,10 +608,10 @@ Symfony is the result of the work of many people who made the code better
- Martin Hujer (martinhujer) - Martin Hujer (martinhujer)
- Pascal Helfenstein - Pascal Helfenstein
- Baldur Rensch (brensch) - Baldur Rensch (brensch)
- Thomas Calvet
- Vladyslav Petrovych - Vladyslav Petrovych
- Alex Xandra Albert Sim - Alex Xandra Albert Sim
- Carson Full - Carson Full
- Andrey Astakhov (aast)
- Trent Steel (trsteel88) - Trent Steel (trsteel88)
- Yuen-Chi Lian - Yuen-Chi Lian
- Besnik Br - Besnik Br
@ -630,11 +638,13 @@ Symfony is the result of the work of many people who made the code better
- Christian Soronellas (theunic) - Christian Soronellas (theunic)
- Romain Gautier (mykiwi) - Romain Gautier (mykiwi)
- Yosmany Garcia (yosmanyga) - Yosmany Garcia (yosmanyga)
- Wouter J
- Wouter de Wild - Wouter de Wild
- Miroslav Sustek - Miroslav Sustek
- Degory Valentine - Degory Valentine
- Benoit Lévêque (benoit_leveque) - Benoit Lévêque (benoit_leveque)
- Jeroen Fiege (fieg) - Jeroen Fiege (fieg)
- Arthur de Moulins (4rthem)
- Krzysiek Łabuś - Krzysiek Łabuś
- Xavier Lacot (xavier) - Xavier Lacot (xavier)
- possum - possum
@ -642,6 +652,7 @@ Symfony is the result of the work of many people who made the code better
- Olivier Maisonneuve (olineuve) - Olivier Maisonneuve (olineuve)
- Masterklavi - Masterklavi
- Francis Turmel (fturmel) - Francis Turmel (fturmel)
- Nikita Nefedov (nikita2206)
- cgonzalez - cgonzalez
- Ben - Ben
- Jayson Xu (superjavason) - Jayson Xu (superjavason)
@ -683,8 +694,10 @@ Symfony is the result of the work of many people who made the code better
- Ivan Menshykov - Ivan Menshykov
- David Romaní - David Romaní
- Patrick Allaert - Patrick Allaert
- Fabien Bourigault (fbourigault)
- Gustavo Falco (gfalco) - Gustavo Falco (gfalco)
- Matt Robinson (inanimatt) - Matt Robinson (inanimatt)
- Ruud Kamphuis (ruudk)
- Aleksey Podskrebyshev - Aleksey Podskrebyshev
- Calin Mihai Pristavu - Calin Mihai Pristavu
- David Marín Carreño (davefx) - David Marín Carreño (davefx)
@ -734,7 +747,6 @@ Symfony is the result of the work of many people who made the code better
- Mikhail Yurasov (mym) - Mikhail Yurasov (mym)
- LOUARDI Abdeltif (ouardisoft) - LOUARDI Abdeltif (ouardisoft)
- Robert Gruendler (pulse00) - Robert Gruendler (pulse00)
- Robin van der Vleuten (robinvdvleuten)
- Simon Terrien (sterrien) - Simon Terrien (sterrien)
- Benoît Merlet (trompette) - Benoît Merlet (trompette)
- Koen Kuipers - Koen Kuipers
@ -763,6 +775,7 @@ Symfony is the result of the work of many people who made the code better
- Colin O'Dell (colinodell) - Colin O'Dell (colinodell)
- xaav - xaav
- Mahmoud Mostafa (mahmoud) - Mahmoud Mostafa (mahmoud)
- Alessandro Lai
- Pieter - Pieter
- Michael Tibben - Michael Tibben
- Sander Marechal - Sander Marechal
@ -811,8 +824,10 @@ Symfony is the result of the work of many people who made the code better
- Nicolas Macherey - Nicolas Macherey
- Lin Clark - Lin Clark
- Jeremy David (jeremy.david) - Jeremy David (jeremy.david)
- Denis Brumann (dbrumann)
- Troy McCabe - Troy McCabe
- Ville Mattila - Ville Mattila
- ilyes kooli
- Boris Vujicic (boris.vujicic) - Boris Vujicic (boris.vujicic)
- Max Beutel - Max Beutel
- Antanas Arvasevicius - Antanas Arvasevicius
@ -832,6 +847,7 @@ Symfony is the result of the work of many people who made the code better
- Christian - Christian
- Sergii Smertin (nfx) - Sergii Smertin (nfx)
- hugofonseca (fonsecas72) - hugofonseca (fonsecas72)
- Martynas Narbutas
- Bailey Parker - Bailey Parker
- Eddie Jaoude - Eddie Jaoude
- Haritz Iturbe (hizai) - Haritz Iturbe (hizai)
@ -846,7 +862,6 @@ Symfony is the result of the work of many people who made the code better
- Alex Demchenko (pilot) - Alex Demchenko (pilot)
- Tadas Gliaubicas (tadcka) - Tadas Gliaubicas (tadcka)
- Benoit Garret - Benoit Garret
- Thomas Royer (cydonia7)
- DerManoMann - DerManoMann
- Olaf Klischat - Olaf Klischat
- orlovv - orlovv
@ -867,7 +882,6 @@ Symfony is the result of the work of many people who made the code better
- rpg600 - rpg600
- Péter Buri (burci) - Péter Buri (burci)
- Davide Borsatto (davide.borsatto) - Davide Borsatto (davide.borsatto)
- Indra Gunawan (guind)
- kaiwa - kaiwa
- Charles Sanquer (csanquer) - Charles Sanquer (csanquer)
- Albert Ganiev (helios-ag) - Albert Ganiev (helios-ag)
@ -909,6 +923,7 @@ Symfony is the result of the work of many people who made the code better
- Krzysztof Przybyszewski - Krzysztof Przybyszewski
- Paul Matthews - Paul Matthews
- Juan Traverso - Juan Traverso
- Tarjei Huse (tarjei)
- Philipp Strube - Philipp Strube
- Christian Sciberras - Christian Sciberras
- Clement Herreman (clemherreman) - Clement Herreman (clemherreman)
@ -919,7 +934,6 @@ Symfony is the result of the work of many people who made the code better
- Alberto Aldegheri - Alberto Aldegheri
- heccjj - heccjj
- Alexandre Melard - Alexandre Melard
- Thomas Calvet
- Sergey Yuferev - Sergey Yuferev
- Tobias Stöckler - Tobias Stöckler
- Mario Young - Mario Young
@ -973,6 +987,7 @@ Symfony is the result of the work of many people who made the code better
- Samuel Vogel (samuelvogel) - Samuel Vogel (samuelvogel)
- Berat Doğan - Berat Doğan
- Juanmi Rodriguez Cerón - Juanmi Rodriguez Cerón
- Andy Raines
- Anthony Ferrara - Anthony Ferrara
- Klaas Cuvelier (kcuvelier) - Klaas Cuvelier (kcuvelier)
- Steve Frécinaux - Steve Frécinaux
@ -998,6 +1013,7 @@ Symfony is the result of the work of many people who made the code better
- Alberto Pirovano (geezmo) - Alberto Pirovano (geezmo)
- Pete Mitchell (peterjmit) - Pete Mitchell (peterjmit)
- Tom Corrigan (tomcorrigan) - Tom Corrigan (tomcorrigan)
- Luis Galeas
- Martin Pärtel - Martin Pärtel
- Noah Heck (myesain) - Noah Heck (myesain)
- Patrick Daley (padrig) - Patrick Daley (padrig)
@ -1014,7 +1030,6 @@ Symfony is the result of the work of many people who made the code better
- Romain Geissler - Romain Geissler
- Adrien Moiruad - Adrien Moiruad
- Tomaz Ahlin - Tomaz Ahlin
- Benjamin Cremer (bcremer)
- Marcus Stöhr (dafish) - Marcus Stöhr (dafish)
- Emmanuel Vella (emmanuel.vella) - Emmanuel Vella (emmanuel.vella)
- Carsten Nielsen (phreaknerd) - Carsten Nielsen (phreaknerd)
@ -1036,6 +1051,7 @@ Symfony is the result of the work of many people who made the code better
- Damien Tournoud - Damien Tournoud
- Jon Gotlin (jongotlin) - Jon Gotlin (jongotlin)
- Michael Dowling (mtdowling) - Michael Dowling (mtdowling)
- Karlos Presumido (oneko)
- BilgeXA - BilgeXA
- r1pp3rj4ck - r1pp3rj4ck
- Robert Queck - Robert Queck
@ -1073,7 +1089,6 @@ Symfony is the result of the work of many people who made the code better
- kor3k kor3k (kor3k) - kor3k kor3k (kor3k)
- Stelian Mocanita (stelian) - Stelian Mocanita (stelian)
- Flavian (2much) - Flavian (2much)
- Arthur de Moulins (4rthem)
- mike - mike
- Keith Maika - Keith Maika
- Mephistofeles - Mephistofeles
@ -1164,6 +1179,7 @@ Symfony is the result of the work of many people who made the code better
- Julius Beckmann - Julius Beckmann
- Romain Dorgueil - Romain Dorgueil
- Grayson Koonce (breerly) - Grayson Koonce (breerly)
- Fabien LUCAS (flucas2)
- Karim Cassam Chenaï (ka) - Karim Cassam Chenaï (ka)
- Nicolas Bastien (nicolas_bastien) - Nicolas Bastien (nicolas_bastien)
- Denis (yethee) - Denis (yethee)
@ -1212,7 +1228,6 @@ Symfony is the result of the work of many people who made the code better
- Bram Van der Sype (brammm) - Bram Van der Sype (brammm)
- Guile (guile) - Guile (guile)
- Julien Moulin (lizjulien) - Julien Moulin (lizjulien)
- Nikita Nefedov (nikita2206)
- Mauro Foti (skler) - Mauro Foti (skler)
- Yannick Warnier (ywarnier) - Yannick Warnier (ywarnier)
- Kevin Decherf - Kevin Decherf
@ -1235,7 +1250,9 @@ Symfony is the result of the work of many people who made the code better
- Tischoi - Tischoi
- J Bruni - J Bruni
- Alexey Prilipko - Alexey Prilipko
- vlakoff
- bertillon - bertillon
- Bertalan Attila
- Yannick Bensacq (cibou) - Yannick Bensacq (cibou)
- Luca Genuzio (genuzio) - Luca Genuzio (genuzio)
- Hans Nilsson (hansnilsson) - Hans Nilsson (hansnilsson)
@ -1254,7 +1271,6 @@ Symfony is the result of the work of many people who made the code better
- Joel Marcey - Joel Marcey
- David Christmann - David Christmann
- root - root
- Wouter J
- James Hudson - James Hudson
- Tom Maguire - Tom Maguire
- David Zuelke - David Zuelke
@ -1309,9 +1325,9 @@ Symfony is the result of the work of many people who made the code better
- ddebree - ddebree
- Tomas Liubinas - Tomas Liubinas
- Alex - Alex
- Patrick Dawkins
- Klaas Naaijkens - Klaas Naaijkens
- Daniel González Cerviño - Daniel González Cerviño
- ShinDarth
- Rafał - Rafał
- Adria Lopez (adlpz) - Adria Lopez (adlpz)
- Rosio (ben-rosio) - Rosio (ben-rosio)
@ -1338,9 +1354,9 @@ Symfony is the result of the work of many people who made the code better
- Michael Pohlers (mick_the_big) - Michael Pohlers (mick_the_big)
- Cayetano Soriano Gallego (neoshadybeat) - Cayetano Soriano Gallego (neoshadybeat)
- Ondrej Machulda (ondram) - Ondrej Machulda (ondram)
- Patrick McDougle (patrick-mcdougle)
- Pablo Monterde Perez (plebs) - Pablo Monterde Perez (plebs)
- Jimmy Leger (redpanda) - Jimmy Leger (redpanda)
- Marcin Szepczynski (szepczynski)
- Cyrille Jouineau (tuxosaurus) - Cyrille Jouineau (tuxosaurus)
- Yorkie Chadwick (yorkie76) - Yorkie Chadwick (yorkie76)
- Yanick Witschi - Yanick Witschi
@ -1363,6 +1379,7 @@ Symfony is the result of the work of many people who made the code better
- Arnaud Buathier (arnapou) - Arnaud Buathier (arnapou)
- chesteroni (chesteroni) - chesteroni (chesteroni)
- Mauricio Lopez (diaspar) - Mauricio Lopez (diaspar)
- HADJEDJ Vincent (hadjedjvincent)
- Daniele Cesarini (ijanki) - Daniele Cesarini (ijanki)
- Ismail Asci (ismailasci) - Ismail Asci (ismailasci)
- Simon CONSTANS (kosssi) - Simon CONSTANS (kosssi)
@ -1505,7 +1522,6 @@ Symfony is the result of the work of many people who made the code better
- Damián Nohales (eagleoneraptor) - Damián Nohales (eagleoneraptor)
- Elliot Anderson (elliot) - Elliot Anderson (elliot)
- Fabien D. (fabd) - Fabien D. (fabd)
- Fabien Bourigault (fbourigault)
- Carsten Eilers (fnc) - Carsten Eilers (fnc)
- Sorin Gitlan (forapathy) - Sorin Gitlan (forapathy)
- Yohan Giarelli (frequence-web) - Yohan Giarelli (frequence-web)
@ -1549,7 +1565,6 @@ Symfony is the result of the work of many people who made the code better
- Daniel Perez Pinazo (pitiflautico) - Daniel Perez Pinazo (pitiflautico)
- Brayden Williams (redstar504) - Brayden Williams (redstar504)
- Rich Sage (richsage) - Rich Sage (richsage)
- Ruud Kamphuis (ruudk)
- Bart Ruysseveldt (ruyss) - Bart Ruysseveldt (ruyss)
- Sascha Dens (saschadens) - Sascha Dens (saschadens)
- scourgen hung (scourgen) - scourgen hung (scourgen)

View File

@ -0,0 +1,53 @@
<?php
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
use Doctrine\ORM\Mapping as ORM;
/**
* an entity that has two objects (class without toString methods) as primary key.
*
* @ORM\Entity
*/
class CompositeObjectNoToStringIdEntity
{
/**
* @var SingleIntIdNoToStringEntity
*
* @ORM\Id
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"persist"})
* @ORM\JoinColumn(name="object_one_id")
*/
protected $objectOne;
/**
* @var SingleIntIdNoToStringEntity
*
* @ORM\Id
* @ORM\ManyToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"persist"})
* @ORM\JoinColumn(name="object_two_id")
*/
protected $objectTwo;
public function __construct(SingleIntIdNoToStringEntity $objectOne, SingleIntIdNoToStringEntity $objectTwo)
{
$this->objectOne = $objectOne;
$this->objectTwo = $objectTwo;
}
/**
* @return SingleIntIdNoToStringEntity
*/
public function getObjectOne()
{
return $this->objectOne;
}
/**
* @return SingleIntIdNoToStringEntity
*/
public function getObjectTwo()
{
return $this->objectTwo;
}
}

View File

@ -19,6 +19,7 @@ use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory; use Symfony\Bridge\Doctrine\Test\TestRepositoryFactory;
use Symfony\Bridge\Doctrine\Tests\Fixtures\Employee; use Symfony\Bridge\Doctrine\Tests\Fixtures\Employee;
use Symfony\Bridge\Doctrine\Tests\Fixtures\Person; use Symfony\Bridge\Doctrine\Tests\Fixtures\Person;
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleNameEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity; use Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity;
@ -146,6 +147,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\Person'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\Person'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\Employee'), $em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\Employee'),
$em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeObjectNoToStringIdEntity'),
)); ));
} }
@ -179,7 +181,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->buildViolation('myMessage') $this->buildViolation('myMessage')
->atPath('property.path.name') ->atPath('property.path.name')
->setParameter('{{ value }}', '"Foo"') ->setParameter('{{ value }}', '"Foo"')
->setInvalidValue('Foo') ->setInvalidValue($entity2)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised(); ->assertRaised();
} }
@ -204,7 +206,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->buildViolation('myMessage') $this->buildViolation('myMessage')
->atPath('property.path.bar') ->atPath('property.path.bar')
->setParameter('{{ value }}', '"Foo"') ->setParameter('{{ value }}', '"Foo"')
->setInvalidValue('Foo') ->setInvalidValue($entity2)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised(); ->assertRaised();
} }
@ -423,7 +425,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->buildViolation('myMessage') $this->buildViolation('myMessage')
->atPath('property.path.single') ->atPath('property.path.single')
->setParameter('{{ value }}', $entity1) ->setParameter('{{ value }}', 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity") identified by (id => 1)')
->setInvalidValue($entity1) ->setInvalidValue($entity1)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised(); ->assertRaised();
@ -456,12 +458,12 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->validator->validate($associated2, $constraint); $this->validator->validate($associated2, $constraint);
$expectedValue = 'Object of class "Symfony\Bridge\Doctrine\Tests\Fixtures\AssociationEntity2" identified by "2"'; $expectedValue = 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity") identified by (id => 1)';
$this->buildViolation('myMessage') $this->buildViolation('myMessage')
->atPath('property.path.single') ->atPath('property.path.single')
->setParameter('{{ value }}', '"'.$expectedValue.'"') ->setParameter('{{ value }}', $expectedValue)
->setInvalidValue($expectedValue) ->setInvalidValue($entity1)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised(); ->assertRaised();
} }
@ -617,4 +619,38 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$entity = new Person(1, 'Foo'); $entity = new Person(1, 'Foo');
$this->validator->validate($entity, $constraint); $this->validator->validate($entity, $constraint);
} }
public function testValidateUniquenessWithCompositeObjectNoToStringIdEntity()
{
$constraint = new UniqueEntity(array(
'message' => 'myMessage',
'fields' => array('objectOne', 'objectTwo'),
'em' => self::EM_NAME,
));
$objectOne = new SingleIntIdNoToStringEntity(1, 'foo');
$objectTwo = new SingleIntIdNoToStringEntity(2, 'bar');
$this->em->persist($objectOne);
$this->em->persist($objectTwo);
$this->em->flush();
$entity = new CompositeObjectNoToStringIdEntity($objectOne, $objectTwo);
$this->em->persist($entity);
$this->em->flush();
$newEntity = new CompositeObjectNoToStringIdEntity($objectOne, $objectTwo);
$this->validator->validate($newEntity, $constraint);
$expectedValue = 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity") identified by (id => 1)';
$this->buildViolation('myMessage')
->atPath('property.path.objectOne')
->setParameter('{{ value }}', $expectedValue)
->setInvalidValue($objectOne)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised();
}
} }

View File

@ -12,6 +12,8 @@
namespace Symfony\Bridge\Doctrine\Validator\Constraints; namespace Symfony\Bridge\Doctrine\Validator\Constraints;
use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@ -141,15 +143,41 @@ class UniqueEntityValidator extends ConstraintValidator
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0];
$invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]]; $invalidValue = isset($criteria[$errorPath]) ? $criteria[$errorPath] : $criteria[$fields[0]];
if (is_object($invalidValue) && !method_exists($invalidValue, '__toString')) {
$invalidValue = sprintf('Object of class "%s" identified by "%s"', get_class($entity), implode(', ', $class->getIdentifierValues($entity)));
}
$this->context->buildViolation($constraint->message) $this->context->buildViolation($constraint->message)
->atPath($errorPath) ->atPath($errorPath)
->setParameter('{{ value }}', $this->formatValue($invalidValue, static::OBJECT_TO_STRING | static::PRETTY_DATE)) ->setParameter('{{ value }}', $this->formatWithIdentifiers($em, $class, $invalidValue))
->setInvalidValue($invalidValue) ->setInvalidValue($invalidValue)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR) ->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->addViolation(); ->addViolation();
} }
private function formatWithIdentifiers(ObjectManager $em, ClassMetadata $class, $value)
{
if (!is_object($value) || $value instanceof \DateTimeInterface) {
return $this->formatValue($value, self::PRETTY_DATE);
}
// non unique value is a composite PK
if ($class->getName() !== $idClass = get_class($value)) {
$identifiers = $em->getClassMetadata($idClass)->getIdentifierValues($value);
} else {
$identifiers = $class->getIdentifierValues($value);
}
if (!$identifiers) {
return sprintf('object("%s")', $idClass);
}
array_walk($identifiers, function (&$id, $field) {
if (!is_object($id) || $id instanceof \DateTimeInterface) {
$idAsString = $this->formatValue($id, self::PRETTY_DATE);
} else {
$idAsString = sprintf('object("%s")', get_class($id));
}
$id = sprintf('%s => %s', $field, $idAsString);
});
return sprintf('object("%s") identified by (%s)', $idClass, implode(', ', $identifiers));
}
} }

View File

@ -141,7 +141,7 @@ class DeprecationErrorHandler
return "\x1B[{$color}m{$str}\x1B[0m"; return "\x1B[{$color}m{$str}\x1B[0m";
}; };
} else { } else {
$colorize = function ($str) {return $str;}; $colorize = function ($str) { return $str; };
} }
register_shutdown_function(function () use ($getMode, &$deprecations, $deprecationHandler, $colorize) { register_shutdown_function(function () use ($getMode, &$deprecations, $deprecationHandler, $colorize) {
$mode = $getMode(); $mode = $getMode();
@ -152,7 +152,7 @@ class DeprecationErrorHandler
restore_error_handler(); restore_error_handler();
if (DeprecationErrorHandler::MODE_WEAK === $mode) { if (DeprecationErrorHandler::MODE_WEAK === $mode) {
$colorize = function ($str) {return $str;}; $colorize = function ($str) { return $str; };
} }
if ($currErrorHandler !== $deprecationHandler) { if ($currErrorHandler !== $deprecationHandler) {
echo "\n", $colorize('THE ERROR HANDLER HAS CHANGED!', true), "\n"; echo "\n", $colorize('THE ERROR HANDLER HAS CHANGED!', true), "\n";

View File

@ -122,9 +122,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
unset($this->valueHolder5157dd96e88c0->$name); unset($this->valueHolder5157dd96e88c0->$name);
} }
/**
*
*/
public function __clone() public function __clone()
{ {
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array()); $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array());
@ -132,9 +129,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
$this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0; $this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0;
} }
/**
*
*/
public function __sleep() public function __sleep()
{ {
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array()); $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array());
@ -142,9 +136,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
return array('valueHolder5157dd96e88c0'); return array('valueHolder5157dd96e88c0');
} }
/**
*
*/
public function __wakeup() public function __wakeup()
{ {
} }

View File

@ -122,9 +122,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
unset($this->valueHolder5157dd96e88c0->$name); unset($this->valueHolder5157dd96e88c0->$name);
} }
/**
*
*/
public function __clone() public function __clone()
{ {
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array()); $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array());
@ -132,9 +129,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
$this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0; $this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0;
} }
/**
*
*/
public function __sleep() public function __sleep()
{ {
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array()); $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array());
@ -142,9 +136,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
return array('valueHolder5157dd96e88c0'); return array('valueHolder5157dd96e88c0');
} }
/**
*
*/
public function __wakeup() public function __wakeup()
{ {
} }
@ -168,7 +159,7 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function initializeProxy() : bool public function initializeProxy(): bool
{ {
return $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, 'initializeProxy', array()); return $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, 'initializeProxy', array());
} }
@ -176,7 +167,7 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function isProxyInitialized() : bool public function isProxyInitialized(): bool
{ {
return null !== $this->valueHolder5157dd96e88c0; return null !== $this->valueHolder5157dd96e88c0;
} }

View File

@ -140,7 +140,7 @@ EOF
} }
if ($type === 'functions' || $type === 'filters') { if ($type === 'functions' || $type === 'filters') {
$cb = $entity->getCallable(); $cb = $entity->getCallable();
if (is_null($cb)) { if (null === $cb) {
return; return;
} }
if (is_array($cb)) { if (is_array($cb)) {

View File

@ -33,7 +33,7 @@ class DumpExtensionTest extends \PHPUnit_Framework_TestCase
$dumped = null; $dumped = null;
$exception = null; $exception = null;
$prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) {$dumped = $var;}); $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) { $dumped = $var; });
try { try {
$this->assertEquals($expectedOutput, $twig->render('template')); $this->assertEquals($expectedOutput, $twig->render('template'));

View File

@ -230,7 +230,7 @@ class MarkdownDescriptor extends Descriptor
} }
} }
$this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output); $this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output);
} }
/** /**
@ -241,7 +241,7 @@ class MarkdownDescriptor extends Descriptor
$output = '- Service: `'.$alias.'`' $output = '- Service: `'.$alias.'`'
."\n".'- Public: '.($alias->isPublic() ? 'yes' : 'no'); ."\n".'- Public: '.($alias->isPublic() ? 'yes' : 'no');
$this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output); $this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output);
} }
/** /**

View File

@ -446,6 +446,10 @@ abstract class FrameworkExtensionTest extends TestCase
public function testFileLinkFormat() public function testFileLinkFormat()
{ {
if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) {
$this->markTestSkipped('A custom file_link_format is defined.');
}
$container = $this->createContainerFromFile('full'); $container = $this->createContainerFromFile('full');
$this->assertEquals('file%link%format', $container->getParameter('debug.file_link_format')); $this->assertEquals('file%link%format', $container->getParameter('debug.file_link_format'));

View File

@ -4,8 +4,7 @@ Public services
Definitions Definitions
----------- -----------
definition_1 ### definition_1
~~~~~~~~~~~~
- Class: `Full\Qualified\Class1` - Class: `Full\Qualified\Class1`
- Public: yes - Public: yes
@ -21,14 +20,12 @@ definition_1
Aliases Aliases
------- -------
alias_1 ### alias_1
~~~~~~~
- Service: `service_1` - Service: `service_1`
- Public: yes - Public: yes
alias_2 ### alias_2
~~~~~~~
- Service: `service_2` - Service: `service_2`
- Public: no - Public: no

View File

@ -4,8 +4,7 @@ Public and private services
Definitions Definitions
----------- -----------
definition_1 ### definition_1
~~~~~~~~~~~~
- Class: `Full\Qualified\Class1` - Class: `Full\Qualified\Class1`
- Public: yes - Public: yes
@ -17,8 +16,7 @@ definition_1
- Factory Class: `Full\Qualified\FactoryClass` - Factory Class: `Full\Qualified\FactoryClass`
- Factory Method: `get` - Factory Method: `get`
definition_2 ### definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2` - Class: `Full\Qualified\Class2`
- Public: no - Public: no
@ -42,14 +40,12 @@ definition_2
Aliases Aliases
------- -------
alias_1 ### alias_1
~~~~~~~
- Service: `service_1` - Service: `service_1`
- Public: yes - Public: yes
alias_2 ### alias_2
~~~~~~~
- Service: `service_2` - Service: `service_2`
- Public: no - Public: no

View File

@ -4,8 +4,7 @@ Public and private services with tag `tag1`
Definitions Definitions
----------- -----------
definition_2 ### definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2` - Class: `Full\Qualified\Class2`
- Public: no - Public: no

View File

@ -4,8 +4,7 @@ Container tags
tag1 tag1
---- ----
definition_2 ### definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2` - Class: `Full\Qualified\Class2`
- Public: no - Public: no
@ -23,8 +22,7 @@ definition_2
tag2 tag2
---- ----
definition_2 ### definition_2
~~~~~~~~~~~~
- Class: `Full\Qualified\Class2` - Class: `Full\Qualified\Class2`
- Public: no - Public: no

View File

@ -369,11 +369,11 @@ class MainConfiguration implements ConfigurationInterface
$providerNodeBuilder $providerNodeBuilder
->validate() ->validate()
->ifTrue(function ($v) {return count($v) > 1;}) ->ifTrue(function ($v) { return count($v) > 1; })
->thenInvalid('You cannot set multiple provider types for the same provider') ->thenInvalid('You cannot set multiple provider types for the same provider')
->end() ->end()
->validate() ->validate()
->ifTrue(function ($v) {return count($v) === 0;}) ->ifTrue(function ($v) { return count($v) === 0; })
->thenInvalid('You must set a provider definition for the provider.') ->thenInvalid('You must set a provider definition for the provider.')
->end() ->end()
; ;

View File

@ -88,7 +88,7 @@ class ExtensionPass implements CompilerPassInterface
$twigLoader = $container->getDefinition('twig.loader.native_filesystem'); $twigLoader = $container->getDefinition('twig.loader.native_filesystem');
if ($container->has('templating')) { if ($container->has('templating')) {
$loader = $container->getDefinition('twig.loader.filesystem'); $loader = $container->getDefinition('twig.loader.filesystem');
$loader->setMethodCalls($twigLoader->getMethodCalls()); $loader->setMethodCalls(array_merge($twigLoader->getMethodCalls(), $loader->getMethodCalls()));
$loader->replaceArgument(2, $composerRootDir); $loader->replaceArgument(2, $composerRootDir);
$twigLoader->clearTag('twig.loader'); $twigLoader->clearTag('twig.loader');

View File

@ -0,0 +1,41 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler;
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
class ExtensionPassTest extends \PHPUnit_Framework_TestCase
{
public function testProcessDoesNotDropExistingFileLoaderMethodCalls()
{
$container = new ContainerBuilder();
$container->setParameter('kernel.debug', false);
$container->register('twig.app_variable', '\Symfony\Bridge\Twig\AppVariable');
$container->register('templating', '\Symfony\Bundle\TwigBundle\TwigEngine');
$nativeTwigLoader = new Definition('\Twig_Loader_Filesystem');
$nativeTwigLoader->addMethodCall('addPath', array());
$container->setDefinition('twig.loader.native_filesystem', $nativeTwigLoader);
$filesystemLoader = new Definition('\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader');
$filesystemLoader->addMethodCall('addPath', array());
$container->setDefinition('twig.loader.filesystem', $filesystemLoader);
$extensionPass = new ExtensionPass();
$extensionPass->process($container);
$this->assertCount(2, $filesystemLoader->getMethodCalls());
}
}

View File

@ -15,10 +15,23 @@ use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\CacheItem; use Symfony\Component\Cache\CacheItem;
/** /**
* Interface for adapters managing instances of Symfony's {@see CacheItem}. * Interface for adapters managing instances of Symfony's CacheItem.
* *
* @author Kévin Dunglas <dunglas@gmail.com> * @author Kévin Dunglas <dunglas@gmail.com>
*/ */
interface AdapterInterface extends CacheItemPoolInterface interface AdapterInterface extends CacheItemPoolInterface
{ {
/**
* {@inheritdoc}
*
* @return CacheItem
*/
public function getItem($key);
/**
* {@inheritdoc}
*
* return \Traversable|CacheItem[]
*/
public function getItems(array $keys = array());
} }

View File

@ -4,7 +4,7 @@
* foo * foo
*/ */
declare (strict_types = 1); declare(strict_types=1);
namespace Namespaced; namespace Namespaced;

View File

@ -173,7 +173,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
); );
if ($prefix) { if ($prefix) {
$candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);}); $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
} }
// We cannot use the autoloader here as most of them use require; but if the class // We cannot use the autoloader here as most of them use require; but if the class

View File

@ -60,7 +60,6 @@ class CheckCircularReferencesPass implements CompilerPassInterface
$id = $node->getId(); $id = $node->getId();
if (empty($this->checkedNodes[$id])) { if (empty($this->checkedNodes[$id])) {
// don't check circular dependencies for lazy services // don't check circular dependencies for lazy services
if (!$node->getValue() || !$node->getValue()->isLazy()) { if (!$node->getValue() || !$node->getValue()->isLazy()) {
$searchKey = array_search($id, $this->currentPath); $searchKey = array_search($id, $this->currentPath);

View File

@ -106,7 +106,7 @@ class Definition
} }
/** /**
* Gets the service that decorates this service. * 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 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
*/ */

View File

@ -110,7 +110,7 @@ class YamlFileLoader extends FileLoader
* @param array $content * @param array $content
* @param string $file * @param string $file
*/ */
private function parseImports($content, $file) private function parseImports(array $content, $file)
{ {
if (!isset($content['imports'])) { if (!isset($content['imports'])) {
return; return;
@ -137,7 +137,7 @@ class YamlFileLoader extends FileLoader
* @param array $content * @param array $content
* @param string $file * @param string $file
*/ */
private function parseDefinitions($content, $file) private function parseDefinitions(array $content, $file)
{ {
if (!isset($content['services'])) { if (!isset($content['services'])) {
return; return;
@ -155,9 +155,9 @@ class YamlFileLoader extends FileLoader
/** /**
* Parses a definition. * Parses a definition.
* *
* @param string $id * @param string $id
* @param array $service * @param array|string $service
* @param string $file * @param string $file
* *
* @throws InvalidArgumentException When tags are invalid * @throws InvalidArgumentException When tags are invalid
*/ */
@ -486,7 +486,7 @@ class YamlFileLoader extends FileLoader
* *
* @param array $content * @param array $content
*/ */
private function loadFromExtensions($content) private function loadFromExtensions(array $content)
{ {
foreach ($content as $namespace => $values) { foreach ($content as $namespace => $values) {
if (in_array($namespace, array('imports', 'parameters', 'services'))) { if (in_array($namespace, array('imports', 'parameters', 'services'))) {

View File

@ -192,7 +192,7 @@ class Crawler implements \Countable, \IteratorAggregate
$dom = new \DOMDocument('1.0', $charset); $dom = new \DOMDocument('1.0', $charset);
$dom->validateOnParse = true; $dom->validateOnParse = true;
set_error_handler(function () {throw new \Exception();}); set_error_handler(function () { throw new \Exception(); });
try { try {
// Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML() // Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML()

View File

@ -212,7 +212,7 @@ class DateType extends AbstractType
array('year' => $default, 'month' => $default, 'day' => $default), array('year' => $default, 'month' => $default, 'day' => $default),
$choiceTranslationDomain $choiceTranslationDomain
); );
}; }
return array( return array(
'year' => $choiceTranslationDomain, 'year' => $choiceTranslationDomain,

View File

@ -213,7 +213,7 @@ class TimeType extends AbstractType
array('hour' => $default, 'minute' => $default, 'second' => $default), array('hour' => $default, 'minute' => $default, 'second' => $default),
$choiceTranslationDomain $choiceTranslationDomain
); );
}; }
return array( return array(
'hour' => $choiceTranslationDomain, 'hour' => $choiceTranslationDomain,

View File

@ -290,7 +290,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
{ {
$html = ''; $html = '';
$dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset);
$dumper->setDumpHeader(''); $dumper->setDumpHeader('');
$dumper->setDumpBoundaries('', ''); $dumper->setDumpBoundaries('', '');

View File

@ -52,6 +52,6 @@ class AddRequestFormatsListener implements EventSubscriberInterface
*/ */
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array(KernelEvents::REQUEST => 'onKernelRequest'); return array(KernelEvents::REQUEST => array('onKernelRequest', 1));
} }
} }

View File

@ -45,7 +45,7 @@ class AddRequestFormatsListenerTest extends \PHPUnit_Framework_TestCase
public function testRegisteredEvent() public function testRegisteredEvent()
{ {
$this->assertEquals( $this->assertEquals(
array(KernelEvents::REQUEST => 'onKernelRequest'), array(KernelEvents::REQUEST => array('onKernelRequest', 1)),
AddRequestFormatsListener::getSubscribedEvents() AddRequestFormatsListener::getSubscribedEvents()
); );
} }

View File

@ -42,9 +42,6 @@ abstract class AbstractDataGenerator
$this->dirName = $dirName; $this->dirName = $dirName;
} }
/**
* {@inheritdoc}
*/
public function generateData(GeneratorConfig $config) public function generateData(GeneratorConfig $config)
{ {
$filesystem = new Filesystem(); $filesystem = new Filesystem();

View File

@ -57,9 +57,6 @@ class LocaleDataGenerator
$this->regionDataProvider = $regionDataProvider; $this->regionDataProvider = $regionDataProvider;
} }
/**
* {@inheritdoc}
*/
public function generateData(GeneratorConfig $config) public function generateData(GeneratorConfig $config)
{ {
$filesystem = new Filesystem(); $filesystem = new Filesystem();

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
pcntl_signal(SIGUSR1, function () {echo 'SIGUSR1'; exit;}); pcntl_signal(SIGUSR1, function () { echo 'SIGUSR1'; exit; });
echo 'Caught '; echo 'Caught ';

View File

@ -223,6 +223,9 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
try { try {
$reflectionMethod = new \ReflectionMethod($class, $methodName); $reflectionMethod = new \ReflectionMethod($class, $methodName);
if ($reflectionMethod->isStatic()) {
continue;
}
if ( if (
(self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) || (self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) ||

View File

@ -73,6 +73,10 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
} }
foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
if ($reflectionMethod->isStatic()) {
continue;
}
$propertyName = $this->getPropertyName($reflectionMethod->name, $reflectionProperties); $propertyName = $this->getPropertyName($reflectionMethod->name, $reflectionProperties);
if (!$propertyName || isset($properties[$propertyName])) { if (!$propertyName || isset($properties[$propertyName])) {
continue; continue;
@ -263,6 +267,9 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
foreach (self::$accessorPrefixes as $prefix) { foreach (self::$accessorPrefixes as $prefix) {
try { try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty); $reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty);
if ($reflectionMethod->isStatic()) {
continue;
}
if (0 === $reflectionMethod->getNumberOfRequiredParameters()) { if (0 === $reflectionMethod->getNumberOfRequiredParameters()) {
return array($reflectionMethod, $prefix); return array($reflectionMethod, $prefix);
@ -298,6 +305,9 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
foreach ($names as $name) { foreach ($names as $name) {
try { try {
$reflectionMethod = new \ReflectionMethod($class, $prefix.$name); $reflectionMethod = new \ReflectionMethod($class, $prefix.$name);
if ($reflectionMethod->isStatic()) {
continue;
}
// Parameter can be optional to allow things like: method(array $foo = null) // Parameter can be optional to allow things like: method(array $foo = null)
if ($reflectionMethod->getNumberOfParameters() >= 1) { if ($reflectionMethod->getNumberOfParameters() >= 1) {

View File

@ -44,7 +44,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface
* @param PropertyDescriptionExtractorInterface[] $descriptionExtractors * @param PropertyDescriptionExtractorInterface[] $descriptionExtractors
* @param PropertyAccessExtractorInterface[] $accessExtractors * @param PropertyAccessExtractorInterface[] $accessExtractors
*/ */
public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array()) public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array())
{ {
$this->listExtractors = $listExtractors; $this->listExtractors = $listExtractors;
$this->typeExtractors = $typeExtractors; $this->typeExtractors = $typeExtractors;

View File

@ -68,6 +68,8 @@ class PhpDocExtractorTest extends \PHPUnit_Framework_TestCase
array('e', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))), null, null), array('e', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))), null, null),
array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))), null, null), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))), null, null),
array('donotexist', null, null, null), array('donotexist', null, null, null),
array('staticGetter', null, null, null),
array('staticSetter', null, null, null),
); );
} }

View File

@ -73,6 +73,8 @@ class ReflectionExtractorTest extends \PHPUnit_Framework_TestCase
array('e', null), array('e', null),
array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime')))), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime')))),
array('donotexist', null), array('donotexist', null),
array('staticGetter', null),
array('staticSetter', null),
); );
} }

View File

@ -51,6 +51,21 @@ class Dummy extends ParentDummy
*/ */
public $B; public $B;
public static function getStatic()
{
}
/**
* @return string
*/
public static function staticGetter()
{
}
public static function staticSetter(\DateTime $d)
{
}
/** /**
* A. * A.
* *

View File

@ -138,11 +138,6 @@ abstract class AnnotationClassLoader implements LoaderInterface
} }
$defaults = array_replace($globals['defaults'], $annot->getDefaults()); $defaults = array_replace($globals['defaults'], $annot->getDefaults());
foreach ($method->getParameters() as $param) {
if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) {
$defaults[$param->getName()] = $param->getDefaultValue();
}
}
$requirements = array_replace($globals['requirements'], $annot->getRequirements()); $requirements = array_replace($globals['requirements'], $annot->getRequirements());
$options = array_replace($globals['options'], $annot->getOptions()); $options = array_replace($globals['options'], $annot->getOptions());
$schemes = array_merge($globals['schemes'], $annot->getSchemes()); $schemes = array_merge($globals['schemes'], $annot->getSchemes());

View File

@ -136,11 +136,10 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
array_intersect_assoc($routeData['options'], $route->getOptions()), array_intersect_assoc($routeData['options'], $route->getOptions()),
'->load preserves options annotation' '->load preserves options annotation'
); );
$defaults = array_replace($methodArgs, $routeData['defaults']);
$this->assertCount( $this->assertCount(
count($defaults), count($routeData['defaults']),
array_intersect_assoc($defaults, $route->getDefaults()), $route->getDefaults(),
'->load preserves defaults annotation and merges them with default arguments in method signature' '->load preserves defaults annotation'
); );
$this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation'); $this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation');
$this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation'); $this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation');

View File

@ -151,6 +151,48 @@ class LdapUserProviderTest extends \PHPUnit_Framework_TestCase
); );
} }
/**
* @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException
*/
public function testLoadUserByUsernameFailsIfEntryHasNoUidKeyAttribute()
{
$result = $this->getMock(CollectionInterface::class);
$query = $this->getMock(QueryInterface::class);
$query
->expects($this->once())
->method('execute')
->will($this->returnValue($result))
;
$ldap = $this->getMock(LdapInterface::class);
$result
->expects($this->once())
->method('offsetGet')
->with(0)
->will($this->returnValue(new Entry('foo', array())))
;
$result
->expects($this->once())
->method('count')
->will($this->returnValue(1))
;
$ldap
->expects($this->once())
->method('escape')
->will($this->returnValue('foo'))
;
$ldap
->expects($this->once())
->method('query')
->will($this->returnValue($query))
;
$provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com', null, null, array(), 'sAMAccountName', '({uid_key}={username})');
$this->assertInstanceOf(
'Symfony\Component\Security\Core\User\User',
$provider->loadUserByUsername('foo')
);
}
/** /**
* @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException * @expectedException \Symfony\Component\Security\Core\Exception\InvalidArgumentException
*/ */
@ -238,7 +280,7 @@ class LdapUserProviderTest extends \PHPUnit_Framework_TestCase
); );
} }
public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute() public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWrongCase()
{ {
$result = $this->getMockBuilder(CollectionInterface::class)->getMock(); $result = $this->getMockBuilder(CollectionInterface::class)->getMock();
$query = $this->getMockBuilder(QueryInterface::class)->getMock(); $query = $this->getMockBuilder(QueryInterface::class)->getMock();
@ -248,6 +290,45 @@ class LdapUserProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($result)) ->will($this->returnValue($result))
; ;
$ldap = $this->getMockBuilder(LdapInterface::class)->getMock(); $ldap = $this->getMockBuilder(LdapInterface::class)->getMock();
$result
->expects($this->once())
->method('offsetGet')
->with(0)
->will($this->returnValue(new Entry('foo', array(
'sAMAccountName' => array('foo'),
)
)))
;
$result
->expects($this->once())
->method('count')
->will($this->returnValue(1))
;
$ldap
->expects($this->once())
->method('escape')
->will($this->returnValue('Foo'))
;
$ldap
->expects($this->once())
->method('query')
->will($this->returnValue($query))
;
$provider = new LdapUserProvider($ldap, 'ou=MyBusiness,dc=symfony,dc=com');
$this->assertSame('foo', $provider->loadUserByUsername('Foo')->getUsername());
}
public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute()
{
$result = $this->getMock(CollectionInterface::class);
$query = $this->getMock(QueryInterface::class);
$query
->expects($this->once())
->method('execute')
->will($this->returnValue($result))
;
$ldap = $this->getMock(LdapInterface::class);
$result $result
->expects($this->once()) ->expects($this->once())
->method('offsetGet') ->method('offsetGet')

View File

@ -31,6 +31,7 @@ class LdapUserProvider implements UserProviderInterface
private $searchDn; private $searchDn;
private $searchPassword; private $searchPassword;
private $defaultRoles; private $defaultRoles;
private $uidKey;
private $defaultSearch; private $defaultSearch;
private $passwordAttribute; private $passwordAttribute;
@ -46,11 +47,16 @@ class LdapUserProvider implements UserProviderInterface
*/ */
public function __construct(LdapInterface $ldap, $baseDn, $searchDn = null, $searchPassword = null, array $defaultRoles = array(), $uidKey = 'sAMAccountName', $filter = '({uid_key}={username})', $passwordAttribute = null) public function __construct(LdapInterface $ldap, $baseDn, $searchDn = null, $searchPassword = null, array $defaultRoles = array(), $uidKey = 'sAMAccountName', $filter = '({uid_key}={username})', $passwordAttribute = null)
{ {
if (null === $uidKey) {
$uidKey = 'uid';
}
$this->ldap = $ldap; $this->ldap = $ldap;
$this->baseDn = $baseDn; $this->baseDn = $baseDn;
$this->searchDn = $searchDn; $this->searchDn = $searchDn;
$this->searchPassword = $searchPassword; $this->searchPassword = $searchPassword;
$this->defaultRoles = $defaultRoles; $this->defaultRoles = $defaultRoles;
$this->uidKey = $uidKey;
$this->defaultSearch = str_replace('{uid_key}', $uidKey, $filter); $this->defaultSearch = str_replace('{uid_key}', $uidKey, $filter);
$this->passwordAttribute = $passwordAttribute; $this->passwordAttribute = $passwordAttribute;
} }
@ -80,7 +86,10 @@ class LdapUserProvider implements UserProviderInterface
throw new UsernameNotFoundException('More than one user found'); throw new UsernameNotFoundException('More than one user found');
} }
return $this->loadUser($username, $entries[0]); $entry = $entries[0];
$username = $this->getAttributeValue($entry, $this->uidKey);
return $this->loadUser($username, $entry);
} }
/** /**
@ -113,30 +122,30 @@ class LdapUserProvider implements UserProviderInterface
*/ */
protected function loadUser($username, Entry $entry) protected function loadUser($username, Entry $entry)
{ {
$password = $this->getPassword($entry); $password = null;
if (null !== $this->passwordAttribute) {
$password = $this->getAttributeValue($entry, $this->passwordAttribute);
}
return new User($username, $password, $this->defaultRoles); return new User($username, $password, $this->defaultRoles);
} }
/** /**
* Fetches the password from an LDAP entry. * Fetches a required unique attribute value from an LDAP entry.
* *
* @param null|Entry $entry * @param null|Entry $entry
* @param string $attribute
*/ */
private function getPassword(Entry $entry) private function getAttributeValue(Entry $entry, $attribute)
{ {
if (null === $this->passwordAttribute) { if (!$entry->hasAttribute($attribute)) {
return; throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $attribute, $entry->getDn()));
} }
if (!$entry->hasAttribute($this->passwordAttribute)) { $values = $entry->getAttribute($attribute);
throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $this->passwordAttribute, $entry->getDn()));
}
$values = $entry->getAttribute($this->passwordAttribute);
if (1 !== count($values)) { if (1 !== count($values)) {
throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $this->passwordAttribute)); throw new InvalidArgumentException(sprintf('Attribute "%s" has multiple values.', $attribute));
} }
return $values[0]; return $values[0];

View File

@ -61,7 +61,7 @@ class JsonDecodeTest extends \PHPUnit_Framework_TestCase
*/ */
public function testDecodeWithException($value) public function testDecodeWithException($value)
{ {
$this->decode->decode($value, JsonEncoder::FORMAT); $this->decode->decode($value, JsonEncoder::FORMAT);
} }
public function decodeProviderException() public function decodeProviderException()

View File

@ -54,6 +54,6 @@ class JsonEncodeTest extends \PHPUnit_Framework_TestCase
*/ */
public function testEncodeWithError() public function testEncodeWithError()
{ {
$this->encode->encode("\xB1\x31", JsonEncoder::FORMAT); $this->encode->encode("\xB1\x31", JsonEncoder::FORMAT);
} }
} }

View File

@ -26,7 +26,7 @@ class FileDumperTest extends \PHPUnit_Framework_TestCase
$dumper = new ConcreteFileDumper(); $dumper = new ConcreteFileDumper();
$dumper->dump($catalogue, array('path' => $tempDir)); $dumper->dump($catalogue, array('path' => $tempDir));
$this->assertTrue(file_exists($tempDir.'/messages.en.concrete')); $this->assertFileExists($tempDir.'/messages.en.concrete');
} }
/** /**

View File

@ -62,7 +62,7 @@ class ArrayConverter
* $tree['foo'] was string before we found array {bar: test2}. * $tree['foo'] was string before we found array {bar: test2}.
* Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2'; * Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2';
*/ */
$elem = &$elem[ implode('.', array_slice($parts, $i)) ]; $elem = &$elem[implode('.', array_slice($parts, $i))];
break; break;
} }
$parentOfElem = &$elem; $parentOfElem = &$elem;

View File

@ -17,7 +17,7 @@ use Symfony\Component\Validator\ConstraintValidator;
/** /**
* @author Michael Hirschler <michael.vhirsch@gmail.com> * @author Michael Hirschler <michael.vhirsch@gmail.com>
* *
* @link https://en.wikipedia.org/wiki/ISO_9362#Structure * @see https://en.wikipedia.org/wiki/ISO_9362#Structure
*/ */
class BicValidator extends ConstraintValidator class BicValidator extends ConstraintValidator
{ {

View File

@ -23,7 +23,7 @@ use Symfony\Component\Yaml\Exception\DumpException;
*/ */
class Inline class Inline
{ {
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')';
public static $parsedLineNumber; public static $parsedLineNumber;

View File

@ -676,4 +676,14 @@ class InlineTest extends \PHPUnit_Framework_TestCase
{ {
Inline::parse('{this, is not, supported}'); Inline::parse('{this, is not, supported}');
} }
public function testVeryLongQuotedStrings()
{
$longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000);
$yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes));
$arrayFromYaml = Inline::parse($yamlString);
$this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']);
}
} }