Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error with constructor property promotion and @var docblock #896

Closed
6 tasks done
archfz opened this issue Jun 1, 2021 · 2 comments
Closed
6 tasks done

Parsing error with constructor property promotion and @var docblock #896

archfz opened this issue Jun 1, 2021 · 2 comments
Milestone

Comments

@archfz
Copy link

archfz commented Jun 1, 2021

  • PHPMD version: 2.10.1
  • PHP Version: 8.0.5
  • Installation type: composer
  • Operating System / Distribution & Version: Ubuntu 20.04

Current Behavior

PHPMD fails to parse file where constructor property promotion is used in combination with @var docblock.

class Test {
   public function __construct(
      private string $id,
      /** @var array<array<string>|null> */
      private array $complex
   ) {}
}

Error

ERROR while parsing 
--------------------
Unexpected token: private, line: 13

Expected Behavior

It should not 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: "JSON rendering failed on Windows for filenames with space".
@adrienlucas
Copy link

This is fixed but not yet released, see #889
(TL;DR; composer require --dev "pdepend/pdepend:2.x-dev" to solve the parse error; but you may still get a unused parameter false-positive)

@tvbeek tvbeek added this to the 2.10.2 milestone Jul 20, 2021
@kylekatarnls
Copy link
Member

You can update to last pdepend/pdepend now to get it fixed, phar version of 2.10.2 that will have it will be released this week too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants