César de la Cal created NETBEANS-1701:
-----------------------------------------
Summary: Multiple assignments to variable inside try catch block
Key: NETBEANS-1701
URL: https://issues.apache.org/jira/browse/NETBEANS-1701
Project: NetBeans
Issue Type: Bug
Components: php - Code, php - Code Analysis
Affects Versions: 8.2
Reporter: César de la Cal
Hello dear Netbeans team,
I found a little issue when analyzing the code that I write in PHP. When I
write the following code it points out an issue that is not really an issue:
<?php
$a = false;
try {
function_with_exception();
$a = true;
} catch (Exception$e) {}
Yields a "You should only use 1 assignment to $a", while something like this
works as expected:
{{<?php}}
{{$a = false;}}
{{if(function_that_may_return_false()) {}}
{{ $a = true;}}
{{} }}
I suppose that both pieces of code should be treated equally by the static code
analysis. Either both are OK or neither is.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists