yii2-apidoc: It doesn't work with PHP 7.2

What steps will reproduce the problem?

$ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
$ cd basic
$ vi composer.json (require "yiisoft/yii2-apidoc": "dev-master")
$ composer update
$ vendor/bin/apidoc api .,vendor/yiisoft/yii2 docs/api \
        --pageTitle="API del proyecto" --guide=.. --guidePrefix= \
        --exclude="docs,vendor,tests" --interactive=0

What’s expected?

Documentation generated OK.

What do you get instead?

Searching files to process... done.
Loading apidoc data from cache... no data available.
Checking for updated files... done.
438 files to update.
Processing files... 14% (64/438) ETA: 34 sec.   PHP Fatal error:  Cannot use 'Object' as class name as it is reserved in vendor/yiisoft/yii2/base/Object.php on line 28
Error: The given file could not be interpreted as it contains errors: 
Fatal error: Cannot use 'Object' as class name as it is reserved in vendor/yiisoft/yii2/base/Object.php on line 28

Errors parsing vendor/yiisoft/yii2/base/Object.php

Additional info

  • I’m using the latest HEAD from yii2-apidoc, including commit dbc640a.
  • Using PHP 7.1 it works OK.
Q A
Yii vesion 2.0.14.1
Yii APIDoc version dev-master
PHP version 7.2.2-3+ubuntu16.04.1+deb.sury.org+1
Operating system Ubuntu 16.04.3 LTS

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 23 (13 by maintainers)

Most upvoted comments

@ricpelo i do have the same problem. This could also be a problem cause https://github.com/yiisoft/yii2/blob/master/framework/base/Object.php is still in the vendor folder, but i have no idea why its “requested” (api docs try to open/create the class).

PHP Fatal error:  Cannot use 'Object' as class name as it is reserved in vendor/yiisoft/yii2/base/Object.php on line 28
Error: The given file could not be interpreted as it contains errors: Errors parsing vendor/yiisoft/yii2/base/Object.php

Ah, right. I forgot that I’ve added try-catch there. I agree about closing the issue.