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

CommentFileSizeAuthor
#3 facets-3469997-MR233-20240823-1.diff1.67 KBrecrit

Issue fork facets-3469997

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

recrit created an issue. See original summary.

recrit’s picture

Status: Active » Needs review
StatusFileSize
new1.67 KB

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

joseph.olstad’s picture

Status: Needs review » Needs work

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.

joseph.olstad’s picture