-
-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Description
- PHP Depend version: 2.13.0
- PHP Version: 8.1.
- Installation type: composer
- Operating System / Distribution & Version: Ubuntu 20.04
Current Behavior
class TimeSwitchPeriod
{
public function __construct(
readonly public string $weekDays,
readonly public string $times
) {
}
}This class is valid PHP as of 8.1, using constructor property promotion and the readonly modifier.
When running PHPMD with pdepend:2.13.0, I get this error:
Unexpected token: public, line: 8, col: 18, file: /TimeSwitchPeriod.php
Expected Behavior
No error is raised.
Steps To Reproduce:
- Copy the class above, or any that uses a promoted property with two modifiers (e.g.
readonly public) in the constructor - Run PHPMD
- Get the unexpected token error
Checks before submitting
- Be sure that there isn't already an issue about this. See: Issues list
- Be sure that there isn't already a pull request about this. See: Pull requests
- I have added every step to reproduce the bug.
- If possible I added relevant code examples.
- This issue is about 1 bug and nothing more.
- The issue has a descriptive title. For example: "Default value is not available in AST when it's an array".
Reactions are currently unavailable