Code Monkey home page Code Monkey logo

Comments (5)

steadweb avatar steadweb commented on July 16, 2024

Should https://github.com/sstalle/php7cc/blob/master/src/NodeVisitor/PHP4ConstructorVisitor.php#L10 be LEVEL = Message::LEVEL_WARNING; instead?

from php7cc.

sstalle avatar sstalle commented on July 16, 2024

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.

steadweb avatar steadweb commented on July 16, 2024

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.

sstalle avatar sstalle commented on July 16, 2024

@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.

nhp avatar nhp commented on July 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.