Merge branch '2.3' into 2.5

* 2.3:
  fix phpdoc's alignment
  Minor phpcs fixes
  [ClassLoader] Fix undefined index in ClassCollectionLoader

Conflicts:
	src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
This commit is contained in:
Fabien Potencier 2014-12-08 09:43:12 +01:00
commit 7bb6f4445c
14 changed files with 96 additions and 45 deletions

View File

@ -24,8 +24,8 @@ use Symfony\Bridge\Propel1\Form\EventListener\TranslationFormListener;
class TranslationType extends AbstractType class TranslationType extends AbstractType
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->addEventSubscriber( $builder->addEventSubscriber(

View File

@ -353,14 +353,17 @@ class ClassCollectionLoader
$unresolved = new \ArrayObject(); $unresolved = new \ArrayObject();
} }
$nodeName = $node->getName(); $nodeName = $node->getName();
$unresolved[$nodeName] = $node;
foreach ($tree[$nodeName] as $dependency) { if (isset($tree[$nodeName])) {
if (!$resolved->offsetExists($dependency->getName())) { $unresolved[$nodeName] = $node;
self::resolveDependencies($tree, $dependency, $resolved, $unresolved); 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; return $resolved;
} }

View File

@ -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 * @dataProvider getFixNamespaceDeclarationsData
*/ */

View File

@ -0,0 +1,8 @@
<?php
namespace ClassesWithParents;
class F
{
use CTrait;
}

View File

@ -0,0 +1,8 @@
<?php
namespace ClassesWithParents;
class G
{
use CTrait;
}

View File

@ -20,10 +20,10 @@ namespace Symfony\Component\EventDispatcher;
* You can call the method stopPropagation() to abort the execution of * You can call the method stopPropagation() to abort the execution of
* further listeners in your event listener. * further listeners in your event listener.
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com> * @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @api * @api
*/ */

View File

@ -17,13 +17,13 @@ namespace Symfony\Component\EventDispatcher;
* Listeners are registered on the manager and events are dispatched through the * Listeners are registered on the manager and events are dispatched through the
* manager. * manager.
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com> * @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be> * @author Jordi Boggiano <j.boggiano@seld.be>
* @author Jordan Alliot <jordan.alliot@gmail.com> * @author Jordan Alliot <jordan.alliot@gmail.com>
* *
* @api * @api
*/ */

View File

@ -17,10 +17,10 @@ namespace Symfony\Component\EventDispatcher;
* {@link getSubscribedEvents} and registers the subscriber as a listener for all * {@link getSubscribedEvents} and registers the subscriber as a listener for all
* returned events. * returned events.
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com> * @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>
* *
* @api * @api
*/ */

View File

@ -164,7 +164,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
} }
/** /**
* @param $rootBundle * @param ArrayAccessibleResourceBundle $rootBundle
* *
* @return array * @return array
*/ */

View File

@ -186,7 +186,7 @@ class StringUtil
return $singulars; return $singulars;
} }
return $newBase.($firstUpper ? ucFirst($newSuffix) : $newSuffix); return $newBase.($firstUpper ? ucfirst($newSuffix) : $newSuffix);
} }
// Suffix is longer than word // Suffix is longer than word

View File

@ -24,12 +24,12 @@ use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterfac
*/ */
interface AuthenticationProviderInterface extends AuthenticationManagerInterface interface AuthenticationProviderInterface extends AuthenticationManagerInterface
{ {
/** /**
* Checks whether this provider supports the given token. * Checks whether this provider supports the given token.
* *
* @param TokenInterface $token A TokenInterface instance * @param TokenInterface $token A TokenInterface instance
* *
* @return bool true if the implementation supports the Token, false otherwise * @return bool true if the implementation supports the Token, false otherwise
*/ */
public function supports(TokenInterface $token); public function supports(TokenInterface $token);
} }

View File

@ -117,17 +117,17 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
return $data; return $data;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsEncoding($format) public function supportsEncoding($format)
{ {
return 'xml' === $format; return 'xml' === $format;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsDecoding($format) public function supportsDecoding($format)
{ {
return 'xml' === $format; return 'xml' === $format;

View File

@ -21,15 +21,15 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
class TestDenormalizer implements DenormalizerInterface class TestDenormalizer implements DenormalizerInterface
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function denormalize($data, $class, $format = null, array $context = array()) public function denormalize($data, $class, $format = null, array $context = array())
{ {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsDenormalization($data, $type, $format = null) public function supportsDenormalization($data, $type, $format = null)
{ {
return true; return true;

View File

@ -21,15 +21,15 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class TestNormalizer implements NormalizerInterface class TestNormalizer implements NormalizerInterface
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function normalize($object, $format = null, array $context = array()) public function normalize($object, $format = null, array $context = array())
{ {
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsNormalization($data, $format = null) public function supportsNormalization($data, $format = null)
{ {
return true; return true;