Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6399ffa

Browse filesBrowse files
committed
Merge branch '3.1'
* 3.1: [TwigBundle] added missing dependencies for tests fixed CS adding missing dep [TwigBundle] Adjust CacheWarmingTest for TemplateCacheWarmer introduced in 2.8 [TwigBundle] Fix CacheWarmingTest are order dependent Revert "bug #20080 [Form] compound forms without children should be considered rendered implicitly (backbone87)" [2.7][VarDumper] Fix PHP 7.1 compat [2.8][VarDumper] Fix PHP 7.1 compat silent file operation to avoid open basedir issues Fix #19943 Make sure to process each interface metadata only once #17580 compound forms without children should be considered rendered implicitly
2 parents 418944b + 0a56032 commit 6399ffa
Copy full SHA for 6399ffa

File tree

11 files changed

+108
-32
lines changed
Filter options

11 files changed

+108
-32
lines changed

‎src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testCacheIsProperlyWarmedWhenTemplatingIsAvailable()
3131
$this->assertTrue(file_exists($kernel->getCacheDir().'/twig'));
3232
}
3333

34-
public function testCacheIsNotWarmedWhenTemplatingIsDisabled()
34+
public function testCacheIsProperlyWarmedWhenTemplatingIsDisabled()
3535
{
3636
$kernel = new CacheWarmingKernel(false);
3737
$kernel->boot();
@@ -40,7 +40,7 @@ public function testCacheIsNotWarmedWhenTemplatingIsDisabled()
4040
$warmer->enableOptionalWarmers();
4141
$warmer->warmUp($kernel->getCacheDir());
4242

43-
$this->assertFalse(file_exists($kernel->getCacheDir().'/twig'));
43+
$this->assertTrue(file_exists($kernel->getCacheDir().'/twig'));
4444
}
4545

4646
protected function setUp()
@@ -72,7 +72,7 @@ public function __construct($withTemplating)
7272
{
7373
$this->withTemplating = $withTemplating;
7474

75-
parent::__construct('dev', true);
75+
parent::__construct(($withTemplating ? 'with' : 'without').'_templating', true);
7676
}
7777

7878
public function getName()
@@ -106,7 +106,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
106106

107107
public function getCacheDir()
108108
{
109-
return sys_get_temp_dir().'/'.Kernel::VERSION.'/CacheWarmingKernel/cache';
109+
return sys_get_temp_dir().'/'.Kernel::VERSION.'/CacheWarmingKernel/cache/'.$this->environment;
110110
}
111111

112112
public function getLogDir()

‎src/Symfony/Bundle/TwigBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/composer.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"symfony/routing": "~2.8|~3.0",
3333
"symfony/templating": "~2.8|~3.0",
3434
"symfony/yaml": "~2.8|~3.0",
35-
"symfony/framework-bundle": "~3.2"
35+
"symfony/framework-bundle": "~3.2",
36+
"doctrine/annotations": "~1.0"
3637
},
3738
"autoload": {
3839
"psr-4": { "Symfony\\Bundle\\TwigBundle\\": "" },

‎src/Symfony/Component/Process/ExecutableFinder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Process/ExecutableFinder.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function find($name, $default = null, array $extraDirs = array())
7979
}
8080
foreach ($suffixes as $suffix) {
8181
foreach ($dirs as $dir) {
82-
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
82+
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
8383
return $file;
8484
}
8585
}

‎src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Mapping/Factory/LazyLoadingMetadataFactory.php
+21-3Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,27 @@ public function getMetadataFor($value)
114114
$metadata->mergeConstraints($this->getMetadataFor($parent->name));
115115
}
116116

