I created this issue for the consolidated deprecated code report for Drupal 9 compatibility/readiness.
The Upgrade Status Report:
Google Analytics Counter
Scanned on Fri, 06/05/2020 - 05:02.
6 errors found. 9 warnings found. Avoid some manual work by using drupal-rector
for fixing issues automatically or Upgrade Rector to generate patches.
web/modules/contrib/google_analytics_counter/src/GoogleAnalyticsCounterAppManage
r.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 123 │ Parameter $alias_manager of method │
│ │ │ Drupal\google_analytics_counter\GoogleAnalyticsCounterAppMan │
│ │ │ ager::__construct() has typehint with deprecated interface │
│ │ │ Drupal\Core\Path\AliasManagerInterface. Deprecated in │
│ │ │ drupal:8.8.0 and is removed from drupal:9.0.0. Use │
│ │ │ Drupal\path_alias\AliasManagerInterface. │
│ │ │ │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/src/GoogleAnalyticsCounterCustomFie
ldGenerator.php:
┌──────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├──────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix with │ 152 │ Call to deprecated function entity_get_form_display(). │
│ rector │ │ Deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. │
│ │ │ Use EntityDisplayRepositoryInterface::getFormDisplay() │
│ │ │ instead. │
│ │ │ │
│ Fix with │ 162 │ Call to deprecated function entity_get_display(). Deprecated │
│ rector │ │ in drupal:8.8.0 and is removed from drupal:9.0.0. Use │
│ │ │ EntityDisplayRepositoryInterface::getViewDisplay() instead. │
│ │ │ │
│ Fix with │ 171 │ Call to deprecated method entityManager() of class Drupal. │
│ rector │ │ Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. │
│ │ │ Use Drupal::entityTypeManager() instead in most cases. If │
│ │ │ the needed method is not on │
│ │ │ \Drupal\Core\Entity\EntityTypeManagerInterface, see the │
│ │ │ deprecated \Drupal\Core\Entity\EntityManager to find the │
│ │ │ correct interface or service. │
│ │ │ │
│ Fix with │ 173 │ Call to deprecated function entity_get_display(). Deprecated │
│ rector │ │ in drupal:8.8.0 and is removed from drupal:9.0.0. Use │
│ │ │ EntityDisplayRepositoryInterface::getViewDisplay() instead. │
│ │ │ │
└──────────┴──────┴──────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/src/Plugin/Filter/GoogleAnalyticsCo
unterFilter.php:
┌─────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├─────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Fix now │ 72 │ Parameter $alias_manager of method │
│ │ │ Drupal\google_analytics_counter\Plugin\Filter\GoogleAnalytic │
│ │ │ sCounterFilter::__construct() has typehint with deprecated │
│ │ │ interface Drupal\Core\Path\AliasManagerInterface. Deprecated │
│ │ │ in drupal:8.8.0 and is removed from drupal:9.0.0. Use │
│ │ │ Drupal\path_alias\AliasManagerInterface. │
│ │ │ │
└─────────┴──────┴──────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/tests/src/Functional/GoogleAnalytic
sCounterAuthSettingsTest.php:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Check │ │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
│ Check │ 12 │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/tests/src/Functional/GoogleAnalytic
sCounterBlockTest.php:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Check │ │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
│ Check │ 17 │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/tests/src/Functional/GoogleAnalytic
sCounterSettingsTest.php:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Check │ │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
│ Check │ 12 │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/tests/src/Kernel/GoogleAnalyticsCou
nterQueueTest.php:
┌──────────┬──────┬─────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├──────────┼──────┼─────────────────────────────────────────────────────────────┤
│ Check │ │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
│ Check │ 12 │ Class PHPUnit\Framework\TestCase not found and could not be │
│ manually │ │ autoloaded. │
│ │ │ │
└──────────┴──────┴─────────────────────────────────────────────────────────────┘
web/modules/contrib/google_analytics_counter/google_analytics_counter.info.yml:
┌──────────┬──────┬──────────────────────────────────────────────────────────────┐
│ STATUS │ LINE │ MESSAGE │
├──────────┼──────┼──────────────────────────────────────────────────────────────┤
│ Check │ 0 │ Add <code>core_version_requirement: ^8 || ^9 to │
│ manually │ │ modules/contrib/google_analytics_counter/google_analytics_co │
│ │ │ unter.info.yml to designate that the module is compatible │
│ │ │ with Drupal 9. See https://drupal.org/node/3070687. │
│ │ │ │
└──────────┴──────┴──────────────────────────────────────────────────────────────┘
Drupal-check utility tool report:
26/26 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -----------------------------------------------------------------------
Line src/GoogleAnalyticsCounterAppManager.php
------ -----------------------------------------------------------------------
123 Parameter $alias_manager of method
Drupal\google_analytics_counter\GoogleAnalyticsCounterAppManager::__c
onstruct() has typehint with deprecated interface
Drupal\Core\Path\AliasManagerInterface:
in drupal:8.8.0 and is removed from drupal:9.0.0.
Use \Drupal\path_alias\AliasManagerInterface.
------ -----------------------------------------------------------------------
------ -----------------------------------------------------------------------
Line src/GoogleAnalyticsCounterCustomFieldGenerator.php
------ -----------------------------------------------------------------------
152 Call to deprecated function entity_get_form_display():
in drupal:8.8.0 and is removed from drupal:9.0.0. Use
EntityDisplayRepositoryInterface::getFormDisplay() instead.
162 Call to deprecated function entity_get_display():
in drupal:8.8.0 and is removed from drupal:9.0.0. Use
EntityDisplayRepositoryInterface::getViewDisplay() instead.
171 Call to deprecated method entityManager() of class Drupal:
in drupal:8.0.0 and is removed from drupal:9.0.0.
Use \Drupal::entityTypeManager() instead in most cases. If the needed
method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see
the
deprecated \Drupal\Core\Entity\EntityManager to find the
correct interface or service.
173 Call to deprecated function entity_get_display():
in drupal:8.8.0 and is removed from drupal:9.0.0. Use
EntityDisplayRepositoryInterface::getViewDisplay() instead.
------ -----------------------------------------------------------------------
------ -----------------------------------------------------------------------
Line src/Plugin/Filter/GoogleAnalyticsCounterFilter.php
------ -----------------------------------------------------------------------
72 Parameter $alias_manager of method
Drupal\google_analytics_counter\Plugin\Filter\GoogleAnalyticsCounterF
ilter::__construct() has typehint with deprecated interface
Drupal\Core\Path\AliasManagerInterface:
in drupal:8.8.0 and is removed from drupal:9.0.0.
Use \Drupal\path_alias\AliasManagerInterface.
------ -----------------------------------------------------------------------
------ -----------------------------------------------------------------
Line tests/src/Functional/GoogleAnalyticsCounterAuthSettingsTest.php
------ -----------------------------------------------------------------
Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
12 Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
------ -----------------------------------------------------------------
------ -------------------------------------------------------------
Line tests/src/Functional/GoogleAnalyticsCounterBlockTest.php
------ -------------------------------------------------------------
Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
17 Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
------ -------------------------------------------------------------
------ -------------------------------------------------------------
Line tests/src/Functional/GoogleAnalyticsCounterSettingsTest.php
------ -------------------------------------------------------------
Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
12 Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
------ -------------------------------------------------------------
------ -------------------------------------------------------------
Line tests/src/Kernel/GoogleAnalyticsCounterQueueTest.php
------ -------------------------------------------------------------
Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
12 Class PHPUnit\Framework\TestCase not found and could not be
autoloaded.
💡 Learn more at https://phpstan.org/user-guide/autoloading
------ -------------------------------------------------------------
[ERROR] Found 14 errors
Issue fork google_analytics_counter-3146542
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:
- 3146542-drupal-9-compatibility
changes, plain diff MR !5
Comments
Comment #2
siddhant.bhosale commentedComment #3
gnanagowthaman sankar commentedHi @siddhant.bhosale,
Here by i attached the patch please review and let me know for any changes.
Thanks & Regards,
GnanagowthamanSankar
Comment #4
drupal.ninja03 commentedTested the patch from #3, and ran the upgrade status scan again:
Comment #5
drupal.ninja03 commentedThere are few warnings related to tests:
Not sure how this should be handled.
Comment #6
gnanagowthaman sankar commentedHi @drupal.ninja03,
I attached the updated patch for your reference except the test case. Please review and let me know for the changes.
Thanks & regards,
GnanagowthamanSankar
Comment #7
gnanagowthaman sankar commentedHi @drupal.ninja03,
I had made some changes in the version can you please review the patch.
Thanks & regards,
GnanagowthamanSankar
Comment #8
drupal.ninja03 commentedPatch from #7 works. and the upgrade status report show no more errors. However, when I tested with D9 site, I faced errors for deprecated services: path.alias_manager & entity.manager and had to make the corrections to path_alias.manager & entity_type.manager and created the patch for the same. Tested against 8.8.9 & 9.0.0.
Comment #9
gnanagowthaman sankar commentedThanks @drupal.ninja03
Comment #10
szeidlerThis looks pretty good. It would be awesome, if we could commit and tag a Drupal 9 compatible release.
Comment #11
vetal4ik commentedAfter applying the patch from #8 I got the next error:
The problem was in missed dependency for `google_analytics_counter.custom_field_generator` service.
Comment #12
rajab natshahComment #13
rajab natshahDrupal 8 end-of-life on November 2, 2021 - PSA-2021-2021-06-29
Symfony 3 will be end-of-life in November 2021
Comment #17
isa.belFor d9 upgrade the
SafeMarkup::checkPlainis also showing as a compatibility error:Error: Class 'Drupal\Component\Utility\SafeMarkup' not found in Drupal\google_analytics_counter\GoogleAnalyticsCounterAppManager->gacUpdatePathCounts()I've added this change to the provided patch on this issue and I'm attaching it here.
Comment #18
rishi.kulshreshthaFrist, the provided patch is broken when applied with 8.x-3.x-dev. Second, the patch is still missing a lot of D9 in compatibilities, hence providing an updated patch here with interdiff.
Comment #19
rishi.kulshreshthaUpdating patch for missed code.
Comment #20
osopolarRecreating interdiff
interdiff drupal_9_compatibility_report-3146542-18.patch drupal-9-compatibility-for-google-analytics-counter-module-3146542-19.patch > interdiff_18-19.txtShouldn't coding standard issues be better fixed in a separate issue? To me there are too many changes for reviewing.
Comment #21
szeidlerYes
Comment #22
kakoum commentedMy patch (compatibilty D9) for version 8.x-3.0-alpha19
Comment #23
kakoum commentedComment #24
kakoum commentedComment #25
kaszarobertPatch couldn't be applied to the latest dev. I'm doing a reroll and release a new D9 compatible alpha version.
Comment #26
ericdsd commentedHi that's good to hear, i'll test it once you release it.
Comment #28
kaszarobertCommitted. Thank you for everyone's hard work! I saw that the patches also trying to solve codestyle problems, too. I will commit those under #3281212: Fix code style issues as there's too many of those solve at once.
Now, at least the module works with Drupal 9. There are still a ton of bugs to solve but it's a small step towards a stable release.