Repository: phpDocumentor/phpDocumentor

Issue #1962: Public/private/protected constants not supported
Created: 2018-03-17T07:31:09Z
I get a syntax error if I define public/private/protected constants within a namespace class. This is something that got supported in PHP 7.1, but PHPDocumentor2 does not yet seem to support the use of these constants.
Expected Behavior
No syntax errors. :)
Actual Behavior
Parsing /src/Library/Config.php
Parse Error: Syntax error, unexpected '[', expecting '(' on line 64  No summary was found for this file

Steps to Reproduce the Problem
Simply try to define the following, and use it later on.

  public static $Db;

  public const Db = [
    'production' => [
      'username' => 'something',
      'password' => '',
      'host' => '127.0.0.1',
      'database' => 'mydb'
    ],
    'staging' => [
      'username' => 'something',
      'password' => '',
      'host' => '127.0.0.1',
      'database' => 'mydb_staging'
    ],
    'development' => [
      'username' => 'something',
      'password' => '',
      'host' => '127.0.0.1',
      'database' => 'mydb_development'
    ]
  ];

  public static function setDatabase(string $environment) {
    if(!isset(self::Db[$environment])) { throw new \Exception('No configuration set for environment ('.$environment.').'); }

    self::$Db = self::Db[$environment];
  }

Here, the !isset(self::Db[$environment]) also seems to be throwing an error. But most importantly, the syntax error happens a the first attempt of defining a scoped constant.
Your environment

Version used: 3.0.0-alpha1
Install method: Composer
php version: 7.2.2
Operating system and version (e.g. Ubuntu 16.04, Windows 7): MacOS High Sierra

Duplicate issue #1964: The phpdoc parser does not like "isset(self::TEST[$code])"
Created: 2018-03-19T20:59:06Z
The phpdoc parser does not like "isset(self::TEST[$code])".
The phpdoc parser is okay with (among others) the following:
self::TEST[$code]
gettype(self::TEST_CONST[$code])
sprintf('%s', self::TEST_CONST[$code])
substr(self::TEST_CONST[$code], 0, 4)
$this->printMe(self::TEST[$code])
Attachments:
Test1.php.txt
Test2.php.txt
Test3.php.txt
Test4.php.txt
Expected Behavior

Test1.php, Test2.php, and Test3.php should, except for class and file names, all produce the same documentation.  (These refer to attached files with '.txt' appended to the name.)
Actual Behavior

Test1.php resulted in Error Line 0: No summary was found for this file.
Steps to Reproduce the Problem

Rename the attached Test*.php.txt files to remove the '.txt'.
Run phpdoc against these Test*.php files
Check reports/errors.html in your phpdoc output and notice that Test1.php has an error.

Your environment
Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
Since many issue might only occur on a specific code base it would be very helpfull if you link to your project
or add any code that is involved in to the issue.

Version used: v2.9.0
Install method: phar
php version: 7.2.3-1+ubuntu16.04.1+deb.sury.org+1 (cli)
Operating system and version (e.g. Ubuntu 16.04, Windows 7):: Ubuntu 16.04.1 LTS
Link to your project: Not online.

Closing comment (2018-03-25T18:57:46Z): This issue is related to #1962