Skip to content

Commit

Permalink
Merge pull request #139 from PhpGt/skip-no-return-types
Browse files Browse the repository at this point in the history
tweak: skip methods without a return type
  • Loading branch information
g105b authored Jul 4, 2023
2 parents 9b9e65e + 6e9d457 commit c64d1bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ public function setLoader(string $className, callable $callback):void {
public function addLoaderClass(object $object):void {
$refClass = new ReflectionClass($object);
foreach($refClass->getMethods(ReflectionMethod::IS_PUBLIC) as $refPublicMethod) {
$type = $refPublicMethod->getReturnType();
if(!$type) {
continue;
}
/** @phpstan-ignore-next-line Why can't PHPStan see getName() ? */
$className = $refPublicMethod->getReturnType()->getName();
$className = $type->getName();
$callback = $refPublicMethod->getClosure($object);

$this->setLoader(
Expand Down

0 comments on commit c64d1bd

Please sign in to comment.