Skip to content

Commit ec7b3f2

Browse files
Merge branch '2.3' into 2.7
* 2.3: [DomCrawler] Clarify the value returned by getPhpFiles() [DependencyInjection] Fix #16461 Let Container::set() replace existing aliases Added more exceptions to singularify method
2 parents 80e08d3 + 1be2d34 commit ec7b3f2

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

src/Symfony/Component/DependencyInjection/Container.php

+4
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER)
193193
$this->scopedServices[$scope][$id] = $service;
194194
}
195195

196+
if (isset($this->aliases[$id])) {
197+
unset($this->aliases[$id]);
198+
}
199+
196200
$this->services[$id] = $service;
197201

198202
if (method_exists($this, $method = 'synchronize'.strtr($id, $this->underscoreMap).'Service')) {

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ public function testAddAliases()
218218
$this->assertTrue(isset($aliases['foobar']));
219219
}
220220

221+
public function testSetReplacesAlias()
222+
{
223+
$builder = new ContainerBuilder();
224+
$builder->setAlias('alias', 'aliased');
225+
$builder->set('aliased', new \stdClass());
226+
227+
$builder->set('alias', $foo = new \stdClass());
228+
$this->assertSame($foo, $builder->get('alias'), '->set() replaces an existing alias');
229+
}
230+
221231
public function testAddGetCompilerPass()
222232
{
223233
$builder = new ContainerBuilder();

src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ public function testSetAlsoCallsSynchronizeService()
184184
$this->assertTrue($c->synchronized, '->set() calls synchronize*Service() if it is defined for the service');
185185
}
186186

187+
public function testSetReplacesAlias()
188+
{
189+
$c = new ProjectServiceContainer();
190+
191+
$c->set('alias', $foo = new \stdClass());
192+
$this->assertSame($foo, $c->get('alias'), '->set() replaces an existing alias');
193+
}
194+
187195
public function testGet()
188196
{
189197
$sc = new ProjectServiceContainer();

src/Symfony/Component/DomCrawler/Form.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,12 @@ public function getPhpValues()
157157
*
158158
* This method converts fields with the array notation
159159
* (like foo[bar] to arrays) like PHP does.
160+
* The returned array is consistent with the array for field values
161+
* (@see getPhpValues), rather than uploaded files found in $_FILES.
162+
* For a compound file field foo[bar] it will create foo[bar][name],
163+
* instead of foo[name][bar] which would be found in $_FILES.
160164
*
161-
* @return array An array of field values.
165+
* @return array An array of file field values.
162166
*/
163167
public function getPhpFiles()
164168
{

src/Symfony/Component/PropertyAccess/StringUtil.php

+9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class StringUtil
3939
// nebulae (nebula)
4040
array('ea', 2, true, true, 'a'),
4141

42+
// services (service)
43+
array('secivres', 8, true, true, 'service'),
44+
4245
// mice (mouse), lice (louse)
4346
array('eci', 3, false, true, 'ouse'),
4447

@@ -66,6 +69,12 @@ class StringUtil
6669
// movies (movie)
6770
array('seivom', 6, true, true, 'movie'),
6871

72+
// news (news)
73+
array('swen', 4, true, true, 'news'),
74+
75+
// series (series)
76+
array('seires', 6, true, true, 'series'),
77+
6978
// babies (baby)
7079
array('sei', 3, false, true, 'y'),
7180

src/Symfony/Component/PropertyAccess/Tests/StringUtilTest.php

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public function singularifyProvider()
102102
array('movies', 'movie'),
103103
array('nebulae', 'nebula'),
104104
array('neuroses', array('neuros', 'neurose', 'neurosis')),
105+
array('news', 'news'),
105106
array('oases', array('oas', 'oase', 'oasis')),
106107
array('objectives', 'objective'),
107108
array('oxen', 'ox'),
@@ -120,6 +121,8 @@ public function singularifyProvider()
120121
array('scarves', array('scarf', 'scarve', 'scarff')),
121122
array('schemas', 'schema'), //schemata
122123
array('selfies', 'selfie'),
124+
array('series', 'series'),
125+
array('services', 'service'),
123126
array('sheriffs', 'sheriff'),
124127
array('shoes', array('sho', 'shoe')),
125128
array('spies', 'spy'),

0 commit comments

Comments
 (0)