Skip to content

Commit f05cc8d

Browse files
committed
bug symfony#48939 [VarExporter] Fix signature of Lazy*Trait::createLazy*() (nicolas-grekas)
This PR was merged into the 6.2 branch. Discussion ---------- [VarExporter] Fix signature of `Lazy*Trait::createLazy*()` | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix doctrine/DoctrineBundle#1615 | License | MIT | Doc PR | - Using `self` makes the traits incompatible with inheritance as child classes cannot also use the trait when a parent class already does. Commits ------- bd7d288 [VarExporter] Fix signature of `Lazy*Trait::createLazy*()`
2 parents 92cce72 + bd7d288 commit f05cc8d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Symfony/Component/VarExporter/LazyGhostTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ trait LazyGhostTrait
4141
* |array{"\0": \Closure(static, array<string, mixed>):array<string, mixed>}) $initializer
4242
* @param array<string, true>|null $skippedProperties An array indexed by the properties to skip, aka the ones
4343
* that the initializer doesn't set when its a closure
44+
* @param static|null $instance
4445
*/
45-
public static function createLazyGhost(\Closure|array $initializer, array $skippedProperties = null, self $instance = null): static
46+
public static function createLazyGhost(\Closure|array $initializer, array $skippedProperties = null, object $instance = null): static
4647
{
4748
$onlyProperties = null === $skippedProperties && \is_array($initializer) ? $initializer : null;
4849

src/Symfony/Component/VarExporter/LazyProxyTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ trait LazyProxyTrait
2525
* Creates a lazy-loading virtual proxy.
2626
*
2727
* @param \Closure():object $initializer Returns the proxied object
28+
* @param static|null $instance
2829
*/
29-
public static function createLazyProxy(\Closure $initializer, self $instance = null): static
30+
public static function createLazyProxy(\Closure $initializer, object $instance = null): static
3031
{
3132
if (self::class !== $class = $instance ? $instance::class : static::class) {
3233
$skippedProperties = ["\0".self::class."\0lazyObjectState" => true];

0 commit comments

Comments
 (0)