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

CommentFileSizeAuthor
#3 3216615--object-reserved--3.patch19.01 KBe0ipso

Issue fork jsonrpc-3216615

Command icon 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

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
StatusFileSize
new19.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.

ptmkenny’s picture

Category: Bug report » Task
Status: Active » Postponed

This could be part of the 3.0 release of this module.

ptmkenny’s picture

Discussion on similar changes:

#3216613: 'resource' is a soft reserved keyword as of PHP version 7.0 and should not be used to name a class, interface or trait or as part of a namespace (T_NAMESPACE)

Note that the linked issue describes a soft reserved keyword, whereas object is not soft; it is a "reserved keyword".

ptmkenny’s picture

Version: 2.x-dev » 3.x-dev
Status: Postponed » Active

ptmkenny’s picture

  • ptmkenny committed 74fd35de on 3.x
    Issue #3216615 by ptmkenny, e0ipso, fadonascimento: [PP] 'object' is  a...
ptmkenny’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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