Skip to content

Commit

Permalink
DependencyChecker: checks types of properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Nov 4, 2020
1 parent 857458c commit c5ba31b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/DI/DependencyChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,17 @@ class_uses($name),

foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) {
if ($prop->getDeclaringClass() == $class) { // intentionally ==
$hash[] = [$name, $prop->name, $prop->getDocComment()];
$type = PHP_VERSION_ID < 70400
? null
: $prop->getType();
$hash[] = [
$name,
$prop->name,
$prop->getDocComment(),
PHP_VERSION_ID < 80000
? ($type ? [$type->getName(), $type->allowsNull()] : null)
: (string) $type,
];
}
}
foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
Expand Down

0 comments on commit c5ba31b

Please sign in to comment.