From dc7c3779a06b5fcfa5434e09b61d45e4bcc53ca5 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 20 Oct 2016 14:39:57 +0200 Subject: [PATCH] fixed phpdoc controller to not crash on non-instantiable classes this happens with codeception classes that are auto generated, they shoud not be changed by phpdoc controller anyway. --- build/controllers/PhpDocController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index eb5b7ea4b0..5e9628250c 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -479,9 +479,15 @@ class PhpDocController extends Controller protected function updateClassPropertyDocs($file, $className, $propertyDoc) { - $ref = new \ReflectionClass($className); + try { + $ref = new \ReflectionClass($className); + } catch (\Exception $e) { + $this->stderr("[ERR] Unable to create ReflectionClass for class '$className': " . $e->getMessage() . "\n", Console::FG_RED); + return false; + } if ($ref->getFileName() != $file) { $this->stderr("[ERR] Unable to create ReflectionClass for class: $className loaded class is not from file: $file\n", Console::FG_RED); + return false; } if (!$ref->isSubclassOf('yii\base\Object') && $className != 'yii\base\Object') {