Skip to content

PHP8.2 Disjunctive Normal Form Types - readonly property followed by ( #9500

Closed
@SpacePossum

Description

@SpacePossum

Description

The following code:

<?php
class Dnf
{
    private A|(B&C) $a; // valid
    private (B&C)|A $b;  // valid
    private readonly A|(B&C) $c;  // valid
    private readonly (B&C)|A $d; // invalid?
}

Resulted in this output:

Parse error: syntax error, unexpected token "(", expecting variable in app/test.php on line 7

But I expected this output instead:

PHP Version

php:8.2.0RC1-zts-alpine3.16

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions