8000 Merge branch '2.3' into 2.6 · symfony/symfony@eabad39 · GitHub
[go: up one dir, main page]

Skip to content

Commit eabad39

Browse files
committed
Merge branch '2.3' into 2.6
Conflicts: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig src/Symfony/Component/PropertyAccess/PropertyAccessor.php src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php
2 parents 2d6fbc5 + a108445 commit eabad39

File tree

31 files changed

+392
-261
lines changed

31 files changed

+392
-261
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,10 @@ public function getChoicesForValues(array $values)
218218
if (!$this->loaded) {
219219
// Optimize performance in case we have an entity loader and
220220
// a single-field identifier
221-
if ($this->idAsValue && $this->entityLoader) {
222-
$unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values);
221+
if ($this->idAsValue) {
222+
$unorderedEntities = $this->entityLoader
223+
? $this->entityLoader->getEntitiesByIds($this->idField, $values)
224+
: $this->em->getRepository($this->class)->findBy(array($this->idField => $values));
223225
$entitiesByValue = array();
224226
$entities = array();
225227

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
805805

806806
if ('file' === $config['cache']) {
807807
$cacheDir = $container->getParameterBag()->resolveValue($config['file_cache_dir']);
808-
if (!is_dir($cacheDir) && false === @mkdir($cacheDir, 0777, true)) {
808+
if (!is_dir($cacheDir) && false === @mkdir($cacheDir, 0777, true) && !is_dir($cacheDir)) {
809809
throw new \RuntimeException(sprintf('Could not create cache directory "%s".', $cacheDir));
810810
}
811811

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ interface SecurityFactoryInterface
2323
{
2424
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint);
2525

26+
/**
27+
* Defines the position at which the provider is called.
28+
* Possible values: pre_auth, form, http, and remember_me.
29+
*
30+
* @return string
31+
*/
2632
public function getPosition();
2733

2834
public function getKey();

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{% set link = collector.controller.file|file_link(collector.controller.line) %}
77
{% if collector.controller.method %}
88
<span class="sf-toolbar-info-class sf-toolbar-info-with-next-pointer">{{ collector.controller.class|abbr_class }}</span>
9-
<span class="sf-toolbar-info-method" onclick="{% if link %}window.location='{{link|e('js')}}';window.event.stopPropagation();return false;{% endif %}">
9+
<span class="sf-toolbar-info-method"{% if link %} onclick="window.location='{{link|e('js')}}';window.event.stopPropagation();return false;"{% endif %}>
1010
{{ collector.controller.method }}
1111
</span>
1212
{% else %}

src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class EnumNodeDefinition extends ScalarNodeDefinition
2222
{
2323
private $values;
2424

25+
/**
26+
* @param array $values
27+
*
28+
* @return EnumNodeDefinition|$this
29+
*/
2530
public function values(array $values)
2631
{
2732
$values = array_unique($values);

src/Symfony/Component/Config/Definition/Builder/NodeDefinition.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct($name, NodeParentInterface $parent = null)
5656
*
5757
* @param NodeParentInterface $parent The parent
5858
*
59-
* @return NodeDefinition
59+
* @return NodeDefinition|$this
6060
*/
6161
public function setParent(NodeParentInterface $parent)
6262
{
@@ -70,7 +70,7 @@ public function setParent(NodeParentInterface $parent)
7070
*
7171
* @param string $info The info text
7272
*
73-
* @return NodeDefinition
73+
* @return NodeDefinition|$this
7474
*/
7575
public function info($info)
7676
{
@@ -82,7 +82,7 @@ public function info($info)
8282
*
8383
* @param string|array $example
8484
*
85-
* @return NodeDefinition
85+
* @return NodeDefinition|$this
8686
*/
8787
public function example($example)
8888
{
@@ -95,7 +95,7 @@ public function example($example)
9595
* @param string $key
9696
* @param mixed $value
9797
*
98-
* @return NodeDefinition
98+
* @return NodeDefinition|$this
9999
*/
100100
public function attribute($key, $value)
101101
{
@@ -146,7 +146,7 @@ public function getNode($forceRootNode = false)
146146
*
147147
* @param mixed $value The default value
148148
*
149-
* @return NodeDefinition
149+
* @return NodeDefinition|$this
150150
*/
151151
public function defaultValue($value)
152152
{
@@ -159,7 +159,7 @@ public function defaultValue($value)
159159
/**
160160
* Sets the node as required.
161161
*
162-
* @return NodeDefinition
162+
* @return NodeDefinition|$this
163163
*/
164164
public function isRequired()
165165
{
@@ -173,7 +173,7 @@ public function isRequired()
173173
*
174174
* @param mixed $value
175175
*
176-
* @return NodeDefinition
176+
* @return NodeDefinition|$this
177177
*/
178178
public function treatNullLike($value)
179179
{
@@ -187,7 +187,7 @@ public function treatNullLike($value)
187187
*
188188
* @param mixed $value
189189
*
190-
* @return NodeDefinition
190+
* @return NodeDefinition|$this
191191
*/
192192
public function treatTrueLike($value)
193193
{
@@ -201,7 +201,7 @@ public function treatTrueLike($value)
201201
*
202202
* @param mixed $value
203203
*
204-
* @return NodeDefinition
204+
* @return NodeDefinition|$this
205205
*/
206206
public function treatFalseLike($value)
207207
{
@@ -213,7 +213,7 @@ public function treatFalseLike($value)
213213
/**
214214
* Sets null as the default value.
215215
*
216-
* @return NodeDefinition
216+
* @return NodeDefinition|$this
217217
*/
218218
public function defaultNull()
219219
{
@@ -223,7 +223,7 @@ public function defaultNull()
223223
/**
224224
* Sets true as the default value.
225225
*
226-
* @return NodeDefinition
226+
* @return NodeDefinition|$this
227227
*/
228228
public function defaultTrue()
229229
{
@@ -233,7 +233,7 @@ public function defaultTrue()
233233
/**
234234
* Sets false as the default value.
235235
*
236-
* @return NodeDefinition
236+
* @return NodeDefinition|$this
237237
*/
238238
public function defaultFalse()
239239
{
@@ -253,7 +253,7 @@ public function beforeNormalization()
253253
/**
254254
* Denies the node value being empty.
255255
*
256-
* @return NodeDefinition
256+
* @return NodeDefinition|$this
257257
*/
258258
public function cannotBeEmpty()
259259
{
@@ -281,7 +281,7 @@ public function validate()
281281
*
282282
* @param bool $deny Whether the overwriting is forbidden or not
283283
*
284-
* @return NodeDefinition
284+
* @return NodeDefinition|$this
285285
*/
286286
public function cannotBeOverwritten($deny = true)
287287
{

src/Symfony/Component/Console/Command/Command.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
173173
/**
174174
* Interacts with the user.
175175
*
176+
* This method is executed before the InputDefinition is validated.
177+
* This means that this is the only place where the command can
178+
* interactively ask for values of missing required arguments.
179+
*
176180
* @param InputInterface $input An InputInterface instance
177181
* @param OutputInterface $output An OutputInterface instance
178182
*/

src/Symfony/Component/Console/Input/ArrayInput.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ public function getParameterOption($values, $default = false)
100100
$values = (array) $values;
101101

102102
foreach ($this->parameters as $k => $v) {
103-
if (is_int($k) && in_array($v, $values)) {
104-
return true;
103+
if (is_int($k)) {
104+
if (in_array($v, $values)) {
105+
return true;
106+
}
105107
} elseif (in_array($k, $values)) {
106108
return $v;
107109
}

src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ public function testHasParameterOption()
3838
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if an option is present in the passed parameters');
3939
}
4040

41+
public function testGetParameterOption()
42+
{
43+
$input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar'));
44+
$this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name');
45+
46+
$input = new ArrayInput(array('Fabien', '--foo' => 'bar'));
47+
$this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name');
48+
}
49+
4150
public function testParseArguments()
4251
{
4352
$input = new ArrayInput(array('name' => 'foo'), new InputDefinition(array(new InputArgument('name'))));

src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,15 @@ public function testGetOptionDefaults()
341341
new InputOption('foo7', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, '', array(1, 2)),
342342
));
343343
$defaults = array(
344-
'foo1' => null,
344+
'foo1' => false,
345345
'foo2' => null,
346346
'foo3' => 'default',
347347
'foo4' => null,
348348
'foo5' => 'default',
349349
'foo6' => array(),
350350
'foo7' => array(1, 2),
351351
);
352-
$this->assertEquals($defaults, $definition->getOptionDefaults(), '->getOptionDefaults() returns the default values for all options');
352+
$this->assertSame($defaults, $definition->getOptionDefaults(), '->getOptionDefaults() returns the default values for all options');
353353
}
354354

355355
public function testGetSynopsis()

src/Symfony/Component/Finder/Finder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function depth($level)
234234
* $finder->date('> now - 2 hours');
235235
* $finder->date('>= 2005-10-15');
236236
*
237-
* @param string $date A date rage string
237+
* @param string $date A date range string
238238
*
239239
* @return Finder The current Finder instance
240240
*

src/Symfony/Component/HttpFoundation/File/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function move($directory, $name = null)
130130
protected function getTargetFile($directory, $name = null)
131131
{
132132
if (!is_dir($directory)) {
133-
if (false === @mkdir($directory, 0777, true)) {
133+
if (false === @mkdir($directory, 0777, true) && !is_dir($directory)) {
134134
throw new FileException(sprintf('Unable to create the "%s" directory', $directory));
135135
}
136136
} elseif (!is_writable($directory)) {

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ public static function getTrustedHosts()
609609
* The following header keys are supported:
610610
*
611611
* * Request::HEADER_CLIENT_IP: defaults to X-Forwarded-For (see getClientIp())
612-
* * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getClientHost())
613-
* * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getClientPort())
612+
* * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost())
613+
* * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort())
614614
* * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure())
615615
*
616616
* Setting an empty value allows to disable the trusted header for the given key.

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ protected function buildContainer()
605605
{
606606
foreach (array('cache' => $this->getCacheDir(), 'logs' => $this->getLogDir()) as $name => $dir) {
607607
if (!is_dir($dir)) {
608-
if (false === @mkdir($dir, 0777, true)) {
608+
if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
609609
throw new \RuntimeException(sprintf("Unable to create the %s directory (%s)\n", $name, $dir));
610610
}
611611
} elseif (!is_writable($dir)) {

0 commit comments

Comments
 (0)
0