2016-12-09 12:07:47 -05:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Tests;
|
|
|
|
|
2017-04-24 23:45:02 -04:00
|
|
|
class ArgTest extends TestCase
|
2016-12-09 12:07:47 -05:00
|
|
|
{
|
2017-04-24 23:45:02 -04:00
|
|
|
use Traits\FileCheckerInvalidCodeParseTestTrait;
|
|
|
|
use Traits\FileCheckerValidCodeParseTestTrait;
|
2017-01-02 15:31:18 -05:00
|
|
|
|
2017-01-13 14:07:23 -05:00
|
|
|
/**
|
2017-04-24 23:45:02 -04:00
|
|
|
* @return array
|
2017-01-13 14:07:23 -05:00
|
|
|
*/
|
2017-04-24 23:45:02 -04:00
|
|
|
public function providerFileCheckerValidCodeParse()
|
2016-12-09 12:07:47 -05:00
|
|
|
{
|
2017-04-24 23:45:02 -04:00
|
|
|
return [
|
|
|
|
'callMapClassOptionalArg' => [
|
|
|
|
'<?php
|
|
|
|
$m = new ReflectionMethod("hello", "goodbye");
|
|
|
|
$m->invoke("cool");'
|
|
|
|
]
|
|
|
|
];
|
2016-12-09 12:07:47 -05:00
|
|
|
}
|
2017-04-08 09:28:02 -04:00
|
|
|
|
|
|
|
/**
|
2017-04-24 23:45:02 -04:00
|
|
|
* @return array
|
2017-04-08 09:28:02 -04:00
|
|
|
*/
|
2017-04-24 23:45:02 -04:00
|
|
|
public function providerFileCheckerInvalidCodeParse()
|
2017-04-08 09:28:02 -04:00
|
|
|
{
|
2017-04-24 23:45:02 -04:00
|
|
|
return [
|
|
|
|
'possiblyInvalidArgument' => [
|
|
|
|
'<?php
|
|
|
|
$foo = [
|
|
|
|
"a",
|
|
|
|
["b"],
|
|
|
|
];
|
|
|
|
|
|
|
|
$a = array_map(
|
|
|
|
function (string $uuid) : string {
|
|
|
|
return $uuid;
|
|
|
|
},
|
|
|
|
$foo[rand(0, 1)]
|
|
|
|
);',
|
|
|
|
'error_message' => 'PossiblyInvalidArgument'
|
|
|
|
]
|
2017-04-08 09:28:02 -04:00
|
|
|
];
|
|
|
|
}
|
2016-12-09 12:07:47 -05:00
|
|
|
}
|