mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #2677 - use better assertion for null coalesce
This commit is contained in:
parent
0f659d996d
commit
0ffb833bf3
@ -778,7 +778,7 @@ class BinaryOpAnalyzer
|
||||
|
||||
if ($stmt_left_type = $statements_analyzer->node_data->getType($stmt->left)) {
|
||||
$if_return_type_reconciled = AssertionReconciler::reconcile(
|
||||
'!null',
|
||||
'isset',
|
||||
clone $stmt_left_type,
|
||||
'',
|
||||
$statements_analyzer,
|
||||
|
@ -1061,6 +1061,16 @@ class AnnotationTest extends TestCase
|
||||
/** @param list<scalar|array|object|resource|null> $_s */
|
||||
function foo(array $_s) : void { }'
|
||||
],
|
||||
'possiblyUndefinedObjectProperty' => [
|
||||
'<?php
|
||||
function consume(string $value): void {
|
||||
echo $value;
|
||||
}
|
||||
|
||||
/** @var object{value?: string} $data */
|
||||
$data = json_decode("{}", false);
|
||||
consume($data->value ?? "");'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user