Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Oct 22, 2022
1 parent edeff14 commit b789ce2
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions tests/ArgTest.php
Expand Up @@ -312,6 +312,40 @@ public function foo(int ...$values): array
}
',
],
'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");',
],
];
}

Expand Down Expand Up @@ -733,6 +767,41 @@ public function __construct(
',
'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' => 'InvalidArgument',
],
'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' => 'InvalidArgument',
],
];
}
}

0 comments on commit b789ce2

Please sign in to comment.