Skip to content

Commit

Permalink
[container] parameterbag handler - fix container classes (#324)
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov authored Nov 10, 2023
1 parent cacf99f commit 517205b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Handler/ContainerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event)
}
}

private static function isContainerMethod(string $declaringMethodId, string $methodName): bool
public static function isContainerMethod(string $declaringMethodId, string $methodName): bool
{
return in_array(
$declaringMethodId,
Expand Down
12 changes: 7 additions & 5 deletions src/Handler/ParameterBagHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ public static function init(ContainerMeta $containerMeta): void

public static function afterMethodCallAnalysis(AfterMethodCallAnalysisEvent $event): void
{
if (!self::$containerMeta) {
return;
}

$declaring_method_id = $event->getDeclaringMethodId();
$expr = $event->getExpr();

if (!self::$containerMeta || !in_array($declaring_method_id, [
'Symfony\Bundle\FrameworkBundle\Controller\AbstractController::getparameter',
'Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface::get',
'Symfony\Component\DependencyInjection\ContainerInterface::getparameter',
], true)) {
if (!ContainerHandler::isContainerMethod($declaring_method_id, 'getparameter')
&& 'Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface::get' !== $declaring_method_id
) {
return;
}

Expand Down

0 comments on commit 517205b

Please sign in to comment.