Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Running phpcs check returns the below error:
FILE: src/Plugin/search_api_autocomplete/suggester/BackendTrait.php
--------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------
38 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
--------------------------------------------------------------
Comment | File | Size | Author |
---|---|---|---|
#10 | 3150197.patch | 1.13 KB | mkalkbrenner |
#4 | 3150197-4.patch | 497 bytes | suzymasri |
#2 | 3150197-2.patch | 510 bytes | suzymasri |
Comments
Comment #2
suzymasriPatch attached.
Comment #3
mkalkbrennerThe patch isn't correct.
We use the Search API internal logger here, not Drupal's.
Comment #4
suzymasriThanks @mkalkbrenner, corrected patch attached.
Let me know if you have any other notes.
Comment #5
suzymasriComment #6
mkalkbrennerThis way you skip a lot of logic:
The code works as it is. I think the correct fix is to actively tell PHPCS that this isn't an error!
Comment #7
mkalkbrennerComment #9
mkalkbrennerYou're right. I didn't notice that getBackend() has to be static as it is called in a static context.
Comment #10
mkalkbrennerComment #12
mkalkbrennerComment #14
suzymasriThanks a lot @mkalkbrenner for helping out!