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,
'braces' => array('allow_single_line_closure' => true),
'heredoc_to_nowdoc' => false,
'phpdoc_annotation_without_dot' => false,
))
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->in(__DIR__.'/src')
->exclude(array(
// directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code
'src/Symfony/Component/DependencyInjection/Tests/Fixtures',
'src/Symfony/Component/Routing/Tests/Fixtures/dumper',
'Symfony/Component/DependencyInjection/Tests/Fixtures',
'Symfony/Component/Routing/Tests/Fixtures/dumper',
// fixture templates
'src/Symfony/Component/Templating/Tests/Fixtures/templates',
'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
'Symfony/Component/Templating/Tests/Fixtures/templates',
'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom',
// generated fixtures
'src/Symfony/Component/VarDumper/Tests/Fixtures',
'Symfony/Component/VarDumper/Tests/Fixtures',
// resource templates
'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form',
'Symfony/Bundle/FrameworkBundle/Resources/views/Form',
))
// 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
->notPath('src/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_1.xml')
->notPath('Symfony/Component/Console/Tests/Fixtures/application_2.xml')
// yml
->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
->notPath('Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml')
// 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
->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)
- Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
- Grégoire Pineau (lyrixx)
- Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon)
- Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw)
- Eriksen Costa (eriksencosta)
- Jules Pietri (heah)
- Maxime Steinhausser (ogizanagi)
- Jules Pietri (heah)
- Robin Chalas (chalas_r)
- Sarah Khalil (saro0h)
- Jonathan Wage (jwage)
- Diego Saint Esteben (dosten)
- Robin Chalas (chalas_r)
- Alexandre Salomé (alexandresalome)
- William Durand (couac)
- ornicar
@ -49,11 +49,12 @@ Symfony is the result of the work of many people who made the code better
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
- Miha Vrhovnik
- Diego Saint Esteben (dii3g0)
- Ener-Getick (energetick)
- Diego Saint Esteben (dii3g0)
- Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
- Iltar van der Berg (kjarli)
- Roland Franssen (ro0)
- Bilal Amarni (bamarni)
- Florin Patan (florinpatan)
- Peter Rehm (rpet)
- 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)
- Dariusz Górecki (canni)
- Douglas Greenshields (shieldo)
- Titouan Galopin (tgalopin)
- Konstantin Myakshin (koc)
- Lee McDermott
- Brandon Turner
- Luis Cordova (cordoval)
- Graham Campbell (graham)
- Titouan Galopin (tgalopin)
- Daniel Holmes (dholmes)
- Pierre du Plessis (pierredup)
- Toni Uebernickel (havvg)
- Bart van den Burg (burgov)
- Jordan Alliot (jalliot)
- John Wards (johnwards)
- Roland Franssen (ro0)
- Fran Moreno (franmomu)
- Jáchym Toušek (enumag)
- Antoine Hérault (herzult)
@ -98,6 +98,7 @@ Symfony is the result of the work of many people who made the code better
- lenar
- Włodzimierz Gajda (gajdaw)
- Baptiste Clavié (talus)
- Maxime STEINHAUSSER
- Alexander Schwenn (xelaris)
- Florian Voutzinos (florianv)
- Colin Frei
@ -114,13 +115,13 @@ Symfony is the result of the work of many people who made the code better
- Eric GELOEN (gelo)
- David Buchmann (dbu)
- Tugdual Saunier (tucksaun)
- Maxime STEINHAUSSER
- Théo FIDRY (theofidry)
- Robert Schönthal (digitalkaoz)
- Florian Lonqueu-Brochard (florianlb)
- Stefano Sala (stefano.sala)
- Evgeniy (ewgraf)
- Juti Noppornpitak (shiroyuki)
- Tobias Nyholm (tobias)
- Tigran Azatyan (tigranazatyan)
- Sebastian Hörl (blogsh)
- 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)
- Jérémie Augustin (jaugustin)
- Andréia Bohner (andreia)
- Yonel Ceruto González (yonelceruto)
- Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
- jwdeitch
- Tobias Nyholm (tobias)
- Joel Wurtz (brouznouf)
- Yonel Ceruto González (yonelceruto)
- Philipp Wahala (hifi)
- Vyacheslav Pavlov
- Javier Spagnoletti (phansys)
@ -179,6 +179,7 @@ Symfony is the result of the work of many people who made the code better
- fivestar
- Dominique Bongiraud
- Jeremy Livingston (jeremylivingston)
- Michael Lee (zerustech)
- Matthieu Auger (matthieuauger)
- Leszek Prabucki (l3l0)
- 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)
- Justin Hileman (bobthecow)
- Blanchon Vincent (blanchonvincent)
- Chris Wilkinson (thewilkybarkid)
- Michele Orselli (orso)
- Tom Van Looy (tvlooy)
- Sven Paulus (subsven)
@ -195,6 +197,7 @@ Symfony is the result of the work of many people who made the code better
- Dawid Nowak
- Eugene Wissner
- Julien Brochet (mewt)
- Tristan Darricau (nicofuma)
- Sergey Linnik (linniksa)
- Michaël Perrin (michael.perrin)
- 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)
- Marco Pivetta (ocramius)
- julien pauli (jpauli)
- Michael Lee (zerustech)
- Lorenz Schori
- Sébastien Lavoie (lavoiesl)
- 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)
- Christian Schmidt
- Xavier Montaña Carreras (xmontana)
- Chris Wilkinson (thewilkybarkid)
- Mickaël Andrieu (mickaelandrieu)
- Xavier Perez
- Arjen Brouwer (arjenjb)
- Katsuhiro OGAWA
- Patrick McDougle (patrick-mcdougle)
- James Halsall (jaitsu)
- Alif Rachmawadi
- Kristen Gilden (kgilden)
- SpacePossum
- Pierre-Yves LEBECQ (pylebecq)
- Alex Pott
- Jakub Kucharovic (jkucharovic)
- Eugene Leonovich (rybakit)
- Filippo Tessarotto
- Tristan Darricau (nicofuma)
- Joseph Rouff (rouffj)
- Félix Labrecque (woodspire)
- GordonsLondon
@ -259,7 +261,6 @@ Symfony is the result of the work of many people who made the code better
- Peter Kruithof (pkruithof)
- Michael Holm (hollo)
- Marc Weistroff (futurecat)
- SpacePossum
- Hidde Wieringa (hiddewie)
- Chris Smith (cs278)
- 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)
- Uwe Jäger (uwej711)
- Aurelijus Valeiša (aurelijus)
- Victor Bocharsky (bocharsky_bw)
- Jan Decavele (jandc)
- Gustavo Piltcher
- Stepan Tanasiychuk (stfalcon)
- Tiago Ribeiro (fixe)
- Hidde Boomsma (hboomsma)
- John Bafford (jbafford)
- Pavel Batanov (scaytrase)
- Bob den Otter (bopp)
- Adrian Rudnik (kreischweide)
- 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)
- Magnus Nordlander (magnusnordlander)
- alquerci
- Adam Prager (padam87)
- Francesco Levorato
- Vitaliy Zakharov (zakharovvi)
- 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)
- Eduardo Gulias (egulias)
- giulio de donato (liuggio)
- ShinDarth
- Stéphane PY (steph_py)
- Philipp Kräutli (pkraeutli)
- 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
- Tamas Szijarto
- Pavel Volokitin (pvolok)
- François Pluchino (francoispluchino)
- Nicolas Dewez (nicolas_dewez)
- Endre Fejes
- Victor Bocharsky (bocharsky_bw)
- Tobias Naumann (tna)
- Daniel Beyer
- Shein Alexey
@ -355,7 +360,6 @@ Symfony is the result of the work of many people who made the code better
- Xavier HAUSHERR
- Albert Jessurum (ajessu)
- Laszlo Korte
- Pavel Batanov (scaytrase)
- Miha Vrhovnik
- Alessandro Desantis
- hubert lecorche (hlecorche)
@ -412,6 +416,7 @@ Symfony is the result of the work of many people who made the code better
- boombatower
- Fabrice Bernhard (fabriceb)
- Jérôme Macias (jeromemacias)
- Andrey Astakhov (aast)
- Fabian Lange (codingfabian)
- Frank Neff (fneff)
- 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)
- Kevin McBride
- Sergio Santoro
- Robin van der Vleuten (robinvdvleuten)
- Philipp Rieber (bicpi)
- Manuel de Ruiter (manuel)
- 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)
- Alain Hippolyte (aloneh)
- Dave Hulbert (dave1010)
- François Pluchino (francoispluchino)
- Ivan Rey (ivanrey)
- Marcin Chyłek (songoq)
- 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)
- Sinan Eldem
- Alexandre Dupuy (satchette)
- Rob Frawley 2nd
- Nahuel Cuesta (ncuesta)
- Chris Boden (cboden)
- Asmir Mustafic (goetas)
@ -522,6 +528,7 @@ Symfony is the result of the work of many people who made the code better
- Åsmund Garfors
- Maxime Douailin
- Jean Pasdeloup (pasdeloup)
- Benjamin Cremer (bcremer)
- Javier López (loalf)
- Andreas Braun
- Reinier Kip
@ -551,7 +558,6 @@ Symfony is the result of the work of many people who made the code better
- umpirski
- Chris Heng (gigablah)
- Ulumuddin Yunus (joenoez)
- Adam Prager (padam87)
- Luc Vieillescazes (iamluc)
- Johann Saunier (prophet777)
- Samuel ROZE (sroze)
@ -586,6 +592,7 @@ Symfony is the result of the work of many people who made the code better
- develop
- ReenExe
- Mark Sonnabaum
- Thomas Royer (cydonia7)
- Richard Quadling
- jochenvdv
- Arturas Smorgun (asarturas)
@ -593,6 +600,7 @@ Symfony is the result of the work of many people who made the code better
- Michael Piecko
- yclian
- twifty
- Indra Gunawan (guind)
- Peter Ward
- Julien DIDIER (juliendidier)
- 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)
- Pascal Helfenstein
- Baldur Rensch (brensch)
- Thomas Calvet
- Vladyslav Petrovych
- Alex Xandra Albert Sim
- Carson Full
- Andrey Astakhov (aast)
- Trent Steel (trsteel88)
- Yuen-Chi Lian
- Besnik Br
@ -630,11 +638,13 @@ Symfony is the result of the work of many people who made the code better
- Christian Soronellas (theunic)
- Romain Gautier (mykiwi)
- Yosmany Garcia (yosmanyga)
- Wouter J
- Wouter de Wild
- Miroslav Sustek
- Degory Valentine
- Benoit Lévêque (benoit_leveque)
- Jeroen Fiege (fieg)
- Arthur de Moulins (4rthem)
- Krzysiek Łabuś
- Xavier Lacot (xavier)
- possum
@ -642,6 +652,7 @@ Symfony is the result of the work of many people who made the code better
- Olivier Maisonneuve (olineuve)
- Masterklavi
- Francis Turmel (fturmel)
- Nikita Nefedov (nikita2206)
- cgonzalez
- Ben
- Jayson Xu (superjavason)
@ -683,8 +694,10 @@ 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)
- Aleksey Podskrebyshev
- Calin Mihai Pristavu
- 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)
- LOUARDI Abdeltif (ouardisoft)
- Robert Gruendler (pulse00)
- Robin van der Vleuten (robinvdvleuten)
- Simon Terrien (sterrien)
- Benoît Merlet (trompette)
- 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)
- xaav
- Mahmoud Mostafa (mahmoud)
- Alessandro Lai
- Pieter
- Michael Tibben
- Sander Marechal
@ -811,8 +824,10 @@ Symfony is the result of the work of many people who made the code better
- Nicolas Macherey
- Lin Clark
- Jeremy David (jeremy.david)
- Denis Brumann (dbrumann)
- Troy McCabe
- Ville Mattila
- ilyes kooli
- Boris Vujicic (boris.vujicic)
- Max Beutel
- Antanas Arvasevicius
@ -832,6 +847,7 @@ Symfony is the result of the work of many people who made the code better
- Christian
- Sergii Smertin (nfx)
- hugofonseca (fonsecas72)
- Martynas Narbutas
- Bailey Parker
- Eddie Jaoude
- 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)
- Tadas Gliaubicas (tadcka)
- Benoit Garret
- Thomas Royer (cydonia7)
- DerManoMann
- Olaf Klischat
- orlovv
@ -867,7 +882,6 @@ Symfony is the result of the work of many people who made the code better
- rpg600
- Péter Buri (burci)
- Davide Borsatto (davide.borsatto)
- Indra Gunawan (guind)
- kaiwa
- Charles Sanquer (csanquer)
- 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
- Paul Matthews
- Juan Traverso
- Tarjei Huse (tarjei)
- Philipp Strube
- Christian Sciberras
- Clement Herreman (clemherreman)
@ -919,7 +934,6 @@ Symfony is the result of the work of many people who made the code better
- Alberto Aldegheri
- heccjj
- Alexandre Melard
- Thomas Calvet
- Sergey Yuferev
- Tobias Stöckler
- Mario Young
@ -973,6 +987,7 @@ Symfony is the result of the work of many people who made the code better
- Samuel Vogel (samuelvogel)
- Berat Doğan
- Juanmi Rodriguez Cerón
- Andy Raines
- Anthony Ferrara
- Klaas Cuvelier (kcuvelier)
- 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)
- Pete Mitchell (peterjmit)
- Tom Corrigan (tomcorrigan)
- Luis Galeas
- Martin Pärtel
- Noah Heck (myesain)
- Patrick Daley (padrig)
@ -1014,7 +1030,6 @@ Symfony is the result of the work of many people who made the code better
- Romain Geissler
- Adrien Moiruad
- Tomaz Ahlin
- Benjamin Cremer (bcremer)
- Marcus Stöhr (dafish)
- Emmanuel Vella (emmanuel.vella)
- Carsten Nielsen (phreaknerd)
@ -1036,6 +1051,7 @@ Symfony is the result of the work of many people who made the code better
- Damien Tournoud
- Jon Gotlin (jongotlin)
- Michael Dowling (mtdowling)
- Karlos Presumido (oneko)
- BilgeXA
- r1pp3rj4ck
- Robert Queck
@ -1073,7 +1089,6 @@ Symfony is the result of the work of many people who made the code better
- kor3k kor3k (kor3k)
- Stelian Mocanita (stelian)
- Flavian (2much)
- Arthur de Moulins (4rthem)
- mike
- Keith Maika
- Mephistofeles
@ -1164,6 +1179,7 @@ Symfony is the result of the work of many people who made the code better
- Julius Beckmann
- Romain Dorgueil
- Grayson Koonce (breerly)
- Fabien LUCAS (flucas2)
- Karim Cassam Chenaï (ka)
- Nicolas Bastien (nicolas_bastien)
- 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)
- Guile (guile)
- Julien Moulin (lizjulien)
- Nikita Nefedov (nikita2206)
- Mauro Foti (skler)
- Yannick Warnier (ywarnier)
- Kevin Decherf
@ -1235,7 +1250,9 @@ Symfony is the result of the work of many people who made the code better
- Tischoi
- J Bruni
- Alexey Prilipko
- vlakoff
- bertillon
- Bertalan Attila
- Yannick Bensacq (cibou)
- Luca Genuzio (genuzio)
- Hans Nilsson (hansnilsson)
@ -1254,7 +1271,6 @@ Symfony is the result of the work of many people who made the code better
- Joel Marcey
- David Christmann
- root
- Wouter J
- James Hudson
- Tom Maguire
- David Zuelke
@ -1309,9 +1325,9 @@ Symfony is the result of the work of many people who made the code better
- ddebree
- Tomas Liubinas
- Alex
- Patrick Dawkins
- Klaas Naaijkens
- Daniel González Cerviño
- ShinDarth
- Rafał
- Adria Lopez (adlpz)
- 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)
- Cayetano Soriano Gallego (neoshadybeat)
- Ondrej Machulda (ondram)
- Patrick McDougle (patrick-mcdougle)
- Pablo Monterde Perez (plebs)
- Jimmy Leger (redpanda)
- Marcin Szepczynski (szepczynski)
- Cyrille Jouineau (tuxosaurus)
- Yorkie Chadwick (yorkie76)
- Yanick Witschi
@ -1363,6 +1379,7 @@ Symfony is the result of the work of many people who made the code better
- Arnaud Buathier (arnapou)
- chesteroni (chesteroni)
- Mauricio Lopez (diaspar)
- HADJEDJ Vincent (hadjedjvincent)
- Daniele Cesarini (ijanki)
- Ismail Asci (ismailasci)
- 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)
- Elliot Anderson (elliot)
- Fabien D. (fabd)
- Fabien Bourigault (fbourigault)
- Carsten Eilers (fnc)
- Sorin Gitlan (forapathy)
- 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)
- Brayden Williams (redstar504)
- Rich Sage (richsage)
- Ruud Kamphuis (ruudk)
- Bart Ruysseveldt (ruyss)
- Sascha Dens (saschadens)
- 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\Tests\Fixtures\Employee;
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\DoubleNameEntity;
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\Person'),
$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')
->atPath('property.path.name')
->setParameter('{{ value }}', '"Foo"')
->setInvalidValue('Foo')
->setInvalidValue($entity2)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised();
}
@ -204,7 +206,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->buildViolation('myMessage')
->atPath('property.path.bar')
->setParameter('{{ value }}', '"Foo"')
->setInvalidValue('Foo')
->setInvalidValue($entity2)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised();
}
@ -423,7 +425,7 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$this->buildViolation('myMessage')
->atPath('property.path.single')
->setParameter('{{ value }}', $entity1)
->setParameter('{{ value }}', 'object("Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity") identified by (id => 1)')
->setInvalidValue($entity1)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised();
@ -456,12 +458,12 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$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')
->atPath('property.path.single')
->setParameter('{{ value }}', '"'.$expectedValue.'"')
->setInvalidValue($expectedValue)
->setParameter('{{ value }}', $expectedValue)
->setInvalidValue($entity1)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->assertRaised();
}
@ -617,4 +619,38 @@ class UniqueEntityValidatorTest extends AbstractConstraintValidatorTest
$entity = new Person(1, 'Foo');
$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;
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\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
@ -141,15 +143,41 @@ class UniqueEntityValidator extends ConstraintValidator
$errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $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)
->atPath($errorPath)
->setParameter('{{ value }}', $this->formatValue($invalidValue, static::OBJECT_TO_STRING | static::PRETTY_DATE))
->setParameter('{{ value }}', $this->formatWithIdentifiers($em, $class, $invalidValue))
->setInvalidValue($invalidValue)
->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
->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";
};
} else {
$colorize = function ($str) {return $str;};
$colorize = function ($str) { return $str; };
}
register_shutdown_function(function () use ($getMode, &$deprecations, $deprecationHandler, $colorize) {
$mode = $getMode();
@ -152,7 +152,7 @@ class DeprecationErrorHandler
restore_error_handler();
if (DeprecationErrorHandler::MODE_WEAK === $mode) {
$colorize = function ($str) {return $str;};
$colorize = function ($str) { return $str; };
}
if ($currErrorHandler !== $deprecationHandler) {
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);
}
/**
*
*/
public function __clone()
{
$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;
}
/**
*
*/
public function __sleep()
{
$this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array());
@ -142,9 +136,6 @@ class stdClass_c1d194250ee2e2b7d2eab8b8212368a8 extends \stdClass implements \Pr
return array('valueHolder5157dd96e88c0');
}
/**
*
*/
public function __wakeup()
{
}

