laminas / laminas-di

Automated dependency injection for PSR-11 containers
https://docs.laminas.dev/laminas-di/
BSD 3-Clause "New" or "Revised" License
36 stars 20 forks source link

Bump supported php versions #15

Closed gennadigennadigennadi closed 4 years ago

gennadigennadigennadi commented 4 years ago

Signed-off-by: gennadigennadigennadi gennadijanzen@icloud.com

Q A
QA yes

Description

Update minimum PHP Version to 7.4. I also updated to PHPunit 9 and fixed the deprecations. All these update are relevant for making laminas-di compatible with PHP 8, since only PHPunit 9 is going to support it.

I have also notices that lamians-servicemanager 3.5 will move in AbstractFactoryInterface to Psr\Container\ContainerInterface, that's why laminas-di will break for now.

boesing commented 4 years ago

@gennadigennadigennadi First of all, thanks for your contribution. Would be great if you include PHP 7.3 as its still supported until end of december 2020. Please also cleanup .travis.yml so it does not test against PHP 7.1 + PHP 7.2.

If you would like to help us by adding PHP 8.0 aswell, please have a look at this gist. 👍

boesing commented 4 years ago

Oh, I was a bit too quick. Could you fix the unit test where the array error is popping up? I guess a simple is_object || is_string check would solve the problem with method_exists tho.

@weierophinney @tux-rampage do you guys know why __set_state is static & private in that UnexporatableValue2 class?

class UnexportableValue2
{
    private static function __set_state($data)
    {
    }
}
tux-rampage commented 4 years ago

@weierophinney @tux-rampage do you guys know why __set_state is static & private in that UnexporatableValue2 class?

class UnexportableValue2
{
    private static function __set_state($data)
    {
    }
}

Because it's representing a case where an instance of this class cannot be safely exported with var_export(). In this case the code generator has to detect this and avoid creating code that breaks with an error when executed.

I'll review the changes within the next days.

boesing commented 4 years ago

Because it's representing a case where an instance of this class cannot be safely exported with var_export()

Yes, because its even invalid PHP code. Sadly, PHP 7 never had a problem with marking that method as private. Not even sure if there is any magic method which can be private. 🤔

gennadigennadigennadi commented 4 years ago

Oh, I was a bit too quick. Could you fix the unit test where the array error is popping up? I guess a simple is_object || is_string check would solve the problem with method_exists tho.

The Problem was already fixed in laminas-stdlib 3.3, therefore I just bump the minimal version.

tux-rampage commented 4 years ago

Because it's representing a case where an instance of this class cannot be safely exported with var_export()

Yes, because its even invalid PHP code. Sadly, PHP 7 never had a problem with marking that method as private. Not even sure if there is any magic method which can be private. thinking

That's why it's there. If people can do it some will do it. I don't mind dropping this test case and stick with resource as non-exportable. For everything else we could refer to the PHP docs and suggest tu use static analysis.

As for static analysis: Psalm with full Template support and strictest level would be my next goal for this component - before improving the AoT generator and getting rid of some code that is no longer necessary.