Disable ClassExtendsInternalClassRule

Created on 5 May 2024, 8 months ago
Updated 13 June 2024, 6 months ago

Problem/Motivation

See https://github.com/mglaman/phpstan-drupal/pull/754

It's not a true issue but more of a warning when folks extend non-API code.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

4.0

Component

Code

Created by

🇺🇸United States mglaman WI, USA

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

Merge Requests

Comments & Activities

  • Issue created by @mglaman
  • Merge request !81Disable ClassExtendsInternalClassRule → (Merged) created by mglaman
  • Status changed to Needs review 7 months ago
  • 🇺🇸United States mglaman WI, USA
  • Status changed to RTBC 7 months ago
  • 🇳🇱Netherlands bbrala Netherlands

    Assuming tests don't fail this is exactly what we need to improve project_analysis.

  • Pipeline finished with Failed
    7 months ago
    Total: 195s
    #169936
  • Status changed to Needs work 7 months ago
  • 🇳🇱Netherlands bbrala Netherlands

    Test did fail, guess review bot didnt find this one yet ;p

  • Pipeline finished with Failed
    7 months ago
    Total: 195s
    #170381
  • Pipeline finished with Failed
    7 months ago
    Total: 244s
    #170392
  • Pipeline finished with Failed
    7 months ago
    Total: 199s
    #170522
  • Pipeline finished with Failed
    7 months ago
    Total: 184s
    #170531
  • Pipeline finished with Failed
    7 months ago
    Total: 220s
    #170556
  • 🇧🇪Belgium gorkagr

    Hi!

    Before applying the patch, i get the following error in one module:

    Class Drupal\ieg_core\Form\BaseCreateNodeEventForm extends @internal class Drupal\node\NodeForm.
    

    after applying the patch, i get the following error:

    PHPStan command failed:
    
    /usr/bin/php /var/www/html/vendor/bin/phpstan analyse --memory-limit=1500M --error-format=json --configuration=/tmp/upgrade_status/deprecation_testing.neon /var/www/html/web/modules/custom/ieg_core
    Command output:
    
    Empty.
    Command error:
    
    In NeonAdapter.php line 44: Error while loading /tmp/upgrade_status/deprecation_testing.neon: Duplicated key 'drupal_root' on line 6, column 3. analyse [-c|--configuration CONFIGURATION] [-l|--level LEVEL] [--no-progress] [--debug] [-a|--autoload-file AUTOLOAD-FILE] [--error-format ERROR-FORMAT] [-b|--generate-baseline [GENERATE-BASELINE]] [--allow-empty-baseline] [--memory-limit MEMORY-LIMIT] [--xdebug] [--fix] [--watch] [--pro] [--fail-without-result-cache] [--] [...]
    

    best

  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Yeah I am not surprised as that is what this part of the diff would do (the drupal_root key is already added a bit above). The str_replace above this needs to be differently done, I think the drupal part removed from that, then this can add the root.

    diff --git a/src/DeprecationAnalyzer.php b/src/DeprecationAnalyzer.php
    index 56affa470c5b0922be0cd9d3522b04c2a63abb63..41026bdd28815493d862b9f98a9a6aa710a49ef6 100644
    --- a/src/DeprecationAnalyzer.php
    +++ b/src/DeprecationAnalyzer.php
    @@ -548,6 +548,11 @@ final class DeprecationAnalyzer {
             "\tdrupal:\n\t\tdrupal_root: '" . DRUPAL_ROOT . "'",
           $config
         );
    +    $config = str_replace(
    +      "\tdrupal:",
    +      "\tdrupal:\n\t\tdrupal_root: '" . DRUPAL_ROOT . "'",
    +      $config
    +    );
  • Pipeline finished with Success
    7 months ago
    Total: 299s
    #181198
  • Status changed to Needs review 7 months ago
  • 🇳🇱Netherlands bbrala Netherlands

    Fixed the issue, seems like he is happy? :)

  • Status changed to RTBC 7 months ago
  • 🇧🇪Belgium gorkagr

    All good now, update_status can analise the module and skip the @internal errors :)

  • Pipeline finished with Skipped
    7 months ago
    #185971
  • Status changed to Fixed 7 months ago
  • 🇭🇺Hungary Gábor Hojtsy Hungary

    Thanks all, merged.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024