- Issue created by @kaszarobert
- First commit to issue fork.
- Open on Drupal.org →Core: 9.5.x + Environment: PHP 8.1 & MySQL 8last update
about 1 year ago Not currently mergeable. - @sandipta opened merge request.
- Merge request !17Issue #3388151: Avoid static \Drupal calls inside class methods and use proper DI → (Open) created by sandipta
- last update
about 1 year ago 8 pass - 🇩🇪Germany simonbaese Berlin
Hi Sandipta,
can we please discuss the scope of this issue? I think the title suggests changes that are too broad and it will make the review hard. Maybe we can restrict ourselves to plugins first.
I see that you started to introduce changes in the merge request. But there are many other plugins that also make static calls to the container.
From static analysis I can see:
GoogleAnalyticsCounterResultProcessorPluginBase
fixed in MR (see comments)/Plugin/GoogleAnalyticsCounterResultProcessor/DefaultResultProcessor
/Plugin/GoogleAnalyticsCounterResultProcessor/DefaultResultProcessor
/Plugin/GoogleAnalyticsCounterResultProcessor/UrlAliasResultProcessor
/Plugin/QueueWorker/GoogleAnalyticsCounterQueueBase
It is a little bit unusual that the plugin base is not in the
Plugin/
namespace.Also, I think it is best practice to make your changes in the issue branch (in this case 3388151-avoid-static-drupal) rather than directly in the fork. And then make a merge request from the issue branch to the actual repository. But maybe it doesn't matter.
- last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 7 pass, 2 fail - last update
about 1 year ago 7 pass, 2 fail - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - last update
about 1 year ago 8 pass - 🇩🇪Germany simonbaese Berlin
@sandipta What is the status on this issue? Do you need help to progress?
- 🇮🇳India sandipta
Checked everything,two files remain where DI hasn't been implemented yet:
1. src/Plugin/GoogleAnalyticsCounterResultProcessor/UrlAliasResultProcessor.php
2. src/GoogleAnalyticsCounterHelper.phpI'll begin working on them soon.
@simonbaese - last update
11 months ago 8 pass - First commit to issue fork.
- Merge request !1google_analytics_counter-3388151: Implemented dependency injection in... → (Open) created by Sapnakhatri
- Status changed to Needs review
7 months ago 1:04pm 7 May 2024 - 🇮🇳India Sapnakhatri
I have updated the MR, added DI in the remaining files. Please review.
- First commit to issue fork.
- Status changed to Needs work
4 months ago 8:39am 5 August 2024 - 🇮🇳India sourav_paul Kolkata
Mr applied successfully but please check why the PHPUnit is failing...
Also please check this phpcs report :
FILE: /home/sourav/projects/my_site/web/modules/contrib/google_analytics_counter/src/GoogleAnalyticsCounterAppManager.php ------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES ------------------------------------------------------------------------------------------------------------------------- 18 | WARNING | [x] Unused use statement 202 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter ------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------------------------------------------- FILE: ...jects/my_site/web/modules/contrib/google_analytics_counter/src/Plugin/GoogleAnalyticsCounterResultProcessor/DefaultResultProcessor.php -------------------------------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE -------------------------------------------------------------------------------------------------------------------------------------------- 35 | ERROR | [x] Expected 1 blank line after function; 0 found -------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------------------------------------------------------------------- FILE: ...ects/my_site/web/modules/contrib/google_analytics_counter/src/Plugin/GoogleAnalyticsCounterResultProcessor/UrlAliasResultProcessor.php -------------------------------------------------------------------------------------------------------------------------------------------- FOUND 3 ERRORS AND 3 WARNINGS AFFECTING 6 LINES -------------------------------------------------------------------------------------------------------------------------------------------- 5 | WARNING | [x] Unused use statement 9 | WARNING | [x] Unused use statement 12 | WARNING | [x] Unused use statement 77 | ERROR | [ ] Doc comment for parameter $database does not match actual variable name $language 85 | ERROR | [ ] Doc comment for parameter $route_match does not match actual variable name $language 87 | ERROR | [ ] Superfluous parameter comment -------------------------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY -------------------------------------------------------------------------------------------------------------------------------------------- FILE: /home/sourav/projects/my_site/web/modules/contrib/google_analytics_counter/src/GoogleAnalyticsCounterMessageManager.php ----------------------------------------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------------- 12 | WARNING | [x] Unused use statement ----------------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------------- FILE: /home/sourav/projects/my_site/web/modules/contrib/google_analytics_counter/src/GoogleAnalyticsCounterHelper.php --------------------------------------------------------------------------------------------------------------------- FOUND 6 ERRORS AND 1 WARNING AFFECTING 6 LINES --------------------------------------------------------------------------------------------------------------------- 9 | WARNING | [x] Unused use statement 84 | ERROR | [x] Expected 1 blank line after function; 0 found 137 | ERROR | [x] Separate the @param and @return sections by a blank line. 170 | ERROR | [x] Whitespace found at end of line 216 | ERROR | [x] Expected 1 space between comma and type hint "TimeInterface"; 0 found 216 | ERROR | [x] Expected one space after the comma, 0 found 350 | ERROR | [x] Separate the @param and @return sections by a blank line. --------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY --------------------------------------------------------------------------------------------------------------------- FILE: /home/sourav/projects/my_site/web/modules/contrib/google_analytics_counter/src/Controller/GoogleAnalyticsCounterController.php ------------------------------------------------------------------------------------------------------------------------------------ FOUND 2 ERRORS AFFECTING 2 LINES ------------------------------------------------------------------------------------------------------------------------------------ 109 | ERROR | [x] Multi-line function declarations must have a trailing comma after the last parameter 110 | ERROR | [x] Multi-line function declaration not indented correctly; expected 2 spaces but found 4 ------------------------------------------------------------------------------------------------------------------------------------ PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY ------------------------------------------------------------------------------------------------------------------------------------ FILE: /home/sourav/projects/my_site/web/modules/contrib/google_analytics_counter/src/Form/ConfirmClearQueueForm.php ------------------------------------------------------------------------------------------------------------------- FOUND 2 ERRORS AFFECTING 2 LINES ------------------------------------------------------------------------------------------------------------------- 32 | ERROR | Parameter $queue is not described in comment 37 | ERROR | Missing parameter name ------------------------------------------------------------------------------------------------------------------- Time: 425ms; Memory: 14MB