Skip to content

Commit da995ca

Browse files
committed
used PhpStorm Language attribute
1 parent 42fed7d commit da995ca

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"nette/tester": "^2.4",
2323
"nikic/php-parser": "^4.15",
2424
"tracy/tracy": "^2.8",
25-
"phpstan/phpstan": "^1.0"
25+
"phpstan/phpstan": "^1.0",
26+
"jetbrains/phpstorm-attributes": "dev-master"
2627
},
2728
"suggest": {
2829
"nikic/php-parser": "to use ClassType::from(withBodies: true) & ClassType::fromCode()"

src/PhpGenerator/Traits/FunctionLike.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Nette\PhpGenerator\Traits;
1111

12+
use JetBrains\PhpStorm\Language;
1213
use Nette;
1314
use Nette\PhpGenerator\Dumper;
1415
use Nette\PhpGenerator\Parameter;
@@ -31,7 +32,11 @@ trait FunctionLike
3132

3233

3334
/** @param ?mixed[] $args */
34-
public function setBody(string $code, ?array $args = null): static
35+
public function setBody(
36+
#[Language('PHP')]
37+
string $code,
38+
?array $args = null,
39+
): static
3540
{
3641
$this->body = $args === null
3742
? $code
@@ -47,7 +52,11 @@ public function getBody(): string
4752

4853

4954
/** @param ?mixed[] $args */
50-
public function addBody(string $code, ?array $args = null): static
55+
public function addBody(
56+
#[Language('PHP')]
57+
string $code,
58+
?array $args = null,
59+
): static
5160
{
5261
$this->body .= ($args === null ? $code : (new Dumper)->format($code, ...$args)) . "\n";
5362
return $this;

0 commit comments

Comments
 (0)