Troubleshooting of Sonar issue: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Created page with " {{Draft}} == How to resolve "Define and throw a dedicated exception instead of using a generic one" == Error condition <pre> if(!is_null($some_variable)){ $erro...")
 
No edit summary
Line 4: Line 4:
== How to resolve "Define and throw a dedicated exception instead of using a generic one" ==
== How to resolve "Define and throw a dedicated exception instead of using a generic one" ==


Error condition
Error condition which met "Define and throw a dedicated exception instead of using a generic one" <ref>[https://cwe.mitre.org/data/definitions/397 CWE - CWE-397: Declaration of Throws for Generic Exception (4.12)]</ref>
<pre>
<pre>
if(!is_null($some_variable)){
if(!is_null($some_variable)){
Line 20: Line 20:
</pre>
</pre>


Further reading
== Further reading ==
* [https://cwe.mitre.org/data/definitions/397 CWE - CWE-397: Declaration of Throws for Generic Exception (4.12)]
* [https://www.php.net/manual/en/spl.exceptions.php PHP: Exceptions - Manual]


== References ==
== References ==
Anonymous user

Navigation menu