Comments (5)
Should https://github.com/sstalle/php7cc/blob/master/src/NodeVisitor/PHP4ConstructorVisitor.php#L10 be LEVEL = Message::LEVEL_WARNING;
instead?
from php7cc.
The issue is that php7cc has different definition of warnings and errors than PHP. Basically any issue that can be detected reliably is classified as error, no matter how severe its impact is. And everything that is not an error is considered a warning. These are usually statements that are valid in both PHP5 and PHP7, but have different meaning between versions.
Now I realize that this classification may indeed be confused with PHP's one. I'll have to think about it, maybe the error levels need to be renamed to something more descriptive or maybe they need to be replaced with an entirely different classification.
from php7cc.
Thanks for clarifying @sstalle - I assumed exactly what you've pointed out, which is that the levels within php7cc reflect those of PHP itself.
I'd vote they'd be reflective, if this were open, so that I could determine the things that need to be rewritten due to them not working / supported in the said version of PHP.
from php7cc.
@steadweb I have been thinking about your suggestion recently. How would you approach the following cases?
function foo() {
$a = (yield 1 or 2);
echo $a;
}
$foo = foo();
echo $foo->current();
$foo->send(3);
Outputs "13" on 5.6 and "11" on 7.0. Does not produce any notices, errors or warnings, but you'd still likely want to fix it, because the result is different.
$arr = ['bar' => ['baz' => 'quux']];
$quux = 1;
$a = $$arr['bar']['baz'];
$a is equal to 1 at the end of the script on 5.6 and $a is null on 7. It emits just some notices on 7, but it could lead to some hard to catch bugs.
Simply marking these cases as errors does not feel right, because it reintroduces incosistency between php7cc and PHP error levels.
from php7cc.
Sorry for necroing, but what is really struggling me is the fact that the error level is displayed different depending on the output format. Something like the PHP4 Constructor is shown as an error with normal output but only as a warning if you use -o json as output format.
from php7cc.
Related Issues (20)
- False positive: Cannot redeclare global function
- False positive: Namespace declaration statement has to be the very first statement
- False Positive: call static method on FQCN string
- PHP Fatal error: Cannot access private property HOT 1
- False Positive: Function argument(s) returned by "func_get_args" might have been modified HOT 6
- False Positive: [Error] Syntax error, unexpected T_SWITCH, expecting T_STRING on line 55. Processing aborted.
- Command "php7cc" is not defined. HOT 1
- Failed to catch: Fatal error: Cannot use $this as parameter in ... HOT 1
- Global composer config HOT 3
- Globbing patterns in Exclude HOT 1
- Is possible to turn specifics checks? HOT 1
- Backward incompatible changes for PHP7 too few function arguments are not detected HOT 3
- Unhelpful "Closing delimiter foo not found" message HOT 3
- Output result into a txt file HOT 2
- space between = and & fools the checker where =& would be caught
- Unquoted string as index or general not detected
- PHP nullable typehinting not supported now
- [Warning] "yield" usage in expression context HOT 1
- Error without a file: [Error] file_get_contents(): Filename cannot be empty. Processing aborted.
- Should "does not cause an error in PHP 7" be an warning? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php7cc.