<?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 {
}
Bug Report
^0.17.1
composer
Minimal PHP Code Causing Issue
See https://getrector.com/demo/75a8fde7-5d55-4b3c-84a2-3df83076349c
Responsible rules
TryCatchToExpectExceptionRector
Expected Behavior
to run and remain unchanged.