Phpunit: Deprecation warning on Symfony 4.4.*

Created on 7 Jan 2020  路  13Comments  路  Source: sebastianbergmann/phpunit

Hello

Running PHPUnit 8.5.1. and Symfony 4.4. i got deprecation warning on running php unit tests.

Other deprecation notices (1)
1x: The "PHPUnit\DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter" class is considered final. It may change without further notice as of its next major version. You should not extend it from "PHPUnit\DeepCopy\TypeFilter\Spl\SplDoublyLinkedList".

Should i ignore that?
If i ignore this warning my pipeline fails on unittest stage

Any help would be appreciate

statublocked typrefactoring

Most helpful comment

While we wait for the release, we can turn off the deprecation warnings shown. By default, Symfony PHPUnit Bridge shows warnings for deprecation notices at autoloading time. To turn it off, do the following:

<!-- phpunit.xml.dist -->
<!-- ... -->
<listeners>
    <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
        <arguments>
            <array>
                <!-- set this option to 0 to disable the DebugClassLoader integration -->
                <element key="debug-class-loader"><integer>0</integer></element>
            </array>
        </arguments>
    </listener>
</listeners>

https://symfony.com/doc/4.4/components/phpunit_bridge.html#deprecation-notices-at-autoloading-time

@arturslogins

All 13 comments

@mnapoli @theofidry Can you advise what should be done here?

IIRC SplDoublyLinkedList has been deprecated in favour of SplDoublyLinkedListFilter. The later has been marked as @final but is not yet completely as the deprecated class extends it.

So no immediate solution yet AFAICT

There will be later any fix for this warning message?

This warning message is not coming from PHPUnit. It looks to me as it is coming from Symfony's PHPUnit bridge.

There will be later any fix for this warning message?

Not in 1.x since it would result in a BC break. The deprecated class can be removed in 2.x hence the deprecation be removed. So it's one deprecation notice you don't have to worry about

This warning message is not coming from PHPUnit. It looks to me as it is coming from Symfony's PHPUnit bridge.

This message is coming from PHPUnit because when i run tests from PHPUnit bridge there is not any message. For now this is workaround for me

There is no code in PHPUnit that prints

Other deprecation notices (1)
1x: The "PHPUnit\DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter" class is considered final. It may change without further notice as of its next major version. You should not extend it from "PHPUnit\DeepCopy\TypeFilter\Spl\SplDoublyLinkedList"

The warning is coming from the required myclabs/deep-copy PHPUnit dependency.

There is a @deprecated annotation in myclabs/deep-copy that triggers the printing of

Other deprecation notices (1)
1x: The "PHPUnit\DeepCopy\TypeFilter\Spl\SplDoublyLinkedListFilter" class is considered final. It may change without further notice as of its next major version. You should not extend it from "PHPUnit\DeepCopy\TypeFilter\Spl\SplDoublyLinkedList"

by Symfony's PHPUnit bridge. It is not printed by PHPUnit, that is what I meant in https://github.com/sebastianbergmann/phpunit/issues/4002#issuecomment-571508630.

@sebastianbergmann is there anything we need to do in myclabs/deep-copy?

I'm happy to help. Not the first time I'm annoyed by that deprecation logger of the Symfony bridge, I'm not sure what to do here.

@mnapoli I think the best way would be to push out 2.x. I'll try to get back to it in the coming months...

This is blocked until there is a 2.x release of myclabs/deep-copy.

While we wait for the release, we can turn off the deprecation warnings shown. By default, Symfony PHPUnit Bridge shows warnings for deprecation notices at autoloading time. To turn it off, do the following:

<!-- phpunit.xml.dist -->
<!-- ... -->
<listeners>
    <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
        <arguments>
            <array>
                <!-- set this option to 0 to disable the DebugClassLoader integration -->
                <element key="debug-class-loader"><integer>0</integer></element>
            </array>
        </arguments>
    </listener>
</listeners>

https://symfony.com/doc/4.4/components/phpunit_bridge.html#deprecation-notices-at-autoloading-time

@arturslogins

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephen-leavitt-sonyatv-com picture stephen-leavitt-sonyatv-com  路  4Comments

dkarlovi picture dkarlovi  路  3Comments

ezzatron picture ezzatron  路  3Comments

keradus picture keradus  路  3Comments

AnmSaiful picture AnmSaiful  路  4Comments