Draft: Issue #3458110: Phpstan fixes, refactor dependency injection and enhance documentation
Refactored dependency injection to use more appropriate services, specifically replacing direct service calls with class properties.
Closes #3458110
Merge request reports
Activity
added 1 commit
- ceb23b2b - Phpcs fixes, add missing annotation and remove unused import
added 1 commit
- b6411b73 - Eslint fixes, refactor code to use ES6 syntax
added 1 commit
- abf0017d - Eslint fixes, refactor code to use ES6 syntax
added 1 commit
- 3bf1336a - Eslint fixes, refactor code to use ES6 syntax
added 1 commit
- dccc9fcc - Cspell fixes, typos and add cspell project words file
- Resolved by Daniel Johnson
26 * The cached discovery clearer. 28 27 * 29 28 * @var \Drupal\Core\Plugin\CachedDiscoveryClearerInterface 30 29 */ 31 protected $pluginCacheClearer; 30 protected $cachedDiscoveryClearer; 32 31 33 32 /** 34 33 * {@inheritdoc} 35 34 */ 36 public static function create(ContainerInterface $container, PluginCacheClearerInterface $pluginCacheClearer) { 37 $this->pluginCacheClearer = $pluginCacheClearer; 38 return new static( 39 $container->get('renderer') 40 ); 35 public static function create(ContainerInterface $container) { Are we sure about this change not breaking any functionality for existing user?
Edited by Ankit PathakThanks, I think that changing the
CachedDiscoveryClearer
property name could well be breaking for classes extendingDynamicLayoutForm
and using this service, so I've changed this back topluginCacheClearer
.With regards to moving the
pluginCacheClearer
out of the arguments and getting from the container in the method body, I'm more unsure. My thinking here was that I could not tell where this service was coming from as there is no services.yml. I guess that removing the argument could be breaking for code overridding the create method. I also could not find anyPluginCacheClearerInterface
to add a use statement for in order to resolve the phpstan check on the argument type.------ --------------------------------------------------------------------------------------------------------------------- Line dynamic_layouts/src/Form/DynamicLayoutForm.php ------ --------------------------------------------------------------------------------------------------------------------- 35 Parameter #2 $pluginCacheClearer of method Drupal\dynamic_layouts\Form\DynamicLayoutForm::create() is not optional. 35 Parameter $pluginCacheClearer of method Drupal\dynamic_layouts\Form\DynamicLayoutForm::create() has invalid type Drupal\dynamic_layouts\Form\PluginCacheClearerInterface. ------ ---------------------------------------------------------------------------------------------------------------------
added 1 commit
- af938415 - Rename cache clearer property for consistency
added 1 commit