This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271272 - Cannot use 'array' as name of class constant
Summary: Cannot use 'array' as name of class constant
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: Macintosh (x86) Mac OS X
: P3 normal with 1 vote (vote)
Assignee: issues@php
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-12 02:17 UTC by M_C_02
Modified: 2017-08-12 02:19 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description M_C_02 2017-08-12 02:17:55 UTC
Netbeans shows a syntax error when trying to use `array` as the name of a class constant in PHP.

```
class Type {
    const ARRAY = 'array';
}
print Type::ARRAY
```

Netbeans shows the following syntax errors:

```
Syntax error:
 unexpected:  array
 after:       const
 expected:    identifier
```
and
```
Syntax error:
 unexpected:  array
 after:       ::
 expected:    identifier, variable, {, define, $
```

There should be no syntax errors.

From http://php.net/manual/en/reserved.keywords.php ('array()' is listed as a reserved keyword):

> As of PHP 7.0.0 these keywords are allowed as property, constant, and method names of
> classes, interfaces and traits, except that class may not be used as constant name.

Build 2016-09-30 on Mac OS X 10.12.5