Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mock method $args parameter type #1397

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions library/Mockery.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public static function hasValue($val)
*
* @template TInstanceMock
*
* @param TInstanceMock ...$args
* @param array<class-string<TInstanceMock>|TInstanceMock> $args
*
* @return LegacyMockInterface&MockInterface&TInstanceMock
*/
Expand Down Expand Up @@ -468,7 +468,7 @@ public static function isSame($expected): IsSame
*
* @template TMock
*
* @param TMock ...$args
* @param array<class-string<TMock>|TMock> $args
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is invalid type, because according in the doc you can

$mock = \Mockery::mock('MyClass', 'MyInterface', [$constructorArg1, $constructorArg2]);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is. There are still a lot of different use cases that this does not cover.

*
* @return LegacyMockInterface&MockInterface&TMock
*/
Expand Down Expand Up @@ -496,7 +496,7 @@ public static function mustBe($expected)
*
* @template TNamedMock
*
* @param TNamedMock ...$args
* @param array<class-string<TNamedMock>|TNamedMock> $args
*
* @return LegacyMockInterface&MockInterface&TNamedMock
*/
Expand Down Expand Up @@ -668,7 +668,7 @@ public static function setLoader(Loader $loader)
*
* @template TSpy
*
* @param TSpy ...$args
* @param array<class-string<TSpy>|TSpy> $args
*
* @return LegacyMockInterface&MockInterface&TSpy
*/
Expand Down