diff --git a/src/Symfony/Bridge/Propel1/Form/Type/TranslationType.php b/src/Symfony/Bridge/Propel1/Form/Type/TranslationType.php index 8315b4f347..6881476533 100644 --- a/src/Symfony/Bridge/Propel1/Form/Type/TranslationType.php +++ b/src/Symfony/Bridge/Propel1/Form/Type/TranslationType.php @@ -24,8 +24,8 @@ use Symfony\Bridge\Propel1\Form\EventListener\TranslationFormListener; class TranslationType extends AbstractType { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->addEventSubscriber( diff --git a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 7e3d275899..6bf4ebd545 100644 --- a/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -353,14 +353,17 @@ class ClassCollectionLoader $unresolved = new \ArrayObject(); } $nodeName = $node->getName(); - $unresolved[$nodeName] = $node; - foreach ($tree[$nodeName] as $dependency) { - if (!$resolved->offsetExists($dependency->getName())) { - self::resolveDependencies($tree, $dependency, $resolved, $unresolved); + + if (isset($tree[$nodeName])) { + $unresolved[$nodeName] = $node; + foreach ($tree[$nodeName] as $dependency) { + if (!$resolved->offsetExists($dependency->getName())) { + self::resolveDependencies($tree, $dependency, $resolved, $unresolved); + } } + $resolved[$nodeName] = $node; + unset($unresolved[$nodeName]); } - $resolved[$nodeName] = $node; - unset($unresolved[$nodeName]); return $resolved; } diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index 696943ed93..e821e45063 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -146,6 +146,38 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase ); } + public function testFixClassWithTraitsOrdering() + { + if (PHP_VERSION_ID < 50400) { + $this->markTestSkipped('Requires PHP > 5.4'); + + return; + } + + require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/F.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/G.php'; + + $classes = array( + 'ClassesWithParents\\F', + 'ClassesWithParents\\G', + ); + + $expected = array( + 'ClassesWithParents\\CTrait', + 'ClassesWithParents\\F', + 'ClassesWithParents\\G', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + /** * @dataProvider getFixNamespaceDeclarationsData */ diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/F.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/F.php new file mode 100644 index 0000000000..a0a5172d71 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/F.php @@ -0,0 +1,8 @@ +getMaxAttempts(); while (null === $attempts || $attempts--) { if (null !== $error) { - $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error')); + if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) { + $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'); + } else { + $message = ''.$error->getMessage().''; + } + + $output->writeln($message); } try { diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php index d6de09798c..e1da7a8c5e 100644 --- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php +++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php @@ -23,6 +23,13 @@ class ChoiceQuestion extends Question private $prompt = ' > '; private $errorMessage = 'Value "%s" is invalid'; + /** + * Constructor. + * + * @param string $question The question to ask to the user + * @param array $choices The list of available choices + * @param mixed $default The default answer to return + */ public function __construct($question, array $choices, $default = null) { parent::__construct($question, $default); @@ -100,6 +107,11 @@ class ChoiceQuestion extends Question return $this; } + /** + * Returns the default answer validator. + * + * @return callable + */ private function getDefaultValidator() { $choices = $this->choices; diff --git a/src/Symfony/Component/Console/Question/ConfirmationQuestion.php b/src/Symfony/Component/Console/Question/ConfirmationQuestion.php index 0438640fa4..09ac74ff65 100644 --- a/src/Symfony/Component/Console/Question/ConfirmationQuestion.php +++ b/src/Symfony/Component/Console/Question/ConfirmationQuestion.php @@ -18,6 +18,12 @@ namespace Symfony\Component\Console\Question; */ class ConfirmationQuestion extends Question { + /** + * Constructor. + * + * @param string $question The question to ask to the user + * @param bool $default The default answer to return, true or false + */ public function __construct($question, $default = true) { parent::__construct($question, (bool) $default); @@ -25,6 +31,11 @@ class ConfirmationQuestion extends Question $this->setNormalizer($this->getDefaultNormalizer()); } + /** + * Returns the default answer normalizer. + * + * @return callable + */ private function getDefaultNormalizer() { $default = $this->getDefault(); diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index 6a7b07f9a1..9f776d5790 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -116,7 +116,7 @@ class Question /** * Gets values for the autocompleter. * - * @return null|array|Traversable + * @return null|array|\Traversable */ public function getAutocompleterValues() { @@ -126,7 +126,7 @@ class Question /** * Sets values for the autocompleter. * - * @param null|array|Traversable $values + * @param null|array|\Traversable $values * * @return Question The current instance * @@ -165,7 +165,7 @@ class Question } /** - * Gets the validator for the question + * Gets the validator for the question. * * @return null|callable */ @@ -211,9 +211,9 @@ class Question /** * Sets a normalizer for the response. * - * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. + * The normalizer can be a callable (a string), a closure or a class implementing __invoke. * - * @param string|Closure $normalizer + * @param string|\Closure $normalizer * * @return Question The current instance */ @@ -229,7 +229,7 @@ class Question * * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. * - * @return string|Closure + * @return string|\Closure */ public function getNormalizer() { diff --git a/src/Symfony/Component/EventDispatcher/Event.php b/src/Symfony/Component/EventDispatcher/Event.php index 34d9e81da7..27e00c2626 100644 --- a/src/Symfony/Component/EventDispatcher/Event.php +++ b/src/Symfony/Component/EventDispatcher/Event.php @@ -20,10 +20,10 @@ namespace Symfony\Component\EventDispatcher; * You can call the method stopPropagation() to abort the execution of * further listeners in your event listener. * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Bernhard Schussek * * @api */ diff --git a/src/Symfony/Component/EventDispatcher/EventDispatcher.php b/src/Symfony/Component/EventDispatcher/EventDispatcher.php index 222a937141..89559f1b06 100644 --- a/src/Symfony/Component/EventDispatcher/EventDispatcher.php +++ b/src/Symfony/Component/EventDispatcher/EventDispatcher.php @@ -17,13 +17,13 @@ namespace Symfony\Component\EventDispatcher; * Listeners are registered on the manager and events are dispatched through the * manager. * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Fabien Potencier - * @author Jordi Boggiano - * @author Jordan Alliot + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Bernhard Schussek + * @author Fabien Potencier + * @author Jordi Boggiano + * @author Jordan Alliot * * @api */ diff --git a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php index 080f892fdf..ff7e305cd5 100644 --- a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php @@ -17,10 +17,10 @@ namespace Symfony\Component\EventDispatcher; * {@link getSubscribedEvents} and registers the subscriber as a listener for all * returned events. * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Bernhard Schussek * * @api */ diff --git a/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php index a00104913e..fea260558f 100644 --- a/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php @@ -164,7 +164,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator } /** - * @param $rootBundle + * @param ArrayAccessibleResourceBundle $rootBundle * * @return array */ diff --git a/src/Symfony/Component/PropertyAccess/StringUtil.php b/src/Symfony/Component/PropertyAccess/StringUtil.php index c8176db964..91adedb2bc 100644 --- a/src/Symfony/Component/PropertyAccess/StringUtil.php +++ b/src/Symfony/Component/PropertyAccess/StringUtil.php @@ -186,7 +186,7 @@ class StringUtil return $singulars; } - return $newBase.($firstUpper ? ucFirst($newSuffix) : $newSuffix); + return $newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix); } // Suffix is longer than word diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php b/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php index 401df6da64..8007234175 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php +++ b/src/Symfony/Component/Security/Core/Authentication/Provider/AuthenticationProviderInterface.php @@ -24,12 +24,12 @@ use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterfac */ interface AuthenticationProviderInterface extends AuthenticationManagerInterface { - /** - * Checks whether this provider supports the given token. - * - * @param TokenInterface $token A TokenInterface instance - * - * @return bool true if the implementation supports the Token, false otherwise - */ + /** + * Checks whether this provider supports the given token. + * + * @param TokenInterface $token A TokenInterface instance + * + * @return bool true if the implementation supports the Token, false otherwise + */ public function supports(TokenInterface $token); } diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 709b8b65c3..44e4a1c36d 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -129,17 +129,17 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec return $data; } - /** - * {@inheritdoc} - */ + /** + * {@inheritdoc} + */ public function supportsEncoding($format) { return 'xml' === $format; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function supportsDecoding($format) { return 'xml' === $format; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php b/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php index e881ad1397..7525d5c928 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/TestDenormalizer.php @@ -21,15 +21,15 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class TestDenormalizer implements DenormalizerInterface { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function denormalize($data, $class, $format = null, array $context = array()) { } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function supportsDenormalization($data, $type, $format = null) { return true; diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php b/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php index 4c000b3eb4..4b29e8fa5d 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/TestNormalizer.php @@ -21,15 +21,15 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class TestNormalizer implements NormalizerInterface { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function normalize($object, $format = null, array $context = array()) { } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function supportsNormalization($data, $format = null) { return true;