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

Summary: Cannot use 'array' as name of class constant
Product: php Reporter: M_C_02
Component: EditorAssignee: issues@php <issues>
Status: NEW ---    
Severity: normal CC: M_C_02
Priority: P3    
Version: 8.2   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

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