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

@ -353,6 +353,8 @@ class ClassCollectionLoader
$unresolved = new \ArrayObject();
}
$nodeName = $node->getName();
if (isset($tree[$nodeName])) {
$unresolved[$nodeName] = $node;
foreach ($tree[$nodeName] as $dependency) {
if (!$resolved->offsetExists($dependency->getName())) {
@ -361,6 +363,7 @@ class ClassCollectionLoader
}
$resolved[$nodeName] = $node;
unset($unresolved[$nodeName]);
}
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
*/

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

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

View File

@ -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