Skip to content

ReturnTypeFromStrictTypedCallRector turns code into phpstan error #7827

@staabm

Description

@staabm

Bug Report

Subject Details
Rector version 0.15.20

given code

<?php

final class DemoFile
{
    public function run()
    {
        $range = static function ($start, $end) {
            return array_map(static function ($number) {
                return sprintf('%02d', $number);
            }, range($start, $end));
        };
    }
}

is turned into

https://phpstan.org/r/d11bf4fe-eebc-4ce6-97ec-78e4be083e01

by ReturnTypeFromStrictTypedCallRector.

Minimal PHP Code Causing Issue

https://getrector.com/demo/11e15340-e07c-4223-a1e7-892c34797dde

Expected Behaviour

rector should not produce "invalid"/unnecessary code/types

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