-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add README #19
Comments
Check out PHPStan’s codebase, namely the PHPStan\PhpDoc namespace.
On Sun, 9 Sep 2018 at 20:52, Arnold Daniels ***@***.***> wrote:
Please add a README.md showing how the parser can be used.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuHnhoXLJeuEeeHo-mwN2OjP9efSYks5uZWNPgaJpZM4WgZmY>
.
--
Ondřej Mirtes
|
I'm more interested in how to use the parser outside of PHPStan. To be precise; Can it be used to collect metadata as an alternative to Doctrine\Annotations? I have a hard time deducing that from the code. It only seems to be concerned with variable types at first glance. |
What exactly do you need it to parse and what output do you expect? Show a
few examples.
On Mon, 10 Sep 2018 at 10:39, Arnold Daniels ***@***.***> wrote:
I'm more interested in how to use the parser outside of PHPStan. To be
precise; Can it be used to collect metadata as an alternative to
Doctrine\Annotations?
I have a hard time deducing that from the code. It only seems to be
concerned with variable types at first glance.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGZuEPcFEv56fT3OD_Nt0-5yOnd_T-Gks5uZiVVgaJpZM4WgZmY>
.
--
Ondřej Mirtes
|
@jasny Probably not. Depends on what metadata do you have in mind. Currently it for example does not allow backslash in annotation name. Even if we allow backslash in annotation name, it will not understand doctrine value syntax, i.e. the following code $input = '/**
* @ORM\Table(name="product")
*/';
$lexer = new Lexer();
$typeParser = new TypeParser();
$constExprParser = new ConstExprParser();
$phpDocParser = new PhpDocParser($typeParser, $constExprParser);
$tokens = $lexer>tokenize($input);
$tokenIterator = new TokenIterator($tokens);
$phpDocNode = $phpDocParser ->parse($tokens);
var_dump($phpDocNode); will result in
|
I don't use the doctrine style notation, from the looks of it, it may be useful as I'm currently just using regular expressions to extract tags and information. This example helps a bit. Still, a good README with such examples would help. |
Where can we find all the phpDoc supported syntax ? Wouldn't the README perfect for this ? Union types, intersections type, @method types, array types (since |
@VincentLanglet https://github.com/phpstan/phpdoc-parser/blob/master/doc/grammars/type.abnf may help (but is not fully up to date i think) |
It helps indeed, but the reader need to know the abnf syntax. |
|
Please add a
README.md
showing how the parser can be used.The text was updated successfully, but these errors were encountered: