Skip to content

Mocking an interface method with a static return value as part of a demeter chain mock results in a fatal error #1447

@kirkbushell

Description

@kirkbushell

Mockery Version

1.6.12

PHP Version

PHP 8.2

Issue Description

As per the title - if you create an interface with a method that has a static return type, Mockery fails.

Steps to Reproduce

  1. Create an interface
  2. Add a method that has a static return type
  3. Run test

Expected Behavior

The method with the static return type should be mockable.

Actual Behavior

Mockery throws an exception:

syntax error, unexpected token "static", expecting identifier

  at /tmp/MockeryVc3BMx:1
  ➜   1▕ <?php class static {}

  1   /tmp/MockeryVc3BMx:1
  2   app/Modules/Forms/Formables/RequestToFieldValues.test.php:24

Exception or Error

Full error is above.

Additional Information

No response

Metadata

Metadata

Assignees

Labels

BugAn error or unexpected behavior.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions