-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove always true/false conditions #7229
Conversation
$invalid_iterator_types[] = $iterator_atomic_type->getKey(); | ||
|
||
$value_type = Type::getMixed(); | ||
} elseif ($iterator_atomic_type instanceof TObject || | ||
$iterator_atomic_type instanceof TMixed || | ||
$iterator_atomic_type instanceof TEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TEmpty is already covered by Scalar on the previous if
@@ -188,7 +188,6 @@ public static function analyze( | |||
if (!$atomic_key_type instanceof TString | |||
&& !$atomic_key_type instanceof TInt | |||
&& !$atomic_key_type instanceof TArrayKey | |||
&& !$atomic_key_type instanceof TMixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TMixed is handled above
@@ -1214,11 +1214,7 @@ private static function analyzeDestructuringAssignment( | |||
&& !$assign_value_type->hasArrayAccessInterface($codebase) | |||
) { | |||
if ($assign_value_type->hasArray()) { | |||
if (($assign_value_atomic_type instanceof TFalse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TNull is handled above
@@ -87,22 +87,6 @@ public static function analyze( | |||
return; | |||
} | |||
|
|||
if ($stmt instanceof PhpParser\Node\Expr\BinaryOp\BitwiseXor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BitwiseXor is handled above
@@ -146,25 +130,5 @@ public static function analyze( | |||
|
|||
return; | |||
} | |||
|
|||
if ($stmt instanceof PhpParser\Node\Expr\BinaryOp\BitwiseOr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BitwiseOr is handled above
@@ -89,9 +89,7 @@ public static function isContainedBy( | |||
} | |||
|
|||
if ($container_type_part instanceof TNonspecificLiteralString | |||
&& ($input_type_part instanceof TLiteralString | |||
|| $input_type_part instanceof TNonspecificLiteralString | |||
|| $input_type_part instanceof TNonEmptyNonspecificLiteralString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TNonEmptyNonspecificLiteralString is a child of TNonspecificLiteralString just above
@@ -1061,9 +1061,7 @@ private static function scrapeStringProperties( | |||
} | |||
} | |||
|
|||
if ($has_non_literal_class_string || | |||
!$type instanceof TClassString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$type instanceof TClassString was handled in another branch
@@ -1079,13 +1077,6 @@ private static function scrapeStringProperties( | |||
} elseif (get_class($combination->value_types['string']) !== TString::class) { | |||
if (get_class($type) === TString::class) { | |||
$combination->value_types['string'] = $type; | |||
} elseif ($combination->value_types['string'] instanceof TTraitString | |||
&& $type instanceof TClassString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -732,7 +732,6 @@ private static function getValueForKey( | |||
if ($existing_key_type_part instanceof TNull) { | |||
$class_property_type = Type::getNull(); | |||
} elseif ($existing_key_type_part instanceof TMixed | |||
|| $existing_key_type_part instanceof TTemplateParam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continued just above
/** | ||
* @psalm-suppress TypeDoesNotContainNull PHPUnit 8.2 made it non-nullable again | ||
*/ | ||
if (null === $name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-nullable since 8.2 and Psalm 4 requires PHPunit 9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I'll explain them in review mode