Skip to content

Commit

Permalink
fix shepherd and test namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Feb 29, 2024
1 parent 2bdba92 commit b761040
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
10 changes: 7 additions & 3 deletions tests/Config/Plugin/Hook/CallUserFuncLikeParamsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ public static function getFunctionParams(FunctionParamsProviderEvent $event): ?a
$callback_param_types[] = $param_type_union;
}

$callback_params = new TKeyedArray(
$callback_param_types,
);
if ($callback_param_types === []) {
$callback_params = Type::getEmptyArrayAtomic();
} else {
$callback_params = new TKeyedArray(
$callback_param_types,
);
}

return array(
new FunctionLikeParameter('callable', false, new Union([new TCallable()]), null, null, null, false),
Expand Down
27 changes: 15 additions & 12 deletions tests/Config/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,20 +797,23 @@ public function testFunctionProviderHooksThisClassInvalidArg(): void
$this->addFile(
$file_path,
'<?php
namespace Foo\Acme;
/**
* @param callable $callable
* @param array $params
*/
function call_user_func_like($callable, $params): void {}
namespace {
/**
* @param callable $callable
* @param array $params
*/
function call_user_func_like($callable, $params): void {}
}
class Bar {
public function run(int $a): int {
return ($a + 2);
}
namespace Foo\Acme {
class Bar {
public function run(int $a): int {
return ($a + 2);
}
public function init(): void {
call_user_func_like(array($this, "run"), array("hello"));
public function init(): void {
call_user_func_like(array($this, "run"), array("hello"));
}
}
}',
);
Expand Down

0 comments on commit b761040

Please sign in to comment.