Skip to content

Mocking \ReflectionClass throws an error in PHPUnit 8.5 when run with PHP>=8.1 #4879

@m-vo

Description

@m-vo
Q A
PHPUnit version 8.5
PHP version 8.1
Installation Method Composer

Summary

Mocking \ReflectionClass throws an error in PHPUnit 8.5 when run with PHP>=8.1.

Current behavior

Throws an exception: Call to undefined method ReflectionUnionType::getName().

How to reproduce

// Execute with PHP>=8.1
$this->createMock(\ReflectionClass::class);

Expected behavior

Works like in PHPUnit 9.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/test-doublesTest Stubs and Mock Objectstype/change-in-php-requires-adaptationA change in PHP requires a change so that existing PHPUnit functionality continues to work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions