We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -81,6 +81,9 @@ discard block |
||
| 81 | 81 | return $this; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param string $name |
|
| 86 | + */ |
|
| 84 | 87 | public function addSchema($name, Schema $schema) |
| 85 | 88 | { |
| 86 | 89 | $this->schemas[$name] = $schema; |
@@ -176,6 +179,10 @@ discard block |
||
| 176 | 179 | return $this->prepareResult($result, $startTime, $startMemoryUsage); |
| 177 | 180 | } |
| 178 | 181 | |
| 182 | + /** |
|
| 183 | + * @param double $startTime |
|
| 184 | + * @param integer $startMemoryUsage |
|
| 185 | + */ |
|
| 179 | 186 | private function prepareResult($result, $startTime, $startMemoryUsage) |
| 180 | 187 | { |
| 181 | 188 | if ($this->hasDebugInfo()) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $result = $this->promiseAdapter->convertThenable($result); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return $this->promiseAdapter->then($result, function ($result) use ($accessChecker, $resolveArgs) { |
|
| 56 | + return $this->promiseAdapter->then($result, function($result) use ($accessChecker, $resolveArgs) { |
|
| 57 | 57 | return $this->processFilter($result, $accessChecker, $resolveArgs); |
| 58 | 58 | }); |
| 59 | 59 | } |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | if (is_array($result)) { |
| 67 | 67 | $result = array_map( |
| 68 | - function ($object) use ($accessChecker, $resolveArgs) { |
|
| 68 | + function($object) use ($accessChecker, $resolveArgs) { |
|
| 69 | 69 | return $this->hasAccess($accessChecker, $object, $resolveArgs) ? $object : null; |
| 70 | 70 | }, |
| 71 | 71 | $result |
| 72 | 72 | ); |
| 73 | 73 | } elseif ($result instanceof Connection) { |
| 74 | 74 | $result->edges = array_map( |
| 75 | - function (Edge $edge) use ($accessChecker, $resolveArgs) { |
|
| 75 | + function(Edge $edge) use ($accessChecker, $resolveArgs) { |
|
| 76 | 76 | $edge->node = $this->hasAccess($accessChecker, $edge->node, $resolveArgs) ? $edge->node : null; |
| 77 | 77 | |
| 78 | 78 | return $edge; |
@@ -56,21 +56,21 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function friendsResolver($user, $args) |
| 58 | 58 | { |
| 59 | - return $this->promiseAdapter->create(function (callable $resolve) use ($user, $args) { |
|
| 59 | + return $this->promiseAdapter->create(function(callable $resolve) use ($user, $args) { |
|
| 60 | 60 | return $resolve(ConnectionBuilder::connectionFromArray($user['friends'], $args)); |
| 61 | 61 | }); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public function resolveNode(Edge $edge) |
| 65 | 65 | { |
| 66 | - return $this->promiseAdapter->create(function (callable $resolve) use ($edge) { |
|
| 66 | + return $this->promiseAdapter->create(function(callable $resolve) use ($edge) { |
|
| 67 | 67 | return $resolve(isset($this->allUsers[$edge->node]) ? $this->allUsers[$edge->node] : null); |
| 68 | 68 | }); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function resolveConnection() |
| 72 | 72 | { |
| 73 | - return $this->promiseAdapter->create(function (callable $resolve) { |
|
| 73 | + return $this->promiseAdapter->create(function(callable $resolve) { |
|
| 74 | 74 | return $resolve(count($this->allUsers) - 1); |
| 75 | 75 | }); |
| 76 | 76 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | public function resolveQuery() |
| 79 | 79 | { |
| 80 | 80 | if ($this->promiseAdapter instanceof GraphQLPromiseAdapter) { |
| 81 | - return new Deferred(function () { |
|
| 81 | + return new Deferred(function() { |
|
| 82 | 82 | return $this->allUsers[0]; |
| 83 | 83 | }); |
| 84 | 84 | } elseif ($this->promiseAdapter instanceof ReactPromiseAdapter) { |
| 85 | - return new Promise(function (callable $resolve) { |
|
| 85 | + return new Promise(function(callable $resolve) { |
|
| 86 | 86 | return $resolve($this->allUsers[0]); |
| 87 | 87 | }); |
| 88 | 88 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | public function __construct($name, callable $compiler) |
| 19 | 19 | { |
| 20 | - parent::__construct($name, $compiler, function () { |
|
| 20 | + parent::__construct($name, $compiler, function() { |
|
| 21 | 21 | throw new \RuntimeException('No need evaluator.'); |
| 22 | 22 | }); |
| 23 | 23 | } |
@@ -21,35 +21,35 @@ discard block |
||
| 21 | 21 | return [ |
| 22 | 22 | new ExpressionFunction( |
| 23 | 23 | 'service', |
| 24 | - function ($value) { |
|
| 24 | + function($value) { |
|
| 25 | 25 | return sprintf('$container->get(%s)', $value); |
| 26 | 26 | } |
| 27 | 27 | ), |
| 28 | 28 | |
| 29 | 29 | new ExpressionFunction( |
| 30 | 30 | 'parameter', |
| 31 | - function ($value) { |
|
| 31 | + function($value) { |
|
| 32 | 32 | return sprintf('$container->getParameter(%s)', $value); |
| 33 | 33 | } |
| 34 | 34 | ), |
| 35 | 35 | |
| 36 | 36 | new ExpressionFunction( |
| 37 | 37 | 'isTypeOf', |
| 38 | - function ($className) { |
|
| 38 | + function($className) { |
|
| 39 | 39 | return sprintf('($className = %s) && $value instanceof $className', $className); |
| 40 | 40 | } |
| 41 | 41 | ), |
| 42 | 42 | |
| 43 | 43 | new ExpressionFunction( |
| 44 | 44 | 'resolver', |
| 45 | - function ($alias, $args = '[]') { |
|
| 45 | + function($alias, $args = '[]') { |
|
| 46 | 46 | return sprintf('$container->get(\'overblog_graphql.resolver_resolver\')->resolve([%s, %s])', $alias, $args); |
| 47 | 47 | } |
| 48 | 48 | ), |
| 49 | 49 | |
| 50 | 50 | new ExpressionFunction( |
| 51 | 51 | 'mutateAndGetPayloadCallback', |
| 52 | - function ($mutateAndGetPayload) { |
|
| 52 | + function($mutateAndGetPayload) { |
|
| 53 | 53 | $code = 'function ($value) use ('.TypeGenerator::USE_FOR_CLOSURES.', $args, $info) { '; |
| 54 | 54 | $code .= 'return '.$mutateAndGetPayload.'; }'; |
| 55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | new ExpressionFunction( |
| 61 | 61 | 'idFetcherCallback', |
| 62 | - function ($idFetcher) { |
|
| 62 | + function($idFetcher) { |
|
| 63 | 63 | $code = 'function ($value) use ('.TypeGenerator::USE_FOR_CLOSURES.', $args, $info) { '; |
| 64 | 64 | $code .= 'return '.$idFetcher.'; }'; |
| 65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | new ExpressionFunction( |
| 71 | 71 | 'resolveSingleInputCallback', |
| 72 | - function ($resolveSingleInput) { |
|
| 72 | + function($resolveSingleInput) { |
|
| 73 | 73 | $code = 'function ($value) use ('.TypeGenerator::USE_FOR_CLOSURES.', $args, $info) { '; |
| 74 | 74 | $code .= 'return '.$resolveSingleInput.'; }'; |
| 75 | 75 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | new ExpressionFunction( |
| 81 | 81 | 'mutation', |
| 82 | - function ($alias, $args = '[]') { |
|
| 82 | + function($alias, $args = '[]') { |
|
| 83 | 83 | return sprintf('$container->get(\'overblog_graphql.mutation_resolver\')->resolve([%s, %s])', $alias, $args); |
| 84 | 84 | } |
| 85 | 85 | ), |
| 86 | 86 | |
| 87 | 87 | new ExpressionFunction( |
| 88 | 88 | 'globalId', |
| 89 | - function ($id, $typeName = null) { |
|
| 89 | + function($id, $typeName = null) { |
|
| 90 | 90 | $typeNameEmpty = null === $typeName || '""' === $typeName || 'null' === $typeName || 'false' === $typeName; |
| 91 | 91 | |
| 92 | 92 | return sprintf( |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | new ExpressionFunction( |
| 101 | 101 | 'fromGlobalId', |
| 102 | - function ($globalId) { |
|
| 102 | + function($globalId) { |
|
| 103 | 103 | return sprintf( |
| 104 | 104 | '\\Overblog\\GraphQLBundle\\Relay\\Node\\GlobalId::fromGlobalId(%s)', |
| 105 | 105 | $globalId |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | new ExpressionFunction( |
| 111 | 111 | 'newObject', |
| 112 | - function ($className, $args = '[]') { |
|
| 112 | + function($className, $args = '[]') { |
|
| 113 | 113 | return sprintf('(new \ReflectionClass(%s))->newInstanceArgs(%s)', $className, $args); |
| 114 | 114 | } |
| 115 | 115 | ), |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | return [ |
| 21 | 21 | new ExpressionFunction( |
| 22 | 22 | 'hasRole', |
| 23 | - function ($role) { |
|
| 23 | + function($role) { |
|
| 24 | 24 | return sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s)', $role); |
| 25 | 25 | } |
| 26 | 26 | ), |
| 27 | 27 | |
| 28 | 28 | new ExpressionFunction( |
| 29 | 29 | 'hasAnyRole', |
| 30 | - function ($roles) { |
|
| 30 | + function($roles) { |
|
| 31 | 31 | $code = sprintf('array_reduce(%s, function ($isGranted, $role) use ($container) { return $isGranted || $container->get(\'security.authorization_checker\')->isGranted($role); }, false)', $roles); |
| 32 | 32 | |
| 33 | 33 | return $code; |
@@ -36,35 +36,35 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | new ExpressionFunction( |
| 38 | 38 | 'isAnonymous', |
| 39 | - function () { |
|
| 39 | + function() { |
|
| 40 | 40 | return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'; |
| 41 | 41 | } |
| 42 | 42 | ), |
| 43 | 43 | |
| 44 | 44 | new ExpressionFunction( |
| 45 | 45 | 'isRememberMe', |
| 46 | - function () { |
|
| 46 | + function() { |
|
| 47 | 47 | return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\')'; |
| 48 | 48 | } |
| 49 | 49 | ), |
| 50 | 50 | |
| 51 | 51 | new ExpressionFunction( |
| 52 | 52 | 'isFullyAuthenticated', |
| 53 | - function () { |
|
| 53 | + function() { |
|
| 54 | 54 | return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')'; |
| 55 | 55 | } |
| 56 | 56 | ), |
| 57 | 57 | |
| 58 | 58 | new ExpressionFunction( |
| 59 | 59 | 'isAuthenticated', |
| 60 | - function () { |
|
| 60 | + function() { |
|
| 61 | 61 | return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\') || $container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')'; |
| 62 | 62 | } |
| 63 | 63 | ), |
| 64 | 64 | |
| 65 | 65 | new ExpressionFunction( |
| 66 | 66 | 'hasPermission', |
| 67 | - function ($object, $permission) { |
|
| 67 | + function($object, $permission) { |
|
| 68 | 68 | $code = sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s, %s)', $permission, $object); |
| 69 | 69 | |
| 70 | 70 | return $code; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | new ExpressionFunction( |
| 75 | 75 | 'hasAnyPermission', |
| 76 | - function ($object, $permissions) { |
|
| 76 | + function($object, $permissions) { |
|
| 77 | 77 | $code = sprintf('array_reduce(%s, function ($isGranted, $permission) use ($container, $object) { return $isGranted || $container->get(\'security.authorization_checker\')->isGranted($permission, %s); }, false)', $permissions, $object); |
| 78 | 78 | |
| 79 | 79 | return $code; |
@@ -58,10 +58,10 @@ |
||
| 58 | 58 | /** @var \React\Promise\PromiseInterface $reactPromise */ |
| 59 | 59 | $reactPromise = $promise->adoptedPromise; |
| 60 | 60 | |
| 61 | - $reactPromise->then(function ($values) use (&$resolvedValue, &$wait) { |
|
| 61 | + $reactPromise->then(function($values) use (&$resolvedValue, &$wait) { |
|
| 62 | 62 | $resolvedValue = $values; |
| 63 | 63 | $wait = false; |
| 64 | - }, function ($reason) use (&$exception, &$wait) { |
|
| 64 | + }, function($reason) use (&$exception, &$wait) { |
|
| 65 | 65 | $exception = $reason; |
| 66 | 66 | $wait = false; |
| 67 | 67 | }); |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | EOF |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - $promise = $this->adapter->create(function (callable $resolve) use (&$process) { |
|
| 59 | - $process->start(function () use ($resolve, &$process) { |
|
| 58 | + $promise = $this->adapter->create(function(callable $resolve) use (&$process) { |
|
| 59 | + $process->start(function() use ($resolve, &$process) { |
|
| 60 | 60 | $output = $process->getOutput(); |
| 61 | 61 | $resolve($output); |
| 62 | 62 | }); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $this->assertEquals( |
| 66 | 66 | $output, |
| 67 | - $this->adapter->wait($promise, function () use (&$process) { |
|
| 67 | + $this->adapter->wait($promise, function() use (&$process) { |
|
| 68 | 68 | $process->wait(); |
| 69 | 69 | }) |
| 70 | 70 | ); |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | trait DIContainerMockTrait |
| 20 | 20 | { |
| 21 | + /** |
|
| 22 | + * @return null|\Symfony\Component\DependencyInjection\ContainerInterface |
|
| 23 | + */ |
|
| 21 | 24 | private function getDIContainerMock(array $services = [], array $parameters = []) |
| 22 | 25 | { |
| 23 | 26 | $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container') |