Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a3a23b8

Browse files
authored
Fix build
1 parent edcce79 commit a3a23b8

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎tests/PHPStan/Rules/Methods/CallToMethodStatementWithoutSideEffectsRuleTest.php‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\Rules\Rule;
66
use PHPStan\Rules\RuleLevelHelper;
77
use PHPStan\Testing\RuleTestCase;
8+
use PHPUnit\Framework\Attributes\RequiresPhp;
89
use function array_merge;
910
use const PHP_VERSION_ID;
1011

@@ -19,7 +20,31 @@ protected function getRule(): Rule
1920
return new CallToMethodStatementWithoutSideEffectsRule(new RuleLevelHelper(self::createReflectionProvider(), true, false, true, false, false, false, true));
2021
}
2122

23+
#[RequiresPhp('>= 8.0')]
2224
public function testRule(): void
25+
{
26+
$this->analyse([__DIR__ . '/data/method-call-statement-no-side-effects.php'], [
27+
[
28+
'Call to method DateTimeImmutable::modify() on a separate line has no effect.',
29+
15,
30+
],
31+
[
32+
'Call to method Exception::getCode() on a separate line has no effect.',
33+
21,
34+
],
35+
[
36+
'Call to method MethodCallStatementNoSideEffects\Bar::doPure() on a separate line has no effect.',
37+
63,
38+
],
39+
[
40+
'Call to method MethodCallStatementNoSideEffects\Bar::doPureWithThrowsVoid() on a separate line has no effect.',
41+
64,
42+
],
43+
]);
44+
}
45+
46+
#[RequiresPhp('< 8')]
47+
public function testRulePhp7(): void
2348
{
2449
$this->analyse([__DIR__ . '/data/method-call-statement-no-side-effects.php'], [
2550
[

‎tests/PHPStan/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRuleTest.php‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\Rules\Rule;
66
use PHPStan\Rules\RuleLevelHelper;
77
use PHPStan\Testing\RuleTestCase;
8+
use PHPUnit\Framework\Attributes\RequiresPhp;
89

910
/**
1011
* @extends RuleTestCase<CallToStaticMethodStatementWithoutSideEffectsRule>
@@ -21,7 +22,19 @@ protected function getRule(): Rule
2122
);
2223
}
2324

25+
#[RequiresPhp('>= 8.0')]
2426
public function testRule(): void
27+
{
28+
$this->analyse([__DIR__ . '/data/static-method-call-statement-no-side-effects.php'], [
29+
[
30+
'Call to method DateTime::format() on a separate line has no effect.',
31+
23,
32+
],
33+
]);
34+
}
35+
36+
#[RequiresPhp('< 8')]
37+
public function testRulePhp7(): void
2538
{
2639
$this->analyse([__DIR__ . '/data/static-method-call-statement-no-side-effects.php'], [
2740
[

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /