Skip to content

Commit 8c3e402

Browse files
committed
Printer: prints fn() without space
1 parent dc91106 commit 8c3e402

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ echo (new Nette\PhpGenerator\Printer)->printArrowFunction($closure);
372372
Result:
373373

374374
```php
375-
fn ($a, $b) => $a + $b
375+
fn($a, $b) => $a + $b
376376
```
377377

378378
Attributes

src/PhpGenerator/Printer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function printArrowFunction(Closure $closure): string
8181
}
8282

8383
return self::printAttributes($closure->getAttributes(), null)
84-
. 'fn '
84+
. 'fn'
8585
. ($closure->getReturnReference() ? '&' : '')
8686
. $this->printParameters($closure, null)
8787
. $this->printReturnType($closure, null)

tests/PhpGenerator/Printer.arrow.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $function
1818
$function->addParameter('a');
1919
$function->addParameter('b');
2020

21-
Assert::same('fn &($a, $b) => $a + $b;', (new Printer)->printArrowFunction($function));
21+
Assert::same('fn&($a, $b) => $a + $b;', (new Printer)->printArrowFunction($function));
2222

2323

2424

@@ -27,7 +27,7 @@ $function
2727
->setReturnType('array')
2828
->setBody('[]');
2929

30-
Assert::same('fn (): array => [];', (new Printer)->printArrowFunction($function));
30+
Assert::same('fn(): array => [];', (new Printer)->printArrowFunction($function));
3131

3232

3333
Assert::exception(function () {

0 commit comments

Comments
 (0)