From e29a373871d0e8cac064780bd7db79477069f700 Mon Sep 17 00:00:00 2001 From: Quentin Gabriele Date: Sun, 18 Aug 2024 20:23:53 +0200 Subject: [PATCH] better support for app --- src/Services/SearchCode/PhpParserService.php | 2 +- tests/Unit/PhpParserServiceTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Services/SearchCode/PhpParserService.php b/src/Services/SearchCode/PhpParserService.php index ee9bf37..de13fb7 100644 --- a/src/Services/SearchCode/PhpParserService.php +++ b/src/Services/SearchCode/PhpParserService.php @@ -99,7 +99,7 @@ public static function scanCode(string $code): array $node->var instanceof FuncCall && static::isFunCallTo($node->var, 'app', 'abstract', 0, 'translator') ) { - return in_array($node->name->name, ['get']); + return in_array($node->name->name, ['get', 'has', 'hasForLocale', 'choice']); } if ($node instanceof StaticCall && $node->class->name === Lang::class) { diff --git a/tests/Unit/PhpParserServiceTest.php b/tests/Unit/PhpParserServiceTest.php index e9742f6..43a11a0 100644 --- a/tests/Unit/PhpParserServiceTest.php +++ b/tests/Unit/PhpParserServiceTest.php @@ -20,6 +20,10 @@ "get('messages.dummy.class');", + "has('messages.dummy.class');", + "hasForLocale('messages.dummy.class');", + "choice('messages.dummy.class');", ]); it('finds all occurences of __ in blade code', function (string $code) {