PHPStan error: unknown interface

Created on 13 November 2024, 3 months ago

Resolve this PHPStan error:

Class Drupal\token_filter\Plugin\CKEditor4To5Upgrade\TokenBrowser implements unknown interface

currently happening on the main branch: https://git.drupalcode.org/project/token_filter/-/jobs/3313662

📌 Task
Status

Active

Version

2.0

Component

Code

Created by

🇦🇺Australia darvanen Sydney, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @darvanen
  • 🇮🇳India sayan_k_dutta

    Adding the following code to .neon file of phpstan removes the error.

    scanDirectories:
        - web/core
        - web/modules/custom
        - web/modules/contrib
    
  • 🇦🇺Australia darvanen Sydney, Australia

    Hi @sayan_k_dutta, welcome to the community, I see you're fairly new :)

    The purpose of the PHPStan test is to ensure that the code we write is as type-safe as possible.

    Can you explain why you made the change you did? Keep in mind that the error is pointing to a potential problem - the goal here is to fix any potential problems, not just to "remove" the error.

  • 🇮🇳India sayan_k_dutta

    Ok looking into it.

  • 🇮🇳India sayan_k_dutta

    Tried to figure out the cause of phpstan failure, but could not find the solution. Checked if the implemented interface is defined in the correct place or not and the module is installed or not.

  • Assigned to koustav_mondal
  • 🇮🇳India koustav_mondal Kolkata

    Working on it.

  • 🇮🇳India koustav_mondal Kolkata

    @darvanen I also tried to reproduce the error. Got the following error but not able to reproduce the error that you mentioned.

     ------ -----------------------------------------------------------------------------------------------------
      Line   tests/src/Kernel/TokenFilterKernelTest.php
     ------ -----------------------------------------------------------------------------------------------------
      :47    \Drupal calls should be avoided in classes, use dependency injection instead
             :identification_card:  globalDrupalDependencyInjection.useDependencyInjection
      :55    Call to an undefined method Drupal\Tests\token_filter\Kernel\TokenFilterKernelTest::assertEquals().
             :identification_card:  method.notFound
    
Production build 0.71.5 2024