diff --git a/composer.json b/composer.json index 257e528c5..0d216157a 100644 --- a/composer.json +++ b/composer.json @@ -14,16 +14,15 @@ "require": { "php": ">=8.1", "ext-json": "*", - "infinityloop-dev/graphpinator-parser": "^1.1", - "infinityloop-dev/graphpinator-common": "^1.2", - "infinityloop-dev/utils": "^2.2", - "nette/utils": "^3.2", - "psr/http-message": "^1.1 || ^2.0", + "infinityloop-dev/graphpinator-parser": "^1.2", + "infinityloop-dev/graphpinator-common": "^2.0", + "infinityloop-dev/utils": "^2.3", + "psr/http-message": "^2.0", "psr/log": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^10.0", - "infection/infection": "^0.26 || ^0.27", + "phpunit/phpunit": "^10.4", + "infection/infection": "^0.27", "phpstan/phpstan": "^1.10", "infinityloop-dev/coding-standard": "^0.2" }, diff --git a/composer.lock b/composer.lock index de3943a0c..92be87d91 100644 --- a/composer.lock +++ b/composer.lock @@ -4,32 +4,31 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2ba6465ea3f18536167dd383d1e01024", + "content-hash": "025fba2a27bc5cb915483f980191c7fc", "packages": [ { "name": "infinityloop-dev/graphpinator-common", - "version": "v1.2", + "version": "v2.0", "source": { "type": "git", - "url": "https://github.com/infinityloop-dev/graphpinator-common.git", - "reference": "74f82575cc86a2028810df6e6ead5b0281c3e49d" + "url": "https://github.com/graphpql/graphpinator-common.git", + "reference": "fbe087fb00cdd023b3c584cd6bf403c77d0fd5be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infinityloop-dev/graphpinator-common/zipball/74f82575cc86a2028810df6e6ead5b0281c3e49d", - "reference": "74f82575cc86a2028810df6e6ead5b0281c3e49d", + "url": "https://api.github.com/repos/graphpql/graphpinator-common/zipball/fbe087fb00cdd023b3c584cd6bf403c77d0fd5be", + "reference": "fbe087fb00cdd023b3c584cd6bf403c77d0fd5be", "shasum": "" }, "require": { - "infinityloop-dev/utils": "^2.0", - "nette/utils": "^3.0", + "infinityloop-dev/utils": "^2.3", "php": ">=8.0" }, "require-dev": { - "infection/infection": "^0.20 || ^0.21", - "infinityloop-dev/coding-standard": "^0.1", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.3" + "infection/infection": "^0.27", + "infinityloop-dev/coding-standard": "^0.2", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.4" }, "type": "library", "autoload": { @@ -51,37 +50,36 @@ "description": "Common structures for GraPHPinator: GraphQL server implementation for PHP.", "homepage": "https://www.infinityloop.dev/", "support": { - "issues": "https://github.com/infinityloop-dev/graphpinator-common/issues", - "source": "https://github.com/infinityloop-dev/graphpinator-common/tree/v1.2" + "issues": "https://github.com/graphpql/graphpinator-common/issues", + "source": "https://github.com/graphpql/graphpinator-common/tree/v2.0" }, - "time": "2021-03-22T10:41:35+00:00" + "time": "2023-11-10T12:38:41+00:00" }, { "name": "infinityloop-dev/graphpinator-parser", - "version": "v1.1.1", + "version": "v1.2", "source": { "type": "git", "url": "https://github.com/graphpql/graphpinator-parser.git", - "reference": "1445936ba8854f2135bbfa9fdb31c174840b727d" + "reference": "760e1473312c2933ffee68fccef2b96c902597b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/graphpql/graphpinator-parser/zipball/1445936ba8854f2135bbfa9fdb31c174840b727d", - "reference": "1445936ba8854f2135bbfa9fdb31c174840b727d", + "url": "https://api.github.com/repos/graphpql/graphpinator-parser/zipball/760e1473312c2933ffee68fccef2b96c902597b6", + "reference": "760e1473312c2933ffee68fccef2b96c902597b6", "shasum": "" }, "require": { - "infinityloop-dev/graphpinator-common": "^1.1", - "infinityloop-dev/graphpinator-tokenizer": "^1.1.1", + "infinityloop-dev/graphpinator-common": "^2.0", + "infinityloop-dev/graphpinator-tokenizer": "^1.2", "infinityloop-dev/utils": "^2.0", - "nette/utils": "^3.0", "php": ">=8.0" }, "require-dev": { - "infection/infection": "^0.26", + "infection/infection": "^0.27", "infinityloop-dev/coding-standard": "^0.2", - "phpstan/phpstan": "^1.0", - "phpunit/phpunit": "^9.3" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.4" }, "type": "library", "autoload": { @@ -104,35 +102,33 @@ "homepage": "https://github.com/graphpql", "support": { "issues": "https://github.com/graphpql/graphpinator-parser/issues", - "source": "https://github.com/graphpql/graphpinator-parser/tree/v1.1.1" + "source": "https://github.com/graphpql/graphpinator-parser/tree/v1.2" }, - "time": "2023-10-27T16:20:59+00:00" + "time": "2023-11-10T14:47:00+00:00" }, { "name": "infinityloop-dev/graphpinator-source", - "version": "v1.0", + "version": "v1.1", "source": { "type": "git", - "url": "https://github.com/infinityloop-dev/graphpinator-source.git", - "reference": "1b6891a93883dff8c1dfd0947422d30db2a432f3" + "url": "https://github.com/graphpql/graphpinator-source.git", + "reference": "d0a2429560f3e110d03e2ff0c123373a1b779be2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infinityloop-dev/graphpinator-source/zipball/1b6891a93883dff8c1dfd0947422d30db2a432f3", - "reference": "1b6891a93883dff8c1dfd0947422d30db2a432f3", + "url": "https://api.github.com/repos/graphpql/graphpinator-source/zipball/d0a2429560f3e110d03e2ff0c123373a1b779be2", + "reference": "d0a2429560f3e110d03e2ff0c123373a1b779be2", "shasum": "" }, "require": { - "infinityloop-dev/graphpinator-common": "^1.0", - "infinityloop-dev/utils": "^2.0", - "nette/utils": "^3.0", - "php": ">=8.0" + "infinityloop-dev/graphpinator-common": "^2.0", + "php": ">=8.1" }, "require-dev": { - "infection/infection": "^0.23", + "infection/infection": "^0.27", "infinityloop-dev/coding-standard": "^0.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.3" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.2" }, "type": "library", "autoload": { @@ -154,37 +150,35 @@ "description": "Source subproject for GraPHPinator: GraphQL server implementation for PHP.", "homepage": "https://www.infinityloop.dev/", "support": { - "issues": "https://github.com/infinityloop-dev/graphpinator-source/issues", - "source": "https://github.com/infinityloop-dev/graphpinator-source/tree/v1.0" + "issues": "https://github.com/graphpql/graphpinator-source/issues", + "source": "https://github.com/graphpql/graphpinator-source/tree/v1.1" }, - "time": "2021-06-01T18:07:02+00:00" + "time": "2023-11-10T13:14:05+00:00" }, { "name": "infinityloop-dev/graphpinator-tokenizer", - "version": "v1.1.1", + "version": "v1.2", "source": { "type": "git", - "url": "https://github.com/infinityloop-dev/graphpinator-tokenizer.git", - "reference": "6ad6c7cc61139d19eaa473f56e2f5b1e2351ba92" + "url": "https://github.com/graphpql/graphpinator-tokenizer.git", + "reference": "20af497ce3fd89b43bfbe993107c4b481576cb3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infinityloop-dev/graphpinator-tokenizer/zipball/6ad6c7cc61139d19eaa473f56e2f5b1e2351ba92", - "reference": "6ad6c7cc61139d19eaa473f56e2f5b1e2351ba92", + "url": "https://api.github.com/repos/graphpql/graphpinator-tokenizer/zipball/20af497ce3fd89b43bfbe993107c4b481576cb3d", + "reference": "20af497ce3fd89b43bfbe993107c4b481576cb3d", "shasum": "" }, "require": { - "infinityloop-dev/graphpinator-common": "^1.0", + "infinityloop-dev/graphpinator-common": "^2.0", "infinityloop-dev/graphpinator-source": "^1.0", - "infinityloop-dev/utils": "^2.0", - "nette/utils": "^3.0", - "php": ">=8.0" + "php": ">=8.1" }, "require-dev": { - "infection/infection": "^0.23", + "infection/infection": "^0.27", "infinityloop-dev/coding-standard": "^0.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.3" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.4" }, "type": "library", "autoload": { @@ -206,35 +200,34 @@ "description": "Tokenizer subproject for GraPHPinator: GraphQL server implementation for PHP.", "homepage": "https://www.infinityloop.dev/", "support": { - "issues": "https://github.com/infinityloop-dev/graphpinator-tokenizer/issues", - "source": "https://github.com/infinityloop-dev/graphpinator-tokenizer/tree/v1.1.1" + "issues": "https://github.com/graphpql/graphpinator-tokenizer/issues", + "source": "https://github.com/graphpql/graphpinator-tokenizer/tree/v1.2" }, - "time": "2021-06-01T20:40:36+00:00" + "time": "2023-11-10T13:55:56+00:00" }, { "name": "infinityloop-dev/utils", - "version": "v2.2.1", + "version": "v2.3", "source": { "type": "git", - "url": "https://github.com/infinityloop-dev/utils.git", - "reference": "50448ea11d51eb0314b84c858722c35a8b9d1bc0" + "url": "https://github.com/graphpql/utils.git", + "reference": "560a91790921ce6ebb67759b789893c884d479a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infinityloop-dev/utils/zipball/50448ea11d51eb0314b84c858722c35a8b9d1bc0", - "reference": "50448ea11d51eb0314b84c858722c35a8b9d1bc0", + "url": "https://api.github.com/repos/graphpql/utils/zipball/560a91790921ce6ebb67759b789893c884d479a3", + "reference": "560a91790921ce6ebb67759b789893c884d479a3", "shasum": "" }, "require": { "ext-json": "*", - "nette/utils": "^3.0", - "php": ">=8.0" + "php": ">=8.1" }, "require-dev": { - "infection/infection": "^0.20", + "infection/infection": "^0.27", "infinityloop-dev/coding-standard": "^0.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^9.1" + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.4" }, "type": "library", "autoload": { @@ -255,96 +248,10 @@ "description": "Common utils for infinityloop packages.", "homepage": "https://www.infinityloop.dev/", "support": { - "issues": "https://github.com/infinityloop-dev/utils/issues", - "source": "https://github.com/infinityloop-dev/utils/tree/v2.2.1" + "issues": "https://github.com/graphpql/utils/issues", + "source": "https://github.com/graphpql/utils/tree/v2.3" }, - "time": "2022-02-14T13:09:56+00:00" - }, - { - "name": "nette/utils", - "version": "v3.2.10", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "a4175c62652f2300c8017fb7e640f9ccb11648d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/a4175c62652f2300c8017fb7e640f9ccb11648d2", - "reference": "a4175c62652f2300c8017fb7e640f9ccb11648d2", - "shasum": "" - }, - "require": { - "php": ">=7.2 <8.4" - }, - "conflict": { - "nette/di": "<3.0.6" - }, - "require-dev": { - "jetbrains/phpstorm-attributes": "dev-master", - "nette/tester": "~2.0", - "phpstan/phpstan": "^1.0", - "tracy/tracy": "^2.3" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", - "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0-only", - "GPL-3.0-only" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", - "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "support": { - "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v3.2.10" - }, - "time": "2023-07-30T15:38:18+00:00" + "time": "2023-11-10T10:40:43+00:00" }, { "name": "psr/http-message", @@ -994,16 +901,16 @@ }, { "name": "infection/infection", - "version": "0.27.7", + "version": "0.27.8", "source": { "type": "git", "url": "https://github.com/infection/infection.git", - "reference": "e5bf714c1e6b45b881f3c8990b0cb82f1b232625" + "reference": "673ce762abf3355fcdc186ca17eb89edf86993bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/infection/infection/zipball/e5bf714c1e6b45b881f3c8990b0cb82f1b232625", - "reference": "e5bf714c1e6b45b881f3c8990b0cb82f1b232625", + "url": "https://api.github.com/repos/infection/infection/zipball/673ce762abf3355fcdc186ca17eb89edf86993bf", + "reference": "673ce762abf3355fcdc186ca17eb89edf86993bf", "shasum": "" }, "require": { @@ -1110,7 +1017,7 @@ ], "support": { "issues": "https://github.com/infection/infection/issues", - "source": "https://github.com/infection/infection/tree/0.27.7" + "source": "https://github.com/infection/infection/tree/0.27.8" }, "funding": [ { @@ -1122,7 +1029,7 @@ "type": "open_collective" } ], - "time": "2023-11-02T11:38:21+00:00" + "time": "2023-11-08T14:29:03+00:00" }, { "name": "infinityloop-dev/coding-standard", @@ -3284,16 +3191,16 @@ }, { "name": "symfony/console", - "version": "v6.3.4", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6" + "reference": "0d14a9f6d04d4ac38a8cea1171f4554e325dae92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/eca495f2ee845130855ddf1cf18460c38966c8b6", - "reference": "eca495f2ee845130855ddf1cf18460c38966c8b6", + "url": "https://api.github.com/repos/symfony/console/zipball/0d14a9f6d04d4ac38a8cea1171f4554e325dae92", + "reference": "0d14a9f6d04d4ac38a8cea1171f4554e325dae92", "shasum": "" }, "require": { @@ -3354,7 +3261,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.3.4" + "source": "https://github.com/symfony/console/tree/v6.3.8" }, "funding": [ { @@ -3370,7 +3277,7 @@ "type": "tidelift" } ], - "time": "2023-08-16T10:10:12+00:00" + "time": "2023-10-31T08:09:35+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4041,16 +3948,16 @@ }, { "name": "symfony/string", - "version": "v6.3.5", + "version": "v6.3.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339" + "reference": "13880a87790c76ef994c91e87efb96134522577a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/13d76d0fb049051ed12a04bef4f9de8715bea339", - "reference": "13d76d0fb049051ed12a04bef4f9de8715bea339", + "url": "https://api.github.com/repos/symfony/string/zipball/13880a87790c76ef994c91e87efb96134522577a", + "reference": "13880a87790c76ef994c91e87efb96134522577a", "shasum": "" }, "require": { @@ -4107,7 +4014,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.5" + "source": "https://github.com/symfony/string/tree/v6.3.8" }, "funding": [ { @@ -4123,7 +4030,7 @@ "type": "tidelift" } ], - "time": "2023-09-18T10:38:32+00:00" + "time": "2023-11-09T08:28:21+00:00" }, { "name": "thecodingmachine/safe", diff --git a/src/Exception/Value/InvalidValue.php b/src/Exception/Value/InvalidValue.php index 234ef665d..ca98a75be 100644 --- a/src/Exception/Value/InvalidValue.php +++ b/src/Exception/Value/InvalidValue.php @@ -10,9 +10,7 @@ final class InvalidValue extends \Graphpinator\Exception\Value\ValueError public function __construct(string $type, mixed $rawValue, bool $outputable) { - $this->messageArgs = [$type, $this->printValue($rawValue)]; - - parent::__construct($outputable); + parent::__construct($outputable, [$type, $this->printValue($rawValue)]); } private function printValue(mixed $rawValue) : string diff --git a/src/Exception/Value/ValueError.php b/src/Exception/Value/ValueError.php index 8d446ca47..7e043dfff 100644 --- a/src/Exception/Value/ValueError.php +++ b/src/Exception/Value/ValueError.php @@ -8,9 +8,10 @@ abstract class ValueError extends \Graphpinator\Exception\GraphpinatorBase { public function __construct( protected bool $outputable, + array $messageArgs = [], ) { - parent::__construct(); + parent::__construct($messageArgs); } public function isOutputable() : bool diff --git a/src/Graphpinator.php b/src/Graphpinator.php index fb1567470..47f230b2e 100644 --- a/src/Graphpinator.php +++ b/src/Graphpinator.php @@ -6,8 +6,6 @@ final class Graphpinator implements \Psr\Log\LoggerAwareInterface { - use \Nette\SmartObject; - /** * Whether Graphpinator should perform schema integrity checks. Disable in production to avoid unnecessary overhead. */ @@ -93,9 +91,9 @@ public function run(\Graphpinator\Request\RequestFactory $requestFactory) : \Gra $this->logger->log(self::getLogLevel($exception), self::getLogMessage($exception)); return new \Graphpinator\Result(null, [ - $exception instanceof \Graphpinator\Exception\GraphpinatorBase - ? $exception - : \Graphpinator\Exception\GraphpinatorBase::notOutputableResponse(), + $exception instanceof \Graphpinator\Exception\ClientAware + ? self::serializeError($exception) + : self::notOutputableResponse(), ]); } } @@ -120,4 +118,36 @@ private static function getLogLevel(\Throwable $exception) : string return \Psr\Log\LogLevel::EMERGENCY; } + + private static function serializeError(\Graphpinator\Exception\ClientAware $exception) : array + { + if (!$exception->isOutputable()) { + return self::notOutputableResponse(); + } + + $result = [ + 'message' => $exception->getMessage(), + ]; + + if ($exception->getLocation() instanceof \Graphpinator\Common\Location) { + $result['locations'] = [$exception->getLocation()]; + } + + if ($exception->getPath() instanceof \Graphpinator\Common\Path) { + $result['path'] = $exception->getPath(); + } + + if (\is_array($exception->getExtensions())) { + $result['extensions'] = $exception->getExtensions(); + } + + return $result; + } + + private static function notOutputableResponse() : array + { + return [ + 'message' => 'Server responded with unknown error.', + ]; + } } diff --git a/src/Introspection/TypeKindVisitor.php b/src/Introspection/TypeKindVisitor.php index b02478238..6e3806e10 100644 --- a/src/Introspection/TypeKindVisitor.php +++ b/src/Introspection/TypeKindVisitor.php @@ -6,8 +6,6 @@ final class TypeKindVisitor implements \Graphpinator\Typesystem\Contract\TypeVisitor { - use \Nette\SmartObject; - public function visitType(\Graphpinator\Typesystem\Type $type) : string { return TypeKind::OBJECT; diff --git a/src/Normalizer/Directive/Directive.php b/src/Normalizer/Directive/Directive.php index 08a4a5047..26890098a 100644 --- a/src/Normalizer/Directive/Directive.php +++ b/src/Normalizer/Directive/Directive.php @@ -6,8 +6,6 @@ final class Directive { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Contract\ExecutableDirective $directive, private \Graphpinator\Value\ArgumentValueSet $arguments, diff --git a/src/Normalizer/Exception/DirectiveIncorrectLocation.php b/src/Normalizer/Exception/DirectiveIncorrectLocation.php index 0e0349f31..cb1f484ad 100644 --- a/src/Normalizer/Exception/DirectiveIncorrectLocation.php +++ b/src/Normalizer/Exception/DirectiveIncorrectLocation.php @@ -10,8 +10,6 @@ final class DirectiveIncorrectLocation extends \Graphpinator\Normalizer\Exceptio public function __construct(string $name) { - $this->messageArgs = [$name]; - - parent::__construct(); + parent::__construct([$name]); } } diff --git a/src/Normalizer/Exception/DirectiveIncorrectUsage.php b/src/Normalizer/Exception/DirectiveIncorrectUsage.php index 3404ed943..dece17f2f 100644 --- a/src/Normalizer/Exception/DirectiveIncorrectUsage.php +++ b/src/Normalizer/Exception/DirectiveIncorrectUsage.php @@ -10,8 +10,6 @@ final class DirectiveIncorrectUsage extends \Graphpinator\Normalizer\Exception\N public function __construct(string $name) { - $this->messageArgs = [$name]; - - parent::__construct(); + parent::__construct([$name]); } } diff --git a/src/Normalizer/Exception/DirectiveNotExecutable.php b/src/Normalizer/Exception/DirectiveNotExecutable.php index f695ab58c..c5af24525 100644 --- a/src/Normalizer/Exception/DirectiveNotExecutable.php +++ b/src/Normalizer/Exception/DirectiveNotExecutable.php @@ -10,8 +10,6 @@ final class DirectiveNotExecutable extends \Graphpinator\Normalizer\Exception\No public function __construct(string $name) { - $this->messageArgs = [$name]; - - parent::__construct(); + parent::__construct([$name]); } } diff --git a/src/Normalizer/Exception/DuplicatedDirective.php b/src/Normalizer/Exception/DuplicatedDirective.php index 4127ca3fc..71072c649 100644 --- a/src/Normalizer/Exception/DuplicatedDirective.php +++ b/src/Normalizer/Exception/DuplicatedDirective.php @@ -10,8 +10,6 @@ final class DuplicatedDirective extends \Graphpinator\Normalizer\Exception\Norma public function __construct(string $name) { - $this->messageArgs = [$name]; - - parent::__construct(); + parent::__construct([$name]); } } diff --git a/src/Normalizer/Exception/InvalidFragmentType.php b/src/Normalizer/Exception/InvalidFragmentType.php index e6da89f8d..9043c7279 100644 --- a/src/Normalizer/Exception/InvalidFragmentType.php +++ b/src/Normalizer/Exception/InvalidFragmentType.php @@ -10,8 +10,6 @@ final class InvalidFragmentType extends \Graphpinator\Normalizer\Exception\Norma public function __construct(string $childType, string $parentType) { - $this->messageArgs = [$childType, $parentType]; - - parent::__construct(); + parent::__construct([$childType, $parentType]); } } diff --git a/src/Normalizer/Exception/OperationNotSupported.php b/src/Normalizer/Exception/OperationNotSupported.php index f89266189..f27440f1d 100644 --- a/src/Normalizer/Exception/OperationNotSupported.php +++ b/src/Normalizer/Exception/OperationNotSupported.php @@ -10,8 +10,6 @@ final class OperationNotSupported extends \Graphpinator\Normalizer\Exception\Nor public function __construct(string $operation) { - $this->messageArgs = [$operation]; - - parent::__construct(); + parent::__construct([$operation]); } } diff --git a/src/Normalizer/Exception/UnknownArgument.php b/src/Normalizer/Exception/UnknownArgument.php index 1e62061af..b6d493c8f 100644 --- a/src/Normalizer/Exception/UnknownArgument.php +++ b/src/Normalizer/Exception/UnknownArgument.php @@ -10,8 +10,6 @@ final class UnknownArgument extends \Graphpinator\Normalizer\Exception\Normalize public function __construct(string $argument) { - $this->messageArgs = [$argument]; - - parent::__construct(); + parent::__construct([$argument]); } } diff --git a/src/Normalizer/Exception/UnknownDirective.php b/src/Normalizer/Exception/UnknownDirective.php index f400ba12d..23f649039 100644 --- a/src/Normalizer/Exception/UnknownDirective.php +++ b/src/Normalizer/Exception/UnknownDirective.php @@ -10,8 +10,6 @@ final class UnknownDirective extends \Graphpinator\Normalizer\Exception\Normaliz public function __construct(string $name) { - $this->messageArgs = [$name]; - - parent::__construct(); + parent::__construct([$name]); } } diff --git a/src/Normalizer/Exception/UnknownField.php b/src/Normalizer/Exception/UnknownField.php index 15fcb7428..6c814294b 100644 --- a/src/Normalizer/Exception/UnknownField.php +++ b/src/Normalizer/Exception/UnknownField.php @@ -10,8 +10,6 @@ final class UnknownField extends \Graphpinator\Normalizer\Exception\NormalizerEr public function __construct(string $field, string $type) { - $this->messageArgs = [$field, $type]; - - parent::__construct(); + parent::__construct([$field, $type]); } } diff --git a/src/Normalizer/Exception/UnknownFragment.php b/src/Normalizer/Exception/UnknownFragment.php index c0cd5e44c..4892e7976 100644 --- a/src/Normalizer/Exception/UnknownFragment.php +++ b/src/Normalizer/Exception/UnknownFragment.php @@ -10,8 +10,6 @@ final class UnknownFragment extends \Graphpinator\Normalizer\Exception\Normalize public function __construct(string $fragmentName) { - $this->messageArgs = [$fragmentName]; - - parent::__construct(); + parent::__construct([$fragmentName]); } } diff --git a/src/Normalizer/Exception/UnknownType.php b/src/Normalizer/Exception/UnknownType.php index de70c27c4..79934e8b8 100644 --- a/src/Normalizer/Exception/UnknownType.php +++ b/src/Normalizer/Exception/UnknownType.php @@ -10,8 +10,6 @@ final class UnknownType extends \Graphpinator\Normalizer\Exception\NormalizerErr public function __construct(string $type) { - $this->messageArgs = [$type]; - - parent::__construct(); + parent::__construct([$type]); } } diff --git a/src/Normalizer/Exception/UnknownVariable.php b/src/Normalizer/Exception/UnknownVariable.php index eb76f714e..a5a110d3e 100644 --- a/src/Normalizer/Exception/UnknownVariable.php +++ b/src/Normalizer/Exception/UnknownVariable.php @@ -10,8 +10,6 @@ final class UnknownVariable extends \Graphpinator\Normalizer\Exception\Normalize public function __construct(string $varName) { - $this->messageArgs = [$varName]; - - parent::__construct(); + parent::__construct([$varName]); } } diff --git a/src/Normalizer/Exception/VariableTypeInputable.php b/src/Normalizer/Exception/VariableTypeInputable.php index 542b79508..528f63b70 100644 --- a/src/Normalizer/Exception/VariableTypeInputable.php +++ b/src/Normalizer/Exception/VariableTypeInputable.php @@ -10,8 +10,6 @@ final class VariableTypeInputable extends \Graphpinator\Normalizer\Exception\Nor public function __construct(string $name) { - $this->messageArgs = [$name]; - - parent::__construct(); + parent::__construct([$name]); } } diff --git a/src/Normalizer/FinalizedRequest.php b/src/Normalizer/FinalizedRequest.php index 066fee315..2ec0d0c63 100644 --- a/src/Normalizer/FinalizedRequest.php +++ b/src/Normalizer/FinalizedRequest.php @@ -6,8 +6,6 @@ final class FinalizedRequest { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Normalizer\Operation\Operation $operation, ) diff --git a/src/Normalizer/Finalizer.php b/src/Normalizer/Finalizer.php index 22792b6a9..eb74dca5e 100644 --- a/src/Normalizer/Finalizer.php +++ b/src/Normalizer/Finalizer.php @@ -6,8 +6,6 @@ final class Finalizer { - use \Nette\SmartObject; - private \Graphpinator\Common\Path $path; public function finalize(NormalizedRequest $normalizedRequest, \stdClass $variables, ?string $operationName) : FinalizedRequest diff --git a/src/Normalizer/FragmentCycleValidator.php b/src/Normalizer/FragmentCycleValidator.php index c8ef4ca00..dd3165575 100644 --- a/src/Normalizer/FragmentCycleValidator.php +++ b/src/Normalizer/FragmentCycleValidator.php @@ -6,8 +6,6 @@ final class FragmentCycleValidator { - use \Nette\SmartObject; - private array $stack = []; private array $validated = []; diff --git a/src/Normalizer/GetFieldVisitor.php b/src/Normalizer/GetFieldVisitor.php index a01a08221..a3868a0b8 100644 --- a/src/Normalizer/GetFieldVisitor.php +++ b/src/Normalizer/GetFieldVisitor.php @@ -36,7 +36,7 @@ public function visitUnion(\Graphpinator\Typesystem\UnionType $union) : Field public function visitInput(\Graphpinator\Typesystem\InputType $input) : mixed { - throw new \Nette\InvalidStateException(); + throw new \LogicException(); } public function visitScalar(\Graphpinator\Typesystem\ScalarType $scalar) : Field diff --git a/src/Normalizer/NormalizedRequest.php b/src/Normalizer/NormalizedRequest.php index 3d1027a00..b264282a9 100644 --- a/src/Normalizer/NormalizedRequest.php +++ b/src/Normalizer/NormalizedRequest.php @@ -6,8 +6,6 @@ final class NormalizedRequest { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Normalizer\Operation\OperationSet $operations, ) diff --git a/src/Normalizer/Normalizer.php b/src/Normalizer/Normalizer.php index e3b5111fd..e54250bcb 100644 --- a/src/Normalizer/Normalizer.php +++ b/src/Normalizer/Normalizer.php @@ -4,15 +4,13 @@ namespace Graphpinator\Normalizer; -use \Graphpinator\Typesystem\Location\ExecutableDirectiveLocation; +use \Graphpinator\Normalizer\Directive\DirectiveSet; use \Graphpinator\Normalizer\Variable\Variable; use \Graphpinator\Normalizer\Variable\VariableSet; -use \Graphpinator\Normalizer\Directive\DirectiveSet; +use \Graphpinator\Typesystem\Location\ExecutableDirectiveLocation; final class Normalizer { - use \Nette\SmartObject; - private \Graphpinator\Common\Path $path; private \SplStack $scopeStack; private \Graphpinator\Parser\Fragment\FragmentSet $fragmentDefinitions; @@ -62,9 +60,9 @@ private function normalizeOperation( ) : \Graphpinator\Normalizer\Operation\Operation { $rootObject = match ($operation->getType()) { - \Graphpinator\Tokenizer\OperationType::QUERY => $this->schema->getQuery(), - \Graphpinator\Tokenizer\OperationType::MUTATION => $this->schema->getMutation(), - \Graphpinator\Tokenizer\OperationType::SUBSCRIPTION => $this->schema->getSubscription(), + \Graphpinator\Tokenizer\TokenType::QUERY->value => $this->schema->getQuery(), + \Graphpinator\Tokenizer\TokenType::MUTATION->value => $this->schema->getMutation(), + \Graphpinator\Tokenizer\TokenType::SUBSCRIPTION->value => $this->schema->getSubscription(), }; if (!$rootObject instanceof \Graphpinator\Typesystem\Type) { @@ -321,7 +319,7 @@ private function normalizeFragmentSpread( \Graphpinator\Parser\FragmentSpread\InlineFragmentSpread::class => $this->normalizeInlineFragmentSpread($fragmentSpread), default => - throw new \Nette\InvalidStateException(), + throw new \LogicException(), }; } @@ -389,7 +387,7 @@ private function normalizeTypeRef( \Graphpinator\Parser\TypeRef\NotNullRef::class => new \Graphpinator\Typesystem\NotNullType($this->normalizeTypeRef($typeRef->getInnerRef())), default => - throw new \Nette\InvalidStateException(), + throw new \LogicException(), }; } diff --git a/src/Normalizer/Operation/Operation.php b/src/Normalizer/Operation/Operation.php index c9ac8c052..2dc244d4b 100644 --- a/src/Normalizer/Operation/Operation.php +++ b/src/Normalizer/Operation/Operation.php @@ -6,8 +6,6 @@ final class Operation { - use \Nette\SmartObject; - public function __construct( private string $type, private ?string $name, diff --git a/src/Normalizer/RefinerModule/DuplicateFieldModule.php b/src/Normalizer/RefinerModule/DuplicateFieldModule.php index 68f97076e..05f369792 100644 --- a/src/Normalizer/RefinerModule/DuplicateFieldModule.php +++ b/src/Normalizer/RefinerModule/DuplicateFieldModule.php @@ -6,8 +6,6 @@ final class DuplicateFieldModule implements RefinerModule, \Graphpinator\Normalizer\Selection\SelectionVisitor { - use \Nette\SmartObject; - private array $fieldForName; private int $index; diff --git a/src/Normalizer/RefinerModule/DuplicateFragmentSpreadModule.php b/src/Normalizer/RefinerModule/DuplicateFragmentSpreadModule.php index 8488c868f..bb7b31484 100644 --- a/src/Normalizer/RefinerModule/DuplicateFragmentSpreadModule.php +++ b/src/Normalizer/RefinerModule/DuplicateFragmentSpreadModule.php @@ -6,8 +6,6 @@ final class DuplicateFragmentSpreadModule implements RefinerModule, \Graphpinator\Normalizer\Selection\SelectionVisitor { - use \Nette\SmartObject; - private array $visitedFragments; private int $index; diff --git a/src/Normalizer/RefinerModule/EmptyFragmentModule.php b/src/Normalizer/RefinerModule/EmptyFragmentModule.php index 79034cb84..bcf20f7ef 100644 --- a/src/Normalizer/RefinerModule/EmptyFragmentModule.php +++ b/src/Normalizer/RefinerModule/EmptyFragmentModule.php @@ -6,8 +6,6 @@ final class EmptyFragmentModule implements RefinerModule, \Graphpinator\Normalizer\Selection\SelectionVisitor { - use \Nette\SmartObject; - private int $index; public function __construct( diff --git a/src/Normalizer/Selection/Field.php b/src/Normalizer/Selection/Field.php index 3900df7f7..427f24ca3 100644 --- a/src/Normalizer/Selection/Field.php +++ b/src/Normalizer/Selection/Field.php @@ -6,8 +6,6 @@ final class Field implements Selection { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Field\Field $field, private string $outputName, diff --git a/src/Normalizer/Selection/FragmentSpread.php b/src/Normalizer/Selection/FragmentSpread.php index 83860841e..b3bcea2d8 100644 --- a/src/Normalizer/Selection/FragmentSpread.php +++ b/src/Normalizer/Selection/FragmentSpread.php @@ -6,8 +6,6 @@ final class FragmentSpread implements \Graphpinator\Normalizer\Selection\Selection { - use \Nette\SmartObject; - public function __construct( private string $name, private \Graphpinator\Normalizer\Selection\SelectionSet $children, diff --git a/src/Normalizer/Selection/InlineFragment.php b/src/Normalizer/Selection/InlineFragment.php index 8274326f8..3ade9c7cf 100644 --- a/src/Normalizer/Selection/InlineFragment.php +++ b/src/Normalizer/Selection/InlineFragment.php @@ -6,8 +6,6 @@ final class InlineFragment implements \Graphpinator\Normalizer\Selection\Selection { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Normalizer\Selection\SelectionSet $children, private \Graphpinator\Normalizer\Directive\DirectiveSet $directives, diff --git a/src/Normalizer/SelectionSetRefiner.php b/src/Normalizer/SelectionSetRefiner.php index 8359a0389..37b664ba3 100644 --- a/src/Normalizer/SelectionSetRefiner.php +++ b/src/Normalizer/SelectionSetRefiner.php @@ -6,8 +6,6 @@ final class SelectionSetRefiner { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Normalizer\Selection\SelectionSet $selections, ) diff --git a/src/Normalizer/SelectionSetValidator.php b/src/Normalizer/SelectionSetValidator.php index 56c45d85a..ec6c97011 100644 --- a/src/Normalizer/SelectionSetValidator.php +++ b/src/Normalizer/SelectionSetValidator.php @@ -6,8 +6,6 @@ final class SelectionSetValidator { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Normalizer\Selection\SelectionSet $selections, ) diff --git a/src/Normalizer/ValidatorModule/FieldForName.php b/src/Normalizer/ValidatorModule/FieldForName.php index f16a270de..14c6aec24 100644 --- a/src/Normalizer/ValidatorModule/FieldForName.php +++ b/src/Normalizer/ValidatorModule/FieldForName.php @@ -6,8 +6,6 @@ final class FieldForName { - use \Nette\SmartObject; - public function __construct( public \Graphpinator\Normalizer\Selection\Field $field, public ?\Graphpinator\Typesystem\Contract\TypeConditionable $fragmentType, diff --git a/src/Normalizer/ValidatorModule/ValidateFieldsCanMergeModule.php b/src/Normalizer/ValidatorModule/ValidateFieldsCanMergeModule.php index 1b58f519d..1e88abf1f 100644 --- a/src/Normalizer/ValidatorModule/ValidateFieldsCanMergeModule.php +++ b/src/Normalizer/ValidatorModule/ValidateFieldsCanMergeModule.php @@ -6,8 +6,6 @@ final class ValidateFieldsCanMergeModule implements ValidatorModule, \Graphpinator\Normalizer\Selection\SelectionVisitor { - use \Nette\SmartObject; - private array $fieldsForName; private ?\Graphpinator\Typesystem\Contract\TypeConditionable $contextType; diff --git a/src/Normalizer/Variable/Variable.php b/src/Normalizer/Variable/Variable.php index efbf829ac..a371ad602 100644 --- a/src/Normalizer/Variable/Variable.php +++ b/src/Normalizer/Variable/Variable.php @@ -6,8 +6,6 @@ final class Variable { - use \Nette\SmartObject; - private \Graphpinator\Normalizer\Directive\DirectiveSet $directives; public function __construct( diff --git a/src/Normalizer/VariableValueSet.php b/src/Normalizer/VariableValueSet.php index d3de66458..4036c707d 100644 --- a/src/Normalizer/VariableValueSet.php +++ b/src/Normalizer/VariableValueSet.php @@ -6,8 +6,6 @@ final class VariableValueSet { - use \Nette\SmartObject; - public function __construct( private array $variables, ) diff --git a/src/Request/JsonRequestFactory.php b/src/Request/JsonRequestFactory.php index 8964c736f..f33faea61 100644 --- a/src/Request/JsonRequestFactory.php +++ b/src/Request/JsonRequestFactory.php @@ -6,14 +6,12 @@ final class JsonRequestFactory implements \Graphpinator\Request\RequestFactory { - use \Nette\SmartObject; - public const QUERY = 'query'; public const VARIABLES = 'variables'; public const OPERATION_NAME = 'operationName'; public function __construct( - private \Infinityloop\Utils\Json\JsonContract $json, + private \Infinityloop\Utils\Json $json, private bool $strict = true, // whether to allow unknown JSON keys in request, enable this to pass additional data in request, e.g. request ID ) { @@ -21,7 +19,7 @@ public function __construct( public static function fromString(string $json, bool $strict = true) : self { - return new self(\Infinityloop\Utils\Json\MapJson::fromString($json), $strict); + return new self(\Infinityloop\Utils\Json::fromString($json), $strict); } public function create() : Request diff --git a/src/Request/PsrRequestFactory.php b/src/Request/PsrRequestFactory.php index e0d401670..0832b8312 100644 --- a/src/Request/PsrRequestFactory.php +++ b/src/Request/PsrRequestFactory.php @@ -4,12 +4,10 @@ namespace Graphpinator\Request; -use \Infinityloop\Utils\Json\MapJson; +use \Infinityloop\Utils\Json; final class PsrRequestFactory implements RequestFactory { - use \Nette\SmartObject; - public function __construct( private \Psr\Http\Message\ServerRequestInterface $request, private bool $strict = true, @@ -30,7 +28,7 @@ public function create() : Request if (\is_string($contentType) && \str_starts_with($contentType, 'multipart/form-data')) { if ($method === 'POST' && \array_key_exists('operations', $this->request->getParsedBody())) { - return $this->applyJsonFactory(MapJson::fromString($this->request->getParsedBody()['operations'])); + return $this->applyJsonFactory(Json::fromString($this->request->getParsedBody()['operations'])); } throw new \Graphpinator\Request\Exception\InvalidMultipartRequest(); @@ -40,19 +38,19 @@ public function create() : Request case 'application/graphql': return new Request($this->request->getBody()->getContents()); case 'application/json': - return $this->applyJsonFactory(MapJson::fromString($this->request->getBody()->getContents())); + return $this->applyJsonFactory(Json::fromString($this->request->getBody()->getContents())); default: $params = $this->request->getQueryParams(); if (\array_key_exists('variables', $params)) { - $params['variables'] = MapJson::fromString($params['variables'])->toNative(); + $params['variables'] = Json::fromString($params['variables'])->toNative(); } - return $this->applyJsonFactory(MapJson::fromNative((object) $params)); + return $this->applyJsonFactory(Json::fromNative((object) $params)); } } - private function applyJsonFactory(MapJson $json) : Request + private function applyJsonFactory(Json $json) : Request { return (new JsonRequestFactory($json, $this->strict))->create(); } diff --git a/src/Request/Request.php b/src/Request/Request.php index 085299ba6..14e05cbd8 100644 --- a/src/Request/Request.php +++ b/src/Request/Request.php @@ -6,8 +6,6 @@ final class Request { - use \Nette\SmartObject; - public function __construct( private string $query, private \stdClass $variables = new \stdClass(), diff --git a/src/Resolver/CreateResolvedValueVisitor.php b/src/Resolver/CreateResolvedValueVisitor.php index ffbf53282..2b124cc84 100644 --- a/src/Resolver/CreateResolvedValueVisitor.php +++ b/src/Resolver/CreateResolvedValueVisitor.php @@ -41,7 +41,7 @@ public function visitUnion(\Graphpinator\Typesystem\UnionType $union) : \Graphpi public function visitInput(\Graphpinator\Typesystem\InputType $input) : mixed { - throw new \Nette\InvalidStateException(); + throw new \LogicException(); } public function visitScalar(\Graphpinator\Typesystem\ScalarType $scalar) : \Graphpinator\Value\ResolvedValue diff --git a/src/Resolver/ResolveSelectionVisitor.php b/src/Resolver/ResolveSelectionVisitor.php index 68d4fc216..5a7821bf3 100644 --- a/src/Resolver/ResolveSelectionVisitor.php +++ b/src/Resolver/ResolveSelectionVisitor.php @@ -9,8 +9,6 @@ final class ResolveSelectionVisitor implements \Graphpinator\Normalizer\Selection\SelectionVisitor { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Value\ResolvedValue $parentResult, private \stdClass $result, diff --git a/src/Resolver/ResolveVisitor.php b/src/Resolver/ResolveVisitor.php index 41fa99375..b3376c817 100644 --- a/src/Resolver/ResolveVisitor.php +++ b/src/Resolver/ResolveVisitor.php @@ -5,7 +5,6 @@ namespace Graphpinator\Resolver; use \Graphpinator\Value\ResolvedValue; -use \Nette\InvalidStateException; final class ResolveVisitor implements \Graphpinator\Typesystem\Contract\TypeVisitor { @@ -31,17 +30,17 @@ public function visitType(\Graphpinator\Typesystem\Type $type) : \Graphpinator\V public function visitInterface(\Graphpinator\Typesystem\InterfaceType $interface) : mixed { - throw new InvalidStateException(); + throw new \LogicException(); } public function visitUnion(\Graphpinator\Typesystem\UnionType $union) : mixed { - throw new InvalidStateException(); + throw new \LogicException(); } public function visitInput(\Graphpinator\Typesystem\InputType $input) : mixed { - throw new InvalidStateException(); + throw new \LogicException(); } public function visitScalar(\Graphpinator\Typesystem\ScalarType $scalar) : ResolvedValue diff --git a/src/Resolver/Resolver.php b/src/Resolver/Resolver.php index 4bc0bfe86..3f1535336 100644 --- a/src/Resolver/Resolver.php +++ b/src/Resolver/Resolver.php @@ -6,16 +6,14 @@ final class Resolver { - use \Nette\SmartObject; - public function resolve(\Graphpinator\Normalizer\FinalizedRequest $finalizedRequest) : \Graphpinator\Result { $operation = $finalizedRequest->getOperation(); return match ($operation->getType()) { - \Graphpinator\Tokenizer\OperationType::QUERY => $this->resolveQuery($operation), - \Graphpinator\Tokenizer\OperationType::MUTATION => $this->resolveMutation($operation), - \Graphpinator\Tokenizer\OperationType::SUBSCRIPTION => $this->resolveSubscription($operation), + \Graphpinator\Tokenizer\TokenType::QUERY->value => $this->resolveQuery($operation), + \Graphpinator\Tokenizer\TokenType::MUTATION->value => $this->resolveMutation($operation), + \Graphpinator\Tokenizer\TokenType::SUBSCRIPTION->value => $this->resolveSubscription($operation), }; } diff --git a/src/Result.php b/src/Result.php index 89f8120fa..6f1766764 100644 --- a/src/Result.php +++ b/src/Result.php @@ -8,8 +8,6 @@ final class Result implements \JsonSerializable { - use \Nette\SmartObject; - public function __construct( private ?TypeValue $data = null, private ?array $errors = null, @@ -44,6 +42,6 @@ public function jsonSerialize() : \stdClass public function toString() : string { - return \Infinityloop\Utils\Json\MapJson::fromNative($this->jsonSerialize())->toString(); + return \Infinityloop\Utils\Json::fromNative($this->jsonSerialize())->toString(); } } diff --git a/src/Typesystem/Argument/Argument.php b/src/Typesystem/Argument/Argument.php index e1670728f..8fdf1c57b 100644 --- a/src/Typesystem/Argument/Argument.php +++ b/src/Typesystem/Argument/Argument.php @@ -9,7 +9,6 @@ final class Argument implements \Graphpinator\Typesystem\Contract\Component { - use \Nette\SmartObject; use \Graphpinator\Typesystem\Utils\TOptionalDescription; use \Graphpinator\Typesystem\Utils\THasDirectives; use \Graphpinator\Typesystem\Utils\TDeprecatable; diff --git a/src/Typesystem/Container.php b/src/Typesystem/Container.php index d7277f884..f6b7792e4 100644 --- a/src/Typesystem/Container.php +++ b/src/Typesystem/Container.php @@ -9,8 +9,6 @@ */ abstract class Container { - use \Nette\SmartObject; - protected static array $builtInTypes = []; protected static array $builtInDirectives = []; diff --git a/src/Typesystem/Contract/NamedType.php b/src/Typesystem/Contract/NamedType.php index 8b2a8417e..4140d3677 100644 --- a/src/Typesystem/Contract/NamedType.php +++ b/src/Typesystem/Contract/NamedType.php @@ -9,7 +9,6 @@ abstract class NamedType implements Type, Entity { - use \Nette\SmartObject; use \Graphpinator\Typesystem\Utils\THasDescription; protected const NAME = ''; diff --git a/src/Typesystem/Directive.php b/src/Typesystem/Directive.php index 85538b12d..fd444d7d7 100644 --- a/src/Typesystem/Directive.php +++ b/src/Typesystem/Directive.php @@ -5,12 +5,11 @@ namespace Graphpinator\Typesystem; use \Graphpinator\Typesystem\Argument\ArgumentSet; -use \Graphpinator\Typesystem\Location\TypeSystemDirectiveLocation; use \Graphpinator\Typesystem\Location\ExecutableDirectiveLocation; +use \Graphpinator\Typesystem\Location\TypeSystemDirectiveLocation; abstract class Directive implements \Graphpinator\Typesystem\Contract\Directive { - use \Nette\SmartObject; use \Graphpinator\Typesystem\Utils\THasDescription; protected const NAME = ''; @@ -21,30 +20,30 @@ abstract class Directive implements \Graphpinator\Typesystem\Contract\Directive TypeSystemDirectiveLocation::SCHEMA, ], \Graphpinator\Typesystem\Location\ObjectLocation::class => [ - TypesystemDirectiveLocation::OBJECT, - TypesystemDirectiveLocation::INTERFACE, + TypeSystemDirectiveLocation::OBJECT, + TypeSystemDirectiveLocation::INTERFACE, ], \Graphpinator\Typesystem\Location\InputObjectLocation::class => [ - TypesystemDirectiveLocation::INPUT_OBJECT, + TypeSystemDirectiveLocation::INPUT_OBJECT, ], \Graphpinator\Typesystem\Location\UnionLocation::class => [ - TypesystemDirectiveLocation::UNION, + TypeSystemDirectiveLocation::UNION, ], \Graphpinator\Typesystem\Location\EnumLocation::class => [ - TypesystemDirectiveLocation::ENUM, + TypeSystemDirectiveLocation::ENUM, ], \Graphpinator\Typesystem\Location\ScalarLocation::class => [ - TypesystemDirectiveLocation::SCALAR, + TypeSystemDirectiveLocation::SCALAR, ], \Graphpinator\Typesystem\Location\ArgumentDefinitionLocation::class => [ - TypesystemDirectiveLocation::ARGUMENT_DEFINITION, - TypesystemDirectiveLocation::INPUT_FIELD_DEFINITION, + TypeSystemDirectiveLocation::ARGUMENT_DEFINITION, + TypeSystemDirectiveLocation::INPUT_FIELD_DEFINITION, ], \Graphpinator\Typesystem\Location\FieldDefinitionLocation::class => [ - TypesystemDirectiveLocation::FIELD_DEFINITION, + TypeSystemDirectiveLocation::FIELD_DEFINITION, ], \Graphpinator\Typesystem\Location\EnumItemLocation::class => [ - TypesystemDirectiveLocation::ENUM_VALUE, + TypeSystemDirectiveLocation::ENUM_VALUE, ], // Executable \Graphpinator\Typesystem\Location\QueryLocation::class => [ @@ -81,7 +80,7 @@ final public function getName() : string } /** - * @return array + * @return array<(\Graphpinator\Typesystem\Location\ExecutableDirectiveLocation|\Graphpinator\Typesystem\Location\TypeSystemDirectiveLocation)> */ final public function getLocations() : array { diff --git a/src/Typesystem/DirectiveUsage/DirectiveUsage.php b/src/Typesystem/DirectiveUsage/DirectiveUsage.php index 95c2db252..e7bab66b9 100644 --- a/src/Typesystem/DirectiveUsage/DirectiveUsage.php +++ b/src/Typesystem/DirectiveUsage/DirectiveUsage.php @@ -8,8 +8,6 @@ final class DirectiveUsage implements \Graphpinator\Typesystem\Contract\Component { - use \Nette\SmartObject; - private ArgumentValueSet $argumentValues; public function __construct( diff --git a/src/Typesystem/EnumItem/EnumItem.php b/src/Typesystem/EnumItem/EnumItem.php index 398d7a88d..ccd7ce022 100644 --- a/src/Typesystem/EnumItem/EnumItem.php +++ b/src/Typesystem/EnumItem/EnumItem.php @@ -6,7 +6,6 @@ final class EnumItem implements \Graphpinator\Typesystem\Contract\Component { - use \Nette\SmartObject; use \Graphpinator\Typesystem\Utils\TOptionalDescription; use \Graphpinator\Typesystem\Utils\THasDirectives; use \Graphpinator\Typesystem\Utils\TDeprecatable; diff --git a/src/Typesystem/Exception/ArgumentDirectiveNotContravariant.php b/src/Typesystem/Exception/ArgumentDirectiveNotContravariant.php index 07ec62291..ce9190e5b 100644 --- a/src/Typesystem/Exception/ArgumentDirectiveNotContravariant.php +++ b/src/Typesystem/Exception/ArgumentDirectiveNotContravariant.php @@ -10,8 +10,6 @@ final class ArgumentDirectiveNotContravariant extends \Graphpinator\Typesystem\E public function __construct(string $childName, string $interfaceName, string $fieldName, string $argumentName, string $message) { - $this->messageArgs = [$childName, $interfaceName, $argumentName, $fieldName, $message]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $argumentName, $fieldName, $message]); } } diff --git a/src/Typesystem/Exception/EnumItemInvalid.php b/src/Typesystem/Exception/EnumItemInvalid.php index 2f2acfb10..ce310ab71 100644 --- a/src/Typesystem/Exception/EnumItemInvalid.php +++ b/src/Typesystem/Exception/EnumItemInvalid.php @@ -10,8 +10,6 @@ final class EnumItemInvalid extends \Graphpinator\Typesystem\Exception\TypeError public function __construct(string $enumItem) { - $this->messageArgs = [$enumItem]; - - parent::__construct(); + parent::__construct([$enumItem]); } } diff --git a/src/Typesystem/Exception/FieldDirectiveNotCovariant.php b/src/Typesystem/Exception/FieldDirectiveNotCovariant.php index 0992e70f6..308884c50 100644 --- a/src/Typesystem/Exception/FieldDirectiveNotCovariant.php +++ b/src/Typesystem/Exception/FieldDirectiveNotCovariant.php @@ -10,8 +10,6 @@ final class FieldDirectiveNotCovariant extends \Graphpinator\Typesystem\Exceptio public function __construct(string $childName, string $interfaceName, string $fieldName, string $message) { - $this->messageArgs = [$childName, $interfaceName, $fieldName, $message]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $fieldName, $message]); } } diff --git a/src/Typesystem/Exception/InputCycle.php b/src/Typesystem/Exception/InputCycle.php index 71e547b27..c832bbb53 100644 --- a/src/Typesystem/Exception/InputCycle.php +++ b/src/Typesystem/Exception/InputCycle.php @@ -10,8 +10,6 @@ final class InputCycle extends \Graphpinator\Typesystem\Exception\TypeError public function __construct(array $inputCycle) { - $this->messageArgs = [\implode(' -> ', $inputCycle)]; - - parent::__construct(); + parent::__construct([\implode(' -> ', $inputCycle)]); } } diff --git a/src/Typesystem/Exception/InterfaceContractArgumentTypeMismatch.php b/src/Typesystem/Exception/InterfaceContractArgumentTypeMismatch.php index 899c48c30..1272ea45b 100644 --- a/src/Typesystem/Exception/InterfaceContractArgumentTypeMismatch.php +++ b/src/Typesystem/Exception/InterfaceContractArgumentTypeMismatch.php @@ -10,8 +10,6 @@ final class InterfaceContractArgumentTypeMismatch extends \Graphpinator\Typesyst public function __construct(string $childName, string $interfaceName, string $fieldName, string $argumentName) { - $this->messageArgs = [$childName, $interfaceName, $argumentName, $fieldName]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $argumentName, $fieldName]); } } diff --git a/src/Typesystem/Exception/InterfaceContractFieldTypeMismatch.php b/src/Typesystem/Exception/InterfaceContractFieldTypeMismatch.php index 3c0d74418..6936d89f7 100644 --- a/src/Typesystem/Exception/InterfaceContractFieldTypeMismatch.php +++ b/src/Typesystem/Exception/InterfaceContractFieldTypeMismatch.php @@ -10,8 +10,6 @@ final class InterfaceContractFieldTypeMismatch extends \Graphpinator\Typesystem\ public function __construct(string $childName, string $interfaceName, string $fieldName) { - $this->messageArgs = [$childName, $interfaceName, $fieldName]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $fieldName]); } } diff --git a/src/Typesystem/Exception/InterfaceContractMissingArgument.php b/src/Typesystem/Exception/InterfaceContractMissingArgument.php index 0314850e1..e6000dee3 100644 --- a/src/Typesystem/Exception/InterfaceContractMissingArgument.php +++ b/src/Typesystem/Exception/InterfaceContractMissingArgument.php @@ -10,8 +10,6 @@ final class InterfaceContractMissingArgument extends \Graphpinator\Typesystem\Ex public function __construct(string $childName, string $interfaceName, string $fieldName, string $argumentName) { - $this->messageArgs = [$childName, $interfaceName, $argumentName, $fieldName]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $argumentName, $fieldName]); } } diff --git a/src/Typesystem/Exception/InterfaceContractMissingField.php b/src/Typesystem/Exception/InterfaceContractMissingField.php index ce2cfbb63..e551ecb39 100644 --- a/src/Typesystem/Exception/InterfaceContractMissingField.php +++ b/src/Typesystem/Exception/InterfaceContractMissingField.php @@ -10,8 +10,6 @@ final class InterfaceContractMissingField extends \Graphpinator\Typesystem\Excep public function __construct(string $childName, string $interfaceName, string $fieldName) { - $this->messageArgs = [$childName, $interfaceName, $fieldName]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $fieldName]); } } diff --git a/src/Typesystem/Exception/InterfaceContractNewArgumentWithoutDefault.php b/src/Typesystem/Exception/InterfaceContractNewArgumentWithoutDefault.php index ac9b090d9..3f3e3aa05 100644 --- a/src/Typesystem/Exception/InterfaceContractNewArgumentWithoutDefault.php +++ b/src/Typesystem/Exception/InterfaceContractNewArgumentWithoutDefault.php @@ -10,8 +10,6 @@ final class InterfaceContractNewArgumentWithoutDefault extends \Graphpinator\Typ public function __construct(string $childName, string $interfaceName, string $fieldName, string $argumentName) { - $this->messageArgs = [$childName, $interfaceName, $argumentName, $fieldName]; - - parent::__construct(); + parent::__construct([$childName, $interfaceName, $argumentName, $fieldName]); } } diff --git a/src/Typesystem/Exception/InterfaceCycle.php b/src/Typesystem/Exception/InterfaceCycle.php index 90de1616c..bcb283864 100644 --- a/src/Typesystem/Exception/InterfaceCycle.php +++ b/src/Typesystem/Exception/InterfaceCycle.php @@ -10,8 +10,6 @@ final class InterfaceCycle extends \Graphpinator\Typesystem\Exception\TypeError public function __construct(array $interfaceCycle) { - $this->messageArgs = [\implode(' -> ', $interfaceCycle)]; - - parent::__construct(); + parent::__construct([\implode(' -> ', $interfaceCycle)]); } } diff --git a/src/Typesystem/Field/Field.php b/src/Typesystem/Field/Field.php index 5bd945621..7b48762b5 100644 --- a/src/Typesystem/Field/Field.php +++ b/src/Typesystem/Field/Field.php @@ -9,7 +9,6 @@ class Field implements \Graphpinator\Typesystem\Contract\Component { - use \Nette\SmartObject; use \Graphpinator\Typesystem\Utils\TOptionalDescription; use \Graphpinator\Typesystem\Utils\THasDirectives; use \Graphpinator\Typesystem\Utils\TDeprecatable; diff --git a/src/Typesystem/Schema.php b/src/Typesystem/Schema.php index a10727c7d..bee50b8dd 100644 --- a/src/Typesystem/Schema.php +++ b/src/Typesystem/Schema.php @@ -6,7 +6,6 @@ class Schema implements \Graphpinator\Typesystem\Contract\Entity { - use \Nette\SmartObject; use \Graphpinator\Typesystem\Utils\TOptionalDescription; use \Graphpinator\Typesystem\Utils\THasDirectives; diff --git a/src/Value/ArgumentValue.php b/src/Value/ArgumentValue.php index cd1a56bee..844a3c8ff 100644 --- a/src/Value/ArgumentValue.php +++ b/src/Value/ArgumentValue.php @@ -6,8 +6,6 @@ final class ArgumentValue { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Argument\Argument $argument, private \Graphpinator\Value\InputedValue $value, diff --git a/src/Value/ConvertParserValueVisitor.php b/src/Value/ConvertParserValueVisitor.php index 753193b61..091c6d164 100644 --- a/src/Value/ConvertParserValueVisitor.php +++ b/src/Value/ConvertParserValueVisitor.php @@ -6,8 +6,6 @@ final class ConvertParserValueVisitor implements \Graphpinator\Parser\Value\ValueVisitor { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Contract\Inputable $type, private ?\Graphpinator\Normalizer\Variable\VariableSet $variableSet, diff --git a/src/Value/ConvertRawValueVisitor.php b/src/Value/ConvertRawValueVisitor.php index b25584107..a1b8fca4f 100644 --- a/src/Value/ConvertRawValueVisitor.php +++ b/src/Value/ConvertRawValueVisitor.php @@ -4,12 +4,8 @@ namespace Graphpinator\Value; -use \Nette\InvalidStateException; - final class ConvertRawValueVisitor implements \Graphpinator\Typesystem\Contract\TypeVisitor { - use \Nette\SmartObject; - public function __construct( private mixed $rawValue, private \Graphpinator\Common\Path $path, @@ -72,17 +68,17 @@ public static function convertArgumentSet( public function visitType(\Graphpinator\Typesystem\Type $type) : mixed { - throw new InvalidStateException(); + throw new \LogicException(); } public function visitInterface(\Graphpinator\Typesystem\InterfaceType $interface) : mixed { - throw new InvalidStateException(); + throw new \LogicException(); } public function visitUnion(\Graphpinator\Typesystem\UnionType $union) : mixed { - throw new InvalidStateException(); + throw new \LogicException(); } public function visitInput(\Graphpinator\Typesystem\InputType $input) : InputedValue diff --git a/src/Value/FieldValue.php b/src/Value/FieldValue.php index 73fd10b16..21390e7cf 100644 --- a/src/Value/FieldValue.php +++ b/src/Value/FieldValue.php @@ -6,8 +6,6 @@ final class FieldValue implements \JsonSerializable { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Field\Field $field, private \Graphpinator\Value\ResolvedValue $value, diff --git a/src/Value/InputValue.php b/src/Value/InputValue.php index ff7f35840..9edb85745 100644 --- a/src/Value/InputValue.php +++ b/src/Value/InputValue.php @@ -6,8 +6,6 @@ final class InputValue implements \Graphpinator\Value\InputedValue, \IteratorAggregate { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\InputType $type, private \stdClass $value, diff --git a/src/Value/LeafValue.php b/src/Value/LeafValue.php index 3129a9b55..46a39b4d6 100644 --- a/src/Value/LeafValue.php +++ b/src/Value/LeafValue.php @@ -6,8 +6,6 @@ abstract class LeafValue implements \Graphpinator\Value\InputedValue, \Graphpinator\Value\OutputValue { - use \Nette\SmartObject; - public function __construct( protected \Graphpinator\Typesystem\Contract\LeafType $type, protected mixed $rawValue, diff --git a/src/Value/ListIntermediateValue.php b/src/Value/ListIntermediateValue.php index 9004af444..9d6eb2e5a 100644 --- a/src/Value/ListIntermediateValue.php +++ b/src/Value/ListIntermediateValue.php @@ -6,8 +6,6 @@ final class ListIntermediateValue implements \Graphpinator\Value\ResolvedValue { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\ListType $type, private iterable $rawValue, diff --git a/src/Value/ListValue.php b/src/Value/ListValue.php index ca759cb78..21c73b3aa 100644 --- a/src/Value/ListValue.php +++ b/src/Value/ListValue.php @@ -6,8 +6,6 @@ abstract class ListValue implements \Graphpinator\Value\Value, \IteratorAggregate, \ArrayAccess, \Countable { - use \Nette\SmartObject; - public function __construct( protected \Graphpinator\Typesystem\ListType $type, protected array $value, diff --git a/src/Value/NullInputedValue.php b/src/Value/NullInputedValue.php index cfe7c83bf..a3fa35765 100644 --- a/src/Value/NullInputedValue.php +++ b/src/Value/NullInputedValue.php @@ -6,8 +6,6 @@ final class NullInputedValue implements \Graphpinator\Value\InputedValue, \Graphpinator\Value\NullValue { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Contract\Inputable $type, ) diff --git a/src/Value/NullResolvedValue.php b/src/Value/NullResolvedValue.php index 2e1f9dd7e..ddf15db92 100644 --- a/src/Value/NullResolvedValue.php +++ b/src/Value/NullResolvedValue.php @@ -6,8 +6,6 @@ final class NullResolvedValue implements \Graphpinator\Value\OutputValue, \Graphpinator\Value\NullValue { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Contract\Outputable $type, ) diff --git a/src/Value/TypeIntermediateValue.php b/src/Value/TypeIntermediateValue.php index 0c4cb724d..67ab03921 100644 --- a/src/Value/TypeIntermediateValue.php +++ b/src/Value/TypeIntermediateValue.php @@ -6,8 +6,6 @@ final class TypeIntermediateValue implements \Graphpinator\Value\ResolvedValue { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Type $type, private mixed $rawValue, diff --git a/src/Value/TypeValue.php b/src/Value/TypeValue.php index fdfee1546..38a107fea 100644 --- a/src/Value/TypeValue.php +++ b/src/Value/TypeValue.php @@ -6,8 +6,6 @@ final class TypeValue implements \Graphpinator\Value\OutputValue { - use \Nette\SmartObject; - public function __construct( private \Graphpinator\Typesystem\Type $type, private \stdClass $value, diff --git a/src/Value/VariableValue.php b/src/Value/VariableValue.php index 7eb74e72b..93a77e0bd 100644 --- a/src/Value/VariableValue.php +++ b/src/Value/VariableValue.php @@ -6,8 +6,6 @@ final class VariableValue implements \Graphpinator\Value\InputedValue { - use \Nette\SmartObject; - private ?\Graphpinator\Value\InputedValue $value = null; public function __construct( diff --git a/tests/Spec/TestSchema.php b/tests/Spec/TestSchema.php index ea23172c0..458e0c235 100644 --- a/tests/Spec/TestSchema.php +++ b/tests/Spec/TestSchema.php @@ -8,8 +8,6 @@ final class TestSchema { - use \Nette\StaticClass; - private static array $types = []; private static ?\Graphpinator\Typesystem\Container $container = null; diff --git a/tests/Unit/Normalizer/NormalizerTest.php b/tests/Unit/Normalizer/NormalizerTest.php index 912037d06..941404776 100644 --- a/tests/Unit/Normalizer/NormalizerTest.php +++ b/tests/Unit/Normalizer/NormalizerTest.php @@ -11,7 +11,7 @@ public function testVariableTypeReferences() : void $parseResult = new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::QUERY, + \Graphpinator\Tokenizer\TokenType::QUERY->value, 'operationName', new \Graphpinator\Parser\Variable\VariableSet([ new \Graphpinator\Parser\Variable\Variable( @@ -56,7 +56,7 @@ public function testDirectiveReferences() : void $parseResult = new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::QUERY, + \Graphpinator\Tokenizer\TokenType::QUERY->value, 'operationName', null, null, @@ -163,7 +163,7 @@ public static function invalidDataProvider() : array new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::MUTATION, + \Graphpinator\Tokenizer\TokenType::MUTATION->value, null, null, null, @@ -178,7 +178,7 @@ public static function invalidDataProvider() : array new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::SUBSCRIPTION, + \Graphpinator\Tokenizer\TokenType::SUBSCRIPTION->value, null, null, null, @@ -193,7 +193,7 @@ public static function invalidDataProvider() : array new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::QUERY, + \Graphpinator\Tokenizer\TokenType::QUERY->value, null, null, null, @@ -210,7 +210,7 @@ public static function invalidDataProvider() : array new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::QUERY, + \Graphpinator\Tokenizer\TokenType::QUERY->value, null, null, null, @@ -266,7 +266,7 @@ public static function invalidDataProvider() : array new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::QUERY, + \Graphpinator\Tokenizer\TokenType::QUERY->value, null, null, null, @@ -306,7 +306,7 @@ public static function invalidDataProvider() : array new \Graphpinator\Parser\ParsedRequest( new \Graphpinator\Parser\Operation\OperationSet([ new \Graphpinator\Parser\Operation\Operation( - \Graphpinator\Tokenizer\OperationType::QUERY, + \Graphpinator\Tokenizer\TokenType::QUERY->value, null, null, null,