Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mikail10000000's avatar

Cannot use 'Object' as class name as it is reserved in

Hi, I use laravel 5.7.* , cloudways - digitalocean , when I do composer install , I get Cannot use 'String' as class name as it is reserved in , then I upgraded php from 7.0 to 7.2 and I get this error, PHP Fatal error: Cannot use 'Object' as class name as it is reserved in phar:///usr/local/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Object.php on line 18 , I do not have the problem on dev environment (I use laragon), please help , thank You

0 likes
1 reply
tykus's avatar

Object is a reserved word since 7.2; your dev environment must be using an earlier version

http://php.net/manual/en/reserved.other-reserved-words.php

Solution; either downgrade the PHP version earlier than 7.2 or change the dependency.

Edit in fact it looks like the latest version of the Json-Schema package has changed the name of the files in a PR from about 3 years ago. Update your dependency to the most recent version

Please or to participate in this conversation.