Skip to content

Commit b4f7f80

Browse files
Merge branch '7.4' into 8.0
* 7.4: [Messenger] Fix unreachable catch [DependencyInjection] Fix PHPDoc syntax for InstantiatorInterface [DomCrawler] Handle malformed tags in HTML5 parser [MonologBundle] Accept HttpExceptionInterface in HttpCodeActivationStrategy Add the proper type declarations for the messenger SerializerInterface [HttpKernel] Make Kernel::getShareDir() nullable
2 parents 02e6b14 + 3a5c2d3 commit b4f7f80

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

LazyProxy/Instantiator/InstantiatorInterface.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ interface InstantiatorInterface
2525
/**
2626
* Instantiates a proxy object.
2727
*
28-
* @param string $id Identifier of the requested service
29-
* @param callable(object=) $realInstantiator A callback that is capable of producing the real service instance
28+
* @param string $id Identifier of the requested service
29+
* @param (callable(): object)|(callable(object): void) $realInstantiator A callback that creates or initializes the real service instance:
30+
* - For direct instantiation or value-holder proxies: Called without arguments and returns the service object.
31+
* - For ghost object proxies (using PHP's lazy objects): Called with the proxy as argument, initializes it in place and returns void.
3032
*/
3133
public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator): object;
3234
}

LazyProxy/Instantiator/RealServiceInstantiator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
*/
2222
class RealServiceInstantiator implements InstantiatorInterface
2323
{
24+
/**
25+
* @return object The real service instance
26+
*/
2427
public function instantiateProxy(ContainerInterface $container, Definition $definition, string $id, callable $realInstantiator): object
2528
{
2629
return $realInstantiator();

0 commit comments

Comments
 (0)