Skip to content

Incorrect behavior of ReturnTypeFromStrictNativeCallRector #9045

Closed
@Dan-Suite

Description

@Dan-Suite

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/8c5d72b6-135f-43c4-8688-d4976d7ce331

<?php
class DemoFile
{
    public function run(bool $param)
    {
        return array_filter($this->value ?? []);
    }
}

Responsible rules

  • ReturnTypeFromStrictNativeCallRector

Expected Behavior

return array_filter ought to always be typed as array. This only seems to be an issue if $this->value is dynamic or typed as mixed. When typed as 'array', the expected behaviour is there.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions