Skip to content

Commit b3c1a49

Browse files
Merge branch '10.5' into 11.0
2 parents d60dedf + 484cacc commit b3c1a49

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<exec executable="${basedir}/build/scripts/generate-global-assert-wrappers.php" taskname="generate-global-assert-wrappers" failonerror="true"/>
3434
<exec executable="${basedir}/tools/php-cs-fixer" taskname="php-cs-fixer" failonerror="true">
3535
<arg value="fix"/>
36+
<arg value="--show-progress=none"/>
3637
<arg path="${basedir}/src/Framework/Assert/Functions.php"/>
3738
</exec>
3839
</target>

build/scripts/generate-global-assert-wrappers.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464

6565
$usedClasses[] = $returnType->getName();
6666

67+
// skip, so we can later on append a signature including precise analysis types
68+
if ($method->getName() === 'callback') {
69+
continue;
70+
}
71+
6772
$constraintMethods .= \sprintf(
6873
"if (!function_exists('PHPUnit\Framework\\" . $method->getName() . "')) {\n%s\n{\n return Assert::%s(...\\func_get_args());\n}\n}\n\n",
6974
\str_replace('final public static ', '', \trim($lines[$method->getStartLine() - 1])),
@@ -105,6 +110,19 @@
105110
$buffer .= $constraintMethods;
106111

107112
$buffer .= <<<'EOT'
113+
if (!function_exists('PHPUnit\Framework\callback')) {
114+
/**
115+
* @psalm-template CallbackInput of mixed
116+
*
117+
* @psalm-param callable(CallbackInput $callback): bool $callback
118+
*
119+
* @psalm-return Callback<CallbackInput>
120+
*/
121+
function callback(callable $callback): Callback
122+
{
123+
return Assert::callback($callback);
124+
}
125+
}
108126
109127
if (!function_exists('PHPUnit\Framework\any')) {
110128
/**

src/Framework/Assert/Functions.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,13 +2384,6 @@ function isTrue(): IsTrue
23842384
}
23852385
}
23862386

2387-
if (!function_exists('PHPUnit\Framework\callback')) {
2388-
function callback(callable $callback): Callback
2389-
{
2390-
return Assert::callback(...func_get_args());
2391-
}
2392-
}
2393-
23942387
if (!function_exists('PHPUnit\Framework\isFalse')) {
23952388
function isFalse(): IsFalse
23962389
{
@@ -2643,6 +2636,20 @@ function objectEquals(object $object, string $method = 'equals'): ObjectEquals
26432636
}
26442637
}
26452638

2639+
if (!function_exists('PHPUnit\Framework\callback')) {
2640+
/**
2641+
* @psalm-template CallbackInput of mixed
2642+
*
2643+
* @psalm-param callable(CallbackInput $callback): bool $callback
2644+
*
2645+
* @psalm-return Callback<CallbackInput>
2646+
*/
2647+
function callback(callable $callback): Callback
2648+
{
2649+
return Assert::callback($callback);
2650+
}
2651+
}
2652+
26462653
if (!function_exists('PHPUnit\Framework\any')) {
26472654
/**
26482655
* Returns a matcher that matches when the method is executed

0 commit comments

Comments
 (0)