rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
http://getrector.com
MIT License
62 stars 47 forks source link

Rector run Failed `TryCatchToExpectExceptionRector` #199

Closed ghostwriter closed 1 year ago

ghostwriter commented 1 year ago

Bug Report

Subject Details
Rector version ^0.17.1
Installed as composer

System error: \"array_merge(): Argument rectorphp/rector#2 must be of type array, null given on line 104.

Minimal PHP Code Causing Issue

See https://getrector.com/demo/75a8fde7-5d55-4b3c-84a2-3df83076349c

<?php

use PHPUnit\Framework\TestCase;

final class DemoFileTest extends TestCase
{
    public function testThrowsBadMethodCallException(): void
    {
        try {
            throw new BadMethodCallException();
        } catch (BadMethodCallException $badMethodCallException) {
            self::assertSame($badMethodCallException::class, BadMethodCallException::class);
            return;
        }

        self::fail('Exception was not thrown');
    }
}

class BadMethodCallException extends \RuntimeException {
}

Responsible rules

Expected Behavior

to run and remain unchanged.

ghostwriter commented 1 year ago

please move this to rectorphp/rector-phpunit, my mistake.

TomasVotruba commented 1 year ago

Sure :+1:

ghostwriter commented 1 year ago

Thanks, I'll send a PR with a fix.