Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error on PHP 8.1 #12

Open
habibimh opened this issue Feb 27, 2023 · 12 comments
Open

Fatal error on PHP 8.1 #12

habibimh opened this issue Feb 27, 2023 · 12 comments

Comments

@habibimh
Copy link

Hi Elan, I tried to run Props project and faced this issue:

Fatal error: Declaration of Props\Container::has($name) must be compatible with Psr\Container\ContainerInterface::has(string $id): bool in /var/www/html/vendor/mrclay/props-dic/src/Props/Container.php on line 105

Could you fix it or can I send you a pull request to fix this?

@Be-Mann
Copy link

Be-Mann commented Mar 17, 2023

+1

@glensc
Copy link
Collaborator

glensc commented Mar 20, 2023

  1. why are you addressing one developer specifically? what change are you referring to? do point to it!
  2. your bug report lacks any reproducer, or information about your environment! or even version you were using.

@habibimh
Copy link
Author

  1. Sorry I just knew there are more developers on this branch.
  2. I use the latest version of "mrclay/minify" 3.0.13 and PHP 8.1.17

This error is obvious from the description, type of $id in the ContainerInterface not defined.
If you don't mind I will send a pull request for fix it.

@habibimh
Copy link
Author

I need permission to create a PR,
ERROR: Permission to mrclay/Props.git denied to habibimh, if somebody give me the permission I will send the PR.

@glensc
Copy link
Collaborator

glensc commented Mar 29, 2023

this is not how this work. you create pr from your own fork, not push directly to upstream repo.

also, still unclear what are your other dependencies. create gist reproducer. last i checked you should be able to use proper psr package depending on your environment.

@bwaters
Copy link

bwaters commented Apr 6, 2023

Submitted fix in #13

@glensc
Copy link
Collaborator

glensc commented Apr 6, 2023

Still, no reproducer or environment info, as I see you have to install compatible dependency:

@habibimh
Copy link
Author

habibimh commented Apr 6, 2023

I made a pr for it: #14, for strict type in function we should use PHP > 7, so I change the php version to 7.

@ethaniel
Copy link

ethaniel commented Jul 7, 2023

I experience this on PHP 7.3:
My composer.json is:

{
    "config":
    {
        "platform":
        {
            "php": "7.3"

        }

    },
    "require": {
        "mrclay/minify": "^3.0",
        "stripe/stripe-php": "^10.16",
        "aws/aws-sdk-php": "^3.275"
    }
}

Somehow props contains:

    public function has($name)

But psr/container ContainerInterface contains:

    public function has(string $id): bool;

@ethaniel
Copy link

ethaniel commented Jul 7, 2023

It turns out that props-dic 3.0.0 requires psr/container ^1.0.
But props-dic 3.0.1 requires psr/container ^1.0|^2.0, and turns out that it's incompatible with the 2.0 version.

You need to update the packagist.

@ethaniel
Copy link

ethaniel commented Jul 7, 2023

Here is my updated composer.json, which locks mrclay/props-dic to 3.0.0:

{
    "config":
    {
        "platform":
        {
            "php": "7.4"

        }

    },
    "require": {
        "mrclay/minify": "^3.0",
        "mrclay/props-dic": "3.0.0",
        "stripe/stripe-php": "^10.16",
        "aws/aws-sdk-php": "^3.275"
    }
}

@Be-Mann
Copy link

Be-Mann commented Aug 3, 2023

Please make it finally PHP8.1 and psr/container 2.0 compatible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants