File tree Expand file tree Collapse file tree
Tests/Integration/NewInstance Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public function instantiateObject(
7979 return new $ class ();
8080 }
8181
82- if ([] === $ data || !ArrayHelper::isAssoc ($ data )) {
82+ if ([] !== $ data && !ArrayHelper::isAssoc ($ data )) {
8383 throw new RuntimeException ('invalid data ' );
8484 }
8585
Original file line number Diff line number Diff line change 66
77use Omasn \ObjectHandler \Exception \HandlerException ;
88use Omasn \ObjectHandler \Exception \ObjectHandlerException ;
9+ use Omasn \ObjectHandler \Exception \RequireArgumentException ;
910use Omasn \ObjectHandler \Exception \ViolationListException ;
1011use Omasn \ObjectHandler \Extractor \DefaultValueExtractorInterface ;
1112use ReflectionException ;
@@ -45,6 +46,7 @@ public function handle(
4546 * @throws HandlerException
4647 * @throws ReflectionException
4748 * @throws ViolationListException
49+ * @throws RequireArgumentException
4850 */
4951 public function instantiateObject (
5052 string $ class ,
Original file line number Diff line number Diff line change @@ -101,10 +101,6 @@ public function testInvalidData(): void
101101 $ objectHandler = new ObjectHandler ($ this ->getPropertyInfo ());
102102 $ objectHandler ->addHandleType (new HandleIntType ());
103103
104- $ data1 = [];
105- $ this ->expectException (\RuntimeException::class);
106- $ objectHandler ->instantiateObject (ArrayTest1::class, $ data1 );
107-
108104 $ data2 = ['not assoc ' ];
109105 $ this ->expectException (\RuntimeException::class);
110106 $ objectHandler ->instantiateObject (ArrayTest1::class, $ data2 );
You can’t perform that action at this time.
0 commit comments