Skip to content

Commit 883e6c2

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: Fix PHP 8.1 null values [Console] Fix PHP 8.1 null error for preg_match flag Fix: Article Definition::removeMethodCall should remove all matching calls mark the LazyIterator class as internal fix extracting mixed type-hinted property types keep valid submitted choices when additional choices are submitted
2 parents cfb06a0 + ade1c5a commit 883e6c2

File tree

6 files changed

+20
-5
lines changed

6 files changed

+20
-5
lines changed

Compiler/ResolveClassPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function process(ContainerBuilder $container)
3131
}
3232
if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)++$/', $id)) {
3333
if ($definition instanceof ChildDefinition && !class_exists($id)) {
34-
throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id));
34+
throw new InvalidArgumentException(sprintf('Service definition "%s" has a parent but no class, and its name looks like an FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.', $id));
3535
}
3636
$definition->setClass($id);
3737
}

Definition.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ public function removeMethodCall(string $method)
370370
foreach ($this->calls as $i => $call) {
371371
if ($call[0] === $method) {
372372
unset($this->calls[$i]);
373-
break;
374373
}
375374
}
376375

Loader/Configurator/Traits/BindTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ trait BindTrait
2626
* injected in the matching parameters (of the constructor, of methods
2727
* called and of controller actions).
2828
*
29-
* @param string $nameOrFqcn A parameter name with its "$" prefix, or a FQCN
29+
* @param string $nameOrFqcn A parameter name with its "$" prefix, or an FQCN
3030
* @param mixed $valueOrRef The value or reference to bind
3131
*
3232
* @return $this

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private function parseDefinition(\DOMElement $service, string $file, Definition
373373
}
374374

375375
/**
376-
* Parses a XML file to a \DOMDocument.
376+
* Parses an XML file to a \DOMDocument.
377377
*
378378
* @throws InvalidArgumentException When loading of XML file returns error
379379
*/

Tests/Compiler/ResolveClassPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function testClassFoundChildDefinition()
8686
public function testAmbiguousChildDefinition()
8787
{
8888
$this->expectException(InvalidArgumentException::class);
89-
$this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like a FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.');
89+
$this->expectExceptionMessage('Service definition "App\Foo\Child" has a parent but no class, and its name looks like an FQCN. Either the class is missing or you want to inherit it from the parent service. To resolve this ambiguity, please rename this service to a non-FQCN (e.g. using dots), or create the missing class.');
9090
$container = new ContainerBuilder();
9191
$container->register('App\Foo', null);
9292
$container->setDefinition('App\Foo\Child', new ChildDefinition('App\Foo'));

Tests/DefinitionTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,4 +411,20 @@ public function testAddError()
411411
$def->addError('Second error');
412412
$this->assertSame(['First error', 'Second error'], $def->getErrors());
413413
}
414+
415+
public function testMultipleMethodCalls()
416+
{
417+
$def = new Definition('stdClass');
418+
419+
$def->addMethodCall('configure', ['arg1']);
420+
$this->assertTrue($def->hasMethodCall('configure'));
421+
$this->assertCount(1, $def->getMethodCalls());
422+
423+
$def->addMethodCall('configure', ['arg2']);
424+
$this->assertTrue($def->hasMethodCall('configure'));
425+
$this->assertCount(2, $def->getMethodCalls());
426+
427+
$def->removeMethodCall('configure');
428+
$this->assertFalse($def->hasMethodCall('configure'));
429+
}
414430
}

0 commit comments

Comments
 (0)