117-
// Include constraints from all implemented interfaces that have not been processed via parent class yet
118-
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) {
119-
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name || ($parent && $parent->implementsInterface($interface->name))) {
117+
$interfaces = $metadata->getReflectionClass()->getInterfaces();
118+
119+
$interfaces = array_filter($interfaces, function ($interface) use ($parent, $interfaces) {
120+
$interfaceName = $interface->getName();
121+
122+
if ($parent && $parent->implementsInterface($interfaceName)) {
123+
return false;
124+
}
125+
126+
foreach ($interfaces as $i) {
127+
if ($i !== $interface && $i->implementsInterface($interfaceName)) {
128+
return false;
129+
}
130+
}
131+
132+
return true;
133+
});
134+
135+
// Include constraints from all directly implemented interfaces
136+
foreach ($interfaces as $interface) {
137+
if ('Symfony\Component\Validator\GroupSequenceProviderInterface' === $interface->name) {
120138
continue;
121139
}
122140
$metadata->mergeConstraints($this->getMetadataFor($interface->name));

‎src/Symfony/Component/Validator/Tests/Fixtures/Entity.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Fixtures/Entity.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @Assert\GroupSequence({"Foo", "Entity"})
2020
* @Assert\Callback({"Symfony\Component\Validator\Tests\Fixtures\CallbackClass", "callback"})
2121
*/
22-
class Entity extends EntityParent
22+
class Entity extends EntityParent implements EntityInterfaceB
2323
{
2424
/**
2525
* @Assert\NotNull

‎src/Symfony/Component/Validator/Tests/Fixtures/EntityInterface.php renamed to ‎src/Symfony/Component/Validator/Tests/Fixtures/EntityInterfaceA.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Fixtures/EntityInterfaceA.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
namespace Symfony\Component\Validator\Tests\Fixtures;
1313

14-
interface EntityInterface
14+
interface EntityInterfaceA
1515
{
1616
}
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Tests\Fixtures;
13+
14+
interface EntityInterfaceB extends EntityParentInterface
15+
{
16+
}

‎src/Symfony/Component/Validator/Tests/Fixtures/EntityParent.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Fixtures/EntityParent.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Validator\Constraints\NotNull;
1515

16-
class EntityParent implements EntityInterface
16+
class EntityParent implements EntityInterfaceA
1717
{
1818
protected $firstName;
1919
private $internal;
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Validator\Tests\Fixtures;
13+
14+
interface EntityParentInterface
15+
{
16+
}

‎src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php
+32-17Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@
1818

1919
class LazyLoadingMetadataFactoryTest extends \PHPUnit_Framework_TestCase
2020
{
21-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
22-
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
23-
const INTERFACECLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterface';
21+
const CLASS_NAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
22+
const PARENT_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
23+
const INTERFACE_A_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceA';
24+
const INTERFACE_B_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceB';
25+
const PARENT_INTERFACE_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParentInterface';
2426

2527
public function testLoadClassMetadataWithInterface()
2628
{
2729
$factory = new LazyLoadingMetadataFactory(new TestLoader());
28-
$metadata = $factory->getMetadataFor(self::PARENTCLASS);
30+
$metadata = $factory->getMetadataFor(self::PARENT_CLASS);
2931

3032
$constraints = array(
31-
new ConstraintA(array('groups' => array('Default', 'EntityInterface', 'EntityParent'))),
33+
new ConstraintA(array('groups' => array('Default', 'EntityInterfaceA', 'EntityParent'))),
3234
new ConstraintA(array('groups' => array('Default', 'EntityParent'))),
3335
);
3436

@@ -38,12 +40,12 @@ public function testLoadClassMetadataWithInterface()
3840
public function testMergeParentConstraints()
3941
{
4042
$factory = new LazyLoadingMetadataFactory(new TestLoader());
41-
$metadata = $factory->getMetadataFor(self::CLASSNAME);
43+
$metadata = $factory->getMetadataFor(self::CLASS_NAME);
4244

4345
$constraints = array(
4446
new ConstraintA(array('groups' => array(
4547
'Default',
46-
'EntityInterface',
48+
'EntityInterfaceA',
4749
'EntityParent',
4850
'Entity',
4951
))),
@@ -52,6 +54,17 @@ public function testMergeParentConstraints()
5254
'EntityParent',
5355
'Entity',
5456
))),
57+
new ConstraintA(array('groups' => array(
58+
'Default',
59+
'EntityParentInterface',
60+
'EntityInterfaceB',
61+
'Entity',
62+
))),
63+
new ConstraintA(array('groups' => array(
64+
'Default',
65+
'EntityInterfaceB',
66+
'Entity',
67+
))),
5568
new ConstraintA(array('groups' => array(
5669
'Default',
5770
'Entity',
@@ -67,34 +80,36 @@ public function testWriteMetadataToCache()
6780
$factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache);
6881

6982
$parentClassConstraints = array(
70-
new ConstraintA(array('groups' => array('Default', 'EntityInterface', 'EntityParent'))),
83+
new ConstraintA(array('groups' => array('Default', 'EntityInterfaceA', 'EntityParent'))),
7184
new ConstraintA(array('groups' => array('Default', 'EntityParent'))),
7285
);
73-
$interfaceConstraints = array(new ConstraintA(array('groups' => array('Default', 'EntityInterface'))));
86+
$interfaceAConstraints = array(
87+
new ConstraintA(array('groups' => array('Default', 'EntityInterfaceA'))),
88+
);
7489

7590
$cache->expects($this->never())
7691
->method('has');
7792
$cache->expects($this->exactly(2))
7893
->method('read')
7994
->withConsecutive(
80-
array($this->equalTo(self::PARENTCLASS)),
81-
array($this->equalTo(self::INTERFACECLASS))
95+
array($this->equalTo(self::PARENT_CLASS)),
96+
array($this->equalTo(self::INTERFACE_A_CLASS))
8297
)
8398
->will($this->returnValue(false));
8499
$cache->expects($this->exactly(2))
85100
->method('write')
86101
->withConsecutive(
87-
$this->callback(function ($metadata) use ($interfaceConstraints) {
88-
return $interfaceConstraints == $metadata->getConstraints();
102+
$this->callback(function ($metadata) use ($interfaceAConstraints) {
103+
return $interfaceAConstraints == $metadata->getConstraints();
89104
}),
90105
$this->callback(function ($metadata) use ($parentClassConstraints) {
91106
return $parentClassConstraints == $metadata->getConstraints();
92107
})
93108
);
94109

95-
$metadata = $factory->getMetadataFor(self::PARENTCLASS);
110+
$metadata = $factory->getMetadataFor(self::PARENT_CLASS);
96111

97-
$this->assertEquals(self::PARENTCLASS, $metadata->getClassName());
112+
$this->assertEquals(self::PARENT_CLASS, $metadata->getClassName());
98113
$this->assertEquals($parentClassConstraints, $metadata->getConstraints());
99114
}
100115

@@ -104,7 +119,7 @@ public function testReadMetadataFromCache()
104119
$cache = $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface');
105120
$factory = new LazyLoadingMetadataFactory($loader, $cache);
106121

107-
$metadata = new ClassMetadata(self::PARENTCLASS);
122+
$metadata = new ClassMetadata(self::PARENT_CLASS);
108123
$metadata->addConstraint(new ConstraintA());
109124

110125
$loader->expects($this->never())
@@ -116,7 +131,7 @@ public function testReadMetadataFromCache()
116131
->method('read')
117132
->will($this->returnValue($metadata));
118133

119-
$this->assertEquals($metadata, $factory->getMetadataFor(self::PARENTCLASS));
134+
$this->assertEquals($metadata, $factory->getMetadataFor(self::PARENT_CLASS));
120135
}
121136
}
122137

‎src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php
+13-3Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNes
7373
$prefix = Caster::PREFIX_VIRTUAL;
7474

7575
$a += array(
76-
$prefix.'type' => $c->__toString(),
76+
$prefix.'name' => method_exists('ReflectionType', 'getName') ? $c->getName() : $c->__toString(),
7777
$prefix.'allowsNull' => $c->allowsNull(),
7878
$prefix.'isBuiltin' => $c->isBuiltin(),
7979
);
@@ -217,12 +217,13 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
217217
'position' => 'getPosition',
218218
'isVariadic' => 'isVariadic',
219219
'byReference' => 'isPassedByReference',
220+
'allowsNull' => 'allowsNull',
220221
));
221222

222223
try {
223224
if (method_exists($c, 'hasType')) {
224225
if ($c->hasType()) {
225-
$a[$prefix.'typeHint'] = $c->getType()->__toString();
226+
$a[$prefix.'typeHint'] = method_exists('ReflectionType', 'getName') ? $c->getType()->getName() : $c->getType()->__toString();
226227
}
227228
} else {
228229
$v = explode(' ', $c->__toString(), 6);
@@ -235,19 +236,28 @@ public static function castParameter(\ReflectionParameter $c, array $a, Stub $st
235236
$a[$prefix.'typeHint'] = $m[1];
236237
}
237238
}
239+
<<<<<<< HEAD
238240
if (isset($a[$prefix.'typeHint'])) {
239241
$v = $a[$prefix.'typeHint'];
240242
$a[$prefix.'typeHint'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
243+
=======
244+
if (!isset($a[$prefix.'typeHint'])) {
245+
unset($a[$prefix.'allowsNull']);
246+
>>>>>>> 3.1
241247
}
242248

243249
try {
244250
$a[$prefix.'default'] = $v = $c->getDefaultValue();
245251
if (method_exists($c, 'isDefaultValueConstant') && $c->isDefaultValueConstant()) {
246252
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
247253
}
254+
if (null === $v) {
255+
unset($a[$prefix.'allowsNull']);
256+
}
248257
} catch (\ReflectionException $e) {
249-
if (isset($a[$prefix.'typeHint']) && $c->allowsNull()) {
258+
if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !method_exists('ReflectionType', 'getName')) {
250259
$a[$prefix.'default'] = null;
260+
unset($a[$prefix.'allowsNull']);
251261
}
252262
}
253263

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.