Skip to content
This repository was archived by the owner on Dec 3, 2023. It is now read-only.
This repository was archived by the owner on Dec 3, 2023. It is now read-only.

Less strict version of NoMixed* #4567

@dereuromark

Description

@dereuromark

I ran them as per https://tomasvotruba.com/blog/not-all-mixed-types-are-equally-useless/

Is there a less strict version of the NoMixed rules?

rules:
    - Symplify\PHPStanRules\Rules\Explicit\NoMixedPropertyFetcherRule
    - Symplify\PHPStanRules\Rules\Explicit\NoMixedMethodCallerRule

They find like 600 issues in a smaller app.

Some seem to be false positive and otherwise not an issue for PHPStan as a whole.

Example:

        $order = $this->Orders->newEmptyEntity();     

Those appear to be fine for PHPStan, as Orders is resolved as

 * @property \App\Model\Table\OrdersTable&\Cake\ORM\Association\BelongsTo $Orders

on the class itself, which then in return resolves newEmptyEntity() on that OrdersTable:

 * @method \App\Model\Entity\Order newEmptyEntity()

It errors with

  380    Anonymous variables in a "$order->..." property fetch can lead to false dead property. Make sure the variable type is known 

But it is clickable, and resolves properly through the Order docblock:

 * @property int|null $user_id

So it would be more interesting to us to find the actual "undefined" objects where we call property/method on.
As those are prio to be fixed.

So maybe some param to make it only fail for actual missing ones, and assume the docblocks to be "acceptable" as the defined type?

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