Skip to content

Commit 665d8d1

Browse files
Closes #5752
1 parent 5485819 commit 665d8d1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ChangeLog-11.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ All notable changes of the PHPUnit 11.0 release series are documented in this fi
99
* [#5747](https://github.com/sebastianbergmann/phpunit/pull/5747): Cache result of `Groups::groups()`
1010
* [#5748](https://github.com/sebastianbergmann/phpunit/pull/5748): Improve performance of `NamePrettifier::prettifyTestMethodName()`
1111
* [#5750](https://github.com/sebastianbergmann/phpunit/pull/5750): Micro-optimize `NamePrettifier::prettifyTestMethodName()` once again
12+
* [#5752](https://github.com/sebastianbergmann/phpunit/issues/5752): Improve message for deprecation of doubling methods named "method"
1213

1314
## [11.0.6] - 2024-03-12
1415

src/Framework/MockObject/Generator/Generator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,12 @@ private function generateCodeForTestDoubleClass(string $type, bool $mockObject,
763763
}
764764

765765
if ($mockMethods->hasMethod('method') || (isset($class) && $class->hasMethod('method'))) {
766-
$message = 'Doubling interfaces (or classes) that have a method named "method" is deprecated. Support for this will be removed in PHPUnit 12.';
766+
$message = sprintf(
767+
'%s %s has a method named "method". Doubling %s that have a method named "method" is deprecated. Support for this will be removed in PHPUnit 12.',
768+
($isInterface) ? 'Interface' : 'Class',
769+
isset($class) ? $class->getName() : $type,
770+
($isInterface) ? 'interfaces' : 'classes',
771+
);
767772

768773
try {
769774
EventFacade::emitter()->testTriggeredPhpunitDeprecation(

0 commit comments

Comments
 (0)