Skip to content

Problem with new static unsafe usage #2773

@mitelg

Description

@mitelg

Support question

Following example given: https://phpstan.org/r/dec561c6-72a9-434b-9a6d-2032b3b13ae3 (simplified!)
Or have a look here: https://github.com/shopware/platform/blob/master/src/Core/Framework/DataAbstractionLayer/Search/EntitySearchResult.php
https://github.com/shopware/platform/blob/master/src/Core/Framework/Struct/Collection.php

PHPStan complains about "Unsafe usage of new static()" in the Collection on line 157

I don't really have an idea, how to fix that. I can't make the class final as many other classes extend from Collection. Also I could not make the constructor final as e.g. the EntitySearchResult is using more constructor parameter.

Wish you all happy holidays! 🎄 🎆

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