Skip to content

Incorrect behavior of RecastingRemovalRector #9005

@samsonasik

Description

@samsonasik

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/c655ef2d-fc8b-413b-b22d-eb903cd113a7

<?php

trait SomeTrait
{
    public function run(bool $param): bool
    {
        return (bool) ($this->config['allow_404'] ?? false);
    }
}

On trait, the valid cast is removed on union falsy mixed.

Responsible rules

  • RecastingRemovalRector

Expected Behavior

should be skipped.

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