Use of dynamic properties is deprecated in PHP 8.2+

Created on 23 August 2024, 6 months ago

Problem/Motivation

The following code is flagged for accessing undefined properties in classes. Dynamic properties are deprecated in PHP 8.2+, see https://www.php.net/manual/en/migration82.deprecated.php.

------ -----------------------------------------------------------------------------------------------------
  Line   modules/facets_summary/src/Processor/ProcessorPluginBase.php
 ------ -----------------------------------------------------------------------------------------------------
  98     Call to an undefined method Drupal\facets_summary\Processor\ProcessorPluginBase::addDependency().
  99     Access to an undefined property Drupal\facets_summary\Processor\ProcessorPluginBase::$dependencies.
         πŸ’‘ Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
 ------ -----------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------
  Line   src/Entity/Facet.php
 ------ --------------------------------------------------------------------------------------
  429    Access to an undefined property Drupal\facets\Entity\Facet::$hierarchy_instance.
         πŸ’‘ Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
 ------ --------------------------------------------------------------------------------------

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States recrit

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

Merge Requests

Comments & Activities

  • Issue created by @recrit
  • Status changed to Needs review 6 months ago
  • πŸ‡ΊπŸ‡ΈUnited States recrit

    MR 233 created. Attached is a static patch for composer builds.

  • Pipeline finished with Failed
    6 months ago
    Total: 984s
    #263040
  • Pipeline finished with Failed
    6 months ago
    #263041
  • Status changed to Needs work 27 days ago
  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    TESTS are failing above, this needs to be fixed, the changes made maybe were incorrect.

    There's other phpstan fixes needed also.

     ------ -------------------------------------------------------------------------- 
      Line   modules/facets_summary/src/Processor/ProcessorPluginBase.php              
     ------ -------------------------------------------------------------------------- 
      98     Call to an undefined method                                               
             Drupal\facets_summary\Processor\ProcessorPluginBase::addDependency().     
    
    <code>  Line   src/Plugin/facets/facet_source/SearchApiBaseFacetSource.php           
     ------ ---------------------------------------------------------------------- 
      82     Access to deprecated property $index of class                         
             Drupal\facets\Plugin\facets\facet_source\SearchApiBaseFacetSource:    
             in facets:8.x-1.5 and is removed from facets:8.x-2.0. Classes         
               extending SearchApiBaseFacetSource should implement ::getIndex()    
             instead.   
     ------ ----------------------------------------------------------------------- 
      Line   src/Plugin/facets/processor/ListItemProcessor.php                      
     ------ ----------------------------------------------------------------------- 
      156    Function Drupal\facets\Plugin\facets\processor\options_allowed_values  
             invoked with 1 parameter, 0 required.                                  
     ------ ----------------------------------------------------------------------- 
     ------ ---------------------------------------------------------------- 
      Line   src/Plugin/facets/processor/TermWeightWidgetOrderProcessor.php  
     ------ ---------------------------------------------------------------- 
      88     Variable $a_raw might not be defined.       
     ------ ------------------------------------------------------------ 
      Line   src/Plugin/facets/query_type/SearchApiRange.php             
     ------ ------------------------------------------------------------ 
      28     Variable $query in empty() always exists and is not falsy.  
     ------ ------------------------------------------------------------ 
     ------ ------------------------------------------------------------ 
      Line   src/Plugin/facets/query_type/SearchApiString.php            
     ------ ------------------------------------------------------------ 
      33     Variable $query in empty() always exists and is not falsy.  
     ------ ------------------------------------------------------------ 
    

    There's also a bunch for the tests, maybe split off all these phpstan fixes into another issue and bring that in as a patch to run the tests for these.

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Ah nvm, should look at πŸ› In PHP 8.2+, the creation of dynamic properties is deprecated Active instead

  • πŸ‡¨πŸ‡¦Canada joseph.olstad

    Closing this in favour of 3482015

    πŸ› In PHP 8.2+, the creation of dynamic properties is deprecated Active

    Thank you all!

Production build 0.71.5 2024