@@ -35,6 +35,10 @@ |
||
| 35 | 35 | ]; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | + /** |
|
| 39 | + * @param string $variableName |
|
| 40 | + * @param string $typeName |
|
| 41 | + */ |
|
| 38 | 42 | public static function nonInputTypeOnVarMessage($variableName, $typeName) |
| 39 | 43 | { |
| 40 | 44 | return sprintf('Variable "$%s" cannot be non-input type "%s".', $variableName, $typeName); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * @param Source|string $doc |
|
| 35 | + * @param string $doc |
|
| 36 | 36 | * |
| 37 | 37 | * @return mixed[] |
| 38 | 38 | */ |
@@ -82,6 +82,10 @@ discard block |
||
| 82 | 82 | self::assertValidPromise($promise, null, 'A', SyncPromise::FULFILLED); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | + /** |
|
| 86 | + * @param Promise $promise |
|
| 87 | + * @param null|string $expectedNextReason |
|
| 88 | + */ |
|
| 85 | 89 | private static function assertValidPromise($promise, $expectedNextReason, $expectedNextValue, $expectedNextState) |
| 86 | 90 | { |
| 87 | 91 | self::assertInstanceOf('GraphQL\Executor\Promise\Promise', $promise); |
@@ -93,10 +97,18 @@ discard block |
||
| 93 | 97 | $onRejectedCalled = false; |
| 94 | 98 | |
| 95 | 99 | $promise->then( |
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * @param Promise $nextValue |
|
| 103 | + */ |
|
| 96 | 104 | static function ($nextValue) use (&$actualNextValue, &$onFulfilledCalled) { |
| 97 | 105 | $onFulfilledCalled = true; |
| 98 | 106 | $actualNextValue = $nextValue; |
| 99 | 107 | }, |
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @param Promise $reason |
|
| 111 | + */ |
|
| 100 | 112 | static function (Throwable $reason) use (&$actualNextReason, &$onRejectedCalled) { |
| 101 | 113 | $onRejectedCalled = true; |
| 102 | 114 | $actualNextReason = $reason->getMessage(); |
@@ -82,11 +82,19 @@ discard block |
||
| 82 | 82 | self::assertSync(['errors' => [['message' => 'Must provide an operation.']]], $result); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | + /** |
|
| 86 | + * @param Schema $schema |
|
| 87 | + * @param \GraphQL\Language\AST\DocumentNode $doc |
|
| 88 | + * @param string $rootValue |
|
| 89 | + */ |
|
| 85 | 90 | private function execute($schema, $doc, $rootValue = null) |
| 86 | 91 | { |
| 87 | 92 | return Executor::promiseToExecute($this->promiseAdapter, $schema, $doc, $rootValue); |
| 88 | 93 | } |
| 89 | 94 | |
| 95 | + /** |
|
| 96 | + * @param Promise $actualResult |
|
| 97 | + */ |
|
| 90 | 98 | private static function assertSync($expectedFinalArray, $actualResult) : void |
| 91 | 99 | { |
| 92 | 100 | $message = 'Failed assertion that execution was synchronous'; |
@@ -146,6 +154,9 @@ discard block |
||
| 146 | 154 | $this->assertAsync(['data' => ['syncField' => 'rootValue', 'asyncField' => 'rootValue']], $result); |
| 147 | 155 | } |
| 148 | 156 | |
| 157 | + /** |
|
| 158 | + * @param Promise $actualResult |
|
| 159 | + */ |
|
| 149 | 160 | private function assertAsync($expectedFinalArray, $actualResult) |
| 150 | 161 | { |
| 151 | 162 | $message = 'Failed assertion that execution was asynchronous'; |
@@ -180,6 +191,11 @@ discard block |
||
| 180 | 191 | ); |
| 181 | 192 | } |
| 182 | 193 | |
| 194 | + /** |
|
| 195 | + * @param Schema $schema |
|
| 196 | + * @param string $doc |
|
| 197 | + * @param string $rootValue |
|
| 198 | + */ |
|
| 183 | 199 | private function graphqlSync($schema, $doc, $rootValue = null) |
| 184 | 200 | { |
| 185 | 201 | return GraphQL::promiseToExecute($this->promiseAdapter, $schema, $doc, $rootValue); |
@@ -109,6 +109,9 @@ |
||
| 109 | 109 | ); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | + /** |
|
| 113 | + * @param string $query |
|
| 114 | + */ |
|
| 112 | 115 | private function executeQuery($query, $variableValues = null) |
| 113 | 116 | { |
| 114 | 117 | $document = Parser::parse($query); |
@@ -52,6 +52,10 @@ |
||
| 52 | 52 | return $lexer->advance(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param integer $line |
|
| 57 | + * @param integer $column |
|
| 58 | + */ |
|
| 55 | 59 | private function loc($line, $column) |
| 56 | 60 | { |
| 57 | 61 | return new SourceLocation($line, $column); |
@@ -149,6 +149,11 @@ discard block |
||
| 149 | 149 | Parser::parse('query Foo($x: Boolean = false @bar) { field }'); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | + /** |
|
| 153 | + * @param string $text |
|
| 154 | + * @param string $message |
|
| 155 | + * @param SourceLocation $location |
|
| 156 | + */ |
|
| 152 | 157 | private function expectSyntaxError($text, $message, $location) |
| 153 | 158 | { |
| 154 | 159 | $this->expectException(SyntaxError::class); |
@@ -161,6 +166,10 @@ discard block |
||
| 161 | 166 | } |
| 162 | 167 | } |
| 163 | 168 | |
| 169 | + /** |
|
| 170 | + * @param integer $line |
|
| 171 | + * @param integer $column |
|
| 172 | + */ |
|
| 164 | 173 | private function loc($line, $column) |
| 165 | 174 | { |
| 166 | 175 | return new SourceLocation($line, $column); |
@@ -78,6 +78,9 @@ discard block |
||
| 78 | 78 | ]; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | + /** |
|
| 82 | + * @param string $name |
|
| 83 | + */ |
|
| 81 | 84 | private function typeNode($name, $loc) |
| 82 | 85 | { |
| 83 | 86 | return [ |
@@ -294,6 +297,11 @@ discard block |
||
| 294 | 297 | ); |
| 295 | 298 | } |
| 296 | 299 | |
| 300 | + /** |
|
| 301 | + * @param string $text |
|
| 302 | + * @param string $message |
|
| 303 | + * @param SourceLocation $location |
|
| 304 | + */ |
|
| 297 | 305 | private function expectSyntaxError($text, $message, $location) |
| 298 | 306 | { |
| 299 | 307 | $this->expectException(SyntaxError::class); |
@@ -306,6 +314,10 @@ discard block |
||
| 306 | 314 | } |
| 307 | 315 | } |
| 308 | 316 | |
| 317 | + /** |
|
| 318 | + * @param integer $line |
|
| 319 | + * @param integer $column |
|
| 320 | + */ |
|
| 309 | 321 | private function loc($line, $column) |
| 310 | 322 | { |
| 311 | 323 | return new SourceLocation($line, $column); |
@@ -533,6 +545,9 @@ discard block |
||
| 533 | 545 | self::assertEquals($expected, TestUtils::nodeToArray($doc)); |
| 534 | 546 | } |
| 535 | 547 | |
| 548 | + /** |
|
| 549 | + * @param string $name |
|
| 550 | + */ |
|
| 536 | 551 | private function enumValueNode($name, $loc) |
| 537 | 552 | { |
| 538 | 553 | return [ |
@@ -107,6 +107,9 @@ |
||
| 107 | 107 | ]); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | + /** |
|
| 111 | + * @param DocumentNode $ast |
|
| 112 | + */ |
|
| 110 | 113 | private function checkVisitorFnArgs($ast, $args, $isEdited = false) |
| 111 | 114 | { |
| 112 | 115 | /** @var Node $node */ |