-
Notifications
You must be signed in to change notification settings - Fork 310
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
Cannot see deprecated warnings #761
Comments
Because you're not running code without parenthesis 🙁 If you run PsySH with debugging output ( The reason this is happening is because PsySH can't actually execute raw user input. It requires pre-processing to create the illusion of a REPL in userland 😛 For example, take namespaces. PsySH, on the other hand, acts just like you'd expect: … but that's because, behind the scenes, it's doing something you very much don't expect:
PsySH does all this with a feature called "code cleaners". They parse input and run a bunch of transformers on it—doing everything from this namespace emulation, to input validation, to converting fatal errors to runtime errors, to return value wrangling, to making This is the man behind the curtain. It is a big piece of the magic that makes PsySH work, but doesn't come without its downsides. In this case, the trip through tokenizing and parsing loses the fact that, originally, there weren't any parenthesis there. Because the output is just an AST writing to code, which of course emits valid code. It might be possible to detect and warn on the issue during the parsing phase, and I'll look into that, but that would be using more tricks to emulate this behavior, which as we've seen can have some downsides ¯\_(ツ)_/¯ |
Thanks a lot of good explanations and examples. I love psysh. However I decided to create this issue not for make psysh better only, but being in hope that I can find some information in this discussion. I try to understand why we get such warning in the unit-test in our gitlab pipeline but we don't see it at our all other kinds of running, including the same code and the same auto-test. |
Checked versions are Psy Shell v0.11.12 (PHP 7.4.33) and Psy Shell v0.11.16 (PHP 7.4.33).
When we run code
error_reporting(E_ALL);$a = 1?5:1?6:7;
It returns
6
as all is ok.But if we use the php interactive shell (and there are some several ways to have been hurted by this message), we get warning
root@3cb2be255823:/var/www/html# php -a
Interactive mode enabled
php > error_reporting(E_ALL);
php > $a = 1?5:1?6:7;
Deprecated: Unparenthesized
a ? b : c ? d : e
is deprecated. Use either(a ? b : c) ? d : e
ora ? b : (c ? d : e)
in php shell code on line 1So, why Psy keeps silence about it?
The text was updated successfully, but these errors were encountered: