This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -668,6 +668,10 @@ private function getFactory($name)
668
668
if ($ lazyLoaded ) {
669
669
$ this ->factories [$ name ] = $ factory ;
670
670
}
671
+ // PHP 5.6 fails on 'class::method' callables unless we explode them:
672
+ if (is_string ($ factory ) && strpos ($ factory , ':: ' ) !== false ) {
673
+ $ factory = explode (':: ' , $ factory );
674
+ }
671
675
return $ factory ;
672
676
}
673
677
Original file line number Diff line number Diff line change @@ -267,4 +267,20 @@ public function testSetAliasShouldWorkWithRecursiveAlias()
267
267
$ this ->assertSame ($ service , $ alias );
268
268
$ this ->assertSame ($ service , $ headAlias );
269
269
}
270
+
271
+ public static function sampleFactory ()
272
+ {
273
+ return new stdClass ();
274
+ }
275
+
276
+ public function testStaticCallable ()
277
+ {
278
+ $ config = [
279
+ 'factories ' => [
280
+ stdClass::class => 'ZendTest\ServiceManager\ServiceManagerTest::sampleFactory ' ,
281
+ ]
282
+ ];
283
+ $ serviceManager = new SimpleServiceManager ($ config );
284
+ $ this ->assertEquals (stdClass::class, get_class ($ serviceManager ->get (stdClass::class)));
285
+ }
270
286
}
You can’t perform that action at this time.
0 commit comments