diff --git a/composer.json b/composer.json index 2d1ddac..7785b33 100644 --- a/composer.json +++ b/composer.json @@ -28,11 +28,11 @@ "ringcentral/psr7": "^1.3", "symfony/yaml": "^5.4", "wyrihaximus/composer-update-bin-autoload-path": "^1 || ^1.0.1", - "wyrihaximus/hydrator": "dev-master", "league/openapi-psr7-validator": "^0.16", "react/http": "^1.8", "reactivex/rxphp": "^2.0", - "api-clients/contracts": "dev-main" + "api-clients/contracts": "dev-main", + "eventsauce/object-hydrator": "^1.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 4638340..f4cb4f6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2dd809e4acc0eaa541e513dcd3f7550c", + "content-hash": "509fa4fc49313811feb0caf000d961ff", "packages": [ { "name": "api-clients/contracts", @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/php-api-clients/contracts.git", - "reference": "8da5e2581c5ca36c9d04e3d85d82fc65bc0112f9" + "reference": "96729b2eb5f1c79b470de21bf4ec278c957d6260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-api-clients/contracts/zipball/8da5e2581c5ca36c9d04e3d85d82fc65bc0112f9", - "reference": "8da5e2581c5ca36c9d04e3d85d82fc65bc0112f9", + "url": "https://api.github.com/repos/php-api-clients/contracts/zipball/96729b2eb5f1c79b470de21bf4ec278c957d6260", + "reference": "96729b2eb5f1c79b470de21bf4ec278c957d6260", "shasum": "" }, "require": { @@ -45,7 +45,7 @@ "issues": "https://github.com/php-api-clients/contracts/issues", "source": "https://github.com/php-api-clients/contracts/tree/main" }, - "time": "2023-01-12T21:32:54+00:00" + "time": "2023-01-29T13:53:21+00:00" }, { "name": "cebe/php-openapi", @@ -118,40 +118,29 @@ "time": "2022-02-09T13:37:56+00:00" }, { - "name": "doctrine/annotations", - "version": "1.14.2", + "name": "evenement/evenement", + "version": "v3.0.1", "source": { "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "ad785217c1e9555a7d6c6c8c9f406395a5e2882b" + "url": "https://github.com/igorw/evenement.git", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/ad785217c1e9555a7d6c6c8c9f406395a5e2882b", - "reference": "ad785217c1e9555a7d6c6c8c9f406395a5e2882b", + "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7", "shasum": "" }, "require": { - "doctrine/lexer": "^1 || ^2", - "ext-tokenizer": "*", - "php": "^7.1 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" + "php": ">=7.0" }, "require-dev": { - "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^4.4 || ^5.4 || ^6", - "vimeo/psalm": "^4.10" - }, - "suggest": { - "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" + "phpunit/phpunit": "^6.0" }, "type": "library", "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + "psr-0": { + "Evenement": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -160,111 +149,54 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" } ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", + "description": "Événement is a very simple event dispatching library for PHP", "keywords": [ - "annotations", - "docblock", - "parser" + "event-dispatcher", + "event-emitter" ], "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.14.2" + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/master" }, - "time": "2022-12-15T06:48:22+00:00" + "time": "2017-07-23T21:35:13+00:00" }, { - "name": "doctrine/deprecations", - "version": "v1.0.0", + "name": "eventsauce/object-hydrator", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + "url": "https://github.com/EventSaucePHP/ObjectHydrator.git", + "reference": "77683528dc3b96a4edfb8c864760748ae7fc0817" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "url": "https://api.github.com/repos/EventSaucePHP/ObjectHydrator/zipball/77683528dc3b96a4edfb8c864760748ae7fc0817", + "reference": "77683528dc3b96a4edfb8c864760748ae7fc0817", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "ext-fileinfo": "*", + "php": "^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" + "friendsofphp/php-cs-fixer": "^3.4", + "league/construct-finder": "^1.1", + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.7", + "phpunit/phpunit": "^9.5.11", + "ramsey/uuid": "^4.2" }, "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + "league/construct-finder": "Find all classes in a directory for the best dumped hydrators." }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" - }, - "time": "2022-05-02T15:47:09+00:00" - }, - { - "name": "doctrine/lexer", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Lexer\\": "src" + "EventSauce\\ObjectHydrator\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -273,93 +205,28 @@ ], "authors": [ { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" } ], - "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "description": "Converts structured data into strict objects.", "keywords": [ - "annotations", - "docblock", - "lexer", - "parser", - "php" + "construction", + "constructor", + "hydration", + "mapper" ], "support": { - "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.0" + "issues": "https://github.com/EventSaucePHP/ObjectHydrator/issues", + "source": "https://github.com/EventSaucePHP/ObjectHydrator/tree/1.1.0" }, "funding": [ { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", - "type": "tidelift" - } - ], - "time": "2022-12-14T08:49:07+00:00" - }, - { - "name": "evenement/evenement", - "version": "v3.0.1", - "source": { - "type": "git", - "url": "https://github.com/igorw/evenement.git", - "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7", - "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Evenement": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" + "url": "https://github.com/frankdejonge", + "type": "github" } ], - "description": "Événement is a very simple event dispatching library for PHP", - "keywords": [ - "event-dispatcher", - "event-emitter" - ], - "support": { - "issues": "https://github.com/igorw/evenement/issues", - "source": "https://github.com/igorw/evenement/tree/master" - }, - "time": "2017-07-23T21:35:13+00:00" + "time": "2022-12-29T20:17:25+00:00" }, { "name": "fig/http-message-util", @@ -554,142 +421,6 @@ }, "time": "2022-04-13T08:02:27+00:00" }, - { - "name": "laminas/laminas-hydrator", - "version": "4.12.0", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-hydrator.git", - "reference": "78fa8f8a29a2866b1fccdf1b0c260557b6bb595e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-hydrator/zipball/78fa8f8a29a2866b1fccdf1b0c260557b6bb595e", - "reference": "78fa8f8a29a2866b1fccdf1b0c260557b6bb595e", - "shasum": "" - }, - "require": { - "laminas/laminas-stdlib": "^3.3", - "php": "~8.0.0 || ~8.1.0 || ~8.2.0", - "webmozart/assert": "^1.10" - }, - "conflict": { - "laminas/laminas-servicemanager": "<3.14.0", - "zendframework/zend-hydrator": "*" - }, - "require-dev": { - "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-eventmanager": "^3.6", - "laminas/laminas-modulemanager": "^2.14.0", - "laminas/laminas-serializer": "^2.14.0", - "laminas/laminas-servicemanager": "^3.19", - "phpbench/phpbench": "^1.2.7", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^5.0" - }, - "suggest": { - "laminas/laminas-eventmanager": "^3.2, to support aggregate hydrator usage", - "laminas/laminas-serializer": "^2.9, to use the SerializableStrategy", - "laminas/laminas-servicemanager": "^3.14, to support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "laminas": { - "component": "Laminas\\Hydrator", - "config-provider": "Laminas\\Hydrator\\ConfigProvider" - } - }, - "autoload": { - "psr-4": { - "Laminas\\Hydrator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Serialize objects to arrays, and vice versa", - "homepage": "https://laminas.dev", - "keywords": [ - "hydrator", - "laminas" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-hydrator/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-hydrator/issues", - "rss": "https://github.com/laminas/laminas-hydrator/releases.atom", - "source": "https://github.com/laminas/laminas-hydrator" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2022-12-21T04:00:01+00:00" - }, - { - "name": "laminas/laminas-stdlib", - "version": "3.16.1", - "source": { - "type": "git", - "url": "https://github.com/laminas/laminas-stdlib.git", - "reference": "f4f773641807c7ccee59b758bfe4ac4ba33ecb17" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-stdlib/zipball/f4f773641807c7ccee59b758bfe4ac4ba33ecb17", - "reference": "f4f773641807c7ccee59b758bfe4ac4ba33ecb17", - "shasum": "" - }, - "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0" - }, - "conflict": { - "zendframework/zend-stdlib": "*" - }, - "require-dev": { - "laminas/laminas-coding-standard": "^2.4.0", - "phpbench/phpbench": "^1.2.7", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^5.0.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Laminas\\Stdlib\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "SPL extensions, array utilities, error handlers, and more", - "homepage": "https://laminas.dev", - "keywords": [ - "laminas", - "stdlib" - ], - "support": { - "chat": "https://laminas.dev/chat", - "docs": "https://docs.laminas.dev/laminas-stdlib/", - "forum": "https://discourse.laminas.dev", - "issues": "https://github.com/laminas/laminas-stdlib/issues", - "rss": "https://github.com/laminas/laminas-stdlib/releases.atom", - "source": "https://github.com/laminas/laminas-stdlib" - }, - "funding": [ - { - "url": "https://funding.communitybridge.org/projects/laminas-project", - "type": "community_bridge" - } - ], - "time": "2022-12-03T18:48:01+00:00" - }, { "name": "league/openapi-psr7-validator", "version": "0.16.4", @@ -924,16 +655,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -974,147 +705,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" - }, - "time": "2022-11-12T15:38:23+00:00" - }, - { - "name": "ocramius/code-generator-utils", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/CodeGenerationUtils.git", - "reference": "6c12bc604278932a82138e37aa699ba57a476735" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/CodeGenerationUtils/zipball/6c12bc604278932a82138e37aa699ba57a476735", - "reference": "6c12bc604278932a82138e37aa699ba57a476735", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.15.2", - "php": "~8.1.0 || ~8.2.0" - }, - "require-dev": { - "doctrine/coding-standard": "^10.0.0", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.3", - "roave/infection-static-analysis-plugin": "^1.26.0", - "vimeo/psalm": "^5.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "CodeGenerationUtils\\": "src/CodeGenerationUtils" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A set of code generator utilities built on top of PHP-Parsers that ease its use when combined with Reflection", - "homepage": "https://github.com/Ocramius/CodeGenerationUtils", - "keywords": [ - "code generation", - "compiler", - "parser", - "php code", - "reflection" - ], - "support": { - "issues": "https://github.com/Ocramius/CodeGenerationUtils/issues", - "source": "https://github.com/Ocramius/CodeGenerationUtils/tree/1.6.0" - }, - "funding": [ - { - "url": "https://github.com/Ocramius", - "type": "github" - } - ], - "time": "2022-12-01T14:52:22+00:00" - }, - { - "name": "ocramius/generated-hydrator", - "version": "4.5.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/GeneratedHydrator.git", - "reference": "9537dff80a2c0d99eee4d45dacf4cb5ddf30f82a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/GeneratedHydrator/zipball/9537dff80a2c0d99eee4d45dacf4cb5ddf30f82a", - "reference": "9537dff80a2c0d99eee4d45dacf4cb5ddf30f82a", - "shasum": "" - }, - "require": { - "laminas/laminas-hydrator": "^4.8.0", - "nikic/php-parser": "^4.15.2", - "ocramius/code-generator-utils": "^1.6.0", - "php": "~8.1.0 || ~8.2.0" - }, - "require-dev": { - "doctrine/coding-standard": "^10.0.0", - "phpbench/phpbench": "^1.2.7", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.3", - "roave/infection-static-analysis-plugin": "^1.26.0", - "vimeo/psalm": "^5.0.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "GeneratedHydrator\\": "src/GeneratedHydrator" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "An Object Hydrator that allows very fast array to object to array conversion", - "homepage": "https://github.com/Ocramius/GeneratedHydrator", - "keywords": [ - "array conversion", - "hydrator", - "object conversion", - "performance", - "serializer" - ], - "support": { - "issues": "https://github.com/Ocramius/GeneratedHydrator/issues", - "source": "https://github.com/Ocramius/GeneratedHydrator/tree/4.5.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "funding": [ - { - "url": "https://github.com/Ocramius", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ocramius/generated-hydrator", - "type": "tidelift" - } - ], - "time": "2022-12-01T16:00:51+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "psr/cache", @@ -2609,16 +2202,16 @@ }, { "name": "symfony/yaml", - "version": "v5.4.17", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "edcdc11498108f8967fe95118a7ec8624b94760e" + "reference": "71c05db20cb9b54d381a28255f17580e2b7e36a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/edcdc11498108f8967fe95118a7ec8624b94760e", - "reference": "edcdc11498108f8967fe95118a7ec8624b94760e", + "url": "https://api.github.com/repos/symfony/yaml/zipball/71c05db20cb9b54d381a28255f17580e2b7e36a5", + "reference": "71c05db20cb9b54d381a28255f17580e2b7e36a5", "shasum": "" }, "require": { @@ -2664,7 +2257,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.17" + "source": "https://github.com/symfony/yaml/tree/v5.4.19" }, "funding": [ { @@ -2680,7 +2273,7 @@ "type": "tidelift" } ], - "time": "2022-12-13T09:57:04+00:00" + "time": "2023-01-10T18:51:14+00:00" }, { "name": "twig/twig", @@ -2865,59 +2458,6 @@ } ], "time": "2021-03-14T20:55:38+00:00" - }, - { - "name": "wyrihaximus/hydrator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/WyriHaximus/php-hydrator.git", - "reference": "9548bf4685e4b44504af0890262390d775e66063" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WyriHaximus/php-hydrator/zipball/9548bf4685e4b44504af0890262390d775e66063", - "reference": "9548bf4685e4b44504af0890262390d775e66063", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.12", - "ocramius/generated-hydrator": "^4.0", - "php": "^8 || ^7.4" - }, - "require-dev": { - "wyrihaximus/test-utilities": "^3.7" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "WyriHaximus\\Hydrator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Cees-Jan Kiewiet", - "email": "ceesjank@gmail.com", - "homepage": "https://www.wyrihaximus.net/" - } - ], - "description": "Middleware infused hydrator", - "support": { - "issues": "https://github.com/WyriHaximus/php-hydrator/issues", - "source": "https://github.com/WyriHaximus/php-hydrator/tree/master" - }, - "funding": [ - { - "url": "https://github.com/WyriHaximus", - "type": "github" - } - ], - "time": "2022-08-07T12:37:28+00:00" } ], "packages-dev": [], @@ -2932,7 +2472,6 @@ "minimum-stability": "stable", "stability-flags": { "cebe/php-openapi": 20, - "wyrihaximus/hydrator": 20, "api-clients/contracts": 20 }, "prefer-stable": false, diff --git a/src/File.php b/src/File.php index e25da53..26ef914 100644 --- a/src/File.php +++ b/src/File.php @@ -13,22 +13,9 @@ final class File { - private string $fqcn; - private Node $contents; - - public function __construct(string $path, Node $contents) - { - $this->fqcn = $path; - $this->contents = $contents; - } - - public function fqcn(): string - { - return $this->fqcn; - } - - public function contents(): Node - { - return $this->contents; + public function __construct( + public readonly string $fqcn, + public readonly Node|string $contents, + ){ } } diff --git a/src/Generator.php b/src/Generator.php index 0244924..36d378a 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -13,7 +13,10 @@ use ApiClients\Tools\OpenApiClientGenerator\Generator\WebHooks; use cebe\openapi\Reader; use cebe\openapi\spec\OpenApi; +use EventSauce\ObjectHydrator\ObjectMapperCodeGenerator; use Jawira\CaseConverter\Convert; +use League\ConstructFinder\ConstructFinder; +use PhpParser\Node; use PhpParser\PrettyPrinter\Standard; final class Generator @@ -31,16 +34,17 @@ public function generate(string $namespace, string $destinationPath) $namespace = self::cleanUpNamespace($namespace); $codePrinter = new Standard(); - foreach ($this->all($namespace) as $file) { - $fileName = $destinationPath . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, substr($file->fqcn(), strlen($namespace))); + foreach ($this->all($namespace, $destinationPath . DIRECTORY_SEPARATOR) as $file) { + $fileName = $destinationPath . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, substr($file->fqcn, strlen($namespace))); @mkdir(dirname($fileName), 0744, true); - file_put_contents($fileName . '.php', $codePrinter->prettyPrintFile([$file->contents()]) . PHP_EOL); + file_put_contents($fileName . '.php', ($file->contents instanceof Node ? $codePrinter->prettyPrintFile([$file->contents]) : $file->contents) . PHP_EOL); + include_once $fileName . '.php'; } } public static function className(string $className): string { - return str_replace(['{', '}', '-', '$', '_', '+'], ['Cb', 'Rcb', 'Dash', '_', '\\', 'Plus'], (new Convert($className))->toPascal()) . (self::isKeyword(self::basename($className)) ? '_' : ''); + return str_replace(['{', '}', '-', '$', '_', '+', '*', '.'], ['Cb', 'Rcb', 'Dash', '_', '\\', 'Plus', 'Obelix', 'Dot'], (new Convert($className))->toPascal()) . (self::isKeyword(self::basename($className)) ? '_' : ''); } private static function cleanUpNamespace(string $namespace): string @@ -56,8 +60,9 @@ private static function cleanUpNamespace(string $namespace): string * @param string $destinationPath * @return iterable */ - private function all(string $namespace): iterable + private function all(string $namespace, string $rootPath): iterable { + $schemaClasses = []; $schemaRegistry = new SchemaRegistry(); if (count($this->spec->components->schemas ?? []) > 0) { foreach ($this->spec->components->schemas as $name => $schema) { @@ -73,6 +78,7 @@ private function all(string $namespace): iterable continue; } + $schemaClasses[] = $namespace . 'Schema/' . $schemaClassName; yield from Schema::generate( $name, self::dirname($namespace . 'Schema/' . $schemaClassName), @@ -134,6 +140,7 @@ private function all(string $namespace): iterable yield from Clients::generate( $operationGroup, self::dirname($namespace . 'Operation/' . $operationGroup), + $namespace, self::basename($namespace . 'Operation/' . $operationGroup), $operations, ); @@ -166,10 +173,6 @@ private function all(string $namespace): iterable ); } - yield from WebHookInterface::generate( - self::dirname($namespace . 'WebHookInterface'), - 'WebHookInterface', - ); yield from WebHooks::generate( self::dirname($namespace . 'WebHooks'), $namespace, @@ -179,6 +182,7 @@ private function all(string $namespace): iterable while ($schemaRegistry->hasUnknownSchemas()) { foreach ($schemaRegistry->unknownSchemas() as $schema) { + $schemaClasses[] = $namespace . 'Schema/' . $schema['className']; yield from Schema::generate( $schema['name'], self::dirname($namespace . 'Schema/' . $schema['className']), @@ -189,6 +193,14 @@ private function all(string $namespace): iterable ); } } + + yield new File( + $namespace . 'OptimizedHydratorMapper', + (new ObjectMapperCodeGenerator())->dump( + array_unique(array_filter(array_map(static fn (string $className): string => str_replace('/', '\\', $className), $schemaClasses), static fn (string $className): bool => count((new \ReflectionMethod($className, '__construct'))->getParameters()) > 0)), + $namespace . 'OptimizedHydratorMapper' + ) + ); } private static function fqcn(string $fqcn): string @@ -212,6 +224,6 @@ public static function basename(string $fqcn): string private static function isKeyword(string $name): bool { - return in_array(strtolower($name), array('__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor', 'self'), false); + return in_array(strtolower($name), array('__halt_compiler', 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor', 'self', 'parent', 'object'), false); } } diff --git a/src/Generator/Client.php b/src/Generator/Client.php index 7d57519..ae4775d 100644 --- a/src/Generator/Client.php +++ b/src/Generator/Client.php @@ -42,6 +42,8 @@ public static function generate(string $namespace, array $clients, SchemaRegistr $factory->property('requestSchemaValidator')->setType('\League\OpenAPIValidation\Schema\SchemaValidator')->makeReadonly()->makePrivate() )->addStmt( $factory->property('responseSchemaValidator')->setType('\League\OpenAPIValidation\Schema\SchemaValidator')->makeReadonly()->makePrivate() + )->addStmt( + $factory->property('hydrator')->setType('\\' . $namespace . 'OptimizedHydratorMapper')->makeReadonly()->makePrivate() )->addStmt( $factory->method('__construct')->makePublic()->addParam( (new Param('authentication'))->setType('\\' . AuthenticationInterface::class) @@ -98,6 +100,18 @@ public static function generate(string $namespace, array $clients, SchemaRegistr ] ), ) + )->addStmt( + new Node\Expr\Assign( + new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'hydrator' + ), + new Node\Expr\New_( + new Node\Name('\\' . $namespace . 'OptimizedHydratorMapper'), + [ + ] + ), + ) ) ); @@ -149,6 +163,10 @@ public static function generate(string $namespace, array $clients, SchemaRegistr new Node\Expr\Variable('this'), 'responseSchemaValidator' )), + new Node\Arg(new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'hydrator' + )), ] ) ) diff --git a/src/Generator/Clients.php b/src/Generator/Clients.php index fd0b397..a0d225b 100644 --- a/src/Generator/Clients.php +++ b/src/Generator/Clients.php @@ -17,7 +17,7 @@ final class Clients * @param array $operations * @return iterable */ - public static function generate(string $operationGroup, string $namespace, string $className, array $operations): iterable + public static function generate(string $operationGroup, string $namespace, string $rootNamespace, string $className, array $operations): iterable { $factory = new BuilderFactory(); $stmt = $factory->namespace($namespace); @@ -26,6 +26,8 @@ public static function generate(string $operationGroup, string $namespace, strin $factory->property('requestSchemaValidator')->setType('\League\OpenAPIValidation\Schema\SchemaValidator')->makeReadonly()->makePrivate() )->addStmt( $factory->property('responseSchemaValidator')->setType('\League\OpenAPIValidation\Schema\SchemaValidator')->makeReadonly()->makePrivate() + )->addStmt( + $factory->property('hydrator')->setType('\\' . $rootNamespace . 'OptimizedHydratorMapper')->makeReadonly()->makePrivate() )->addStmt( $factory->method('__construct')->makePublic()->addParam( (new Param('requestSchemaValidator'))->setType('\League\OpenAPIValidation\Schema\SchemaValidator') @@ -47,6 +49,16 @@ public static function generate(string $operationGroup, string $namespace, strin ), new Node\Expr\Variable('responseSchemaValidator'), ) + )->addParam( + (new Param('hydrator'))->setType('\\' . $rootNamespace . 'OptimizedHydratorMapper') + )->addStmt( + new Node\Expr\Assign( + new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'hydrator' + ), + new Node\Expr\Variable('hydrator'), + ) ) ); @@ -60,6 +72,10 @@ public static function generate(string $operationGroup, string $namespace, strin new Node\Expr\Variable('this'), 'responseSchemaValidator' ); + $params[] = new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'hydrator' + ); $cn = str_replace('/', '\\', '\\' . $namespace . '\\' . $operationDetails['class']); $method = $factory->method(lcfirst($operationOperation))->setReturnType($cn)->makePublic(); foreach ($operationDetails['operation']->parameters as $parameter) { diff --git a/src/Generator/Operation.php b/src/Generator/Operation.php index 9002f9f..276325a 100644 --- a/src/Generator/Operation.php +++ b/src/Generator/Operation.php @@ -72,6 +72,8 @@ public static function generate(string $path, string $method, string $namespace, $factory->property('requestSchemaValidator')->setType('\League\OpenAPIValidation\Schema\SchemaValidator')->makeReadonly()->makePrivate() )->addStmt( $factory->property('responseSchemaValidator')->setType('\League\OpenAPIValidation\Schema\SchemaValidator')->makeReadonly()->makePrivate() + )->addStmt( + $factory->property('hydrator')->setType('\\' . $rootNamespace . 'OptimizedHydratorMapper')->makeReadonly()->makePrivate() ); $constructor = $factory->method('__construct')->makePublic()->addParam( @@ -94,6 +96,16 @@ public static function generate(string $path, string $method, string $namespace, ), new Node\Expr\Variable('responseSchemaValidator'), ) + )->addParam( + (new Param('hydrator'))->setType('\\' . $rootNamespace . 'OptimizedHydratorMapper') + )->addStmt( + new Node\Expr\Assign( + new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'hydrator' + ), + new Node\Expr\Variable('hydrator'), + ) ); $requestReplaces = []; $query = []; @@ -113,7 +125,7 @@ public static function generate(string $path, string $method, string $namespace, 'bool', ], implode('|', is_array($parameter->schema->type) ? $parameter->schema->type : [$parameter->schema->type]))); } - $class->addStmt($paramterStmt->makeReadonly()->makePrivate()); + $class->addStmt($paramterStmt->makePrivate()); $param = new Param($parameter->name); if ($parameter->schema->type !== null) { @@ -225,8 +237,11 @@ public static function generate(string $path, string $method, string $namespace, $returnType[] = ($contentTypeSchema->schema->type === 'array' ? '\\' . Observable::class . '<' : '') . $object . ($contentTypeSchema->schema->type === 'array' ? '>' : ''); $returnTypeRaw[] = $contentTypeSchema->schema->type === 'array' ? '\\' . Observable::class : $object; $hydrate = new Node\Expr\MethodCall( - new Node\Expr\Variable('hydrator'), - new Node\Name('hydrate'), + new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + 'hydrator' + ), + new Node\Name('hydrateObject'), [ new Node\Arg(new Node\Scalar\String_($object)), new Node\Arg(new Node\Expr\Variable('body')), @@ -277,9 +292,6 @@ public static function generate(string $path, string $method, string $namespace, 'params' => [ new Node\Param(new Node\Expr\Variable('body'), null, new Node\Name('array')) ], - 'uses' => [ - new Node\Expr\Variable('hydrator'), - ], 'returnType' => $object, ])) ] @@ -320,8 +332,6 @@ public static function generate(string $path, string $method, string $namespace, new Node\Expr\Assign(new Node\Expr\Variable('contentType'), new Node\Expr\MethodCall(new Node\Expr\Variable('response'), 'getHeaderLine', [new Arg(new Node\Scalar\String_('Content-Type'))])) )->addStmt( new Node\Expr\Assign(new Node\Expr\Variable('body'), new Node\Expr\FuncCall(new Node\Name('json_decode'), [new Node\Expr\MethodCall(new Node\Expr\MethodCall(new Node\Expr\Variable('response'), 'getBody'), 'getContents'), new Node\Expr\ConstFetch(new Node\Name('true'))])) - )->addStmt( - new Node\Expr\Assign(new Node\Expr\Variable('hydrator'), new Node\Expr\New_(new Node\Name('\\' . Hydrator::class))) )->addStmt( new Node\Stmt\Switch_( new Node\Expr\MethodCall(new Node\Expr\Variable('response'), 'getStatusCode'), diff --git a/src/Generator/Schema.php b/src/Generator/Schema.php index c958311..b195ebb 100644 --- a/src/Generator/Schema.php +++ b/src/Generator/Schema.php @@ -83,6 +83,8 @@ public static function generate(string $name, string $namespace, string $classNa private static function fillUpSchema(string $name, string $namespace, string $className, \PhpParser\Builder\Class_ $class, OpenAPiSchema $schema, $factory, SchemaRegistry $schemaRegistry, string $rootNamespace): iterable { yield from []; + $constructor = (new BuilderFactory())->method('__construct')->makePublic(); + $constructDocBlock = []; foreach ($schema->properties as $propertyName => $property) { $propertyName = str_replace([ '@', @@ -95,27 +97,17 @@ private static function fillUpSchema(string $name, string $namespace, string $cl '_MINUS_', '', ], $propertyName); - $propertyStmt = $factory->property($propertyName)->makePrivate(); + $propertyStmt = $factory->property($propertyName)->makePublic()->makeReadonly(); $propertyDocBlock = []; - $methodDocBlock = []; if (is_string($property->description) && strlen($property->description) > 0) { $propertyDocBlock[] = $property->description; - $methodDocBlock[] = $property->description; } - $method = $factory->method($propertyName)->makePublic()/*->setReturnType('string')*/->addStmt( - new Node\Stmt\Return_( - new Node\Expr\PropertyFetch( - new Node\Expr\Variable('this'), - $propertyName - ) - ) - ); $propertyType = $property->type; $setDefaylt = true; $nullable = ''; if ($property->nullable) { $nullable = '?'; - $propertyStmt->setDefault(null); +// $propertyStmt->setDefault(null); } if ( @@ -139,25 +131,22 @@ private static function fillUpSchema(string $name, string $namespace, string $cl if (is_string($propertyType)) { if (is_array($schema->required) && !in_array($propertyName, $schema->required, false)) { $nullable = '?'; - $propertyStmt->setDefault(null); +// $propertyStmt->setDefault(null); } if ($propertyType === 'array'/* && $property->items instanceof OpenAPiSchema*/) { // if (array_key_exists(spl_object_hash($property->items), $schemaClassNameMap)) { - $methodDocBlock[] = '@return array<\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->items, $className . '\\' . (new Convert($propertyName))->toPascal()) . '>'; $propertyDocBlock[] = '@var array<\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->items, $className . '\\' . (new Convert($propertyName))->toPascal()) . '>'; - $propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\HydrateArray(\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->items, $className . '\\' . (new Convert($propertyName))->toPascal()) . '::class)'; +// $constructDocBlock[] = '@param array<\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->items, $className . '\\' . (new Convert($propertyName))->toPascal()) . '>'; + $constructDocBlock[] = '@param array<\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->items, $className . '\\' . (new Convert($propertyName))->toPascal()) . '> $' . $propertyName; // } elseif ($property->items->type === 'object') { // yield from self::generate($name . '::' . $propertyName, $namespace . '\\' . $className, (new Convert($propertyName))->toPascal(), $property->items, $schemaClassNameMap, $rootNamespace); -// $methodDocBlock[] = '@return array<\\' . $namespace . '\\' . $className . '\\' . (new Convert($propertyName))->toPascal() . '>'; // $propertyDocBlock[] = '@var array<\\' . $namespace . '\\' . $className . '\\' . (new Convert($propertyName))->toPascal() . '>'; -// $propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\HydrateArray(\\' . $namespace . '\\' . $className . '\\' . (new Convert($propertyName))->toPascal() . '::class)'; // } } - if (is_string($propertyType)) { - $t = str_replace([ + $propertyType = str_replace([ 'object', 'integer', 'number', @@ -173,26 +162,35 @@ private static function fillUpSchema(string $name, string $namespace, string $cl 'bool', ], $propertyType); - if ($t !== '') { - $propertyStmt->setType(($t === 'array' ? '' : $nullable) . $t); - $method->setReturnType(($t === 'array' ? '' : $nullable) . $t); + if ($propertyType === '') { + $propertyType = 'mixed'; } } + } else { + $propertyType = 'mixed'; } + + $propertyStmt->setType(($propertyType === 'array' ? '' : $nullable) . $propertyType); + $constructor->addParam((new Param($propertyName))->setType($propertyType))->addStmt( + new Node\Expr\Assign( + new Node\Expr\PropertyFetch( + new Node\Expr\Variable('this'), + $propertyName + ), + new Node\Expr\Variable($propertyName), + ) + ); + // 74908 if (is_array($property->anyOf) && $property->anyOf[0] instanceof OpenAPiSchema/* && array_key_exists(spl_object_hash($property->anyOf[0]), $schemaClassNameMap)*/) { $fqcnn = '\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->anyOf[0], $className . '\\' . (new Convert($propertyName))->toPascal()); $propertyStmt->setType($nullable . $fqcnn); - $method->setReturnType($nullable . $fqcnn); - $propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\Hydrate(' . $fqcnn . '::class)'; $setDefaylt = false; } else if (is_array($property->allOf) && $property->allOf[0] instanceof OpenAPiSchema/* && array_key_exists(spl_object_hash($property->allOf[0]), $schemaClassNameMap)*/) { $fqcnn = '\\' . $rootNamespace . '\\' . $schemaRegistry->get($property->allOf[0], $className . '\\' . (new Convert($propertyName))->toPascal()); $propertyStmt->setType($nullable . $fqcnn); - $method->setReturnType($nullable . $fqcnn); - $propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\Hydrate(' . $fqcnn . '::class)'; $setDefaylt = false; } @@ -200,8 +198,6 @@ private static function fillUpSchema(string $name, string $namespace, string $cl if ($propertyType === 'object') { $fqcnn = '\\' . $rootNamespace . '\\' . $schemaRegistry->get($property, $className . '\\' . (new Convert($propertyName))->toPascal()); $propertyStmt->setType($nullable . $fqcnn); - $method->setReturnType($nullable . $fqcnn); - $propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\Hydrate(' . $fqcnn . '::class)'; $setDefaylt = false; } @@ -219,20 +215,22 @@ private static function fillUpSchema(string $name, string $namespace, string $cl ], $propertyType); if ($t !== '') { if ($t === 'array' && $setDefaylt === true) { - $propertyStmt->setDefault([]); +// $propertyStmt->setDefault([]); } } } if (count($propertyDocBlock) > 0) { - $propertyStmt->setDocComment('/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', $propertyDocBlock) . PHP_EOL .' */'); + $propertyStmt->setDocComment('/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', str_replace(['/**', '*/'], '', $propertyDocBlock)) . PHP_EOL .' */'); } - if (count($methodDocBlock) > 0) { - $method->setDocComment('/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', $methodDocBlock) . PHP_EOL .' */'); - } + $class->addStmt($propertyStmt); + } - $class->addStmt($propertyStmt)->addStmt($method); + if (count($constructDocBlock) > 0) { + $constructor->setDocComment('/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', str_replace(['/**', '*/'], '', $constructDocBlock)) . PHP_EOL .' */'); } + + $class->addStmt($constructor); } } diff --git a/src/Generator/WebHook.php b/src/Generator/WebHook.php index c637fad..b6fafc0 100644 --- a/src/Generator/WebHook.php +++ b/src/Generator/WebHook.php @@ -2,6 +2,7 @@ namespace ApiClients\Tools\OpenApiClientGenerator\Generator; +use ApiClients\Contracts\OpenAPI\WebHookInterface; use ApiClients\Tools\OpenApiClientGenerator\File; use ApiClients\Tools\OpenApiClientGenerator\SchemaRegistry; use cebe\openapi\spec\Operation as OpenAPiOperation; @@ -32,7 +33,7 @@ public static function generate(string $path, string $namespace, string $baseNam $factory = new BuilderFactory(); $stmt = $factory->namespace($namespace); - $class = $factory->class($className)->makeFinal()->implement('\\' . $baseNamespace . 'WebHookInterface'); + $class = $factory->class($className)->makeFinal()->implement('\\' . WebHookInterface::class); $method = $factory->method('resolve')->makePublic()->setReturnType('string')->addParam( (new Param('data'))->setType('array') diff --git a/src/Generator/WebHookInterface.php b/src/Generator/WebHookInterface.php deleted file mode 100644 index e3c37e3..0000000 --- a/src/Generator/WebHookInterface.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @throws \Jawira\CaseConverter\CaseConverterException - */ - public static function generate(string $namespace, string $className): iterable - { - $factory = new BuilderFactory(); - $stmt = $factory->namespace($namespace); - - yield new File($namespace . '\\' . $className, $stmt->addStmt($factory->interface($className)->addStmt($factory->method('resolve')->makePublic()->setReturnType('string')->addParam( - (new Param('data'))->setType('array') - )))->getNode()); - } -} diff --git a/src/Generator/WebHooks.php b/src/Generator/WebHooks.php index 112bbbe..7a81cbd 100644 --- a/src/Generator/WebHooks.php +++ b/src/Generator/WebHooks.php @@ -2,6 +2,7 @@ namespace ApiClients\Tools\OpenApiClientGenerator\Generator; +use ApiClients\Contracts\OpenAPI\WebHookInterface; use ApiClients\Tools\OpenApiClientGenerator\File; use cebe\openapi\spec\Operation as OpenAPiOperation; use cebe\openapi\spec\PathItem; @@ -50,7 +51,7 @@ public static function generate(string $namespace, string $baseNamespace, array Class_::MODIFIER_PUBLIC ) )->addStmt( - $factory->method('resolve')->makePublic()->makeStatic()->setReturnType('\\' . $baseNamespace . 'WebHookInterface')->addParam( + $factory->method('resolve')->makePublic()->makeStatic()->setReturnType('\\' . WebHookInterface::class)->addParam( (new Param('event'))->setType('string') )->addStmt( new Node\Stmt\If_(