Skip to content

Clash with PHP 8.1 JsonSerializable Interface #144

Closed
@MarkBaker

Description

@MarkBaker

Running tests against the latest PHP 8.1 nightly causes fatal errors with a clash between MyClabs Enum and the new return typehints implementation in the interface for jsonSerializable in PHP 8.1

PHPUnit\Framework\Exception: PHP Fatal error:  During inheritance of JsonSerializable: Uncaught Declaration of MyCLabs\Enum\Enum::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed

and the stack trace (for reference)

/home/runner/work/PhpSpreadsheet/PhpSpreadsheet/vendor/myclabs/php-enum/src/Enum.php:301
/home/runner/work/PhpSpreadsheet/PhpSpreadsheet/vendor/myclabs/php-enum/src/Enum.php:22

As PHP 8.1 is now in alpha release stage, I thought I'd better raise an issue to ensure that you are aware of the problem.

This is against version 1.8.0 of the Enum library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions