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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fadonascimento created an issue. See original summary.

e0ipso’s picture

Thanks for the report. I will take a look into it.

e0ipso’s picture

Title: '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) » 'object' is a reserved keyword as of PHP version 7.2 and should not be used in namespaces
Category: Feature request » Bug report
Status: Active » Needs review
FileSize
19.01 KB
e0ipso’s picture

  • e0ipso committed 33314c0 on 2.x
    Issue #3216615 by e0ipso, fadonascimento: 'object' is  a reserved...
e0ipso’s picture

Status: Needs review » Fixed

  • e0ipso committed 9a7bcef on 2.x
    Revert "Issue #3216615 by e0ipso, fadonascimento: 'object' is  a...
e0ipso’s picture

I reverted this, since I did not realize this would cause a breaking change.

e0ipso’s picture

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

Postponing to the next major version, if ever.

  • e0ipso committed 35eae9d on 2.x
    Revert "Issue #3216615 by e0ipso, fadonascimento: object is  a reserved...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sjerdo’s picture

@e0ipso Since this commit is reverted, could you re-open this issue?

e0ipso’s picture

Sure thing.

e0ipso’s picture

Status: Closed (fixed) » Active
er_abhinav’s picture

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

er_abhinav’s picture

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.