Fix remaining php 8.2 errors: Deprecated function: Creation of dynamic property.

Created on 28 February 2024, 4 months ago
Updated 1 March 2024, 4 months ago

Problem/Motivation

When running php 8.2, you run into these deprecation errors when running the seed and other functionality.

https://php.watch/versions/8.2/dynamic-properties-deprecated

Example:

Deprecated function: Creation of dynamic property Drupal\quant\Plugin\QueueItem\NodeItem::$vid is deprecated in Drupal\quant\Plugin\QueueItem\NodeItem->__construct() (line 41 of modules/contrib/quantcdn/src/Plugin/QueueItem/NodeItem.php).
Drupal\quant\Plugin\QueueItem\NodeItem->__construct(Array) (Line: 72)
Drupal\quant\Event\ConfigFormEventBase->queueItem(Array) (Line: 106)
Drupal\quant\EventSubscriber\CollectionSubscriber->collectEntities(Object, 'quant.seed.entities', Object)
call_user_func(Array, Object, 'quant.seed.entities', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'quant.seed.entities') (Line: 383)
Drupal\quant\Form\SeedForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
...

Steps to reproduce

  • Install/configure Drupal 10.1 on php 8.2
  • Install/configure quant_api
  • Create content
  • Seed content
  • Look at the logs
  • Results: Errors shown above
  • Expected results: No errors in the logs

Proposed resolution

Went through all classes and checked the properties and found a few to fix:

  1. okay ./modules/quant_api/src/Form/SettingsForm.php
  2. okay ./modules/quant_api/src/EventSubscriber/QuantApi.php
  3. okay ./modules/quant_api/src/Client/QuantClient.php
  4. okay ./modules/quant_tome/src/QuantTomeBatch.php
  5. okay ./modules/quant_tome/src/Commands/QuantTomeCommands.php
  6. okay ./modules/quant_tome/src/EventSubscriber/RedirectSubscriber.php
  7. okay ./modules/quant_purger/src/StackMiddleware/UrlRegistrar.php
  8. okay ./modules/quant_purger/src/StackMiddleware/UrlRegistrar.php
  9. okay ./modules/quant_purger/src/TrafficRegistry.php
  10. okay ./modules/quant_sitemap/src/SitemapManager.php
  11. okay ./modules/quant_sitemap/src/EventSubscriber/CollectionSubscriber.php
  12. okay ./modules/quant_search/src/Form/SearchPagesForm.php
  13. needs updating ./modules/quant_search/src/Form/QuantSearchPageForm.php
  14. okay ./modules/quant_search/src/Form/SearchIndexForm.php
  15. okay ./modules/quant_search/src/Form/SearchEntitiesForm.php
  16. okay ./modules/quant_search/src/Controller/Search.php
  17. okay ./modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php
  18. okay ./src/Form/SeedForm.php
  19. okay ./src/Plugin/QuantMetadataManager.php
  20. okay ./src/Plugin/Quant/Metadata/Info.php
  21. okay ./src/Plugin/Quant/Metadata/ProxyOverride.php
  22. okay ./src/Plugin/Quant/Metadata/Published.php
  23. okay ./src/Plugin/Quant/Metadata/PublishedRevision.php
  24. okay ./src/Plugin/Quant/Metadata/Transitions.php
  25. okay ./src/Plugin/QueueItem/RedirectItem.php
  26. needs updating ./src/Plugin/QueueItem/FileItem.php
  27. okay ./src/Plugin/QueueItem/RouteItem.php
  28. okay ./src/Plugin/QueueItem/TaxonomyTermItem.php
  29. needs updating ./src/Plugin/QueueItem/NodeItem.php
  30. okay ./src/TokenManager.php
  31. okay ./src/Controller/QuantNodeViewController.php
  32. needs updating ./src/EventSubscriber/NodeInsertSubscriber.php
  33. okay ./src/EventSubscriber/CollectionSubscriber.php
  34. okay ./src/EventSubscriber/TokenAccessSubscriber.php
  35. okay ./src/Exception/InvalidTokenException.php
  36. okay ./src/Exception/StrictTokenException.php
  37. okay ./src/Exception/ExpiredTokenException.php
  38. okay ./src/Event/ConfigFormEventInterface.php
  39. okay ./src/Event/QuantEvent.php
  40. okay ./src/Event/NodeInsertEvent.php
  41. okay ./src/Event/QuantFileEvent.php
  42. okay ./src/Event/QuantRedirectEvent.php
  43. okay ./src/Event/ConfigFormEventBase.php

Remaining tasks

  • Update code
  • Review and test
  • Commit :)

User interface changes

No deprecation errors in the logs.

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

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

Comments & Activities

Production build 0.69.0 2024