public function testCasts()
{
$values = [INativeType::TYPE_STRING => function () {
(string) 'abc';
}, INativeType::TYPE_INT => function () {
(int) 'abc';
}, INativeType::TYPE_BOOL => function () {
(bool) 1;
}, INativeType::TYPE_DOUBLE => function () {
(double) false;
}, INativeType::TYPE_ARRAY => function () {
(array) 'abc';
}];
foreach ($values as $expectedType => $expression) {
$this->doAnalysisTest($expression, function (ITypeAnalysis $analysis, O\CastExpression $expression) use($expectedType) {
$this->assertTypeMatchesValue($analysis, $expression->getCastValue(), $analysis->getCast($expression)->getSourceType());
$this->assertEqualsNativeType($expectedType, $analysis->getCast($expression)->getReturnType());
});
}
}