diff --git a/src/Translator.php b/src/Translator.php index 676618a3..ce370f1e 100644 --- a/src/Translator.php +++ b/src/Translator.php @@ -3249,8 +3249,8 @@ CODE; Type::STR => [['kind' => 'isString']], Type::ARRAY => [['kind' => 'isArray']], Type::RESOURCE => [['kind' => 'isResource']], - Type::OBJECT => $arg->class - ? [['kind' => 'instanceof', 'class' => $arg->class]] + Type::OBJECT => $arg->declaredClass + ? [['kind' => 'instanceof', 'class' => $arg->declaredClass]] : [['kind' => 'isObject']], default => null, }; diff --git a/tests/compiler/namespace/interface-impl-param-type-cross-ns.phpt b/tests/compiler/namespace/interface-impl-param-type-cross-ns.phpt new file mode 100644 index 00000000..acaec9e6 --- /dev/null +++ b/tests/compiler/namespace/interface-impl-param-type-cross-ns.phpt @@ -0,0 +1,48 @@ +--TEST-- +Cross-namespace interface implementation with an interface-typed parameter must not be reported as incompatible +--FILE-- +test(new \B\Impl1())); + echo "done\n"; + } +} +?> +--EXPECT-- +bool(true) +done