PHPUnit provides helper functions and annotations to verify that a given block of code throws an exception and to assert different properties of that exception. The provided helper functions are: * ``++expectException()++`` * ``++expectExceptionCode()++`` * ``++expectExceptionMessage()++`` * ``++expectExceptionMessageRegExp()++`` This check raises an issue when the throw of an exception is verified using a _try-catch_ approach instead of relying on the provided helper functions. == Noncompliant Code Example ---- public function testA() { try { doSomething(); $this->fail("Assertion should have been thrown"); } catch (MyException $e) { assertEquals("Exception message", $e->getMessage()); } } ---- == Compliant Solution ---- public function testB() { $this->expectException(MyException::class); $this->expectExceptionMessage("Exception message"); doSomething(); } ---- == See thePHP.cc: https://thephp.cc/news/2016/02/questioning-phpunit-best-practices[Questioning PHPUnit Best Practice]