Comment not allowed in @phpstan-type

Open
#219 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
php
Domain
tooling

Research direction

Start with the linked reproducer for the @phpstan-type comment syntax and trace how the phpDoc parser handles the local type alias. Confirm the expected behavior from the report: comments should be accepted without errors. Check the parser's existing tests for similar PHPDoc tags and add coverage for this reproducer.

Written by the indexing model from the issue text.

Description

Bug report

I'd like to add comment to local type alias (@phpstan-type) but it throws "PHPDoc tag @phpstan-type MyNumber has invalid value: Unexpected token "some", expected TOKEN_PHPDOC_EOL at offset..."

Didn't find any mention in docs that comments are not allowed.

Code snippet that reproduces the problem

https://phpstan.org/r/94564802-931b-496e-b84f-82795bd0b552

Expected output

No errors

Did PHPStan help you today? Did it make you happy in any way?

It helps every day, it's so native that I can think coding without it anymore.

Dominant language
PHP
Stars
1.5k
Forks
78
Avg merge
9h 5m
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpdoc-parser

All issues in phpstan/phpdoc-parser

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.