Skip to content

Incorrect behavior of ParentTestClassConstructorRector #9528

@gisostallenberg

Description

@gisostallenberg

Bug Report

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

Minimal PHP Code Causing Issue

See https://getrector.com/demo/919b7847-fa96-4779-8160-37d400c35745

<?php

 use PHPUnit\Framework\TestCase;

 final class SomeHelper extends TestCase
 {
 }

Responsible rules

  • ParentTestClassConstructorRector

Description

Because in PHPUnit 11 the constructor of \PHPUnit\Framework\TestCase is marked final, applying this rule results in a PHPStan error 'Method SomeHelper::__construct() overrides @Final method PHPUnit\Framework\TestCase::__construct()

Could the rule detect if the parent method is final?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions