Skip to content

Using comment before for parameter throws exception  #135

Closed
@ticktackk

Description

@ticktackk

When attempting to the following code:

<?php

require 'vendor/autoload.php';

$file = \Nette\PhpGenerator\PhpFile::fromCode(<<<PHP
<?php

namespace Hello;

class World
{
    public function example(/** @noinspection  */?string \$example) :? string
    {
        return 'boo';
    }
}
PHP
);

I get an exception saying

Value '/** @noinspection */ ?string' is not valid type.

That is because when parsing the parameter type for $example, this package doesn't clear the comment before attempting to get the parameter type.

Currently running 3.6.9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions