Skip to content

Commit 38a9b0d

Browse files
committed
test: create test
1 parent 57711bf commit 38a9b0d

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Tests\CallStaticMethodInClassRuleTest;
4+
5+
use Rules\CallStaticMethodInClassRule;
6+
use PHPStan\Rules\Rule;
7+
use PHPStan\Testing\RuleTestCase;
8+
9+
/**
10+
* @extends RuleTestCase<CallStaticMethodInClassRuleTest>
11+
*/
12+
class CallStaticMethodInClassRuleTest extends RuleTestCase
13+
{
14+
protected function getRule(): Rule
15+
{
16+
return new CallStaticMethodInClassRule();
17+
}
18+
19+
public function testRule(): void
20+
{
21+
$this->analyse([__DIR__ . '/data/call-static-method-in-class-rule.php'], [
22+
[
23+
'Use constructor injection for dependent classes.',
24+
8,
25+
],
26+
[
27+
'Use constructor injection for dependent classes.',
28+
13,
29+
],
30+
]);
31+
}
32+
33+
// public static function getAdditionalConfigFiles(): array
34+
// {
35+
// return [__DIR__ . '/../extension.neon'];
36+
// }
37+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace App;
4+
5+
class SomeClass extends SomeParentClass
6+
{
7+
public function someMethod(): void {
8+
SomeStaticClass::someStaticMethod();
9+
self::someStaticMethod();
10+
static::someStaticMethod();
11+
parent::someStaticMethod();
12+
$someStaticClass = 'SomeStaticClass';
13+
$someStaticClass::someStaticMethod();
14+
}
15+
}

0 commit comments

Comments
 (0)