@@ -29,6 +29,57 @@ public function setUp(): void
2929 $ this ->printer = new Standard (['shortArraySyntax ' => true ]);
3030 }
3131
32+ /**
33+ * @test
34+ */
35+ public function it_generates_method_without_doc_block_if_typed (): void
36+ {
37+ $ method = new MethodGenerator (
38+ 'setType ' ,
39+ [
40+ new ParameterGenerator ('type ' , '?string ' ),
41+ ]
42+ );
43+ $ method ->setTyped (true );
44+ $ method ->setReturnType ('void ' );
45+
46+ $ expectedOutput = <<<'EOF'
47+ <?php
48+
49+ public function setType(?string $type) : void;
50+ EOF;
51+
52+ $ this ->assertSame ($ expectedOutput , $ this ->printer ->prettyPrintFile ([$ method ->generate ()]));
53+ }
54+
55+ /**
56+ * @test
57+ */
58+ public function it_generates_method_with_doc_block_comment_if_typed (): void
59+ {
60+ $ method = new MethodGenerator (
61+ 'setType ' ,
62+ [
63+ new ParameterGenerator ('type ' , '?string ' ),
64+ ]
65+ );
66+ $ method ->setTyped (true );
67+ $ method ->setDocBlockComment ('Sets an awesome type ' );
68+
69+ $ expectedOutput = <<<'EOF'
70+ <?php
71+
72+ /**
73+ * Sets an awesome type
74+ *
75+ * @var string|null $type
76+ */
77+ public function setType(?string $type);
78+ EOF;
79+
80+ $ this ->assertSame ($ expectedOutput , $ this ->printer ->prettyPrintFile ([$ method ->generate ()]));
81+ }
82+
3283 /**
3384 * @test
3485 */
@@ -41,6 +92,7 @@ public function it_generates_method_with_doc_block(): void
4192 ]
4293 );
4394 $ method ->setDocBlockComment ('Sets an awesome type ' );
95+ $ method ->setTyped (true );
4496
4597 $ expectedOutput = <<<'EOF'
4698<?php
0 commit comments