Skip to content

Commit 6bdd65a

Browse files
committed
move the test to rule tests
1 parent 447d581 commit 6bdd65a

File tree

5 files changed

+39
-37
lines changed

5 files changed

+39
-37
lines changed

Diff for: tests/PHPStan/Analyser/WeirdBugTest.php

-35
This file was deleted.

Diff for: tests/PHPStan/Rules/Functions/WeirdBugTest.php

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Rules\Functions;
4+
5+
use PHPStan\Rules\FunctionReturnTypeCheck;
6+
use PHPStan\Rules\Rule;
7+
use PHPStan\Rules\RuleLevelHelper;
8+
use PHPStan\Testing\RuleTestCase;
9+
10+
/**
11+
* @extends RuleTestCase<ClosureReturnTypeRule>
12+
*/
13+
class WeirdBugTest extends RuleTestCase
14+
{
15+
16+
protected function getRule(): Rule
17+
{
18+
return new ClosureReturnTypeRule(new FunctionReturnTypeCheck(new RuleLevelHelper($this->createReflectionProvider(), true, false, true, false, false, true, false)));
19+
}
20+
21+
public function testClosureReturnTypeRule(): void
22+
{
23+
if (PHP_VERSION_ID < 80000) {
24+
$this->markTestSkipped('Test requires PHP 8.0');
25+
}
26+
27+
$this->analyse([__DIR__ . '/data/weird-bug-test.php'], []);
28+
}
29+
30+
public static function getAdditionalConfigFiles(): array
31+
{
32+
return [
33+
__DIR__ . '/data/weird-bug-config.neon',
34+
];
35+
}
36+
37+
}

Diff for: tests/PHPStan/Analyser/data/weird-bug.php renamed to tests/PHPStan/Rules/Functions/data/weird-bug-test.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Model {
1010
*/
1111
public static function getBuilder(): Builder
1212
{
13-
return new Builder(new static()); // @phpstan-ignore-line
13+
return new Builder(new static());
1414
}
1515
}
1616

@@ -24,7 +24,7 @@ class Builder {
2424
/**
2525
* @param T $model
2626
*/
27-
public function __construct(private Model $model) // @phpstan-ignore-line
27+
public function __construct(private Model $model)
2828
{
2929
}
3030

0 commit comments

Comments
 (0)