Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Mar 3, 2024
1 parent e6c3e9b commit 23e3ff7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
8 changes: 2 additions & 6 deletions src/ArrayDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,16 @@ public function withReferenceContainer(?ContainerInterface $referenceContainer):
}

/**
* Create ArrayDefinition from array config.
* Create `ArrayDefinition` from array config.
*
* @psalm-param ArrayDefinitionConfig $config
*/
public static function fromConfig(array $config): self
{
/**
* @psalm-suppress MixedArgument
*/
return new self(
$config[self::CLASS_NAME],
$config[self::CONSTRUCTOR] ?? [],
// Already normalized config. Ignore all the rest parameters
$config['methodsAndProperties'] ?? self::getMethodsAndPropertiesFromConfig($config),
self::getMethodsAndPropertiesFromConfig($config),
);
}

Expand Down
13 changes: 3 additions & 10 deletions src/LazyDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,12 @@ public function resolve(ContainerInterface $container): VirtualProxyInterface
{
/** @var LazyLoadingValueHolderFactory $factory */
$factory = $container->get(LazyLoadingValueHolderFactory::class);
/**
* @var mixed $definition
*/
$definition = $this->definition;
$class = $this->class;

return $factory->createProxy(
$class,
static function (mixed &$wrappedObject) use ($container, $class, $definition) {
$definition = Normalizer::normalize($definition, $class);
/**
* @var mixed $wrappedObject
*/
$this->class,
static function (mixed &$wrappedObject) use ($container, $definition) {
$definition = Normalizer::normalize($definition);

Check warning on line 33 in src/LazyDefinition.php

View check run for this annotation

Codecov / codecov/patch

src/LazyDefinition.php#L33

Added line #L33 was not covered by tests
$wrappedObject = $definition->resolve($container);
return true;
}
Expand Down

0 comments on commit 23e3ff7

Please sign in to comment.