<?php class A { } $ref = new ReflectionClass('A'); var_dump(method_exists($ref, 'getDocComment')); //bool(true) var_dump($ref->getDocComment()); //bool(false) // serialize only the class name $refClass = unserialize(serialize($ref)); try { $refClass->getDocComment(); } catch (Error $e) { $recoveredRef = new ReflectionClass($refClass->getName()); var_dump($recoveredRef); var_dump($recoveredRef->getDocComment()); // works correctly echo "Malformed Reflection object, but recovered: ".$e->getMessage(); }
You have javascript disabled. You will not be able to edit any code.