Skip to content

Parameter declaration not compatible with parent class #10

@SanderVanLeeuwen

Description

@SanderVanLeeuwen

Upgrading mrclay/minify from 3.0.10 to 3.0.11 got me into some troubles. After some digging I found out this is caused because of a PHP version mismatch between my development and production environment (7.4 vs 7.1). Although that's my own problem off course, I do think this can also somewhat be described as a bug in this library too.

It's caused by the following method (and the has() as well):

public function get($name)

The (latest) Psr\Container\ContainerInterface has this method defined with a typehint: public function get(string $name). Starting from PHP 7.2, these typehint mismatches are allowed, but on PHP 7.1 this throws an error.

So my thoughts are that either this library should have a PHP requirement of >= 7.2 or the typehints should match to make this library compatible with PHP < 7.1.

And in case anyone stumbles upon this, for now I've fixed it by manually requiring "psr/container": "1.0" (instead of 1.1) which still has the un-hinted declarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions