Skip to content
Permalink
Browse files

Revert "Fix #2035 - warn about erroneous casting"

This reverts commit d0f277a.
  • Loading branch information...
muglug committed Aug 20, 2019
1 parent d0f277a commit f5b63218f13fa9331000e732fddbb0485c330b9b
@@ -442,23 +442,6 @@ function (\Psalm\Internal\Clause $c) use ($mixed_var_ids) {
$t_if_context->inside_isset = false;
if (isset($stmt->left->inferredType)
&& !$stmt->left->inferredType->isMixed()
&& !$stmt->left->inferredType->isNullable()
) {
if (!$stmt->left->inferredType->from_docblock) {
if (IssueBuffer::accepts(
new \Psalm\Issue\TypeDoesNotContainType(
$stmt->left->inferredType->getId() . ' is always defined and non-null',
new CodeLocation($statements_analyzer, $stmt->left)
),
$statements_analyzer->getSuppressedIssues()
)) {
// fall through
}
}
}
foreach ($t_if_context->vars_in_scope as $var_id => $type) {
if (isset($context->vars_in_scope[$var_id])) {
$context->vars_in_scope[$var_id] = Type::combineUnionTypes($context->vars_in_scope[$var_id], $type);
@@ -1468,13 +1468,6 @@ function render(array $data): ?Traversable {
return null;
}'
],
'nullCoalesceTypedValue' => [
'<?php
/** @param string[] $arr */
function foo(array $arr) : string {
return $arr["b"] ?? "bar";
}',
],
];
}
@@ -1759,13 +1752,6 @@ function firstChar(string $s) : string { return $s; }
if (false !== firstChar("sdf")) {}',
'error_message' => 'RedundantCondition',
],
'nullCoalesceImpossible' => [
'<?php
function foo(?string $s) : string {
return ((string) $s) ?? "bar";
}',
'error_message' => 'TypeDoesNotContainType'
],
];
}
}

0 comments on commit f5b6321

Please sign in to comment.
You can’t perform that action at this time.