瀏覽代碼

Update get methods function to skip unknown classes
If a class is removed from the project and the auto_loader has not removed the cached classes and functions, the ReflectionClass will trigger a fatal error. This update will now skip the class.

Tim Fry 6 月之前
父節點
當前提交
436bb97f80
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      resources/get_php_methods.php

+ 8 - 1
resources/get_php_methods.php

@@ -16,8 +16,15 @@ foreach ($classes_to_scan as $class => $path) {
 		continue;
 	}
 
-	// Skip internal classes
+	// Guard against removed classes
+	if (!class_exists($class)) {
+		continue;
+	}
+
+	// Create the RefectionClass for inspecting class
 	$ref = new ReflectionClass($class);
+
+	// Skip internal classes
 	if ($ref->isInternal()) {
 		continue;
 	}