Skip to content

Limitations

This page documents known analyzer boundaries, supported version floors, and the Semantic Versioning policy for friendsofmago/mago-mockery.

Known analyzer limitations

  • Intersection-to-intersection argument checks. Mago 1.60.2 through 1.62.0 accepts Mockery::mock(ApiClient::class) for a parameter typed Greeter&Mockery\MockInterface. Mago does not yet compare intersection types member by member. tests/fixtures/Negative.php pins this case.
  • Direct calls to mocked protected methods. Calling a protected method directly on a mock after ->makePartial()->shouldAllowMockingProtectedMethods() reports Mago's invalid-method-access, or non-documented-method when the class defines __call(). Mago 1.60.2 through 1.62.0 does not expose receiver types to IssueFilterContext, so the extension does not suppress those diagnostics. Filtering by source text would also hide real visibility bugs on non-mocks.
  • Opt-in strict method checks. The extension checks literal and higher-order method names only when you set MAGO_MOCKERY_STRICT_METHODS to 1, true, yes, or on, or pass strictMockedMethods: true to MockeryExtension::plugins(). Without strict mode, shouldReceive('doesNotExist') and shouldReceive()->doesNotExist() stay silent. With strict mode, each unknown higher-order call reports one mockery/unknown-mocked-method diagnostic.
  • Strict allowance flow boundaries. In strict mode, shouldAllowMockingMethod() silences mockery/unknown-mocked-method only when you call it on the same local variable or straight-line $this->property. The call must dominate the expectation without a reassignment, unset(), $this alias, by-reference mutation, helper reset, or unmerged branch.

Compatibility and SemVer policy

friendsofmago/mago-mockery follows Semantic Versioning from 1.0.0.

  • Public PHP API. MagoMockery\MockeryExtension::create() and MagoMockery\MockeryExtension::plugins() are the supported PHP entry points. All classes under MagoMockery\Analyzer carry @internal and may change without a major version bump.
  • Worker CLI. vendor/bin/mago-mockery-worker, from bin/mago-mockery-worker, and resources/worker.php are supported worker entry points. stdout carries the Mago extension protocol. Diagnostics and warnings go to stderr.
  • Diagnostic codes. mockery/unknown-mocked-method is the only extension-owned analyzer diagnostic code and stays opt-in. Adding a new default-on diagnostic is a minor bump. Changing the meaning of an existing code, removing a code, or enabling an opt-in check by default is a major bump.
  • Suppression. Project-wide [analyzer] ignore = ["mockery/unknown-mocked-method"] and per-call // @mago-ignore analysis:mockery/unknown-mocked-method remain supported.

Supported version floors

Dependency Supported floor Tested in CI
PHP ^8.1 8.1, 8.2, 8.3, 8.4, 8.5
carthage-software/mago ^1.60.2 1.60.2, 1.61.0, 1.62.0, latest
mockery/mockery ^1.6 ^1.6