1515use Mockery as m ;
1616use phpDocumentor \Reflection \DocBlock \Description ;
1717use phpDocumentor \Reflection \DocBlock \DescriptionFactory ;
18+ use phpDocumentor \Reflection \Fqsen ;
1819use phpDocumentor \Reflection \TypeResolver ;
1920use phpDocumentor \Reflection \Types \Array_ ;
2021use phpDocumentor \Reflection \Types \Compound ;
@@ -469,6 +470,16 @@ public function testCreateMethodParenthesisMissing()
469470 $ this ->assertSame ($ description , $ fixture ->getDescription ());
470471 }
471472
473+ /**
474+ * @covers ::create
475+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
476+ * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
477+ * @uses \phpDocumentor\Reflection\TypeResolver
478+ * @uses \phpDocumentor\Reflection\DocBlock\Description
479+ * @uses \phpDocumentor\Reflection\Fqsen
480+ * @uses \phpDocumentor\Reflection\Types\Context
481+ * @uses \phpDocumentor\Reflection\Types\Void_
482+ */
472483 public function testCreateWithoutReturnType ()
473484 {
474485 $ descriptionFactory = m::mock (DescriptionFactory::class);
@@ -492,4 +503,44 @@ public function testCreateWithoutReturnType()
492503 $ this ->assertInstanceOf (Void_::class, $ fixture ->getReturnType ());
493504 $ this ->assertSame ($ description , $ fixture ->getDescription ());
494505 }
506+
507+ /**
508+ * @covers ::create
509+ * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::<public>
510+ * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
511+ * @uses \phpDocumentor\Reflection\TypeResolver
512+ * @uses \phpDocumentor\Reflection\DocBlock\Description
513+ * @uses \phpDocumentor\Reflection\Fqsen
514+ * @uses \phpDocumentor\Reflection\Types\Context
515+ * @uses \phpDocumentor\Reflection\Types\Array_
516+ * @uses \phpDocumentor\Reflection\Types\Compound
517+ * @uses \phpDocumentor\Reflection\Types\Integer
518+ * @uses \phpDocumentor\Reflection\Types\Object_
519+ */
520+ public function testCreateWithMixedReturnTypes ()
521+ {
522+ $ descriptionFactory = m::mock (DescriptionFactory::class);
523+ $ resolver = new TypeResolver ();
524+ $ context = new Context ('' );
525+
526+ $ descriptionFactory ->shouldReceive ('create ' )->andReturn (new Description ('' ));
527+
528+ $ fixture = Method::create (
529+ 'MyClass[]|int[] myMethod() ' ,
530+ $ resolver ,
531+ $ descriptionFactory ,
532+ $ context
533+ );
534+
535+ $ this ->assertSame ('\MyClass[]|int[] myMethod() ' , (string )$ fixture );
536+ $ this ->assertSame ('myMethod ' , $ fixture ->getMethodName ());
537+ $ this ->assertEquals ([], $ fixture ->getArguments ());
538+
539+ $ this ->assertEquals (
540+ new Compound ([
541+ new Array_ (new Object_ (new Fqsen ('\MyClass ' ))),
542+ new Array_ (new Integer ()),
543+ ])
544+ , $ fixture ->getReturnType ());
545+ }
495546}
0 commit comments