Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Spin off of #3274474: Fix 'Access to an undefined property' PHPStan L0 errors.
Problem/Motivation
PHPStan baseline is currently skipping multiple Access to an undefined property
errors.
Proposed resolution
Fix the errors, clean up the baseline. In this issue, focus on runtime code public properties.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3295157
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:
- 3295157-fix-access-to changes, plain diff MR !2494
Comments
Comment #3
mondrakeComment #4
mondrakeI am RTBCing this because this is just a spin off of the parent that was RTBC already.
Comment #5
mondrakeComment #6
andypostNot sure about returning
$info
array to extension class which was just removed and ongoing work happening to fix it with getters/setters #3292759: Create getters and setters for dynamic Extension propertiesComment #7
alexpott$info has been a public property on the extension object for a very long time. This change is only documenting that fact. It's not been removed.
Comment #8
alexpottCommitted and pushed f76cebd189 to 10.1.x and 7fe5869f20 to 10.0.x. Thanks!
Comment #12
BerdirMissed this on my earlier review but this IMHO has some problematic parts.
This didn't just add new properties but also added types to existing properties by moving them to the base class, that broke the aggregator module:#3294389: Fix fails in HEAD and other modules could be affected as well in contrib. Isn't adding a type to existing properties a BC break? Especially in a base class.
Another strange part is that it defines the original property for _some_ entity types, but $entity->original is a generic entityconcept and this conflicts with #2839195: Add a method to access the original property which I finally resurrected. Sure, we need a BC layer for that anyway but that might complicate that and feels like a very half-baked solution with the only purpose of reducing the baseline.
Comment #14
donquixote CreditAttribution: donquixote as a volunteer commentedThis also fixed #3035618: Extension.php code quality: declare info array as public class field :)