mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Prevent features pre-php-8
This commit is contained in:
parent
66e40f1007
commit
0f8b017384
@ -367,16 +367,21 @@ class ExpressionAnalyzer
|
||||
return Expression\YieldFromAnalyzer::analyze($statements_analyzer, $stmt, $context);
|
||||
}
|
||||
|
||||
if ($stmt instanceof PhpParser\Node\Expr\Match_) {
|
||||
if ($stmt instanceof PhpParser\Node\Expr\Match_
|
||||
&& $statements_analyzer->getCodebase()->php_major_version >= 8
|
||||
) {
|
||||
return Expression\MatchAnalyzer::analyze($statements_analyzer, $stmt, $context);
|
||||
}
|
||||
|
||||
if ($stmt instanceof PhpParser\Node\Expr\Throw_) {
|
||||
if ($stmt instanceof PhpParser\Node\Expr\Throw_
|
||||
&& $statements_analyzer->getCodebase()->php_major_version >= 8
|
||||
) {
|
||||
return ThrowAnalyzer::analyze($statements_analyzer, $stmt, $context);
|
||||
}
|
||||
|
||||
if ($stmt instanceof PhpParser\Node\Expr\NullsafePropertyFetch
|
||||
|| $stmt instanceof PhpParser\Node\Expr\NullsafeMethodCall
|
||||
if (($stmt instanceof PhpParser\Node\Expr\NullsafePropertyFetch
|
||||
|| $stmt instanceof PhpParser\Node\Expr\NullsafeMethodCall)
|
||||
&& $statements_analyzer->getCodebase()->php_major_version >= 8
|
||||
) {
|
||||
return Expression\NullsafeAnalyzer::analyze($statements_analyzer, $stmt, $context);
|
||||
}
|
||||
|
@ -2831,7 +2831,7 @@ class ConditionalTest extends \Psalm\Tests\TestCase
|
||||
) {}
|
||||
}
|
||||
|
||||
function skipOn(IntLinkedList $l) : ?int {
|
||||
function skipOne(IntLinkedList $l) : ?int {
|
||||
return $l->next?->value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user