View File

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

View File

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

View File

@ -33,7 +33,7 @@ class DumpExtensionTest extends \PHPUnit_Framework_TestCase
$dumped = null;
$exception = null;
$prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) {$dumped = $var;});
$prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) { $dumped = $var; });
try {
$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.'`'
."\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()
{
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');
$this->assertEquals('file%link%format', $container->getParameter('debug.file_link_format'));

View File

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

View File

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

View File

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

View File

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

View File

@ -369,11 +369,11 @@ class MainConfiguration implements ConfigurationInterface
$providerNodeBuilder
->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')
->end()
->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.')
->end()
;

View File

@ -88,7 +88,7 @@ class ExtensionPass implements CompilerPassInterface
$twigLoader = $container->getDefinition('twig.loader.native_filesystem');
if ($container->has('templating')) {
$loader = $container->getDefinition('twig.loader.filesystem');
$loader->setMethodCalls($twigLoader->getMethodCalls());
$loader->setMethodCalls(array_merge($twigLoader->getMethodCalls(), $loader->getMethodCalls()));
$loader->replaceArgument(2, $composerRootDir);
$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;
/**
* 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>
*/
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
*/
declare (strict_types = 1);
declare(strict_types=1);
namespace Namespaced;

View File

@ -173,7 +173,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
);
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

View File

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

View File

@ -110,7 +110,7 @@ class YamlFileLoader extends FileLoader
* @param array $content
* @param string $file
*/
private function parseImports($content, $file)
private function parseImports(array $content, $file)
{
if (!isset($content['imports'])) {
return;
@ -137,7 +137,7 @@ class YamlFileLoader extends FileLoader
* @param array $content
* @param string $file
*/
private function parseDefinitions($content, $file)
private function parseDefinitions(array $content, $file)
{
if (!isset($content['services'])) {
return;
@ -155,9 +155,9 @@ class YamlFileLoader extends FileLoader
/**
* Parses a definition.
*
* @param string $id
* @param array $service
* @param string $file
* @param string $id
* @param array|string $service
* @param string $file
*
* @throws InvalidArgumentException When tags are invalid
*/
@ -486,7 +486,7 @@ class YamlFileLoader extends FileLoader
*
* @param array $content
*/
private function loadFromExtensions($content)
private function loadFromExtensions(array $content)
{
foreach ($content as $namespace => $values) {
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->validateOnParse = true;
set_error_handler(function () {throw new \Exception();});
set_error_handler(function () { throw new \Exception(); });
try {
// 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),
$choiceTranslationDomain
);
};
}
return array(
'year' => $choiceTranslationDomain,

View File

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

View File

@ -290,7 +290,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
{
$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->setDumpBoundaries('', '');

View File

@ -52,6 +52,6 @@ class AddRequestFormatsListener implements EventSubscriberInterface
*/
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()
{
$this->assertEquals(
array(KernelEvents::REQUEST => 'onKernelRequest'),
array(KernelEvents::REQUEST => array('onKernelRequest', 1)),
AddRequestFormatsListener::getSubscribedEvents()
);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface
* @param PropertyDescriptionExtractorInterface[] $descriptionExtractors
* @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->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('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('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('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('staticGetter', null),
array('staticSetter', null),
);
}

View File

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

View File

@ -138,11 +138,6 @@ abstract class AnnotationClassLoader implements LoaderInterface
}
$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());
$options = array_replace($globals['options'], $annot->getOptions());
$schemes = array_merge($globals['schemes'], $annot->getSchemes());

View File

@ -136,11 +136,10 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
array_intersect_assoc($routeData['options'], $route->getOptions()),
'->load preserves options annotation'
);
$defaults = array_replace($methodArgs, $routeData['defaults']);
$this->assertCount(
count($defaults),
array_intersect_assoc($defaults, $route->getDefaults()),
'->load preserves defaults annotation and merges them with default arguments in method signature'
count($routeData['defaults']),
$route->getDefaults(),
'->load preserves defaults annotation'
);
$this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes 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
*/
@ -238,7 +280,7 @@ class LdapUserProviderTest extends \PHPUnit_Framework_TestCase
);
}
public function testLoadUserByUsernameIsSuccessfulWithPasswordAttribute()
public function testLoadUserByUsernameIsSuccessfulWithoutPasswordAttributeAndWrongCase()
{
$result = $this->getMockBuilder(CollectionInterface::class)->getMock();
$query = $this->getMockBuilder(QueryInterface::class)->getMock();
@ -248,6 +290,45 @@ class LdapUserProviderTest extends \PHPUnit_Framework_TestCase
->will($this->returnValue($result))
;
$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
->expects($this->once())
->method('offsetGet')

View File

@ -31,6 +31,7 @@ class LdapUserProvider implements UserProviderInterface
private $searchDn;
private $searchPassword;
private $defaultRoles;
private $uidKey;
private $defaultSearch;
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)
{
if (null === $uidKey) {
$uidKey = 'uid';
}
$this->ldap = $ldap;
$this->baseDn = $baseDn;
$this->searchDn = $searchDn;
$this->searchPassword = $searchPassword;
$this->defaultRoles = $defaultRoles;
$this->uidKey = $uidKey;
$this->defaultSearch = str_replace('{uid_key}', $uidKey, $filter);
$this->passwordAttribute = $passwordAttribute;
}
@ -80,7 +86,10 @@ class LdapUserProvider implements UserProviderInterface
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)
{
$password = $this->getPassword($entry);
$password = null;
if (null !== $this->passwordAttribute) {
$password = $this->getAttributeValue($entry, $this->passwordAttribute);
}
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 string $attribute
*/
private function getPassword(Entry $entry)
private function getAttributeValue(Entry $entry, $attribute)
{
if (null === $this->passwordAttribute) {
return;
if (!$entry->hasAttribute($attribute)) {
throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $attribute, $entry->getDn()));
}
if (!$entry->hasAttribute($this->passwordAttribute)) {
throw new InvalidArgumentException(sprintf('Missing attribute "%s" for user "%s".', $this->passwordAttribute, $entry->getDn()));
}
$values = $entry->getAttribute($this->passwordAttribute);
$values = $entry->getAttribute($attribute);
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];

View File

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

View File

@ -54,6 +54,6 @@ class JsonEncodeTest extends \PHPUnit_Framework_TestCase
*/
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->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}.
* 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;
}
$parentOfElem = &$elem;

View File

@ -17,7 +17,7 @@ use Symfony\Component\Validator\ConstraintValidator;
/**
* @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
{

View File

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

View File

@ -676,4 +676,14 @@ class InlineTest extends \PHPUnit_Framework_TestCase
{
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']);
}
}