1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

add tests

This commit is contained in:
kkmuffme 2022-10-22 08:48:18 +02:00
parent edeff148b4
commit 7d953dfb90

View File

@ -312,6 +312,40 @@ class ArgTest extends TestCase
}
',
],
'variadicCallbackArgsCountMatch' => [
'<?php
/**
* @param callable(string, string):void $callback
* @return void
*/
function caller($callback) {}
/**
* @param string ...$bar
* @return void
*/
function foo(...$bar) {}
caller("foo");',
],
'variadicCallableArgsCountMatch' => [
'<?php
/**
* @param callable(string, ...int):void $callback
* @return void
*/
function var_caller($callback) {}
/**
* @param string $a
* @param int $b
* @param int $c
* @return void
*/
function foo($a, $b, $c) {}
var_caller("foo");',
],
];
}
@ -733,6 +767,41 @@ class ArgTest extends TestCase
',
'error_message' => 'TooFewArguments',
],
'callbackArgsCountMismatch' => [
'<?php
/**
* @param callable(string, string):void $callback
* @return void
*/
function caller($callback) {}
/**
* @param string $a
* @return void
*/
function foo($a) {}
caller("foo");',
'error_message' => 'InvalidScalarArgument',
],
'callableArgsCountMismatch' => [
'<?php
/**
* @param callable(string):void $callback
* @return void
*/
function caller($callback) {}
/**
* @param string $a
* @param string $b
* @return void
*/
function foo($a, $b) {}
caller("foo");',
'error_message' => 'InvalidScalarArgument',
],
];
}
}