Skip to content

DowngradeNeverTypeDeclarationRector creates a fatal error bc never type hint is removed #9334

@kkmuffme

Description

@kkmuffme

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/895266d8-462e-40a9-98e8-81d61c3b1919

<?php

class Foo {
    public function run(): void {
        
    }
}

class Bar extends Foo {
    /**
     * @return never
     */
    public function run(): never {
        exit;
    }
}

new Bar();

Responsible rules

  • DowngradeNeverTypeDeclarationRector

Expected Behavior

Rector created code has a fatal: https://3v4l.org/ODTRm#v8.4.12
Using void works correctly/no fatal: https://3v4l.org/7u2rKv#v8.4.12

I already told you in #9333 (comment) but you closed it to contributors only...

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