#1520·mockery

Deprecate `\Mockery` matcher static factory methods

Author: ghostwriterCreated Sep 5, 2026Updated Sep 5, 2026
LabelsMinorDeprecated

[!WARNING] The following static factory methods on the \Mockery class are planned for deprecation in 1.7.0 and removal in 2.0.0.

Deprecated Replacement
\Mockery::andAnyOtherArgs() \Mockery\Argument::andAnyOtherArgs()
\Mockery::andAnyOthers() \Mockery\Argument::andAnyOthers()
\Mockery::any() \Mockery\Argument::any()
\Mockery::anyOf() \Mockery\Argument::anyOf()
\Mockery::capture() \Mockery\Argument::capture()
\Mockery::contains() \Mockery\Argument::contains()
\Mockery::ducktype() \Mockery\Argument::ducktype()
\Mockery::hasKey() \Mockery\Argument::hasKey()
\Mockery::hasValue() \Mockery\Argument::hasValue()
\Mockery::isEqual() \Mockery\Argument::isEqual()
\Mockery::isSame() \Mockery\Argument::isSame()
\Mockery::mustBe() \Mockery\Argument::mustBe()
\Mockery::not() \Mockery\Argument::not()
\Mockery::notAnyOf() \Mockery\Argument::notAnyOf()
\Mockery::on() \Mockery\Argument::on()
\Mockery::pattern() \Mockery\Argument::pattern()
\Mockery::subset() \Mockery\Argument::subset()
\Mockery::type() \Mockery\Argument::type()

[!IMPORTANT] The \Mockery static factory methods will remain available throughout the deprecation period to avoid unnecessarily breaking existing test suites.

Their existing behavior will remain unchanged during this period.

[!TIP] The [mockery/rector-extension] package will provide automated migration of existing test suites from the deprecated \Mockery static factory methods to the corresponding \Mockery\Argument static factory methods.