[PP] 'object' is a reserved keyword as of PHP version 7.2 and should not be used in namespaces

Created on 31 May 2021, about 3 years ago
Updated 21 February 2023, over 1 year ago

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

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇧🇷Brazil fadonascimento

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India er_abhinav Brisbane

    These errors still exists with latest version on the module. Any plans to resolve these?

  • 🇮🇳India er_abhinav Brisbane

    e0ipso
    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.

Production build 0.69.0 2024