Skip to content

Commit 2e6e49a

Browse files
Remove wrapper functions for #5424
1 parent 7a7648c commit 2e6e49a

File tree

2 files changed

+0
-113
lines changed

2 files changed

+0
-113
lines changed

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

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -200,68 +200,13 @@ function atMost(int $allowedInvocations): InvokedAtMostCountMatcher
200200
}
201201
}
202202
203-
if (!function_exists('PHPUnit\Framework\returnValue')) {
204-
function returnValue(mixed $value): ReturnStub
205-
{
206-
return new ReturnStub($value);
207-
}
208-
}
209-
210-
if (!function_exists('PHPUnit\Framework\returnValueMap')) {
211-
/**
212-
* @param array<mixed> $valueMap
213-
*/
214-
function returnValueMap(array $valueMap): ReturnValueMapStub
215-
{
216-
return new ReturnValueMapStub($valueMap);
217-
}
218-
}
219-
220-
if (!function_exists('PHPUnit\Framework\returnArgument')) {
221-
function returnArgument(int $argumentIndex): ReturnArgumentStub
222-
{
223-
return new ReturnArgumentStub($argumentIndex);
224-
}
225-
}
226-
227-
if (!function_exists('PHPUnit\Framework\returnCallback')) {
228-
function returnCallback(callable $callback): ReturnCallbackStub
229-
{
230-
return new ReturnCallbackStub($callback);
231-
}
232-
}
233-
234-
if (!function_exists('PHPUnit\Framework\returnSelf')) {
235-
/**
236-
* Returns the current object.
237-
*
238-
* This method is useful when mocking a fluent interface.
239-
*/
240-
function returnSelf(): ReturnSelfStub
241-
{
242-
return new ReturnSelfStub;
243-
}
244-
}
245-
246203
if (!function_exists('PHPUnit\Framework\throwException')) {
247204
function throwException(\Throwable $exception): ExceptionStub
248205
{
249206
return new ExceptionStub($exception);
250207
}
251208
}
252209

253-
if (!function_exists('PHPUnit\Framework\onConsecutiveCalls')) {
254-
/**
255-
* @param mixed $value , ...
256-
*/
257-
function onConsecutiveCalls(): ConsecutiveCallsStub
258-
{
259-
$arguments = \func_get_args();
260-
261-
return new ConsecutiveCallsStub($arguments);
262-
}
263-
}
264-
265210
EOT;
266211

267212
\file_put_contents(__DIR__ . '/../../src/Framework/Assert/Functions.php', $buffer);

src/Framework/Assert/Functions.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,7 @@
5959
use PHPUnit\Framework\MockObject\Rule\InvokedAtLeastOnce as InvokedAtLeastOnceMatcher;
6060
use PHPUnit\Framework\MockObject\Rule\InvokedAtMostCount as InvokedAtMostCountMatcher;
6161
use PHPUnit\Framework\MockObject\Rule\InvokedCount as InvokedCountMatcher;
62-
use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls as ConsecutiveCallsStub;
6362
use PHPUnit\Framework\MockObject\Stub\Exception as ExceptionStub;
64-
use PHPUnit\Framework\MockObject\Stub\ReturnArgument as ReturnArgumentStub;
65-
use PHPUnit\Framework\MockObject\Stub\ReturnCallback as ReturnCallbackStub;
66-
use PHPUnit\Framework\MockObject\Stub\ReturnSelf as ReturnSelfStub;
67-
use PHPUnit\Framework\MockObject\Stub\ReturnStub;
68-
use PHPUnit\Framework\MockObject\Stub\ReturnValueMap as ReturnValueMapStub;
6963
use PHPUnit\Util\Xml\XmlException;
7064
use Throwable;
7165

@@ -2745,61 +2739,9 @@ function atMost(int $allowedInvocations): InvokedAtMostCountMatcher
27452739
}
27462740
}
27472741

2748-
if (!function_exists('PHPUnit\Framework\returnValue')) {
2749-
function returnValue(mixed $value): ReturnStub
2750-
{
2751-
return new ReturnStub($value);
2752-
}
2753-
}
2754-
2755-
if (!function_exists('PHPUnit\Framework\returnValueMap')) {
2756-
/**
2757-
* @param array<mixed> $valueMap
2758-
*/
2759-
function returnValueMap(array $valueMap): ReturnValueMapStub
2760-
{
2761-
return new ReturnValueMapStub($valueMap);
2762-
}
2763-
}
2764-
2765-
if (!function_exists('PHPUnit\Framework\returnArgument')) {
2766-
function returnArgument(int $argumentIndex): ReturnArgumentStub
2767-
{
2768-
return new ReturnArgumentStub($argumentIndex);
2769-
}
2770-
}
2771-
2772-
if (!function_exists('PHPUnit\Framework\returnCallback')) {
2773-
function returnCallback(callable $callback): ReturnCallbackStub
2774-
{
2775-
return new ReturnCallbackStub($callback);
2776-
}
2777-
}
2778-
2779-
if (!function_exists('PHPUnit\Framework\returnSelf')) {
2780-
/**
2781-
* Returns the current object.
2782-
*
2783-
* This method is useful when mocking a fluent interface.
2784-
*/
2785-
function returnSelf(): ReturnSelfStub
2786-
{
2787-
return new ReturnSelfStub;
2788-
}
2789-
}
2790-
27912742
if (!function_exists('PHPUnit\Framework\throwException')) {
27922743
function throwException(Throwable $exception): ExceptionStub
27932744
{
27942745
return new ExceptionStub($exception);
27952746
}
27962747
}
2797-
2798-
if (!function_exists('PHPUnit\Framework\onConsecutiveCalls')) {
2799-
function onConsecutiveCalls(): ConsecutiveCallsStub
2800-
{
2801-
$arguments = func_get_args();
2802-
2803-
return new ConsecutiveCallsStub($arguments);
2804-
}
2805-
}

0 commit comments

Comments
 (0)