bobthecow/psysh

Symfony deprecation trigger

Nek- opened this issue · 6 comments

Nek- commented

Hello,

I was wondering if you have a solution to avoid having all of this in the terminal:

2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\UseStatementPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\UseStatementPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\NamespacePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\AbstractClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\AbstractClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\AssignThisVariablePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\CalledClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\CalledClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\CalledClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\CallTimePassByReferencePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\FinalClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\FinalClassPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\FunctionContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\FunctionContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\FunctionContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\FunctionReturnInWriteContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\InstanceOfPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\IssetPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LabelContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LabelContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LabelContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::afterTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LabelContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LeavePsyshAlonePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ListPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LoopContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LoopContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\LoopContextPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\PassableByReferencePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ReturnTypePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ReturnTypePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\EmptyArrayDimFetchPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\EmptyArrayDimFetchPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ValidConstructorPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ValidConstructorPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ExitPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\RequirePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\StrictTypesPass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\NamespaceAwarePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\NamespaceAwarePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ValidClassNamePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ValidClassNamePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::enterNode()" might add "int|Node|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ValidFunctionNamePass" now to avoid errors or add an explicit @return annotation to suppress this message.
2022-10-24T22:05:16+00:00 [info] User Deprecated: Method "PhpParser\NodeVisitor::leaveNode()" might add "int|Node|array|null" as a native return type declaration in the future. Do the same in implementation "Psy\CodeCleaner\ValidFunctionNamePass" now to avoid errors or add an explicit @return annotation to suppress this message.

Patching psysh to have proper return types is impossible since it supports PHP 7.0...

Looks like we can solve it with @return declarations where the proper types are incompatible.

Nek- commented

Do you want me to make a PR for it ? :)

That would be awesome!

@Nek- how are you getting these deprecation notices? With a fresh Symfony install, or even installing PHP-Parser @dev or from master I can't reproduce.

Nek- commented

I have this in all my projects in Symfony 5.4 with the psysh bundle, but I tested it in a new Symfony project and I don't have the issue... 🤔

Anyway I worked on a fix for it and I have a PR for it.

¯\_(ツ)_/¯ it can't hurt to add the return types, even if we can't repro anymore :)

Thanks for the fix!