From 2931a462c01e383a5ce92e680cbc82ae0f7bb815 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Thu, 22 Oct 2026 15:15:38 +0000 Subject: [PATCH] - Added a new getExtensionInstanceOf() method in Compiler --- src/Compiler.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Compiler.php b/src/Compiler.php index 3edb082..f59b19a 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -158,6 +158,19 @@ class Compiler return $this->extensionList[$tokenName]; } + public function getExtensionInstanceOf(string $class) : Extension\Extension + { + foreach(array_reverse($this->extensionList) as $ext) { + if ( is_a($ext, $class, false) ) { + return $ext; + } + } + + throw new \InvalidArgumentException(<<