mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #4516 - treat exit() as the empty type
This commit is contained in:
parent
ec9d8e6700
commit
9fd4a24c55
@ -78,6 +78,8 @@ class ExitAnalyzer
|
||||
$context->inside_call = false;
|
||||
}
|
||||
|
||||
$statements_analyzer->node_data->setType($stmt, \Psalm\Type::getEmpty());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -188,6 +188,23 @@ class MatchTest extends TestCase
|
||||
false,
|
||||
'8.0',
|
||||
],
|
||||
'exitIsLikeThrow' => [
|
||||
'<?php
|
||||
/**
|
||||
* @param 1|2|3 $i
|
||||
*/
|
||||
function foo(int $i): void {
|
||||
$a = match ($i) {
|
||||
1 => exit(),
|
||||
2, 3 => $i,
|
||||
};
|
||||
$a === "aaa";
|
||||
}',
|
||||
'error_message' => 'DocblockTypeContradiction',
|
||||
[],
|
||||
false,
|
||||
'8.0',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user