1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #639 - add scalar to psalm-recognised types

This commit is contained in:
Matt Brown 2018-04-03 11:24:23 -04:00
parent 1395299e28
commit fef56c7633
2 changed files with 26 additions and 0 deletions

View File

@ -38,6 +38,7 @@ abstract class Type
'float' => true,
'bool' => true,
'false' => true,
'true' => true,
'object' => true,
'empty' => true,
'callable' => true,
@ -55,6 +56,7 @@ abstract class Type
'void' => true,
'self' => true,
'static' => true,
'scalar' => true,
];
/**

View File

@ -507,6 +507,30 @@ class ReturnTypeTest extends TestCase
return $arr;
}',
],
'namespacedScalarParamAndReturn' => [
'<?php
namespace Foo;
/**
* @param scalar $scalar
*
* @return scalar
*/
function ($scalar) {
switch(random_int(0, 3)) {
case 0:
return true;
case 1:
return "string";
case 2:
return 2;
case 3:
return 3.0;
}
return 0;
}'
],
];
}