Needs work
Project:
Drupal core
Version:
main
Component:
extension system
Priority:
Major
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
27 Jun 2022 at 02:33 UTC
Updated:
21 Jan 2025 at 22:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kim.pepperComment #3
kim.pepperInitial patch.
Comment #4
kim.pepperComment #5
kim.pepperReverts the twig changes and replaces a few more uses of
->requires.Comment #6
andypostI bet it needs few more properties (used in extension discovery) like
weightSee #2024043-63: Add Module, Theme, Profile, and Extension value objects
Comment #7
andypostMaybe it makes sense to introduce kinda "third party settings" for extensions objects instead of removed "info" property, ref #3035618: Extension.php code quality: declare info array as public class field
Comment #8
andypostIn a light of PHP 8.2 this looks major blocker as #2024043-63: Add Module, Theme, Profile, and Extension value objects shows tons of deprecations
Comment #9
kim.pepperComment #10
andypostComment #11
berdir->origin and ->subpath are additional examples, added by \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory().
Removing the array return type, that's an API change on an interface, we can't do that. And fixed the required check in ModuleListForm. That's requireD, not requires and is a flag if a module is required, this change caused the module install form to attempt to install any module in the system that had any dependencies, which then unsurprisingly blew up badly.
We can't just make them deprecated, they are an API even if not explicitly defined. I guess we need a BC layer with __get/__set(), we could also use that to temporarily throw an exception on any unknown property to find others that will cause issues in PHP 8.2.
Comment #12
berdirComment #13
andypostnot sure it needed as PHP will do that for us
Comment #14
berdir> not sure it needed as PHP will do that for us
Yes, but we can't reliable test yet on 8.2. I only meant as part of the process of ensuring that we define all the properties this class needs, not to actually commit it.
Comment #15
kim.pepperAdded magic methods to trigger deprecations on direct property access and throw an exception if a property is undefined. Lets see how much blows up.
Comment #16
kim.pepperAdded origin, subpath, required as allowed properties.
Comment #17
kim.pepperI'm starting to think this issue and #2024043: Add Module, Theme, Profile, and Extension value objects are too closely linked to split apart.
Comment #18
kim.pepperAdded a few more properties.
Comment #19
kim.pepperStill more missing properties.
Comment #20
andypostThank you! It looks like neverending story so I tend to agree about split a-ka #17
Comment #21
kim.pepperHmm. There is a 'base_theme' property and a 'base_themes' property. 🤔
Comment #22
kim.pepperTheme extensions are really a dumping ground. Found the following properties:
Comment #23
kim.pepperA couple more:
Also made the properties nullable types.
Comment #24
kim.pepperComment #26
kim.pepperOK. so the __get()/__set() magic methods don't get called on public properties. So I'll try protected again and see what breaks.
Also, since we are removing adding any dynamic properties in this patch, I think we can remove
ExtensionSerializationTest::testPublicProperties()I expect we will get a lot of fails due to deprecations.
Comment #27
kim.pepperReplaced a load of direct property access with getters / setters.
Comment #28
kim.pepperFound a few more direct property access.
Comment #29
kim.pepperRe-roll.
Comment #30
borisson_Yes, this changed object is huge, and by introducing it now, we're not really designing it correctly I think. Instead of trying to get all this in by 8.2/10.0 would it make more sense to just define them as properties for now?
I'm not sure if the effort to more properly define profiles would also have an impact in having seperate theme/module/profile objects? Or should that be a followup (or even a good idea?)
Looks like the latest patch also has a couple JS failures, but I haven't yet looked at why.
Comment #31
borisson_Just read the linked issue #2024043: Add Module, Theme, Profile, and Extension value objects, and agreeing with #17 & #20. If we want to have getters/setters it should all go in as one effort.
Comment #32
berdirNote that the Extension class now has the annotation to allow dynamic properties, that's not very pretty but it means that this is no longer a blocker for PHP 8.2 support and we do not need to rush it. I didn't read the other issue just going from the issue title, but +1 to splitting into separate classes so that we can have the methods only where the make sense.
Comment #33
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #35
moshe weitzman commentedThis would be helpful for Drush's PmCommands to avoid phpstan complaining when accessing $extension->origin
Comment #36
kim.pepperWe should add a Universal object crate to PHPStan config to suppress this warning until we resolve it.
This came up in another issue somewhere, but I can't seem to find it.
Comment #37
andypostComment #38
tim.plunkettRe #35/#36, adding this to
core/phpstan.neon.distdoesn't help contrib modules (since extending core's is a bad practice), but adding it to your own does help.