Hi,
I am facing the following error after PHP7.2 upgrade.
FILE: ...ules/contrib/rules_conditional/includes/rules_conditional.ui.inc
----------------------------------------------------------------------
FOUND 20 ERRORS AFFECTING 17 LINES
----------------------------------------------------------------------
69 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
72 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
72 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
83 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
83 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
83 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
89 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
90 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
104 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
105 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
115 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
116 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
126 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
235 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
237 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
241 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
244 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
247 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
258 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
270 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
Comments
Comment #2
tr commentedThese appear to be false positives. There is nothing wrong with those uses of $this. Notably, they are NOT occurring in a "plain function". The first two errors, for example, use $this in a class constructor, which is not only allowed but is almost mandatory for OO code.
If that's the output of some Drupal-integrated script, then you should report this as a false positive for that project.
Comment #3
tr commented