File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -73,9 +73,16 @@ public function createModels($objects)
7373 foreach ($ objects as $ key => $ object ) {
7474 $ modelFactory = $ this ->findSupportingModelFactoryForObject ($ object );
7575 if (!$ modelFactory instanceof ModelFactoryInterface) {
76+ if (is_object ($ object )) {
77+ throw new ModelFactoryCollectionException (sprintf (
78+ 'Model factory for class %s not found. ' ,
79+ get_class ($ object )
80+ ));
81+ }
82+
7683 throw new ModelFactoryCollectionException (sprintf (
77- " Model factory for class '%s' not found. " ,
78- get_class ($ object )
84+ ' Model factory for type %s not found. ' ,
85+ gettype ($ object )
7986 ));
8087 }
8188 $ models [$ key ] = $ this ->createModelAndSetDependencies ($ modelFactory , $ object );
Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ public function dataProvider_supportsObjects_onInvalidArgument()
167167 [3 ],
168168 [false ],
169169 [new stdClass ()],
170+ [null ],
170171 ];
171172 }
172173
@@ -186,7 +187,7 @@ public function test_createModels_onInvalidArgument($invalidArgument)
186187 new BarModelFactory ()
187188 );
188189
189- $ modelFactoryCollection ->createModels ($ invalidArgument );
190+ $ modelFactoryCollection ->createModels ([ $ invalidArgument] );
190191 }
191192
192193 /**
You can’t perform that action at this time.
0 commit comments