Skip to content

Commit 0e581eb

Browse files
committed
Fix code style
1 parent 4889f9e commit 0e581eb

File tree

5 files changed

+33
-25
lines changed

5 files changed

+33
-25
lines changed

src/Rules/Keywords/RequireFileExistsRule.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
namespace PHPStan\Rules\Keywords;
44

55
use PhpParser\Node;
6-
use PhpParser\Node\Expr\ConstFetch;
7-
use PhpParser\Node\Expr\Include_;
86
use PhpParser\Node\Expr\BinaryOp\Concat;
97
use PhpParser\Node\Expr\ClassConstFetch;
8+
use PhpParser\Node\Expr\ConstFetch;
9+
use PhpParser\Node\Expr\Include_;
1010
use PhpParser\Node\Identifier;
1111
use PhpParser\Node\Name;
1212
use PhpParser\Node\Scalar\MagicConst\Dir;
@@ -15,17 +15,21 @@
1515
use PHPStan\Reflection\ReflectionProvider;
1616
use PHPStan\Rules\Rule;
1717
use PHPStan\Rules\RuleErrorBuilder;
18+
use function constant;
19+
use function defined;
20+
use function dirname;
21+
use function file_exists;
22+
use function is_string;
23+
use function sprintf;
1824

1925
/**
2026
* @implements Rule<Include_>
2127
*/
2228
class RequireFileExistsRule implements Rule
2329
{
24-
private ReflectionProvider $reflectionProvider;
2530

26-
public function __construct(ReflectionProvider $reflectionProvider)
31+
public function __construct(private ReflectionProvider $reflectionProvider)
2732
{
28-
$this->reflectionProvider = $reflectionProvider;
2933
}
3034

3135
public function getNodeType(): string
@@ -42,8 +46,8 @@ public function processNode(Node $node, Scope $scope): array
4246
RuleErrorBuilder::message(
4347
sprintf(
4448
'Required file "%s" does not exist.',
45-
$filePath
46-
)
49+
$filePath,
50+
),
4751
)->build(),
4852
];
4953
}
@@ -122,4 +126,5 @@ private function resolveConstant(ConstFetch $node): ?string
122126
}
123127
return null;
124128
}
129+
125130
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<?php
2-
3-
declare(strict_types=1);
1+
<?php declare(strict_types = 1);
42

53
namespace PHPStan\Rules\Keywords;
64

75
class ClassThatContainsConst
86
{
9-
public const FILE_EXISTS = 'include-me-to-prove-you-work.txt';
10-
public const FILE_DOES_NOT_EXIST = 'a-file-that-does-not-exist.php';
7+
8+
public const FILE_EXISTS = 'include-me-to-prove-you-work.txt';
9+
public const FILE_DOES_NOT_EXIST = 'a-file-that-does-not-exist.php';
10+
1111
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
<?php declare(strict_types=1);
1+
<?php declare(strict_types = 1);
22

33
namespace PHPStan\Rules\Keywords;
44

55
class ClassThatContainsMethod
66
{
7-
public function getFileThatDoesNotExist(): string
8-
{
9-
return 'a-file-that-does-not-exist.txt';
10-
}
7+
8+
public function getFileThatDoesNotExist(): string
9+
{
10+
return 'a-file-that-does-not-exist.txt';
11+
}
12+
1113
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?php
2-
3-
declare(strict_types=1);
1+
<?php declare(strict_types = 1);
42

53
namespace PHPStan\Rules\Keywords;
64

75
class ClassThatContainsProperties
86
{
9-
public string $fileDoesNotExist = 'a-file-that-does-not-exist.php';
7+
8+
public string $fileDoesNotExist = 'a-file-that-does-not-exist.php';
9+
1010
}

tests/PHPStan/Rules/Keywords/RequireFileExistsRuleTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
<?php declare(strict_types=1);
1+
<?php declare(strict_types = 1);
22

33
namespace PHPStan\Rules\Keywords;
44

5-
use PHPStan\Testing\RuleTestCase;
6-
use PHPStan\Rules\Keywords\RequireFileExistsRule;
75
use PHPStan\Rules\Rule;
8-
6+
use PHPStan\Testing\RuleTestCase;
7+
use function define;
98

109
/**
1110
* @extends RuleTestCase<RequireFileExistsRule>
1211
*/
1312
class RequireFileExistsRuleTest extends RuleTestCase
1413
{
14+
1515
protected function getRule(): Rule
1616
{
1717
return new RequireFileExistsRule($this->createReflectionProvider());
@@ -102,4 +102,5 @@ public function testFileDoesNotExistButUsesAFunction(): void
102102
{
103103
$this->analyse([__DIR__ . '/data/file-does-not-exist-but-uses-a-function.php'], []);
104104
}
105+
105106
}

0 commit comments

Comments
 (0)