-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
[FPDP] Format preserving doc printer #4334
Comments
what does this mean? do you have a plan/a idea of what needs to be done? |
We need a new package that builds on https://github.com/phpstan/phpdoc-parser, I don't have any ETA on that. |
Whats the job of this package? What should it provide on top of what phpstan/phpdoc-parser already can? |
Current job of existing package is getting docs block to types. E.g. /**
* @var int
*/ ↓ Very rougly: use PHPStan\PhpDocParser\VarTagNode;
use PHPStan\PhpDocParser\IntegerTypeNode;
new VarTagNode(new IntegerTypeNode()); The problem is, all these cases: /**
* @var int
*/
/**
* @var integer
*/
/**
* @var int
*/ Are printed back as: /**
* @var int
*/
Keep the format in it's original form. /**
* @var integer
*/ ↓ /**
* @var integer
*/ and /**
* @var int
*/ ↓ /**
* @var int
*/ |
Work in progress https://github.com/rectorphp/phpdoc-parser-printer |
Big jump forward via:
|
We've just added another jump with static doctrine annotatoin parsing #5974 Before, to parse class-based annotations the https://github.com/doctrine/annotations was needed: use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class Product
{
} That required the Further more, this approach required every such annotation to have own php doc node class and factory to make it. In total, Rector contained ~50 such classes + factories. The #5974 PR solves this using https://github.com/phpstan/phpdoc-parser and copying the doctrine/annotation behavior 1:1 without autoloading used classes and constants. Now, Rector is now using static for annotations making it more accessible to wide PHP comunity 🤗 👍 |
Since last 2 comments and full month of testing we have exactly 0 reported issues with docblocks 👍 I think we can close this issue as resolved 🙂 |
rectorphp/rector-src@d6db548 [NodeTypeResolver] Remove parent attribute on VariableTypeResolver (#4334)
Mirror of nikic/PHP-Parser#344, just for phpdoc
It might be worth to create https://github.com/phpstan/phpdoc-parser which actually preserver format
Here is knowledge snippet from php-parser: nikic/PHP-Parser#487
Related Issues
The text was updated successfully, but these errors were encountered: