mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Ignore more redundant issues
This commit is contained in:
parent
f49be31aeb
commit
61e086ac7b
@ -553,8 +553,11 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer implements Statements
|
|||||||
if ($context->collect_initializations) {
|
if ($context->collect_initializations) {
|
||||||
$statements_analyzer->addSuppressedIssues([
|
$statements_analyzer->addSuppressedIssues([
|
||||||
'DocblockTypeContradiction',
|
'DocblockTypeContradiction',
|
||||||
|
'InvalidReturnStatement',
|
||||||
'RedundantCondition',
|
'RedundantCondition',
|
||||||
'RedundantConditionGivenDocblockType',
|
'RedundantConditionGivenDocblockType',
|
||||||
|
'TypeDoesNotContainNull',
|
||||||
|
'TypeDoesNotContainType',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,6 +1376,42 @@ class PropertyTypeTest extends TestCase
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __construct () {
|
||||||
|
$this->x = false;
|
||||||
|
if ($this->func1()) {
|
||||||
|
$this->y = $this->func2();
|
||||||
|
}
|
||||||
|
$this->func2();
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
],
|
||||||
|
'noRedundantConditionWhenCheckingInitializationsEdgeCases' => [
|
||||||
|
'<?php
|
||||||
|
final class Clazz {
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $x;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $y = 0;
|
||||||
|
|
||||||
|
public function func1 (): bool {
|
||||||
|
if ($this->y !== 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function func2 (): int {
|
||||||
|
if ($this->y !== 0) {
|
||||||
|
return $this->y;
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct () {
|
public function __construct () {
|
||||||
$this->x = false;
|
$this->x = false;
|
||||||
if ($this->func1()) {
|
if ($this->func1()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user