Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 14, 2024
1 parent 02986d0 commit b3e7231
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 2 additions & 5 deletions src/Framework/MockObject/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject,
throw new ClassIsReadonlyException($_mockClassName['fullClassName']);
}

if ($class->hasMethod('method')) {
if ($class->hasMethod('method') ||
($explicitMethods !== null && in_array('method', $explicitMethods, true))) {
throw new MethodNamedMethodException;
}

Expand Down Expand Up @@ -440,10 +441,6 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject,
}
}

if ($mockMethods->hasMethod('method')) {
throw new MethodNamedMethodException;
}

$mockedMethods = '';
$configurable = [];

Expand Down
6 changes: 0 additions & 6 deletions src/Framework/MockObject/Generator/MockMethodSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
namespace PHPUnit\Framework\MockObject\Generator;

use function array_key_exists;
use function array_values;
use function strtolower;

Expand Down Expand Up @@ -37,9 +36,4 @@ public function asArray(): array
{
return array_values($this->methods);
}

public function hasMethod(string $methodName): bool
{
return array_key_exists(strtolower($methodName), $this->methods);
}
}

0 comments on commit b3e7231

Please sign in to comment.