Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify warnings, as well as errors #83

Closed
BackEndTea opened this issue Oct 1, 2020 · 3 comments · Fixed by #84
Closed

Identify warnings, as well as errors #83

BackEndTea opened this issue Oct 1, 2020 · 3 comments · Fixed by #84

Comments

@BackEndTea
Copy link
Contributor

The following code gives a warning during linting, but phplint does not notify the user of that.

<?php

class Foo
{
    private function bar(object $a) {
        while (true) {
            switch($a) {
                case 'b': 
                    continue;
            }
        }
    }
}

Running php -l on the file gives the following output:

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in a.php on line 9

I'd like to be able to see the warnings as well, perhaps with an additional flag to preserve the 'old behavior.

@overtrue
Copy link
Owner

overtrue commented Oct 1, 2020

I'm sorry, but this package is just an easy-to-use wrapper for php -l, unfortunately it doesn't give you the results you'd expect, you may need to use the PHP static analysis tool: https://github.com/phpstan/phpstan

@BackEndTea
Copy link
Contributor Author

BackEndTea commented Oct 1, 2020

The php -l command does output the warning. If this is something that you would want in this tool id be happy to provide a PR.

@overtrue
Copy link
Owner

overtrue commented Oct 1, 2020

Oh, that must be wonderful. Welcome, PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants