Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit e7e0b91

Browse files
Deal with when there is no constructor defined
1 parent d2e67cf commit e7e0b91

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/AnemicTrait.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace AltThree\TestBench;
1313

1414
use ReflectionClass;
15+
use ReflectionException;
1516
use ReflectionParameter;
1617
use ReflectionProperty;
1718

@@ -52,9 +53,13 @@ public function testPropertiesMatchTheConstructor()
5253
return $property->getName();
5354
}, $rc->getProperties());
5455

55-
$params = array_map(function (ReflectionParameter $param) {
56-
return $param->getName();
57-
}, $rc->getMethod('__construct')->getParameters());
56+
try {
57+
$params = array_map(function (ReflectionParameter $param) {
58+
return $param->getName();
59+
}, $rc->getMethod('__construct')->getParameters());
60+
} catch (ReflectionException $e) {
61+
$params = [];
62+
}
5863

5964
if ($this->objectHasQueue()) {
6065
$params[] = 'queue';

0 commit comments

Comments
 (0)