Skip to content

Commit 7589493

Browse files
Merge branch '2.7' into 2.8
* 2.7: [HttpFoundation] fixed return type of method HeaderBag::get [HttpFoundation] Added "resource" type on Request::create docblock Revert "bug symfony#25789 Enableable ArrayNodeDefinition is disabled for empty configuration (kejwmen)" Revert "bug symfony#25851 [Validator] Conflict with egulias/email-validator 2.0 (emodric)" [Validator] add missing parent isset and add test
2 parents ac3e1b1 + 44a03b1 commit 7589493

File tree

9 files changed

+35
-55
lines changed

9 files changed

+35
-55
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
"sensio/framework-extra-bundle": "^3.0.2"
9494
},
9595
"conflict": {
96-
"egulias/email-validator": ">=2.0",
9796
"phpdocumentor/reflection": "<1.0.7",
9897
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
9998
},

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ public function canBeEnabled()
227227
->beforeNormalization()
228228
->ifArray()
229229
->then(function ($v) {
230-
if (!isset($v['enabled'])) {
231-
$v['enabled'] = !empty($v);
232-
}
230+
$v['enabled'] = isset($v['enabled']) ? $v['enabled'] : true;
233231

234232
return $v;
235233
})

src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,6 @@ public function testCanBeDisabled()
207207
$this->assertTrue($this->getField($enabledNode, 'defaultValue'));
208208
}
209209

210-
public function testEnableableNodeIsDisabledForEmptyConfigurationWhenNormalized()
211-
{
212-
$config = array();
213-
214-
$node = new ArrayNodeDefinition('root');
215-
$node->canBeEnabled();
216-
217-
$this->assertEquals(
218-
array('enabled' => false),
219-
$node->getNode()->normalize($config),
220-
'An enableable node is disabled by default'
221-
);
222-
}
223-
224210
public function testIgnoreExtraKeys()
225211
{
226212
$node = new ArrayNodeDefinition('root');
@@ -254,7 +240,6 @@ public function getEnableableNodeFixtures()
254240
array(array('enabled' => true, 'foo' => 'baz'), array(array('foo' => 'baz')), 'any configuration enables an enableable node'),
255241
array(array('enabled' => false, 'foo' => 'baz'), array(array('foo' => 'baz', 'enabled' => false)), 'An enableable node can be disabled'),
256242
array(array('enabled' => false, 'foo' => 'bar'), array(false), 'false disables an enableable node'),
257-
array(array('enabled' => false, 'foo' => 'bar'), array(), 'enableable node is disabled by default'),
258243
);
259244
}
260245

src/Symfony/Component/Config/Tests/Definition/Builder/TreeBuilderTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Config\Tests\Definition\Builder;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Config\Definition\Processor;
1615
use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder;
1716
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1817

@@ -132,22 +131,4 @@ public function testDefinitionExampleGetsTransferredToNode()
132131
$this->assertInternalType('array', $tree->getExample());
133132
$this->assertEquals('example', $children['child']->getExample());
134133
}
135-
136-
public function testRootNodeThatCanBeEnabledIsDisabledByDefault()
137-
{
138-
$builder = new TreeBuilder();
139-
140-
$builder->root('test')
141-
->canBeEnabled();
142-
143-
$tree = $builder->buildTree();
144-
$children = $tree->getChildren();
145-
146-
$this->assertFalse($children['enabled']->getDefaultValue());
147-
148-
$processor = new Processor();
149-
$result = $processor->process($tree, array());
150-
151-
$this->assertEquals(array('enabled' => false), $result);
152-
}
153134
}

src/Symfony/Component/HttpFoundation/HeaderBag.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public function add(array $headers)
101101
/**
102102
* Returns a header value by name.
103103
*
104-
* @param string $key The header name
105-
* @param mixed $default The default value
106-
* @param bool $first Whether to return the first value or all header values
104+
* @param string $key The header name
105+
* @param string|string[] $default The default value
106+
* @param bool $first Whether to return the first value or all header values
107107
*
108-
* @return string|array The first header value if $first is true, an array of values otherwise
108+
* @return string|string[] The first header value or default value if $first is true, an array of values otherwise
109109
*/
110110
public function get($key, $default = null, $first = true)
111111
{
@@ -129,9 +129,9 @@ public function get($key, $default = null, $first = true)
129129
/**
130130
* Sets a header by name.
131131
*
132-
* @param string $key The key
133-
* @param string|array $values The value or an array of values
134-
* @param bool $replace Whether to replace the actual value or not (true by default)
132+
* @param string $key The key
133+
* @param string|string[] $values The value or an array of values
134+
* @param bool $replace Whether to replace the actual value or not (true by default)
135135
*/
136136
public function set($key, $values, $replace = true)
137137
{

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,13 @@ public static function createFromGlobals()
303303
* The information contained in the URI always take precedence
304304
* over the other information (server and parameters).
305305
*
306-
* @param string $uri The URI
307-
* @param string $method The HTTP method
308-
* @param array $parameters The query (GET) or request (POST) parameters
309-
* @param array $cookies The request cookies ($_COOKIE)
310-
* @param array $files The request files ($_FILES)
311-
* @param array $server The server parameters ($_SERVER)
312-
* @param string $content The raw body data
306+
* @param string $uri The URI
307+
* @param string $method The HTTP method
308+
* @param array $parameters The query (GET) or request (POST) parameters
309+
* @param array $cookies The request cookies ($_COOKIE)
310+
* @param array $files The request files ($_FILES)
311+
* @param array $server The server parameters ($_SERVER)
312+
* @param string|resource $content The raw body data
313313
*
314314
* @return static
315315
*/

src/Symfony/Component/Validator/Constraint.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ public function __get($option)
214214
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
215215
}
216216

217+
/**
218+
* @param string $option The option name
219+
*
220+
* @return bool
221+
*/
222+
public function __isset($option)
223+
{
224+
return 'groups' === $option;
225+
}
226+
217227
/**
218228
* Adds the given group if this constraint is in the Default group.
219229
*

src/Symfony/Component/Validator/Tests/Constraints/FileTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat)
2626

2727
$this->assertSame($bytes, $file->maxSize);
2828
$this->assertSame($binaryFormat, $file->binaryFormat);
29+
$this->assertTrue($file->__isset('maxSize'));
30+
}
31+
32+
public function testMagicIsset()
33+
{
34+
$file = new File(array('maxSize' => 1));
35+
36+
$this->assertTrue($file->__isset('maxSize'));
37+
$this->assertTrue($file->__isset('groups'));
38+
$this->assertFalse($file->__isset('toto'));
2939
}
3040

3141
/**

src/Symfony/Component/Validator/composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
"symfony/property-access": "For using the 2.4 Validator API",
4343
"symfony/expression-language": "For using the 2.4 Expression validator"
4444
},
45-
"conflict": {
46-
"egulias/email-validator": ">=2.0"
47-
},
4845
"autoload": {
4946
"psr-4": { "Symfony\\Component\\Validator\\": "" },
5047
"exclude-from-classmap": [

0 commit comments

Comments
 (0)