-
What language is this for? PHP
-
Which rule? PHP RSPEC-1848
-
Why do you believe it’s a false-positive/false-negative?
In case (see below), the object is created inside a try/catch block,
In case of a validation function for example, It may be used to check the validity of some variable passed to a constructor.- SonarQube - in Developer Edition
- SonarLint - which IDE/version connected mode with SonarQube
-
Example Code to reproduce:
function isValidDate() {
try {
new DateTime($varToTest);
} catch (Exception $exception) {
return false;
}
return true;
}