Commit Graph

63 Commits

Author SHA1 Message Date
spawnia
6e91e2181c Spread ternary expressions across multiple lines 2019-06-23 18:04:30 +02:00
Simon Podlipsky
90b51e1a5d Replace node kind checks by InstanceOf checks 2018-11-23 12:07:48 +01:00
Vladimir Razuvaev
b4be42acdf Fix printing of ASTs of argument definitions with descriptions 2018-11-21 18:53:44 +07:00
Simon Podlipsky
90d0156291
Use PHPStan strict rules
Two rules excluded: missing type hints and empty() usage
2018-10-09 17:46:55 +02:00
Simon Podlipsky
07c070d795
Fix CS in tests 2018-10-05 10:47:57 +02:00
Simon Podlipsky
c4e06ba528
Use self:: in tests where appropriate 2018-09-19 20:50:32 +02:00
Jeremiah VALERIE
7428cb8a31
Fix namespaces 2018-09-02 17:20:38 +02:00
Jeremiah VALERIE
62de403f27
Use right assert method 2018-09-02 17:20:38 +02:00
Jeremiah VALERIE
eb7ff7048d
Removed unused use for anonymous functions 2018-09-02 17:20:38 +02:00
Simon Podlipsky
d1f49bedbd
Fix CS in test/Language 2018-09-01 22:16:02 +02:00
Simon Podlipsky
715146cdd1
Add void return typehint to test methods 2018-08-31 14:41:18 +02:00
Simon Podlipsky
a30b3104a0
Replace misleading @it by @see annotation 2018-08-31 10:55:14 +02:00
Vladimir Razuvaev
d87c1aba5c Additional printer test 2018-08-22 12:28:13 +07:00
Simon Podlipsky
ad8693cb8a
Fix CS in src/Language 2018-08-20 20:26:21 +02:00
Vladimir Razuvaev
ccb9486d21 SchemaParser: additional test case 2018-08-08 01:18:59 +07:00
Vladimir Razuvaev
a19fc3d208 RFC: SDL - Separate multiple inherited interfaces with & 2018-08-08 01:11:47 +07:00
Vladimir Razuvaev
8e02fdc537 Parser: allowLegacySDLEmptyFields option + minor naming tweaks 2018-08-08 00:41:20 +07:00
Vladimir Razuvaev
c3d69c7c2b Fixed tests for PHPUnit 7+ 2018-08-07 23:59:48 +07:00
Simon Podlipsky
24b6b736b2
Upgrade PHPUnit 2018-07-29 19:01:39 +02:00
Daniel Tschinder
ddfeee314c Fix path argument. Enchance visit test to validate all arguments
ref: graphl/graphql-js#1149
2018-02-15 22:44:17 +01:00
Daniel Tschinder
949b853678 Add experimental support for parsing variable definitions in fragments
ref: graphql/graphql-js#1141
2018-02-15 13:37:45 +01:00
Daniel Tschinder
15374a31dd New: printError()
Lifted from / inspired by a similar change in graphql/graphql-js#722, this creates a new function `printError()` (and uses it as the implementation for `GraphQLError#toString()`) which prints location information in the context of an error.

This is moved from the syntax error where it used to be hard-coded, so it may now be used to format validation errors, value coercion errors, or any other error which may be associated with a location.

ref: graphql/graphql-js

BREAKING CHANGE: The SyntaxError message does not contain the codeframe anymore and only the message, (string) $error will print the codeframe.
2018-02-12 12:23:39 +01:00
Daniel Tschinder
b5106a06c9 SDL Spec changes
This adds the recent changes to the SDL proposal.

ref: graphql/graphql-js#1117
2018-02-11 21:08:53 +01:00
Daniel Tschinder
d70a9a5e53 Update to match SDL changes
This changes the parsing grammar and validation rules to more correctly implement the current state of the GraphQL SDL proposal (facebook/graphql#90)

ref: graphql/graphl-js#1102
2018-02-11 13:27:26 +01:00
Daniel Tschinder
0c32982171 Fix KnownDirectives validator to support all directives 2018-02-11 13:15:51 +01:00
Daniel Tschinder
98e397ce44 Add additional number lexing test
ref: graphql/graphql-js#72421378550cf51b13c6db59b8fc912591fd1a4b
2018-02-10 18:45:06 +01:00
Daniel Tschinder
7705e50e44 Fix print of block string with leading space and quotation
ref: graphql/graphql-js#1190
2018-02-10 18:44:56 +01:00
Daniel Tschinder
022c490011 RFC: Descriptions as strings
As discussed in facebook/graphql#90

This proposes replacing leading comment blocks as descriptions in the schema definition language with leading strings (typically block strings).

While I think there is some reduced ergonomics of using a string literal instead of a comment to write descriptions (unless perhaps you are accustomed to Python or Clojure), there are some compelling advantages:

* Descriptions are first-class in the AST of the schema definition language.
* Comments can remain "ignored" characters.
* No ambiguity between commented out regions and descriptions.

Specific to this reference implementation, since this is a breaking change and comment descriptions in the experimental SDL have fairly wide usage, I've left the comment description implementation intact and allow it to be enabled via an option. This should help with allowing upgrading with minimal impact on existing codebases and aid in automated transforms.

BREAKING CHANGE: This does not parse descriptions from comments by default anymore and the value of description in Nodes changed from string to StringValueNode
2018-02-10 18:44:51 +01:00
Daniel Tschinder
e65638f6f4 Improvements to printing block strings
ref: graphql/graphql-js#f9e67c403a4667372684ee8c3e82e1f0ba27031b
2018-02-10 18:44:45 +01:00
Daniel Tschinder
8747ff8954 RFC: Block String
This RFC adds a new form of `StringValue`, the multi-line string, similar to that found in Python and Scala.

A multi-line string starts and ends with a triple-quote:

```
"""This is a triple-quoted string
and it can contain multiple lines"""
```

Multi-line strings are useful for typing literal bodies of text where new lines should be interpretted literally. In fact, the only escape sequence used is `\"""` and `\` is otherwise allowed unescaped. This is beneficial when writing documentation within strings which may reference the back-slash often:

```
"""
In a multi-line string \n and C:\\ are unescaped.
"""
```

The primary value of multi-line strings are to write long-form input directly in query text, in tools like GraphiQL, and as a prerequisite to another pending RFC to allow docstring style documentation in the Schema Definition Language.

Ref: graphql/graphql-js#926
2018-02-10 18:43:26 +01:00
Daniel Tschinder
46816a7cda Uniform parsing of queries with short-hand syntax with regular queries 2018-02-09 14:33:04 +01:00
Daniel Tschinder
eb9ac66af8 Fix how TypeInfo handles inline fragments without type
ref: graphql/graphql-js#1041
2018-02-09 14:32:44 +01:00
Vladimir Razuvaev
9944a689bf Exclude nulls from serialized AST 2018-01-13 16:25:06 +07:00
Vladimir Razuvaev
8b17953fe5 Fixed bug preventing use of parser noLocation option for serialization / deserialization 2018-01-13 15:45:09 +07:00
Adrien Crivelli
5cbaf973e1
Leverage PHPUnit setExpectedException() instead of custom code
Closes #219
2018-01-01 18:06:08 +09:00
Gabriel Goncalves
440d38d3bc Creating test to Language\Token 2017-10-04 12:06:25 -03:00
Vladimir Razuvaev
a1e06b2e61 Account for query offset in files for errors 2017-09-20 18:36:19 +07:00
Vladimir Razuvaev
085516bdda Moved GraphQL\Language\AST\Node::fromArray to GraphQL\Utils\AST::fromArray 2017-08-20 19:50:44 +07:00
Vladimir Razuvaev
1af902865b AST: new NodeList class for collections of nodes (vs array) to enable effective conversion of libgraphqlparser output to our AST tree 2017-07-21 22:29:59 +07:00
Vladimir Razuvaev
296544089c Moved GraphQL\Utils to GraphQL\Utils\Utils 2017-07-10 19:53:46 +07:00
Vladimir Razuvaev
a79a51d445 Schema Parsing: allow leading pipe for union type definitions 2017-07-05 19:01:13 +07:00
Vladimir Razuvaev
9b9a74c1d1 Spec compliance: errors in buildExecutionContext() are caught and included in result rather than thrown 2017-07-05 17:33:59 +07:00
jane-olszewska
008fd20498 Added test for adding a schema element description in comments 2017-02-06 19:11:12 +00:00
jane-olszewska
dd31ab2b80 Added a description field to schema type definition classes 2017-02-06 18:33:18 +00:00
vladar
660200ed50 GraphQL\Language\AST\NodeType -> GraphQL\Language\AST\NodeKind 2016-11-19 17:31:47 +07:00
vladar
5a17ae8246 Clearer lexer errors 2016-11-19 17:08:20 +07:00
vladar
8d696edee5 Renamed AST nodes to *Node to disambiguate types 2016-11-19 06:12:18 +07:00
vladar
8a676cde99 Support for NullValue 2016-11-18 23:59:28 +07:00
vladar
5d889ccacd Reverted several breaking changes from #75; tests are green 2016-11-16 18:37:35 +07:00
Andreas Heiberg
46788f2ddb move NodeTypes enum to seperate class 2016-11-16 18:02:58 +07:00