private static function calculateHash($classes, $functions)
{
$hash = [];
foreach ($classes as $name) {
try {
$class = new ReflectionClass($name);
} catch (\ReflectionException $e) {
return;
}
$hash[] = [$name, PhpReflection::getUseStatements($class), $class->isAbstract()];
foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
if ($prop->getDeclaringClass() == $class) {
// intentionally ==
$hash[] = [$name, $prop->getName(), $prop->getDocComment()];
}
}
foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if ($method->getDeclaringClass() == $class) {
// intentionally ==
$hash[] = [$name, $method->getName(), $method->getDocComment(), self::hashParameters($method), PHP_VERSION_ID >= 70000 ? $method->getReturnType() : NULL];
}
}
}
$flip = array_flip($classes);
foreach ($functions as $name) {
try {
$method = strpos($name, '::') ? new ReflectionMethod($name) : new \ReflectionFunction($name);
} catch (\ReflectionException $e) {
return;
}
$class = $method instanceof ReflectionMethod ? $method->getDeclaringClass() : NULL;
if ($class && isset($flip[$class->getName()])) {
continue;
}
$hash[] = [$name, $class ? PhpReflection::getUseStatements($method->getDeclaringClass()) : NULL, $method->getDocComment(), self::hashParameters($method), PHP_VERSION_ID >= 70000 ? $method->getReturnType() : NULL];
}
return md5(serialize($hash));
}