Skip to content

Using comment before for parameter throws exception  #135

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.

Activity

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

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