Skip to content

Using comment before for parameter throws exception #135

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

Closed
ticktackk opened this issue Aug 22, 2023 · 2 comments
Closed

Using comment before for parameter throws exception #135

ticktackk opened this issue Aug 22, 2023 · 2 comments

Comments

@ticktackk
Copy link

ticktackk commented Aug 22, 2023

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.

@dg
Copy link
Member

dg commented Aug 22, 2023

I don't know what you're doing that's throwing you an error.

@ticktackk
Copy link
Author

I have updated the original message to give better explanation.

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

No branches or pull requests

2 participants