Skip to content

Commit 40d61e2

Browse files
authored
Merge pull request #208 from alexchexes/fix/return-type-colon-space
Remove extra space before return‑type colon in `MethodGenerator`
2 parents 00c6aee + e747a96 commit 40d61e2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/Generator/MethodGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public function generate()
376376
$output .= ')';
377377

378378
if ($this->returnType) {
379-
$output .= ' : ' . $this->returnType->generate();
379+
$output .= ': ' . $this->returnType->generate();
380380
}
381381

382382
if ($this->isAbstract()) {

test/Generator/ClassGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ public function someMethod()
805805
*
806806
* @return bool
807807
*/
808-
protected function withParamsAndReturnType($mixed, array $array, ?callable $callable = null, ?int $int = 0) : bool
808+
protected function withParamsAndReturnType($mixed, array $array, ?callable $callable = null, ?int $int = 0): bool
809809
{
810810
/* test test */
811811
return true;

test/Generator/MethodGeneratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function testCopyMethodSignature()
127127

128128
$methodGenerator = MethodGenerator::copyMethodSignature($ref);
129129
$target = <<<'EOS'
130-
protected function withParamsAndReturnType($mixed, array $array, ?callable $callable = null, ?int $int = 0) : bool
130+
protected function withParamsAndReturnType($mixed, array $array, ?callable $callable = null, ?int $int = 0): bool
131131
{
132132
}
133133

@@ -373,7 +373,7 @@ public function testSetReturnType()
373373
$methodGenerator->setReturnType('bar');
374374

375375
$expected = <<<'PHP'
376-
public function foo() : \bar
376+
public function foo(): \bar
377377
{
378378
}
379379

@@ -409,7 +409,7 @@ public function testFrom($className, $methodName, $expectedReturnSignature)
409409
{
410410
$methodGenerator = MethodGenerator::fromReflection(new MethodReflection($className, $methodName));
411411

412-
self::assertStringMatchesFormat('%A) : ' . $expectedReturnSignature . '%w{%A', $methodGenerator->generate());
412+
self::assertStringMatchesFormat('%A): ' . $expectedReturnSignature . '%w{%A', $methodGenerator->generate());
413413
}
414414

415415
/**

0 commit comments

Comments
 (0)