generate-registry-annotations: skip files that don't contain classes

This commit is contained in:
Dylan K. Taylor 2021-08-12 20:29:21 +01:00
parent 6a2a4cca4d
commit 662d1a35ff
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -49,7 +49,7 @@ foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($argv[1],
throw new \RuntimeException("Failed to get contents of $file"); throw new \RuntimeException("Failed to get contents of $file");
} }
if(preg_match("/^namespace (.+);$/m", $contents, $matches) !== 1){ if(preg_match("/^namespace (.+);$/m", $contents, $matches) !== 1 || preg_match('/^((final|abstract)\s+)?class /m', $contents) !== 1){
continue; continue;
} }
$shortClassName = basename($file, ".php"); $shortClassName = basename($file, ".php");