Remove @phpstan-ignore-next-line in GeneratedFieldExplicitInputUxComponentSourceBase

Created on 24 February 2025, 2 months ago

Overview

We have two instances of @phpstan-ignore-next-line that refer to prop source arrays.

Proposed resolution

Use PropSourceArray more consistently and stop ignoring PHPStan.

User interface changes

📌 Task
Status

Active

Version

0.0

Component

Code

Created by

🇬🇧United Kingdom longwave UK

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

Merge Requests

Comments & Activities

  • Issue created by @longwave
  • 🇬🇧United Kingdom longwave UK

    Either value are not always present in prop source arrays, in which case we need to fix

      Line   src/PropSource/StaticPropSource.php                                                                                                                                                
     ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
      205    Offset 'value' does not exist on array{sourceType: string, expression: string, value?: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string,  
             mixed>}}.                                                                                                                                                                          
      211    Offset 'value' does not exist on array{sourceType: string, expression: string, value?: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string,  
             mixed>}}.                                                                                                                                                                          
      212    Offset 'value' does not exist on array{sourceType: string, expression: string, value?: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string,  
             mixed>}}.                                                                                                                                                                          
      216    Offset 'value' does not exist on array{sourceType: string, expression: string, value?: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string,  
             mixed>}}.                                                                                                                                                                          
      218    Offset 'value' does not exist on array{sourceType: string, expression: string, value?: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string,  
             mixed>}}.                                                                                                                                                                          
      221    Offset 'value' does not exist on array{sourceType: string, expression: string, value?: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string,  
             mixed>}}.    
    

    or they are, and we need to fix

      Line   src/PropSource/DynamicPropSource.php                                                                                                                                               
     ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
      37     Method Drupal\experience_builder\PropSource\DynamicPropSource::toArray() should return array{sourceType: string, adapterInputs: array<string, mixed>}|array{sourceType: string,    
             expression?: string, value: mixed, sourceTypeSettings?: array{instance?: array<string, mixed>, storage?: array<string, mixed>}} but returns array{sourceType: string, expression:  
             string}.                                                                                                                                                                           
             💡 Array does not have offset 'adapterInputs'.                                                                                                                                     
             💡 Array does not have offset 'value'.             
    
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    +1 for the principle for sure!

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • 🇧🇷Brazil natnatalia

    Hello, I am working on this ticket!

  • Pipeline finished with Failed
    about 1 month ago
    Total: 617s
    #466327
  • Pipeline finished with Failed
    about 1 month ago
    Total: 1404s
    #466330
  • 🇧🇷Brazil natnatalia

    Hello,

    I’ve fixed the previous errors related to the src/PropSource/StaticPropSource.php file.

    Since the branch was quite outdated, I had to rebase it. After rebasing, the PR started showing the following errors:

    ------ ---------------------------------------------------------------------------------------------------
    Line   src/Plugin/ExperienceBuilder/ComponentSource/GeneratedFieldExplicitInputUxComponentSourceBase.php  
    ------ ---------------------------------------------------------------------------------------------------
    178    Class                                                                                               
           Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\ComponentInputs                 
           not found.                                                                                          
           💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                
    179    Call to method getValues() on an unknown class                                                     
           Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\ComponentInputs.                
           💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                                
    ------ ---------------------------------------------------------------------------------------------------
    [ERROR] Found 2 errors

    To fix the first one, I believe I need to add:

    use Drupal\experience_builder\Plugin\DataType\ComponentInputs;

    However, I’m unsure whether this ComponentInputs class is the intended one, as the error references:
    Drupal\experience_builder\Plugin\ExperienceBuilder\ComponentSource\ComponentInputs
    Could someone clarify if these refer to the same class or if the correct one is missing from the patch?
    I would like to continue working on this.
    Thanks!

  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    Apparently something went wrong during the rebase.
    Cleanest+easiest way forward might be opening a new MR from a new branch up-to-date with 0.x.

    Check https://git.drupalcode.org/project/experience_builder/-/merge_requests/6... for the starting point that @longwave did.

  • First commit to issue fork.
  • 🇮🇳India meghasharma

    The PHPStan error regarding the $prop_source parameter still needs to be fixed.

Production build 0.71.5 2024