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
The module use the reserved word "object" as part of namespace, and it's generate a warning compatibility with php 7+.
See: http://php.net/manual/en/reserved.other-reserved-words.php
FILE: /jsonrpc/src/Object/Response.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | ERROR | 'object' is a soft reserved keyword as of PHP version 7.0 and a reserved keyword as of PHP version 7.2 and should not be used to name a class, interface or trait or as part of a namespace
| | (T_NAMESPACE)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /jsonrpc/src/Object/Request.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | ERROR | 'object' is a soft reserved keyword as of PHP version 7.0 and a reserved keyword as of PHP version 7.2 and should not be used to name a class, interface or trait or as part of a namespace
| | (T_NAMESPACE)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /jsonrpc/src/Object/Error.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | ERROR | 'object' is a soft reserved keyword as of PHP version 7.0 and a reserved keyword as of PHP version 7.2 and should not be used to name a class, interface or trait or as part of a namespace
| | (T_NAMESPACE)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /jsonrpc/src/Object/ParameterBag.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 | ERROR | 'object' is a soft reserved keyword as of PHP version 7.0 and a reserved keyword as of PHP version 7.2 and should not be used to name a class, interface or trait or as part of a namespace
| | (T_NAMESPACE)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Steps to reproduce
run ./vendor/bin/phpcs -p jsonrpc/ --runtime-set testVersion 7.4 --standard=PHPCompatibility --extensions=php,module,inc,install,test,profile,theme
Proposed resolution
Change the name from "Object" to "JsonRpcObject", the same happened with the json api core module, you can check here: https://www.drupal.org/project/jsonapi/issues/2971040
Comment | File | Size | Author |
---|---|---|---|
#3 | 3216615--object-reserved--3.patch | 19.01 KB | e0ipso |
Comments
Comment #2
e0ipsoThanks for the report. I will take a look into it.
Comment #3
e0ipsoComment #4
e0ipsoComment #6
e0ipsoComment #8
e0ipsoI reverted this, since I did not realize this would cause a breaking change.
Comment #9
e0ipsoPostponing to the next major version, if ever.
Comment #12
sjerdo@e0ipso Since this commit is reverted, could you re-open this issue?
Comment #13
e0ipsoSure thing.
Comment #14
e0ipsoComment #15
er_abhinav CreditAttribution: er_abhinav as a volunteer commentedThese errors still exists with latest version on the module. Any plans to resolve these?
Comment #16
er_abhinav CreditAttribution: er_abhinav as a volunteer commentede0ipso
CreditAttribution: e0ipso as a volunteer and at Lullabot for IBM commented 2 years ago
I reverted this, since I did not realize this would cause a breaking change.
@e0ipso Can you provide some details, about issues caused by patch as it looks fine you just replaces Object with another word. If you can provide some details about issues you faced I can give it a try to create a patch.