mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-29 11:10:19 +02:00
strong typing based on interface, not object
This commit is contained in:
@@ -28,7 +28,7 @@ abstract class Role
|
|||||||
preg_match('#([^\\\\]+)$#', $fqcn, $extract);
|
preg_match('#([^\\\\]+)$#', $fqcn, $extract);
|
||||||
$visitingMethod = 'visit' . $extract[1];
|
$visitingMethod = 'visit' . $extract[1];
|
||||||
|
|
||||||
if (!method_exists($visitor, $visitingMethod)) {
|
if (!method_exists('DesignPatterns\Visitor\RoleVisitor', $visitingMethod)) {
|
||||||
throw new \InvalidArgumentException("The visitor you provide cannot visit a $fqcn object");
|
throw new \InvalidArgumentException("The visitor you provide cannot visit a $fqcn object");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user