Skip to content

Assignment from yield reports a processing error #804

Closed
pdepend/pdepend
#694
@Nessworthy

Description

  • PHPMD version: 2.8.1 / 2.8.1snapshot202002241446
  • PHP Version: 7.4.8 (both)
  • Installation type: composer / phar
  • Operating System / Distribution & Version: Windows 10

Also tested on 2.8.1 from source at cf8677bbd8c291f7f6ed6437f5c941a49ebc2473

Current Behavior

Running phpmd reports the following processing error:

Unexpected token: }, line: 6, col: 1, file: /path/to/script.php.

Expected Behavior

No processing errors.

Steps To Reproduce:

Using the following script:

<?php declare(strict_types=1);

function test_function(): Generator
{
    $result = yield true;
}

And running phpmd script.php text cleancode

or

php phpmd.phar script.php text cleancode

Checks before submitting

  • Be sure that there isn't already an issue about this. See: Issues list
    • Another prior issue around yield, from a previous version reporting and a different error, but it is closed off.
  • 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".

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions