Conversation
dosten
left a comment
There was a problem hiding this comment.
Hi Andreas!
Thanks for your PR, I've never used a stub for a PHP extension, how do you use it?
This is a first implementation of a parser, limited but functional, the general idea is, as you said, add a proper AST implementation, but actually I'm quite busy :( Any PR is welcome!
|
|
||
| namespace GraphQL\Error; | ||
|
|
||
| class ParseError extends \Exception {} |
There was a problem hiding this comment.
Actually, ParseError extends from RuntimeException
|
|
||
| class Parser | ||
| { | ||
| /** |
There was a problem hiding this comment.
Can you add a simple description for this method?
| * | ||
| * @return array | ||
| */ | ||
| public function parse(string $input): array { |
There was a problem hiding this comment.
This doesn't works for versions before 7.0 right? Can you remove the type hint and the return type?
| @@ -0,0 +1,5 @@ | |||
| <?php | |||
|
|
|||
There was a problem hiding this comment.
I think that is required to add a copyright notice here:
/*
* This file is part of the GraphQL parser extension.
*
* (c) Diego Saint Esteben <diego@saintesteben.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
| @@ -0,0 +1,15 @@ | |||
| <?php | |||
|
|
|||
There was a problem hiding this comment.
Same here, (probably) missing copyright notice.
For IDE's to pickup the classes you're generating with C you need to write stub files.
Here you go for the current interface. Doesn't seem like there's an automatic way to generate these :(
Side note: I was looking into the involved in adding proper AST classes instead of returning as array. It's fairly involved :( this is a script that does it for Ruby. But then on top of that we would need to make something that creates stub files for those automatically. I don't know if this is worth it, but it sure would be nice. Might just do a conversion from array to AST in PHP for now.