Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Make sure Socialbase Drupal 9.4 compatible
Make it PHP 8.0 compatible
Improving coding standards.
Proposed resolution
1. Use tools like PHPStan and PHPCS to scan for incompatible changes and fix them
Issue fork socialblue-3314704
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:
Comments
Comment #3
navneet0693 CreditAttribution: navneet0693 commentedComment #4
cinarb CreditAttribution: cinarb at CI&T commentedHi Ill review this =)
Comment #5
cinarb CreditAttribution: cinarb at CI&T commentedAfter I run PHPstan, I don't get any errors:
---------------------------------------------------------------------------------------------------------------------
cindyv@lnb000015col:~...$ lando phpstan analyse web/themes/contrib/socialblue
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 192.168.1.10:9003 (fallback through xdebug.client_host/xdebug.client_port) :-(
Note: Using configuration file /app/phpstan.neon.
8/8 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
---------------------------------------------------------------------------------------------------------------------
Using phpcs:
---------------------------------------------------------------------------------------------------------------------
cindyv@lnb000015col:~.../web/themes/contrib/socialblue$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,info,md,yml,twig .
FILE: .../web/themes/contrib/socialblue/theme-settings.php
--------------------------------------------------------------------------------------------
FOUND 7 ERRORS AND 1 WARNING AFFECTING 8 LINES
--------------------------------------------------------------------------------------------
1 | ERROR | [x] Missing file doc comment
3 | WARNING | [x] Unused use statement
4 | ERROR | [ ] Missing short description in doc comment
131 | ERROR | [x] Data types in @var tags need to be fully namespaced
215 | ERROR | [x] Data types in @param tags need to be fully namespaced
218 | ERROR | [x] Data types in @throws tags need to be fully namespaced
260 | ERROR | [x] Data types in @param tags need to be fully namespaced
263 | ERROR | [x] Data types in @throws tags need to be fully namespaced
--------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------
FILE: /.../web/themes/contrib/socialblue/templates/node/event/node--event--teaser--sky.html.twig
---------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------
36 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------------------------
FILE: .../web/themes/contrib/socialblue/templates/layout/region--header.html.twig
-------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------
15 | ERROR | [x] Expected 1 newline at end of file; 0 found
-------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------------------------------------------
FILE: .../web/themes/contrib/socialblue/color/color.inc
-----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
8 | WARNING | Unused variable $info.
-----------------------------------------------------------------------------------------
FILE: .../web/themes/contrib/socialblue/components/00-config/variables/colors.twig
--------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------
FILE: .../web/themes/contrib/socialblue/components/02-atoms/badge/badge-variation.twig
------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [x] Expected 1 newline at end of file; 0 found
------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------
FILE: .../web/themes/contrib/socialblue/components/02-atoms/button/button--floating.twig
--------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------
3 | ERROR | [x] Expected 1 newline at end of file; 0 found
--------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------------------------------------------------
Time: 113ms; Memory: 10MB
--------------------------------------------------------------------------------------------------------------------------
I fixed the remaining phpcs errors, but I didn't know how to proceed with this one:
FILE: .../web/themes/contrib/socialblue/color/color.inc
-----------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------
8 | WARNING | Unused variable $info.
-----------------------------------------------------------------------------------------
Time: 114ms; Memory: 10MB
Notice I didn't check for phpcs errors in CSS file extensions due to the big amount of errors to be fixed. I think it is best to create another issue for that.
Comment #6
navneet0693 CreditAttribution: navneet0693 commentedThank @cinarb for your contribution !! Great work.
Comment #7
navneet0693 CreditAttribution: navneet0693 commentedComment #8
tbsiqueiraComment #9
navneet0693 CreditAttribution: navneet0693 commentedComment #11
navneet0693 CreditAttribution: navneet0693 commented