Skip to content

Commit

Permalink
Simplify #4938 for PHPUnit 10 where we do not need to care about PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 24, 2022
1 parent 694cf82 commit a429413
Show file tree
Hide file tree
Showing 108 changed files with 60 additions and 2,788 deletions.
Expand Up @@ -12,7 +12,7 @@
/**
* @internal This trait is not covered by the backward compatibility promise for PHPUnit
*/
trait MockedCloneMethodWithoutReturnType
trait MockedCloneMethod
{
public function __clone(): void
{
Expand Down

This file was deleted.

Expand Up @@ -12,7 +12,7 @@
/**
* @internal This trait is not covered by the backward compatibility promise for PHPUnit
*/
trait UnmockedCloneMethodWithoutReturnType
trait UnmockedCloneMethod
{
public function __clone(): void
{
Expand Down

This file was deleted.

12 changes: 2 additions & 10 deletions src/Framework/MockObject/Generator.php
Expand Up @@ -882,19 +882,11 @@ private function generateMock(string $type, ?array $explicitMethods, string $moc
$cloneTrait = '';

if ($mockedCloneMethod) {
if (PHP_MAJOR_VERSION >= 8) {
$cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\MockedCloneMethodWithVoidReturnType;';
} else {
$cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\MockedCloneMethodWithoutReturnType;';
}
$cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\MockedCloneMethod;';
}

if ($unmockedCloneMethod) {
if (PHP_MAJOR_VERSION >= 8) {
$cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\UnmockedCloneMethodWithVoidReturnType;';
} else {
$cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\UnmockedCloneMethodWithoutReturnType;';
}
$cloneTrait = PHP_EOL . ' use \PHPUnit\Framework\MockObject\UnmockedCloneMethod;';
}

$classTemplate->setVar(
Expand Down
89 changes: 0 additions & 89 deletions tests/end-to-end/mock-objects/generator/232-php7.phpt

This file was deleted.

Expand Up @@ -63,7 +63,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
{
use \PHPUnit\Framework\MockObject\Api;
use \PHPUnit\Framework\MockObject\Method;
use \PHPUnit\Framework\MockObject\MockedCloneMethodWithVoidReturnType;
use \PHPUnit\Framework\MockObject\MockedCloneMethod;

public function speak()
{
Expand Down

This file was deleted.

Expand Up @@ -48,7 +48,7 @@ class Issue3154Mock extends Is\Namespaced\Issue3154 implements PHPUnit\Framework
{
use \PHPUnit\Framework\MockObject\Api;
use \PHPUnit\Framework\MockObject\Method;
use \PHPUnit\Framework\MockObject\MockedCloneMethodWithVoidReturnType;
use \PHPUnit\Framework\MockObject\MockedCloneMethod;

public function a(int $i = %d, int $j = 17, string $v = '%s', string $z = '#'): string
{
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/3967.phpt
Expand Up @@ -36,7 +36,7 @@ class MockBaz extends Exception implements Baz, PHPUnit\Framework\MockObject\Moc
{
use \PHPUnit\Framework\MockObject\Api;
use \PHPUnit\Framework\MockObject\Method;
use \PHPUnit\Framework\MockObject\UnmockedCloneMethodWithVoidReturnType;
use \PHPUnit\Framework\MockObject\UnmockedCloneMethod;

public function foo(): string
{
Expand Down
60 changes: 0 additions & 60 deletions tests/end-to-end/mock-objects/generator/397-php7.phpt

This file was deleted.

Expand Up @@ -34,7 +34,7 @@ class MockC extends C implements PHPUnit\Framework\MockObject\MockObject
{
use \PHPUnit\Framework\MockObject\Api;
use \PHPUnit\Framework\MockObject\Method;
use \PHPUnit\Framework\MockObject\MockedCloneMethodWithVoidReturnType;
use \PHPUnit\Framework\MockObject\MockedCloneMethod;

public function m(?C $other): C
{
Expand Down
51 changes: 0 additions & 51 deletions tests/end-to-end/mock-objects/generator/4139-php7.phpt

This file was deleted.

0 comments on commit a429413

Please sign in to comment.