Skip to content

CreateStubOverCreateMockArgRector ignores parameter type #9683

Closed
rectorphp/rector-phpunit
#662

Description

@mttsch

Bug Report

Subject Details
Rector version v2.3.8

Minimal PHP Code Causing Issue

https://getrector.com/demo/be38a84e-8156-4d5b-bdb7-cdef5b658a1c

Expected Behaviour

As the constructor has an explicit type hint for MockObject, replacing it with Stub causes an exception.

(Background: The real service gets the mock object and then provides multiple methods to configure complex expectations that would be too verbose to repeatedly configure in the tests.)

PS: Only now discovered rectorphp/rector-phpunit#661, which is similar.

Activity

  1. github-actions commented on Aug 30, 2026

    @github-actions
    Contributor

    This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.

  2. locked as resolved and limited conversation to collaborators on Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions