File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ final class PhpClassExistsValidator implements ValidatorInterface
2626 /** @var PhpCodeEnsurerInterface */
2727 private $ codeEnsurer ;
2828
29+ /** @var false|string */
30+ private $ phpVersion ;
31+
2932 public function __construct (
3033 callable $ classExists ,
3134 ?Parser $ parser = null ,
@@ -34,11 +37,19 @@ public function __construct(
3437 $ this ->parser = $ parser ?? (new ParserFactory )->create (ParserFactory::PREFER_PHP7 );
3538 $ this ->classExists = $ classExists ;
3639 $ this ->codeEnsurer = $ codeEnsurer ?? new PhpCodeEnsurer ();
40+
41+ $ phpversion = phpversion ();
42+ Assert::string ($ phpversion , 'Could not get php version. ' );
43+ $ this ->phpVersion = $ phpversion ;
3744 }
3845
3946 /** {@inheritDoc} */
4047 public function validate (Block $ block ): array
4148 {
49+ if ($ this ->phpVersion === "8 " ) {
50+ return [];
51+ }
52+
4253 $ phpCode = $ this ->codeEnsurer ->getPHPCode ($ block ->getContent ());
4354 try {
4455 $ statements = $ this ->parser ->parse ($ phpCode );
You can’t perform that action at this time.
0 commit comments