Skip to content

Commit 59fd0ad

Browse files
committed
Merge branch '4.6'
# Conflicts: # src/contracts/Output/ValueObjectVisitorDispatcher.php # tests/lib/Output/ValueObjectVisitorDispatcherTest.php
2 parents ded303f + 15bc46a commit 59fd0ad

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/contracts/Output/ValueObjectVisitorResolver.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ public function resolveValueObjectVisitor(object $object): ?ValueObjectVisitor
3333
}
3434
} while ($className = get_parent_class($className));
3535

36+
$interfaces = class_implements($object);
37+
foreach ($interfaces as $interface) {
38+
if (isset($this->visitors[$interface])) {
39+
return $this->visitors[$interface];
40+
}
41+
}
42+
3643
if ($object instanceof Throwable) {
3744
throw $object;
3845
}

tests/lib/Output/ValueObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
/**
1313
* Test dummy class.
1414
*/
15-
class ValueObject extends stdClass
15+
class ValueObject extends stdClass implements ValueObjectInterface
1616
{
1717
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/**
4+
* @copyright Copyright (C) Ibexa AS. All rights reserved.
5+
* @license For full copyright and license information view LICENSE file distributed with this source code.
6+
*/
7+
declare(strict_types=1);
8+
9+
namespace Ibexa\Tests\Rest\Output;
10+
11+
/**
12+
* Test dummy interface.
13+
*/
14+
interface ValueObjectInterface
15+
{
16+
}

0 commit comments

Comments
 (0)