diff --git a/src/Infer/Reflector/ClassReflector.php b/src/Infer/Reflector/ClassReflector.php index 85f824c5..e023c57d 100644 --- a/src/Infer/Reflector/ClassReflector.php +++ b/src/Infer/Reflector/ClassReflector.php @@ -56,6 +56,9 @@ public function getNameContext(): NameContext $code = Str::before($content, $firstMatchedClassLikeString); + // Removes all comments. + $code = preg_replace('/\/\*(?:[^*]|\*+[^*\/])*\*+\/|(?cache[md5($content).'23'] ??= new FileParserResult( + return $this->cache[md5($content)] ??= new FileParserResult( $statements = Arr::wrap($this->parser->parse($content)), new FileNameResolver(new NameContext(new Throwing())) );