diff --git a/README.md b/README.md index d70aa4b91..f054ce5f2 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ The set provides best practices to make development more fun and classes/services that I found very useful while working on big extensible applications. [include:exec]: <./dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 5a6479e01ca04242d936b5543af76210a1af5db5468e2f480f167a2a046b62db) +[//]: # (start: cf085248b2284f354e6966f146d7c1c32821f3031a0316e73df3a80e038e704f) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -25,7 +25,7 @@ The set provides best practices to make development more fun and classes/service | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | -[//]: # (end: 5a6479e01ca04242d936b5543af76210a1af5db5468e2f480f167a2a046b62db) +[//]: # (end: cf085248b2284f354e6966f146d7c1c32821f3031a0316e73df3a80e038e704f) # Installation @@ -42,7 +42,7 @@ composer require lastdragon-ru/lara-asp- |:--:|---------------------------------| [include:package-list]: ./packages -[//]: # (start: df3ee6374fabefbdeb79b26164b3f2ef88f6ed94646bb5d44751ea6da758de19) +[//]: # (start: 2d5a58effc8f1949a8d20851019e2cefc9eeb2ea45725bf2b8147fee917f0b0c) [//]: # (warning: Generated automatically. Do not edit.) ## (Laravel) Core @@ -109,17 +109,17 @@ Independent (from Laravel and Lighthouse) package that allow you to print GraphQ [Read more](). -[//]: # (end: df3ee6374fabefbdeb79b26164b3f2ef88f6ed94646bb5d44751ea6da758de19) +[//]: # (end: 2d5a58effc8f1949a8d20851019e2cefc9eeb2ea45725bf2b8147fee917f0b0c) [include:file]: ./docs/Shared/Upgrading.md -[//]: # (start: cdb14a15bab8920d27c60204790e96bf814a9d780f6a55d5e93422db9bf56f64) +[//]: # (start: cbfccea895cb6cddbed8d1e403e510b43171341972c83ab9373a1bc25f6c2e65) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: cdb14a15bab8920d27c60204790e96bf814a9d780f6a55d5e93422db9bf56f64) +[//]: # (end: cbfccea895cb6cddbed8d1e403e510b43171341972c83ab9373a1bc25f6c2e65) # Development @@ -129,7 +129,7 @@ Please follow [Upgrade Guide](UPGRADE.md). 4. Enjoy [include:file]: ./docs/Legend.md -[//]: # (start: 68b5a2c9955bc3698c6033103ab34e32d67edfcff7b726f187662b5ce2e15a67) +[//]: # (start: 9a1322b3ab69b4443131311847c0af0cf6f86c6024c1436b67733d42ba3e2e4a) [//]: # (warning: Generated automatically. Do not edit.) # Legend @@ -148,4 +148,4 @@ Please follow [Upgrade Guide](UPGRADE.md). | 🆆 | CI | Running on Windows | | 🅼 | CI | Running on Mac OS X | -[//]: # (end: 68b5a2c9955bc3698c6033103ab34e32d67edfcff7b726f187662b5ce2e15a67) +[//]: # (end: 9a1322b3ab69b4443131311847c0af0cf6f86c6024c1436b67733d42ba3e2e4a) diff --git a/UPGRADE.md b/UPGRADE.md index a9ecad721..c59b3f4d5 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ./docs/Shared/Upgrade.md -[//]: # (start: 556e36b93ca9f82e94056295c197aa9a4c8c042054927a9bf08dd9140ad872b8) +[//]: # (start: c437867d96b216fb0f421c0c5b19b29eea42439b286bc4bc8f0f551f1fe2d9c2) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,7 +25,7 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 556e36b93ca9f82e94056295c197aa9a4c8c042054927a9bf08dd9140ad872b8) +[//]: # (end: c437867d96b216fb0f421c0c5b19b29eea42439b286bc4bc8f0f551f1fe2d9c2) # Packages diff --git a/monorepo-builder.php b/monorepo-builder.php index 9d1e4983b..06a64dab2 100644 --- a/monorepo-builder.php +++ b/monorepo-builder.php @@ -4,5 +4,5 @@ return static function (MBConfig $config): void { $config->packageDirectories([__DIR__.'/packages']); - $config->packageDirectoriesExcludes(['dev']); + $config->packageDirectoriesExcludes(['dev', 'src']); }; diff --git a/packages/core/README.md b/packages/core/README.md index 8bfcd959a..06c32ed09 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -3,7 +3,7 @@ This package contains useful utilities and classes. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -24,7 +24,7 @@ This package contains useful utilities and classes. | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.4.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "core"}}) [//]: # (start: 701034cd4b15ff1d0ee9742e3d839f3a0c70ba66d75ff6c56f712d2f69e254ae) @@ -43,21 +43,21 @@ composer require lastdragon-ru/lara-asp-core Please see the [source code](./src) to find something interesting 😅 [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/core/UPGRADE.md b/packages/core/UPGRADE.md index 0ba72f4c4..474be67cf 100644 --- a/packages/core/UPGRADE.md +++ b/packages/core/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,26 +25,26 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) * [ ] `\LastDragon_ru\LaraASP\Core\Provider\WithRoutes::bootRoutes()` requires settings. # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) diff --git a/packages/dev/README.md b/packages/dev/README.md index 703f67d20..9207f9264 100644 --- a/packages/dev/README.md +++ b/packages/dev/README.md @@ -3,7 +3,7 @@ Various internal tools and helpers to develop the package itself. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -15,7 +15,7 @@ Various internal tools and helpers to develop the package itself. | | `^8.1` | `HEAD ⋯ 6.2.0` | | PHPStan | `^1.10` | `HEAD ⋯ 6.2.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/InstallationDev.md ({"data": {"package": "dev"}}) [//]: # (start: e7fd13bb6d43bcc48d9fe51411b607bee0e47ccbcb1b788889f59b733865e0f1) @@ -38,21 +38,21 @@ composer require --dev lastdragon-ru/lara-asp-dev _In progress_. [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/dev/UPGRADE.md b/packages/dev/UPGRADE.md index 9da8be17d..61a12a295 100644 --- a/packages/dev/UPGRADE.md +++ b/packages/dev/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,4 +25,4 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) diff --git a/packages/documentator/README.md b/packages/documentator/README.md index bf2382ae3..4df6f6346 100644 --- a/packages/documentator/README.md +++ b/packages/documentator/README.md @@ -3,7 +3,7 @@ This package provides various utilities for documentation generation such as Markdown Preprocessor, Requirements Dumper and more. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -18,7 +18,7 @@ This package provides various utilities for documentation generation such as Mar | | `^10.0.0` | `6.1.0 ⋯ 5.0.0-beta.1` | | | `^9.21.0` | `5.6.0 ⋯ 5.0.0-beta.1` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "documentator"}}) [//]: # (start: d830b5dad8950e88a29e14aa443ca509cfa19889b5c3792b00691760fb8618bb) @@ -35,7 +35,7 @@ composer require lastdragon-ru/lara-asp-documentator # Commands [include:document-list]: ./docs/Commands -[//]: # (start: 3183e17484393f086cbec523de70a97446749151d781d55ef8f480075e5c75b9) +[//]: # (start: bf4572c5a716c01f9df13bb1bfb0e1a6d9c62b3f19f5467f152a12da3f5d92ad) [//]: # (warning: Generated automatically. Do not edit.) ## `lara-asp-documentator:commands` @@ -56,24 +56,24 @@ Generates a table with the required versions of PHP/Laravel/etc in Markdown form [Read more](). -[//]: # (end: 3183e17484393f086cbec523de70a97446749151d781d55ef8f480075e5c75b9) +[//]: # (end: bf4572c5a716c01f9df13bb1bfb0e1a6d9c62b3f19f5467f152a12da3f5d92ad) [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/documentator/UPGRADE.md b/packages/documentator/UPGRADE.md index d3069bd60..ab034f82c 100644 --- a/packages/documentator/UPGRADE.md +++ b/packages/documentator/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,29 +25,31 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) -* [ ] Migrate to the new contract `\LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction`. +* [ ] Migrate to the new contract: + * `\LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction` + * `\LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Resolver`. # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) * [ ] Replace `LastDragon_ru\LaraASP\Documentator\Preprocessor\InstructionContract` by `LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\ProcessableInstruction` or `LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\ParameterizableInstruction`. diff --git a/packages/documentator/composer.json b/packages/documentator/composer.json index d8349e216..6a3749604 100644 --- a/packages/documentator/composer.json +++ b/packages/documentator/composer.json @@ -34,6 +34,7 @@ "symfony/polyfill-php83": "^1.28", "symfony/serializer": "^6.3.3|^7.0.0", "lastdragon-ru/lara-asp-core": "self.version", + "lastdragon-ru/lara-asp-formatter": "self.version", "lastdragon-ru/lara-asp-graphql-printer": "self.version", "lastdragon-ru/lara-asp-serializer": "self.version" }, diff --git a/packages/documentator/src/Commands/Preprocess.php b/packages/documentator/src/Commands/Preprocess.php index dc3bf4b16..c4a5d4216 100644 --- a/packages/documentator/src/Commands/Preprocess.php +++ b/packages/documentator/src/Commands/Preprocess.php @@ -4,18 +4,20 @@ use Illuminate\Console\Command; use LastDragon_ru\LaraASP\Core\Utils\Cast; +use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Package; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Preprocessor; +use LastDragon_ru\LaraASP\Documentator\Processor\Processor; use LastDragon_ru\LaraASP\Documentator\Utils\Markdown; use LastDragon_ru\LaraASP\Documentator\Utils\PhpDoc; +use LastDragon_ru\LaraASP\Formatter\Formatter; use LastDragon_ru\LaraASP\Serializer\Contracts\Serializable; use Override; use ReflectionClass; use ReflectionProperty; use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Finder\Finder; +use Symfony\Component\Console\Terminal; use function getcwd; use function gettype; @@ -23,7 +25,11 @@ use function is_a; use function is_scalar; use function ksort; +use function mb_strlen; +use function microtime; +use function min; use function rtrim; +use function str_repeat; use function strtr; use function trim; use function var_export; @@ -64,31 +70,34 @@ public function __construct( parent::__construct(); } - public function __invoke(Filesystem $filesystem): void { - $cwd = getcwd(); - $path = Cast::toString($this->argument('path') ?? $cwd); - $finder = Finder::create() - ->ignoreVCSIgnored(true) - ->in($path) - ->exclude('vendor') - ->exclude('node_modules') - ->files() - ->name('*.md'); - - foreach ($finder as $file) { - $this->components->task( - $file->getPathname(), - function () use ($filesystem, $file): void { - $path = $file->getPathname(); - $content = $file->getContents(); - $result = $this->preprocessor->process($path, $content); - - if ($content !== $result) { - $filesystem->dumpFile($path, $result); - } - }, - ); - } + public function __invoke(Formatter $formatter): void { + $cwd = getcwd(); + $path = Cast::toString($this->argument('path') ?? $cwd); + $path = Path::normalize($path); + $width = min((new Terminal())->getWidth(), 150); + $start = microtime(true); + + (new Processor()) + ->task($this->preprocessor) + ->run($path, null, function (string $path, ?bool $success, float $duration) use ($formatter, $width): void { + [$resultMessage, $resultColor] = match (true) { + $success === false => ['FAIL', 'red'], + $success === true => ['DONE', 'green'], + default => ['SKIP', 'gray'], + }; + + $duration = $formatter->duration($duration); + $length = $width - (mb_strlen($path) + mb_strlen($duration) + mb_strlen($resultMessage) + 5); + $line = $path + .' '.($length > 0 ? ''.str_repeat('.', $length).'' : '') + .' '."{$duration}" + .' '."{$resultMessage}"; + + $this->output->writeln($line); + }); + + $this->output->newLine(); + $this->output->writeln("OK ({$formatter->duration(microtime(true) - $start)})"); } #[Override] diff --git a/packages/documentator/src/Commands/PreprocessTest.php b/packages/documentator/src/Commands/PreprocessTest.php index 0b66cfd9b..69978b9cf 100644 --- a/packages/documentator/src/Commands/PreprocessTest.php +++ b/packages/documentator/src/Commands/PreprocessTest.php @@ -196,7 +196,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { return $target; } } @@ -224,7 +224,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { return $target; } } @@ -252,7 +252,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { return $target; } } @@ -266,11 +266,11 @@ public function process(Context $context, mixed $target, mixed $parameters): str * @internal * @noinspection PhpMultipleClassesDeclarationsInOneFile * - * @implements Resolver + * @implements Resolver */ class PreprocessTest__Target implements Resolver { #[Override] - public function resolve(Context $context, mixed $parameters): mixed { + public function __invoke(Context $context, mixed $parameters): mixed { return $context->target; } } diff --git a/packages/documentator/src/Preprocessor/Context.php b/packages/documentator/src/Preprocessor/Context.php index e4a143729..da42cdf20 100644 --- a/packages/documentator/src/Preprocessor/Context.php +++ b/packages/documentator/src/Preprocessor/Context.php @@ -2,9 +2,13 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; + class Context { public function __construct( - public readonly string $path, + public readonly Directory $root, + public readonly File $file, public readonly string $target, public readonly ?string $parameters, ) { diff --git a/packages/documentator/src/Preprocessor/Contracts/Instruction.php b/packages/documentator/src/Preprocessor/Contracts/Instruction.php index 9d26dcd81..2510c1856 100644 --- a/packages/documentator/src/Preprocessor/Contracts/Instruction.php +++ b/packages/documentator/src/Preprocessor/Contracts/Instruction.php @@ -2,7 +2,10 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts; +use Generator; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use SplFileInfo; /** * @template TTarget @@ -12,7 +15,7 @@ interface Instruction { public static function getName(): string; /** - * @return class-string|Resolver> + * @return class-string|Resolver> */ public static function getResolver(): string; @@ -24,8 +27,14 @@ public static function getResolver(): string; public static function getParameters(): ?string; /** + * Process target with parameters and return result. + * + * Generator should be used to resolve any file which the Resolver depends on. + * * @param TTarget $target * @param TParameters $parameters + * + * @return Generator|string */ - public function process(Context $context, mixed $target, mixed $parameters): string; + public function __invoke(Context $context, mixed $target, mixed $parameters): Generator|string; } diff --git a/packages/documentator/src/Preprocessor/Contracts/Resolver.php b/packages/documentator/src/Preprocessor/Contracts/Resolver.php index 6b8267b3a..273d532be 100644 --- a/packages/documentator/src/Preprocessor/Contracts/Resolver.php +++ b/packages/documentator/src/Preprocessor/Contracts/Resolver.php @@ -2,17 +2,24 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts; +use Generator; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use SplFileInfo; /** - * @template TParameters - * @template TValue + * @template TTarget + * @template TParameters of object|null */ interface Resolver { /** + * Resolves target into the expected type/value. + * + * Generator should be used to resolve any file which the Resolver depends on. + * * @param TParameters $parameters * - * @return TValue + * @return Generator|TTarget */ - public function resolve(Context $context, mixed $parameters): mixed; + public function __invoke(Context $context, mixed $parameters): mixed; } diff --git a/packages/documentator/src/Preprocessor/Exceptions/DependencyIsMissing.php b/packages/documentator/src/Preprocessor/Exceptions/DependencyIsMissing.php index 54182ede0..59e1fc668 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/DependencyIsMissing.php +++ b/packages/documentator/src/Preprocessor/Exceptions/DependencyIsMissing.php @@ -21,7 +21,7 @@ public function __construct( sprintf( 'The dependency `%s` is missed (in `%s`).', $this->class, - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Exceptions/PackageReadmeIsMissing.php b/packages/documentator/src/Preprocessor/Exceptions/PackageReadmeIsMissing.php deleted file mode 100644 index 83fdcef2a..000000000 --- a/packages/documentator/src/Preprocessor/Exceptions/PackageReadmeIsMissing.php +++ /dev/null @@ -1,30 +0,0 @@ -package, - $context->path, - ), - $previous, - ); - } - - public function getPackage(): string { - return $this->package; - } -} diff --git a/packages/documentator/src/Preprocessor/Exceptions/TargetExecFailed.php b/packages/documentator/src/Preprocessor/Exceptions/TargetExecFailed.php index 77938ceb0..d05f2bafd 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TargetExecFailed.php +++ b/packages/documentator/src/Preprocessor/Exceptions/TargetExecFailed.php @@ -14,7 +14,7 @@ public function __construct(Context $context, Throwable $previous = null) { sprintf( 'Failed to execute the `%s` command (in `%s`).', $context->target, - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirectory.php b/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirectory.php index fb39be30d..d637d69e3 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirectory.php +++ b/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirectory.php @@ -14,7 +14,7 @@ public function __construct(Context $context, Throwable $previous = null) { sprintf( 'The `%s` is not a directory (in `%s`).', $context->target, - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotFile.php b/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotFile.php deleted file mode 100644 index e279c0ba1..000000000 --- a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotFile.php +++ /dev/null @@ -1,22 +0,0 @@ -target, - $context->path, - ), - $previous, - ); - } -} diff --git a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotValidPhpFile.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php similarity index 66% rename from packages/documentator/src/Preprocessor/Exceptions/TargetIsNotValidPhpFile.php rename to packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php index 43e807ea5..113094a36 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotValidPhpFile.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Exceptions/TargetIsNotValidPhpFile.php @@ -1,8 +1,9 @@ target, - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Instruction.php index 590298259..3d4eb1b3d 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/Instruction.php @@ -5,8 +5,9 @@ use Exception; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetIsNotValidPhpFile; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\FileContent; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocBlock\Exceptions\TargetIsNotValidPhpFile; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Resolvers\FileResolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use LastDragon_ru\LaraASP\Documentator\Utils\PhpDoc; use Override; use PhpParser\NameContext; @@ -28,7 +29,7 @@ * from `` file. Inline tags include as is except `@see`/`@link` * which will be replaced to FQCN (if possible). Other tags are ignored. * - * @implements InstructionContract + * @implements InstructionContract */ class Instruction implements InstructionContract { public function __construct() { @@ -42,7 +43,7 @@ public static function getName(): string { #[Override] public static function getResolver(): string { - return FileContent::class; + return FileResolver::class; } #[Override] @@ -51,9 +52,9 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { // Class? - [$class, $context] = ((array) $this->getClass($context, $target) + [null, null]); + [$class, $context] = ((array) $this->getClass($context, $target->getContent()) + [null, null]); if (!$class || !$context) { return ''; diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/InstructionTest.php index 5db24d251..873c9ab28 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocBlock/InstructionTest.php @@ -2,15 +2,18 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocBlock; +use Closure; use Exception; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetIsNotValidPhpFile; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocBlock\Exceptions\TargetIsNotValidPhpFile; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; -use function file_get_contents; -use function str_replace; +use function dirname; /** * @internal @@ -19,27 +22,32 @@ final class InstructionTest extends TestCase { // // ========================================================================= + /** + * @param Closure(self, Context): Exception|string $expected + */ #[DataProvider('dataProviderProcess')] - public function testProcess(Exception|string $expected, string $file, Parameters $params): void { - if ($expected instanceof Exception) { - self::expectExceptionObject($expected); + public function testInvoke(Closure|string $expected, string $file, Parameters $params): void { + $path = self::getTestData()->path($file); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $target = $file; + $context = new Context($root, $file, $file->getName(), null); + $instance = $this->app()->make(Instruction::class); + + if ($expected instanceof Closure) { + self::expectExceptionObject($expected($this, $context)); } else { $expected = self::getTestData()->content($expected); } - $file = self::getTestData()->file($file); - $target = (string) file_get_contents($file->getPathname()); - $context = new Context($file->getPathname(), $file->getFilename(), null); - $instance = $this->app()->make(Instruction::class); - - self::assertEquals($expected, $instance->process($context, $target, $params)); + self::assertEquals($expected, ProcessorHelper::runInstruction($instance, $context, $target, $params)); } // // // ========================================================================= /** - * @return array + * @return array */ public static function dataProviderProcess(): array { return [ @@ -64,13 +72,9 @@ public static function dataProviderProcess(): array { new Parameters(), ], 'invalid' => [ - new TargetIsNotValidPhpFile( - new Context( - str_replace('\\', '/', __DIR__.'/InstructionTest/Invalid.txt'), - 'Invalid.txt', - null, - ), - ), + static function (self $test, Context $context): Exception { + return new TargetIsNotValidPhpFile($context); + }, 'Invalid.txt', new Parameters(), ], diff --git a/packages/documentator/src/Preprocessor/Exceptions/DocumentTitleIsMissing.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php similarity index 53% rename from packages/documentator/src/Preprocessor/Exceptions/DocumentTitleIsMissing.php rename to packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php index b114141ac..0557ace42 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/DocumentTitleIsMissing.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Exceptions/DocumentTitleIsMissing.php @@ -1,8 +1,10 @@ document, - $context->path, + $this->document->getRelativePath($context->file), + $context->file->getRelativePath($context->root), ), $previous, ); } - public function getDocument(): string { + public function getDocument(): File { return $this->document; } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Instruction.php index 48402c0d1..d3ef85b66 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/Instruction.php @@ -2,19 +2,18 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocumentList; -use LastDragon_ru\LaraASP\Core\Utils\Path; +use Generator; use LastDragon_ru\LaraASP\Documentator\PackageViewer; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\DocumentTitleIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\DirectoryPath; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocumentList\Exceptions\DocumentTitleIsMissing; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Resolvers\DirectoryResolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use LastDragon_ru\LaraASP\Documentator\Utils\Markdown; use Override; -use Symfony\Component\Finder\Finder; +use SplFileInfo; -use function basename; -use function dirname; -use function file_get_contents; use function strcmp; use function usort; @@ -23,7 +22,7 @@ * must have `# Header` as the first construction. The first paragraph * after the Header will be used as a summary. * - * @implements InstructionContract + * @implements InstructionContract */ class Instruction implements InstructionContract { public function __construct( @@ -39,7 +38,7 @@ public static function getName(): string { #[Override] public static function getResolver(): string { - return DirectoryPath::class; + return DirectoryResolver::class; } #[Override] @@ -47,46 +46,43 @@ public static function getParameters(): ?string { return Parameters::class; } + /** + * @return Generator + */ #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): Generator { /** @var list $documents */ $documents = []; - $path = basename($context->path); - $base = dirname($context->path); - $root = $target; - $target = Path::normalize($context->target); - $finder = Finder::create()->in($root)->name('*.md'); - - if ($parameters->depth !== null) { - $finder->depth($parameters->depth); - } + $files = $target->getFilesIterator('*.md', $parameters->depth); + $self = $context->file->getPath(); - foreach ($finder->files() as $file) { + foreach ($files as $file) { // Same? - if ($target === '' && $file->getFilename() === $path) { + if ($self === $file->getPath()) { continue; } // Content? - $content = file_get_contents($file->getPathname()); + $file = yield $file; + $content = $file->getContent(); if (!$content) { continue; } - // Extract + // Title? $docTitle = Markdown::getTitle($content); - $docPath = Path::getRelativePath($base, $file->getPathname()); - - if ($docTitle) { - $documents[] = [ - 'path' => $docPath, - 'title' => $docTitle, - 'summary' => Markdown::getSummary($content), - ]; - } else { - throw new DocumentTitleIsMissing($context, $docPath); + + if (!$docTitle) { + throw new DocumentTitleIsMissing($context, $file); } + + // Add + $documents[] = [ + 'path' => $file->getRelativePath($context->file), + 'title' => $docTitle, + 'summary' => Markdown::getSummary($content), + ]; } // Empty? diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/InstructionTest.php index f10fc64bd..85ae44397 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeDocumentList/InstructionTest.php @@ -3,25 +3,29 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocumentList; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\DocumentTitleIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\DirectoryPath; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeDocumentList\Exceptions\DocumentTitleIsMissing; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; use function basename; +use function dirname; /** * @internal */ #[CoversClass(Instruction::class)] final class InstructionTest extends TestCase { - public function testProcessSameDirectory(): void { - $path = self::getTestData()->file('Document.md'); + public function testInvokeSameDirectory(): void { + $path = self::getTestData()->path('Document.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = new Parameters(); - $context = new Context($path->getPathname(), './', ''); + $context = new Context($root, $file, './', ''); $instance = $this->app()->make(Instruction::class); - $target = (new DirectoryPath())->resolve($context, null); - $actual = $instance->process($context, $target, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $root, $params); self::assertEquals( self::getTestData()->content('~SameDirectory.md'), @@ -33,13 +37,18 @@ public function testProcessSameDirectory(): void { ); } - public function testProcessAnotherDirectory(): void { - $path = self::getTestData()->file('~AnotherDirectory.md'); - $params = new Parameters(); - $context = new Context($path->getPathname(), basename(self::getTestData()->path('/')), ''); + public function testInvokeAnotherDirectory(): void { + $path = self::getTestData()->path('~AnotherDirectory.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $params = new Parameters(); + $context = new Context($root, $file, basename(self::getTestData()->path('/')), ''); + $target = $root->getDirectory($context->target); + + self::assertNotNull($target); + $instance = $this->app()->make(Instruction::class); - $target = (new DirectoryPath())->resolve($context, null); - $actual = $instance->process($context, $target, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $target, $params); self::assertEquals( self::getTestData()->content('~AnotherDirectory.md'), @@ -51,13 +60,14 @@ public function testProcessAnotherDirectory(): void { ); } - public function testProcessNestedDirectories(): void { - $path = self::getTestData()->file('nested/Document.md'); + public function testInvokeNestedDirectories(): void { + $path = self::getTestData()->path('nested/Document.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = new Parameters(null); - $context = new Context($path->getPathname(), './', ''); + $context = new Context($root, $file, './', ''); $instance = $this->app()->make(Instruction::class); - $target = (new DirectoryPath())->resolve($context, null); - $actual = $instance->process($context, $target, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $root, $params); self::assertEquals( self::getTestData()->content('~NestedDirectories.md'), @@ -69,24 +79,20 @@ public function testProcessNestedDirectories(): void { ); } - public function testProcessWithoutTitle(): void { - $path = self::getTestData()->file('invalid/Document.md'); + public function testInvokeWithoutTitle(): void { + $path = self::getTestData()->path('invalid/Document.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = new Parameters(); - $context = new Context($path->getPathname(), './', ''); + $context = new Context($root, $file, './', ''); $instance = $this->app()->make(Instruction::class); - $target = (new DirectoryPath())->resolve($context, null); + $expected = $root->getFile('WithoutTitle.md'); + self::assertNotNull($expected); self::expectExceptionObject( - new DocumentTitleIsMissing( - new Context( - $path->getPathname(), - $target, - null, - ), - 'WithoutTitle.md', - ), + new DocumentTitleIsMissing($context, $expected), ); - $instance->process($context, $target, $params); + ProcessorHelper::runInstruction($instance, $context, $root, $params); } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExample/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExample/Instruction.php index 32724271d..4e727d576 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExample/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExample/Instruction.php @@ -4,22 +4,21 @@ use Exception; use Illuminate\Process\Factory; -use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetExecFailed; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\FileContent; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Resolvers\FileResolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use Override; use function dirname; -use function is_file; use function pathinfo; use function preg_match; use function preg_match_all; use function preg_replace_callback; use function trim; -use const PATHINFO_EXTENSION; +use const PATHINFO_FILENAME; use const PREG_UNMATCHED_AS_NULL; /** @@ -31,7 +30,7 @@ * block. You can wrap the output into `text` tags to * insert it as is. * - * @implements InstructionContract + * @implements InstructionContract */ class Instruction implements InstructionContract { public const Limit = 50; @@ -50,7 +49,7 @@ public static function getName(): string { #[Override] public static function getResolver(): string { - return FileContent::class; + return FileResolver::class; } #[Override] @@ -59,26 +58,24 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { - // Prepare - $content = $target; - $target = $context->target; - $path = $context->path; - - // Process - $language = $this->getLanguage($path, $target); - $content = trim($content); + public function __invoke(Context $context, mixed $target, mixed $parameters): string { + // Content + $language = $this->getLanguage($context, $target, $parameters); + $content = trim($target->getContent()); $content = <<getCommand($path, $target); + + // Command? + $command = $this->getCommand($context, $target, $parameters); if ($command) { // Call try { - $output = $this->factory->newPendingProcess()->path(dirname($path))->run($command)->throw()->output(); + $dir = dirname($target->getPath()); + $output = $this->factory->newPendingProcess()->path($dir)->run($command)->throw()->output(); $output = trim($output); } catch (Exception $exception) { throw new TargetExecFailed($context, $exception); @@ -140,17 +137,13 @@ public function process(Context $context, mixed $target, mixed $parameters): str return $content; } - protected function getLanguage(string $path, string $target): string { - return pathinfo($target, PATHINFO_EXTENSION); + protected function getLanguage(Context $context, File $target, mixed $parameters): string { + return $target->getExtension(); } - protected function getCommand(string $path, string $target): ?string { - $info = pathinfo($target); - $file = isset($info['dirname']) - ? Path::join($info['dirname'], "{$info['filename']}.run") - : "{$info['filename']}.run"; - $command = Path::getPath(dirname($path), $file); - $command = is_file($command) ? $command : null; + protected function getCommand(Context $context, File $target, mixed $parameters): ?string { + $command = pathinfo($target->getName(), PATHINFO_FILENAME).'.run'; + $command = $context->root->getDirectory($target)?->getFile($command)?->getPath(); return $command; } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExample/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExample/InstructionTest.php index 55eaffeb2..d56133b16 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExample/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExample/InstructionTest.php @@ -5,10 +5,12 @@ use Illuminate\Process\Factory; use Illuminate\Process\PendingProcess; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use function basename; use function dirname; use function implode; use function range; @@ -19,11 +21,12 @@ */ #[CoversClass(Instruction::class)] final class InstructionTest extends TestCase { - public function testProcessNoRun(): void { + public function testInvokeNoRun(): void { $path = self::getTestData()->path('~example.md'); - $file = basename(self::getTestData()->path('~example.md')); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = null; - $context = new Context($path, $file, $params); + $context = new Context($root, $file, $file->getName(), $params); $content = self::getTestData()->content('~example.md'); $expected = trim($content); $factory = $this->override(Factory::class, function (): Factory { @@ -32,7 +35,7 @@ public function testProcessNoRun(): void { ->fake(); }); $instance = $this->app()->make(Instruction::class); - $actual = $instance->process($context, $content, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $file, $params); self::assertEquals( <<assertNothingRan(); } - public function testProcess(): void { + public function testInvoke(): void { $path = self::getTestData()->path('~runnable.md'); - $file = basename(self::getTestData()->path('~runnable.md')); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = null; - $context = new Context($path, $file, $params); + $context = new Context($root, $file, $file->getName(), $params); $content = self::getTestData()->content('~runnable.md'); $command = self::getTestData()->path('~runnable.run'); $expected = trim($content); @@ -65,7 +69,7 @@ public function testProcess(): void { return $factory; }); $instance = $this->app()->make(Instruction::class); - $actual = $instance->process($context, $content, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $file, $params); self::assertEquals( <<path('~runnable.md'); - $file = self::getTestData()->path('~runnable.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = null; - $context = new Context($path, $file, $params); + $context = new Context($root, $file, $file->getPath(), $params); $content = self::getTestData()->content('~runnable.md'); $command = self::getTestData()->path('~runnable.run'); $expected = trim($content); @@ -107,7 +112,7 @@ public function testProcessLongOutput(): void { return $factory; }); $instance = $this->app()->make(Instruction::class); - $actual = $instance->process($context, $content, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $file, $params); self::assertEquals( <<path('~runnable.md'); - $file = basename(self::getTestData()->path('~runnable.md')); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = null; - $context = new Context($path, $file, $params); + $context = new Context($root, $file, $file->getName(), $params); $content = self::getTestData()->content('~runnable.md'); $command = self::getTestData()->path('~runnable.run'); $expected = trim($content); @@ -151,7 +157,7 @@ public function testProcessMarkdown(): void { return $factory; }); $instance = $this->app()->make(Instruction::class); - $actual = $instance->process($context, $content, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $file, $params); self::assertEquals( <<path('~runnable.md'); - $file = self::getTestData()->path('~runnable.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = null; - $context = new Context($path, $file, $params); + $context = new Context($root, $file, $file->getPath(), $params); $content = self::getTestData()->content('~runnable.md'); $command = self::getTestData()->path('~runnable.run'); $expected = trim($content); @@ -189,7 +196,7 @@ public function testProcessMarkdownLongOutput(): void { return $factory; }); $instance = $this->app()->make(Instruction::class); - $actual = $instance->process($context, $content, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $file, $params); self::assertEquals( <<factory->newPendingProcess()->path(dirname($context->path))->run($target)->throw()->output(), + $this->factory->newPendingProcess() + ->path(dirname($context->file->getPath())) + ->run($target) + ->throw() + ->output(), ); } catch (Exception $exception) { throw new TargetExecFailed($context, $exception); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExec/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExec/InstructionTest.php index c5a4066d2..1896101bf 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExec/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExec/InstructionTest.php @@ -4,23 +4,26 @@ use Illuminate\Process\Factory; use Illuminate\Process\PendingProcess; +use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; -use function dirname; - /** * @internal */ #[CoversClass(Instruction::class)] final class InstructionTest extends TestCase { - public function testProcess(): void { - $path = 'current/working/directory/file.md'; + public function testInvoke(): void { + $root = new Directory(Path::normalize(__DIR__), false); + $file = new File(Path::normalize(__FILE__), false); $params = null; $expected = 'result'; $command = 'command to execute'; - $context = new Context($path, $command, $params); + $context = new Context($root, $file, $command, $params); $factory = $this->override(Factory::class, function () use ($command, $expected): Factory { $factory = $this->app()->make(Factory::class); $factory->preventStrayProcesses(); @@ -32,10 +35,10 @@ public function testProcess(): void { }); $instance = $this->app()->make(Instruction::class); - self::assertEquals($expected, $instance->process($context, $command, $params)); + self::assertEquals($expected, ProcessorHelper::runInstruction($instance, $context, $command, $params)); - $factory->assertRan(static function (PendingProcess $process) use ($path, $command): bool { - return $process->path === dirname($path) + $factory->assertRan(static function (PendingProcess $process) use ($root, $command): bool { + return $process->path === $root->getPath() && $process->command === $command; }); } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeExec/Resolver.php b/packages/documentator/src/Preprocessor/Instructions/IncludeExec/Resolver.php index 884e502a6..a2b2ab08d 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeExec/Resolver.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeExec/Resolver.php @@ -9,7 +9,7 @@ /** * Path to the executable. * - * @implements ResolverContract + * @implements ResolverContract */ class Resolver implements ResolverContract { public function __construct() { @@ -17,7 +17,7 @@ public function __construct() { } #[Override] - public function resolve(Context $context, mixed $parameters): string { + public function __invoke(Context $context, mixed $parameters): mixed { return $context->target; } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeFile/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludeFile/Instruction.php index 1d45dc233..f4c556832 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeFile/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeFile/Instruction.php @@ -4,7 +4,8 @@ use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\FileContent; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Resolvers\FileResolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use Override; use function rtrim; @@ -12,7 +13,7 @@ /** * Includes the `` file. * - * @implements InstructionContract + * @implements InstructionContract */ class Instruction implements InstructionContract { public function __construct() { @@ -26,7 +27,7 @@ public static function getName(): string { #[Override] public static function getResolver(): string { - return FileContent::class; + return FileResolver::class; } #[Override] @@ -35,7 +36,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { - return rtrim($target)."\n"; + public function __invoke(Context $context, mixed $target, mixed $parameters): string { + return rtrim($target->getContent())."\n"; } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeFile/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeFile/InstructionTest.php index d71462be5..1d6e4d56a 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeFile/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeFile/InstructionTest.php @@ -3,7 +3,10 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeFile; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; +use Mockery; use PHPUnit\Framework\Attributes\CoversClass; /** @@ -11,13 +14,14 @@ */ #[CoversClass(Instruction::class)] final class InstructionTest extends TestCase { - public function testProcess(): void { - $file = self::getTestData()->path('.md'); + public function testInvoke(): void { + $path = self::getTestData()->path('.md'); + $file = new File($path, false); $params = null; - $context = new Context($file, $file, $params); + $context = Mockery::mock(Context::class); $instance = $this->app()->make(Instruction::class); $expected = self::getTestData()->content('.md'); - self::assertEquals($expected, $instance->process($context, $expected, $params)); + self::assertEquals($expected, ProcessorHelper::runInstruction($instance, $context, $file, $params)); } } diff --git a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirective.php b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php similarity index 65% rename from packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirective.php rename to packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php index f36a0e53e..74bd95085 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TargetIsNotDirective.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Exceptions/TargetIsNotDirective.php @@ -1,8 +1,9 @@ target, - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Instruction.php index 761eef3bc..ae218ebbe 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Instruction.php @@ -2,10 +2,12 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeGraphqlDirective; +// @phpcs:disable Generic.Files.LineLength.TooLong + use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\DependencyIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetIsNotDirective; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeGraphqlDirective\Exceptions\TargetIsNotDirective; use LastDragon_ru\LaraASP\GraphQLPrinter\Contracts\Printer; use LastDragon_ru\LaraASP\GraphQLPrinter\Settings\ImmutableSettings; use Override; @@ -41,7 +43,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { // Dependencies? if (!$this->printer) { throw new DependencyIsMissing($context, Printer::class); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/InstructionTest.php index 994c17895..f179b12d6 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/InstructionTest.php @@ -2,10 +2,16 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeGraphqlDirective; +// @phpcs:disable Generic.Files.LineLength.TooLong + use GraphQL\Language\Parser; +use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\DependencyIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TargetIsNotDirective; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeGraphqlDirective\Exceptions\TargetIsNotDirective; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use LastDragon_ru\LaraASP\GraphQLPrinter\Contracts\DirectiveResolver; use LastDragon_ru\LaraASP\GraphQLPrinter\Contracts\Printer as PrinterContract; @@ -20,7 +26,7 @@ final class InstructionTest extends TestCase { // // ========================================================================= - public function testProcess(): void { + public function testInvoke(): void { $directive = <<<'GRAPHQL' directive @test on @@ -41,9 +47,11 @@ public function testProcess(): void { return (new Printer())->setDirectiveResolver($resolver); }); + $root = Mockery::mock(Directory::class); + $file = Mockery::mock(File::class); + $context = new Context($root, $file, '@test', null); $instance = $this->app()->make(Instruction::class); - $context = new Context('path/to/file.md', '@test', null); - $actual = $instance->process($context, $context->target, null); + $actual = ProcessorHelper::runInstruction($instance, $context, $context->target, null); self::assertEquals( <<app()[PrinterContract::class]); - $path = 'path/to/file.md'; + $root = new Directory(Path::normalize(__DIR__), false); + $file = new File(Path::normalize(__FILE__), false); $target = '@test'; - $context = new Context($path, $target, null); + $context = new Context($root, $file, $target, null); $instance = $this->app()->make(Instruction::class); self::expectExceptionObject( new DependencyIsMissing($context, PrinterContract::class), ); - $instance->process($context, $context->target, null); + ProcessorHelper::runInstruction($instance, $context, $context->target, null); } - public function testProcessNoDirective(): void { + public function testInvokeNoDirective(): void { $this->override(PrinterContract::class, static function (): PrinterContract { $resolver = Mockery::mock(DirectiveResolver::class); $resolver @@ -84,32 +93,34 @@ public function testProcessNoDirective(): void { return (new Printer())->setDirectiveResolver($resolver); }); - $path = 'path/to/file.md'; + $root = new Directory(Path::normalize(__DIR__), false); + $file = new File(Path::normalize(__FILE__), false); $target = '@test'; - $context = new Context($path, $target, null); + $context = new Context($root, $file, $target, null); $instance = $this->app()->make(Instruction::class); self::expectExceptionObject( new TargetIsNotDirective($context), ); - $instance->process($context, $context->target, null); + ProcessorHelper::runInstruction($instance, $context, $context->target, null); } - public function testProcessNoDirectiveResolver(): void { + public function testInvokeNoDirectiveResolver(): void { $this->override(PrinterContract::class, static function (): PrinterContract { return (new Printer())->setDirectiveResolver(null); }); - $path = 'path/to/file.md'; + $root = new Directory(Path::normalize(__DIR__), false); + $file = new File(Path::normalize(__FILE__), false); $target = '@test'; - $context = new Context($path, $target, null); + $context = new Context($root, $file, $target, null); $instance = $this->app()->make(Instruction::class); self::expectExceptionObject( new TargetIsNotDirective($context), ); - $instance->process($context, $context->target, null); + ProcessorHelper::runInstruction($instance, $context, $context->target, null); } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Resolver.php b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Resolver.php index b5a539d9b..c8ab05a54 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Resolver.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeGraphqlDirective/Resolver.php @@ -9,7 +9,7 @@ /** * Directive name (started with `@` sign) * - * @implements ResolverContract + * @implements ResolverContract */ class Resolver implements ResolverContract { public function __construct() { @@ -17,7 +17,7 @@ public function __construct() { } #[Override] - public function resolve(Context $context, mixed $parameters): string { + public function __invoke(Context $context, mixed $parameters): mixed { return $context->target; } } diff --git a/packages/documentator/src/Preprocessor/Exceptions/PackageComposerJsonIsMissing.php b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php similarity index 53% rename from packages/documentator/src/Preprocessor/Exceptions/PackageComposerJsonIsMissing.php rename to packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php index ae0e9319c..e6cb8b3cd 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/PackageComposerJsonIsMissing.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageComposerJsonIsMissing.php @@ -1,8 +1,10 @@ package, - $context->path, + $this->package->getRelativePath($context->root), + $context->file->getRelativePath($context->root), ), $previous, ); } - public function getPackage(): string { + public function getPackage(): Directory { return $this->package; } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php new file mode 100644 index 000000000..b10659fa0 --- /dev/null +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageReadmeIsEmpty.php @@ -0,0 +1,39 @@ +package->getRelativePath($context->root), + $this->readme->getRelativePath($context->root), + $context->file->getRelativePath($context->root), + ), + $previous, + ); + } + + public function getPackage(): Directory { + return $this->package; + } + + public function getReadme(): File { + return $this->readme; + } +} diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php new file mode 100644 index 000000000..5ef43308e --- /dev/null +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Exceptions/PackageReadmeTitleIsMissing.php @@ -0,0 +1,39 @@ +package->getRelativePath($context->root), + $this->readme->getRelativePath($context->root), + $context->file->getRelativePath($context->root), + ), + $previous, + ); + } + + public function getPackage(): Directory { + return $this->package; + } + + public function getReadme(): File { + return $this->readme; + } +} diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Instruction.php index 4dd29e4b0..c0b87d4ec 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/Instruction.php @@ -2,25 +2,28 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList; +// @phpcs:disable Generic.Files.LineLength.TooLong + use Exception; +use Generator; +use LastDragon_ru\LaraASP\Core\Utils\Cast; use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\PackageViewer; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\DocumentTitleIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\PackageComposerJsonIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\PackageReadmeIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\DirectoryPath; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Exceptions\PackageComposerJsonIsMissing; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Exceptions\PackageReadmeIsEmpty; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Exceptions\PackageReadmeTitleIsMissing; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Resolvers\DirectoryResolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use LastDragon_ru\LaraASP\Documentator\Utils\Markdown; use Override; -use Symfony\Component\Finder\Finder; +use SplFileInfo; use function assert; -use function basename; -use function file_get_contents; use function is_array; use function is_file; -use function is_string; use function json_decode; use function strcmp; use function usort; @@ -31,7 +34,7 @@ * Generates package list from `` directory. The readme file will be * used to determine package name and summary. * - * @implements InstructionContract + * @implements InstructionContract */ class Instruction implements InstructionContract { public function __construct( @@ -47,7 +50,7 @@ public static function getName(): string { #[Override] public static function getResolver(): string { - return DirectoryPath::class; + return DirectoryResolver::class; } #[Override] @@ -55,63 +58,50 @@ public static function getParameters(): ?string { return Parameters::class; } + /** + * @return Generator + */ #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): Generator { /** @var list $packages */ $packages = []; - $basePath = basename($target); - $directories = Finder::create() - ->ignoreVCSIgnored(true) - ->in($target) - ->depth(0) - ->exclude('vendor') - ->exclude('node_modules') - ->directories(); + $directories = $target->getDirectoriesIterator(null, 0); foreach ($directories as $package) { // Package? - $packagePath = $package->getPathname(); - $packageInfo = $this->getPackageInfo($packagePath); + $packageFile = yield $package->getPath('composer.json'); + $packageInfo = $this->getPackageInfo($packageFile); if (!$packageInfo) { - throw new PackageComposerJsonIsMissing( - $context, - Path::join($basePath, $package->getFilename()), - ); + throw new PackageComposerJsonIsMissing($context, $package); } // Readme - $readme = $this->getPackageReadme($packagePath, $packageInfo); - $content = $readme - ? file_get_contents(Path::join($packagePath, $readme)) - : false; - - if (!$readme || $content === false) { - throw new PackageReadmeIsMissing( - $context, - Path::join($basePath, $package->getFilename()), - ); + $readme = yield $package->getPath(Cast::toString($packageInfo['readme'] ?: 'README.md')); + $content = $readme->getContent(); + + if (!$content) { + throw new PackageReadmeIsEmpty($context, $package, $readme); } - // Extract + // Title? $packageTitle = Markdown::getTitle($content); - $readmePath = Path::join($basePath, $package->getFilename(), $readme); - - if ($packageTitle) { - $upgrade = $this->getPackageUpgrade($packagePath, $packageInfo); - $upgradePath = $upgrade - ? Path::join($basePath, $package->getFilename(), $upgrade) - : null; - - $packages[] = [ - 'path' => $readmePath, - 'title' => $packageTitle, - 'summary' => Markdown::getSummary($content), - 'upgrade' => $upgradePath, - ]; - } else { - throw new DocumentTitleIsMissing($context, $readmePath); + + if (!$packageTitle) { + throw new PackageReadmeTitleIsMissing($context, $package, $readme); } + + // Add + $upgrade = $package->getPath('UPGRADE.md'); + $upgrade = is_file($upgrade) + ? Path::getRelativePath($context->file->getPath(), $upgrade) + : null; + $packages[] = [ + 'path' => $readme->getRelativePath($context->file), + 'title' => $packageTitle, + 'summary' => Markdown::getSummary($content), + 'upgrade' => $upgrade, + ]; } // Packages? @@ -137,11 +127,10 @@ public function process(Context $context, mixed $target, mixed $parameters): str /** * @return array|null */ - protected function getPackageInfo(string $path): ?array { + protected function getPackageInfo(File $file): ?array { try { - $file = Path::join($path, 'composer.json'); - $package = is_file($file) ? file_get_contents($file) : false; - $package = $package !== false + $package = $file->getContent(); + $package = $package ? json_decode($package, true, flags: JSON_THROW_ON_ERROR) : null; @@ -152,39 +141,4 @@ protected function getPackageInfo(string $path): ?array { return $package; } - - /** - * @param array $package - */ - protected function getPackageReadme(string $path, array $package): ?string { - return $this->getPackageFile($path, [ - $package['readme'] ?? null, - 'README.md', - ]); - } - - /** - * @param array $package - */ - protected function getPackageUpgrade(string $path, array $package): ?string { - return $this->getPackageFile($path, [ - 'UPGRADE.md', - ]); - } - - /** - * @param array $variants - */ - private function getPackageFile(string $path, array $variants): ?string { - $file = null; - - foreach ($variants as $variant) { - if ($variant && is_string($variant) && is_file(Path::getPath($path, $variant))) { - $file = $variant; - break; - } - } - - return $file; - } } diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest.php index f75bc4cf2..bb452de3d 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest.php @@ -2,16 +2,22 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList; +// @phpcs:disable Generic.Files.LineLength.TooLong + +use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\DocumentTitleIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\PackageComposerJsonIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\PackageReadmeIsMissing; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\DirectoryPath; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Exceptions\PackageComposerJsonIsMissing; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Exceptions\PackageReadmeIsEmpty; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Exceptions\PackageReadmeTitleIsMissing; +use LastDragon_ru\LaraASP\Documentator\Processor\Exceptions\FileDependencyNotFound; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; -use function basename; +use function dirname; /** * @internal @@ -21,14 +27,15 @@ final class InstructionTest extends TestCase { // // ========================================================================= #[DataProvider('dataProviderProcess')] - public function testProcess(string $expected, string $template): void { - $path = self::getTestData()->file('Document.md')->getPathname(); - $target = basename(self::getTestData()->path('/packages')); + public function testInvoke(string $expected, string $template): void { + $path = Path::normalize(self::getTestData()->path('Document.md')); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $target = new Directory($root->getPath('packages'), false); $params = new Parameters(template: $template); - $context = new Context($path, $target, ''); - $resolved = (new DirectoryPath())->resolve($context, null); + $context = new Context($root, $file, $target->getPath(), ''); $instance = $this->app()->make(Instruction::class); - $actual = $instance->process($context, $resolved, $params); + $actual = ProcessorHelper::runInstruction($instance, $context, $target, $params); self::assertEquals( self::getTestData()->content($expected), @@ -40,49 +47,80 @@ public function testProcess(string $expected, string $template): void { ); } - public function testProcessNotAPackage(): void { - $path = self::getTestData()->file('Document.md')->getPathname(); - $target = basename(self::getTestData()->path('/invalid')); + public function testInvokeNotAPackage(): void { + $path = Path::normalize(self::getTestData()->path('Document.md')); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $target = new Directory($root->getPath('invalid'), false); + $params = new Parameters(); + $context = new Context($root, $file, $target->getPath(), ''); + $instance = $this->app()->make(Instruction::class); + $package = $target->getDirectory('package'); + + self::assertNotNull($package); + self::expectExceptionObject( + new PackageComposerJsonIsMissing($context, $package), + ); + + ProcessorHelper::runInstruction($instance, $context, $target, $params); + } + + public function testInvokeNoReadme(): void { + $path = self::getTestData()->path('Document.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $target = new Directory($root->getPath('no readme'), false); $params = new Parameters(); - $context = new Context($path, $target, ''); - $resolved = (new DirectoryPath())->resolve($context, null); + $context = new Context($root, $file, $target->getPath(), ''); $instance = $this->app()->make(Instruction::class); + $package = $target->getDirectory('package'); + self::assertNotNull($package); self::expectExceptionObject( - new PackageComposerJsonIsMissing($context, 'invalid/package'), + new FileDependencyNotFound($context->root, $context->file, 'no readme/package/README.md'), ); - $instance->process($context, $resolved, $params); + ProcessorHelper::runInstruction($instance, $context, $target, $params); } - public function testProcessNoReadme(): void { - $path = self::getTestData()->file('Document.md')->getPathname(); - $target = basename(self::getTestData()->path('/no readme')); + public function testInvokeEmptyReadme(): void { + $path = self::getTestData()->path('Document.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $target = new Directory($root->getPath('empty readme'), false); $params = new Parameters(); - $context = new Context($path, $target, ''); - $resolved = (new DirectoryPath())->resolve($context, null); + $context = new Context($root, $file, $target->getPath(), ''); $instance = $this->app()->make(Instruction::class); + $package = $target->getDirectory('package'); + $expected = $root->getFile('empty readme/package/README.md'); + self::assertNotNull($package); + self::assertNotNull($expected); self::expectExceptionObject( - new PackageReadmeIsMissing($context, 'no readme/package'), + new PackageReadmeIsEmpty($context, $package, $expected), ); - $instance->process($context, $resolved, $params); + ProcessorHelper::runInstruction($instance, $context, $target, $params); } - public function testProcessNoTitle(): void { - $path = self::getTestData()->file('Document.md')->getPathname(); - $target = basename(self::getTestData()->path('/no title')); + public function testInvokeNoTitle(): void { + $path = self::getTestData()->path('Document.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); + $target = new Directory($root->getPath('no title'), false); $params = new Parameters(); - $context = new Context($path, $target, ''); - $resolved = (new DirectoryPath())->resolve($context, null); + $context = new Context($root, $file, $target->getPath(), ''); $instance = $this->app()->make(Instruction::class); + $package = $target->getDirectory('package'); + $expected = $root->getFile('no title/package/README.md'); + self::assertNotNull($package); + self::assertNotNull($expected); self::expectExceptionObject( - new DocumentTitleIsMissing($context, 'no title/package/README.md'), + new PackageReadmeTitleIsMissing($context, $package, $expected), ); - $instance->process($context, $resolved, $params); + ProcessorHelper::runInstruction($instance, $context, $target, $params); } // diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/Document.md b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/Document.md new file mode 100644 index 000000000..4b5481e8e --- /dev/null +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/Document.md @@ -0,0 +1,3 @@ +# Document + +bla bla bla diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/empty readme/package/README.md b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/empty readme/package/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/empty readme/package/composer.json b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/empty readme/package/composer.json new file mode 100644 index 000000000..0a9113a4a --- /dev/null +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/empty readme/package/composer.json @@ -0,0 +1,5 @@ +{ + "name": "lastdragon-ru/lara-asp-documentator", + "homepage": "https://github.com/LastDragon-ru/lara-asp", + "readme": "README.md" +} diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/invalid/package/composer.json b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/invalid/package/composer.json new file mode 100644 index 000000000..609bdea41 --- /dev/null +++ b/packages/documentator/src/Preprocessor/Instructions/IncludePackageList/InstructionTest/invalid/package/composer.json @@ -0,0 +1 @@ +broken json diff --git a/packages/documentator/src/Preprocessor/Exceptions/TemplateDataMissed.php b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php similarity index 64% rename from packages/documentator/src/Preprocessor/Exceptions/TemplateDataMissed.php rename to packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php index 332f58b9f..7073c8b4c 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TemplateDataMissed.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateDataMissed.php @@ -1,8 +1,9 @@ path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Exceptions/TemplateVariablesMissed.php b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php similarity index 76% rename from packages/documentator/src/Preprocessor/Exceptions/TemplateVariablesMissed.php rename to packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php index 319c79df3..56925b962 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TemplateVariablesMissed.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateVariablesMissed.php @@ -1,8 +1,9 @@ variables).'`', - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Exceptions/TemplateVariablesUnused.php b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php similarity index 76% rename from packages/documentator/src/Preprocessor/Exceptions/TemplateVariablesUnused.php rename to packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php index b816b8b09..770260609 100644 --- a/packages/documentator/src/Preprocessor/Exceptions/TemplateVariablesUnused.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Exceptions/TemplateVariablesUnused.php @@ -1,8 +1,9 @@ variables).'`', - $context->path, + $context->file->getRelativePath($context->root), ), $previous, ); diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Instruction.php b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Instruction.php index f53960493..74393be93 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Instruction.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/Instruction.php @@ -4,10 +4,11 @@ use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction as InstructionContract; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TemplateDataMissed; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TemplateVariablesMissed; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TemplateVariablesUnused; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Targets\FileContent; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Exceptions\TemplateDataMissed; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Exceptions\TemplateVariablesMissed; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Exceptions\TemplateVariablesUnused; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Resolvers\FileResolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use Override; use function array_diff; @@ -22,7 +23,7 @@ /** * Includes the `` as a template. * - * @implements InstructionContract + * @implements InstructionContract */ class Instruction implements InstructionContract { public function __construct() { @@ -36,7 +37,7 @@ public static function getName(): string { #[Override] public static function getResolver(): string { - return FileContent::class; + return FileResolver::class; } #[Override] @@ -45,7 +46,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { // Data? if (!$parameters->data) { throw new TemplateDataMissed($context); @@ -56,7 +57,7 @@ public function process(Context $context, mixed $target, mixed $parameters): str $used = []; $known = []; $count = 0; - $content = $target; + $content = $target->getContent(); do { $content = (string) preg_replace_callback( diff --git a/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/InstructionTest.php b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/InstructionTest.php index f8b06109a..2591533da 100644 --- a/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/InstructionTest.php +++ b/packages/documentator/src/Preprocessor/Instructions/IncludeTemplate/InstructionTest.php @@ -2,25 +2,32 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate; +use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Context; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TemplateDataMissed; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TemplateVariablesMissed; -use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\TemplateVariablesUnused; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Exceptions\TemplateDataMissed; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Exceptions\TemplateVariablesMissed; +use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Exceptions\TemplateVariablesUnused; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use PHPUnit\Framework\Attributes\CoversClass; +use function dirname; + /** * @internal */ #[CoversClass(Instruction::class)] final class InstructionTest extends TestCase { - public function testProcess(): void { + public function testInvoke(): void { + $root = new Directory(Path::normalize(__DIR__), false); + $file = new File(Path::normalize(self::getTestData()->path('.md')), false); $params = new Parameters([ 'a' => 'Relative', 'b' => 'Inner reference ${a}', ]); - $content = self::getTestData()->content('.md'); - $context = new Context('/path/to/file.md', '/path/to/file.md', ''); + $context = new Context($root, $file, '/path/to/file.md', ''); $instance = $this->app()->make(Instruction::class); self::assertEquals( @@ -31,56 +38,58 @@ public function testProcess(): void { FILE , - $instance->process($context, $content, $params), + ProcessorHelper::runInstruction($instance, $context, $file, $params), ); } - public function testProcessNoData(): void { - $file = 'path/to/file.md'; + public function testInvokeNoData(): void { + $root = new Directory(Path::normalize(__DIR__), false); + $file = new File(Path::normalize(__FILE__), false); $params = new Parameters([]); - $content = 'content'; - $context = new Context($file, $file, ''); + $context = new Context($root, $file, $file->getPath(), ''); $instance = $this->app()->make(Instruction::class); self::expectExceptionObject( new TemplateDataMissed($context), ); - $instance->process($context, $content, $params); + ProcessorHelper::runInstruction($instance, $context, $file, $params); } - public function testProcessVariablesUnused(): void { - $file = self::getTestData()->file('.md'); + public function testInvokeVariablesUnused(): void { + $path = self::getTestData()->path('.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = new Parameters([ 'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D', ]); - $content = self::getTestData()->content('.md'); - $context = new Context($file->getPathname(), $file->getFilename(), ''); + $context = new Context($root, $file, $file->getName(), ''); $instance = $this->app()->make(Instruction::class); self::expectExceptionObject( new TemplateVariablesUnused($context, ['c', 'd']), ); - $instance->process($context, $content, $params); + ProcessorHelper::runInstruction($instance, $context, $file, $params); } - public function testProcessVariablesMissed(): void { - $file = self::getTestData()->file('.md'); + public function testInvokeVariablesMissed(): void { + $path = self::getTestData()->path('.md'); + $root = new Directory(dirname($path), false); + $file = new File($path, false); $params = new Parameters([ 'a' => 'A', ]); - $content = self::getTestData()->content('.md'); - $context = new Context($file->getPathname(), $file->getFilename(), ''); + $context = new Context($root, $file, $file->getName(), ''); $instance = $this->app()->make(Instruction::class); self::expectExceptionObject( new TemplateVariablesMissed($context, ['b']), ); - $instance->process($context, $content, $params); + ProcessorHelper::runInstruction($instance, $context, $file, $params); } } diff --git a/packages/documentator/src/Preprocessor/Preprocessor.php b/packages/documentator/src/Preprocessor/Preprocessor.php index e7e31f2f2..54dcdeff2 100644 --- a/packages/documentator/src/Preprocessor/Preprocessor.php +++ b/packages/documentator/src/Preprocessor/Preprocessor.php @@ -5,8 +5,8 @@ // @phpcs:disable Generic.Files.LineLength.TooLong use Exception; +use Generator; use LastDragon_ru\LaraASP\Core\Application\ContainerResolver; -use LastDragon_ru\LaraASP\Core\Utils\Path; use LastDragon_ru\LaraASP\Documentator\Commands\Preprocess; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Exceptions\PreprocessingFailed; @@ -19,22 +19,32 @@ use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeGraphqlDirective\Instruction as IncludeGraphqlDirective; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludePackageList\Instruction as IncludePackageList; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Instructions\IncludeTemplate\Instruction as IncludeTemplate; +use LastDragon_ru\LaraASP\Documentator\Processor\Contracts\Task; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; use LastDragon_ru\LaraASP\Serializer\Contracts\Serializer; +use Override; +use SplFileInfo; -use function array_column; +use function array_map; +use function array_values; use function hash; use function is_array; use function json_decode; use function json_encode; use function ksort; +use function mb_strlen; use function mb_substr; -use function preg_replace_callback; +use function preg_match_all; use function rawurldecode; use function str_ends_with; use function str_starts_with; +use function strtr; use function trim; +use function uksort; use const JSON_THROW_ON_ERROR; +use const PREG_SET_ORDER; use const PREG_UNMATCHED_AS_NULL; /** @@ -66,7 +76,7 @@ * * @see Preprocess */ -class Preprocessor { +class Preprocessor implements Task { protected const Warning = 'Generated automatically. Do not edit.'; protected const Regexp = <<<'REGEXP' /^ @@ -83,7 +93,7 @@ class Preprocessor { REGEXP; /** - * @var array>,?Instruction}> + * @var array> */ private array $instructions = []; @@ -105,7 +115,7 @@ public function __construct( * @return list>> */ public function getInstructions(): array { - return array_column($this->instructions, 0); + return array_values(array_map(static fn ($i) => $i->getClass(), $this->instructions)); } /** @@ -115,111 +125,149 @@ public function getInstructions(): array { */ public function addInstruction(Instruction|string $instruction): static { // @phpstan-ignore-next-line Assigment is fine... - $this->instructions[$instruction::getName()] = $instruction instanceof Instruction - ? [$instruction::class, $instruction] - : [$instruction, null]; + $this->instructions[$instruction::getName()] = new ResolvedInstruction($this->container, $instruction); return $this; } /** - * @return Instruction|null + * @inheritDoc */ - protected function getInstruction(string $name): ?Instruction { - if (!isset($this->instructions[$name])) { - return null; - } - - if (!isset($this->instructions[$name][1])) { - $this->instructions[$name][1] = $this->container->getInstance()->make( - $this->instructions[$name][0], - ); - } - - return $this->instructions[$name][1]; + #[Override] + public function getExtensions(): array { + return ['md']; } - public function process(string $path, string $string): string { - $path = Path::normalize($path); - $cache = []; - $result = null; - - try { - $result = preg_replace_callback( - pattern : static::Regexp, - callback: function (array $matches) use (&$cache, $path): string { - // Instruction? - $instruction = $this->getInstruction($matches['instruction']); - - if (!$instruction) { - return $matches['expression']; - } - - // Hash - $target = $matches['target']; - $target = str_starts_with($target, '<') && str_ends_with($target, '>') - ? mb_substr($target, 1, -1) - : rawurldecode($target); - $json = $this->getParametersJson($matches['parameters'] ?: '{}'); - $hash = $this->getHash("{$matches['instruction']}({$target}, {$json})"); - - // Content - $content = $cache[$hash] ?? null; - - if ($content === null) { - $params = $instruction::getParameters(); - $params = $params ? $this->serializer->deserialize($params, $json, 'json') : null; - $context = new Context($path, $target, $matches['parameters']); - $resolver = $this->container->getInstance()->make($instruction::getResolver()); - $resolved = $resolver->resolve($context, $params); - $content = $instruction->process($context, $resolved, $params); - $content = trim($content); - $cache[$hash] = $content; - } - - // Return - $warning = static::Warning; - $prefix = << + */ + #[Override] + public function __invoke(Directory $root, File $file): Generator { + // Process + $parsed = $this->parse($root, $file); + $replace = []; + $warning = static::Warning; + + foreach ($parsed->tokens as $hash => $token) { + try { + // Resolve target + $target = ($token->resolver)($token->context, $token->parameters); + + if ($target instanceof Generator) { + yield from $target; + + $target = $target->getReturn(); + } + + // Run + $content = ($token->instruction)($token->context, $target, $token->parameters); + + if ($content instanceof Generator) { + yield from $content; + + $content = $content->getReturn(); + } + + $content = trim($content); + } catch (PreprocessorError $exception) { + throw $exception; + } catch (Exception $exception) { + throw new PreprocessingFailed($exception); + } + + foreach ($token->matches as $match => $expression) { + $prefix = << << << mb_strlen($a); + }); + + // Replace + $file->setContent(strtr($file->getContent(), $replace)); + + return true; + } + + protected function parse(Directory $root, File $file): TokenList { + // Extract all possible instructions + $tokens = []; + $matches = []; + + if (!preg_match_all(static::Regexp, $file->getContent(), $matches, PREG_SET_ORDER | PREG_UNMATCHED_AS_NULL)) { + return new TokenList($tokens); } - if ($result === null) { - throw new PreprocessingFailed(); + // Parse each of them + foreach ($matches as $match) { + // Instruction? + $name = (string) $match['instruction']; + $instruction = $this->instructions[$name] ?? null; + + if (!$instruction) { + continue; + } + + // Hash + $parameters = $instruction->getClass()::getParameters(); + $target = (string) $match['target']; + $target = str_starts_with($target, '<') && str_ends_with($target, '>') + ? mb_substr($target, 1, -1) + : rawurldecode($target); + $params = $parameters && $match['parameters'] + ? $this->getParametersJson($match['parameters']) + : '{}'; + $hash = $this->getHash("{$name}({$target}, {$params})"); + + // Parsed? + if (isset($tokens[$hash])) { + $tokens[$hash]->matches[$match[0]] = (string) $match['expression']; + + continue; + } + + // Parse + $context = new Context($root, $file, $target, $match['parameters']); + $parameters = $parameters + ? $this->serializer->deserialize($parameters, $params, 'json') + : null; + + $tokens[$hash] = new Token( + $instruction->getInstance(), + $instruction->getResolver(), + $context, + $parameters, + [ + $match[0] => (string) $match['expression'], + ], + ); } - return $result; + // Return + return new TokenList($tokens); } protected function getHash(string $identifier): string { diff --git a/packages/documentator/src/Preprocessor/PreprocessorTest.php b/packages/documentator/src/Preprocessor/PreprocessorTest.php index 28837c629..0869f97f9 100644 --- a/packages/documentator/src/Preprocessor/PreprocessorTest.php +++ b/packages/documentator/src/Preprocessor/PreprocessorTest.php @@ -2,10 +2,17 @@ namespace LastDragon_ru\LaraASP\Documentator\Preprocessor; +use LastDragon_ru\LaraASP\Core\Application\ContainerResolver; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Instruction; use LastDragon_ru\LaraASP\Documentator\Preprocessor\Contracts\Resolver; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\Directory; +use LastDragon_ru\LaraASP\Documentator\Processor\FileSystem\File; +use LastDragon_ru\LaraASP\Documentator\Testing\Package\ProcessorHelper; use LastDragon_ru\LaraASP\Documentator\Testing\Package\TestCase; use LastDragon_ru\LaraASP\Serializer\Contracts\Serializable; +use LastDragon_ru\LaraASP\Serializer\Contracts\Serializer; +use LastDragon_ru\LaraASP\Testing\Mockery\MockProperties; +use Mockery; use Override; use PHPUnit\Framework\Attributes\CoversClass; @@ -19,41 +26,155 @@ */ #[CoversClass(Preprocessor::class)] final class PreprocessorTest extends TestCase { - public function testProcess(): void { - $content = <<<'MARKDOWN' - Bla bla bla [processable]: ./path/to/file should be ignored. + private const MARKDOWN = <<<'MARKDOWN' + Bla bla bla [processable]: ./path/to/file should be ignored. - [unknown]: ./path/to/file (should not be parsed) + [unknown]: ./path/to/file (should not be parsed) - [test:empty]: ./path/to/file + [test:empty]: ./path/to/file - [test:instruction]: ./path/to/file + [test:instruction]: ./path/to/file - [test:instruction]: <./path/to/file> - [//]: # (start: hash) + [test:instruction]: <./path/to/file> + [//]: # (start: hash) - [test:instruction]: ./path/to/file - [//]: # (start: nested-hash) + [test:instruction]: ./path/to/file + [//]: # (start: nested-hash) - outdated + outdated - [//]: # (end: nested-hash) + [//]: # (end: nested-hash) - [//]: # (end: hash) + [//]: # (end: hash) - [test:instruction]: ./path/to/file + [test:instruction]: ./path/to/file - [test:instruction]: ./path/to/file + [test:instruction]: ./path/to/file - [test:instruction]: ./path/to/file/parametrized ({"a": "aa", "b": {"a": "a", "b": "b"}}) + [test:instruction]: ./path/to/file/parametrized ({"a": "aa", "b": {"a": "a", "b": "b"}}) - [test:instruction]: ./path/to/file/parametrized ({"b":{ "b": "b","a": "a"},"a":"aa"}) - MARKDOWN; + [test:instruction]: ./path/to/file/parametrized ({"b":{ "b": "b","a": "a"},"a":"aa"}) + MARKDOWN; + public function testParse(): void { + $a = new PreprocessorTest__EmptyInstruction(); + $b = new PreprocessorTest__TestInstruction(); + $preprocessor = Mockery::mock(Preprocessor::class, MockProperties::class); + $preprocessor->shouldAllowMockingProtectedMethods(); + $preprocessor->makePartial(); + $preprocessor + ->shouldUseProperty('container') + ->value( + $this->app()->make(ContainerResolver::class), + ); + $preprocessor + ->shouldUseProperty('serializer') + ->value( + $this->app()->make(Serializer::class), + ); + + $preprocessor->addInstruction($a); + $preprocessor->addInstruction($b); + + $file = Mockery::mock(File::class); + $file + ->shouldReceive('getContent') + ->once() + ->andReturn(self::MARKDOWN); + + $root = Mockery::mock(Directory::class); + $tokens = $preprocessor->parse($root, $file); + + self::assertEquals( + new TokenList([ + '88d510d98112f651df2ae08444a402cd8b6516cf4c27ad6115dbb2c03fe9ec62' => new Token( + $a, + new PreprocessorTest__TargetResolverAsIs(), + new Context($root, $file, './path/to/file', null), + null, + [ + '[test:empty]: ./path/to/file' => '[test:empty]: ./path/to/file', + ], + ), + '4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095' => new Token( + $b, + new PreprocessorTest__TargetResolverAsValue(), + new Context($root, $file, './path/to/file', null), + new PreprocessorTest__Parameters(), + [ + // phpcs:disable Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned + '[test:instruction]: ./path/to/file' => '[test:instruction]: ./path/to/file', + <<<'TXT' + [test:instruction]: <./path/to/file> + [//]: # (start: hash) + + [test:instruction]: ./path/to/file + [//]: # (start: nested-hash) + + outdated + + [//]: # (end: nested-hash) + + [//]: # (end: hash) + TXT + => '[test:instruction]: <./path/to/file>', + // phpcs:enable + ], + ), + 'ebe11a5c6bf74b7f70eec0c6b14ad768e159a9699273d7f07824ef116b37dfd3' => new Token( + $b, + new PreprocessorTest__TargetResolverAsValue(), + new Context( + $root, + $file, + './path/to/file/parametrized', + '{"a": "aa", "b": {"a": "a", "b": "b"}}', + ), + new PreprocessorTest__Parameters( + 'aa', + [ + 'a' => 'a', + 'b' => 'b', + ], + ), + [ + '[test:instruction]: ./path/to/file/parametrized ({"a": "aa", "b": {"a": "a", "b": "b"}})' => '' + .'[test:instruction]: ./path/to/file/parametrized ({"a": "aa", "b": {"a": "a", "b": "b"}})', + '[test:instruction]: ./path/to/file/parametrized ({"b":{ "b": "b","a": "a"},"a":"aa"})' => '' + .'[test:instruction]: ./path/to/file/parametrized ({"b":{ "b": "b","a": "a"},"a":"aa"})', + ], + ), + ]), + $tokens, + ); + } + + public function testInvoke(): void { $preprocessor = $this->app()->make(Preprocessor::class) ->addInstruction(new PreprocessorTest__EmptyInstruction()) ->addInstruction(new PreprocessorTest__TestInstruction()); - + $actual = null; + $file = Mockery::mock(File::class); + $file + ->shouldReceive('getContent') + ->atLeast() + ->once() + ->andReturn(static::MARKDOWN); + $file + ->shouldReceive('setContent') + ->once() + ->andReturnUsing( + static function (string $content) use ($file, &$actual): File { + $actual = $content; + + return $file; + }, + ); + + $root = Mockery::mock(Directory::class); + $result = ProcessorHelper::runTask($preprocessor, $root, $file); + + self::assertTrue($result); self::assertEquals( <<<'MARKDOWN' Bla bla bla [processable]: ./path/to/file should be ignored. @@ -61,42 +182,42 @@ public function testProcess(): void { [unknown]: ./path/to/file (should not be parsed) [test:empty]: ./path/to/file - [//]: # (start: caf14319a44edf638bf2ba4b4c76caab5a3d85ee06d5c86387fbdb703c8b5c84) + [//]: # (start: 88d510d98112f651df2ae08444a402cd8b6516cf4c27ad6115dbb2c03fe9ec62) [//]: # (warning: Generated automatically. Do not edit.) [//]: # (empty) - [//]: # (end: caf14319a44edf638bf2ba4b4c76caab5a3d85ee06d5c86387fbdb703c8b5c84) + [//]: # (end: 88d510d98112f651df2ae08444a402cd8b6516cf4c27ad6115dbb2c03fe9ec62) [test:instruction]: ./path/to/file - [//]: # (start: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (start: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [//]: # (warning: Generated automatically. Do not edit.) result(./path/to/file/a, {"a":"a","b":[]}) - [//]: # (end: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (end: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [test:instruction]: <./path/to/file> - [//]: # (start: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (start: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [//]: # (warning: Generated automatically. Do not edit.) result(./path/to/file/a, {"a":"a","b":[]}) - [//]: # (end: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (end: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [test:instruction]: ./path/to/file - [//]: # (start: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (start: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [//]: # (warning: Generated automatically. Do not edit.) result(./path/to/file/a, {"a":"a","b":[]}) - [//]: # (end: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (end: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [test:instruction]: ./path/to/file - [//]: # (start: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (start: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [//]: # (warning: Generated automatically. Do not edit.) result(./path/to/file/a, {"a":"a","b":[]}) - [//]: # (end: 15a77bf03e0261f0d7d2af698861fc23733fb4f09e0570e3b2570f4fe7b2694c) + [//]: # (end: 4a9c0bb168ac831e7b45d8d7a78694c12ee0a3273de7562cdbc47cdb7f64e095) [test:instruction]: ./path/to/file/parametrized ({"a": "aa", "b": {"a": "a", "b": "b"}}) [//]: # (start: ebe11a5c6bf74b7f70eec0c6b14ad768e159a9699273d7f07824ef116b37dfd3) @@ -114,7 +235,7 @@ public function testProcess(): void { [//]: # (end: ebe11a5c6bf74b7f70eec0c6b14ad768e159a9699273d7f07824ef116b37dfd3) MARKDOWN, - $preprocessor->process('path', $content), + $actual, ); } } @@ -145,7 +266,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { return ''; } } @@ -173,7 +294,7 @@ public static function getParameters(): ?string { } #[Override] - public function process(Context $context, mixed $target, mixed $parameters): string { + public function __invoke(Context $context, mixed $target, mixed $parameters): string { return sprintf('result(%s, %s)', $target->value, json_encode($parameters, JSON_THROW_ON_ERROR)); } } @@ -194,11 +315,11 @@ public function __construct( * @internal * @noinspection PhpMultipleClassesDeclarationsInOneFile * - * @implements Resolver + * @implements Resolver */ class PreprocessorTest__TargetResolverAsIs implements Resolver { #[Override] - public function resolve(Context $context, mixed $parameters): mixed { + public function __invoke(Context $context, mixed $parameters): mixed { return $context->target; } } @@ -207,11 +328,11 @@ public function resolve(Context $context, mixed $parameters): mixed { * @internal * @noinspection PhpMultipleClassesDeclarationsInOneFile * - * @implements Resolver + * @implements Resolver */ class PreprocessorTest__TargetResolverAsValue implements Resolver { #[Override] - public function resolve(Context $context, mixed $parameters): mixed { + public function __invoke(Context $context, mixed $parameters): mixed { return new PreprocessorTest__Value("{$context->target}/{$parameters->a}"); } } diff --git a/packages/documentator/src/Preprocessor/ResolvedInstruction.php b/packages/documentator/src/Preprocessor/ResolvedInstruction.php new file mode 100644 index 000000000..acbb6e5b1 --- /dev/null +++ b/packages/documentator/src/Preprocessor/ResolvedInstruction.php @@ -0,0 +1,70 @@ +> + */ + private readonly string $class; + /** + * @var Resolver|Resolver|null + */ + private ?Resolver $resolver = null; + /** + * @var Instruction|null + */ + private ?Instruction $instance = null; + + /** + * @param Instruction|class-string> $instruction + */ + public function __construct( + protected readonly ContainerResolver $container, + Instruction|string $instruction, + ) { + if (is_object($instruction)) { + $this->class = $instruction::class; + $this->instance = $instruction; + } else { + $this->class = $instruction; + } + } + + /** + * @return Instruction + */ + public function getInstance(): Instruction { + $this->instance ??= $this->container->getInstance()->make($this->class); + + return $this->instance; + } + + /** + * @return Resolver|Resolver + */ + public function getResolver(): Resolver { + $this->resolver ??= $this->container->getInstance()->make($this->class::getResolver()); + + return $this->resolver; + } + + /** + * @return class-string> + */ + public function getClass(): string { + return $this->class; + } +} diff --git a/packages/documentator/src/Preprocessor/Resolvers/DirectoryResolver.php b/packages/documentator/src/Preprocessor/Resolvers/DirectoryResolver.php new file mode 100644 index 000000000..2de4821c3 --- /dev/null +++ b/packages/documentator/src/Preprocessor/Resolvers/DirectoryResolver.php @@ -0,0 +1,27 @@ + + */ +class DirectoryResolver implements Resolver { + #[Override] + public function __invoke(Context $context, mixed $parameters): Directory { + $directory = $context->root->getDirectory($context->file)?->getDirectory($context->target); + + if (!($directory instanceof Directory)) { + throw new TargetIsNotDirectory($context); + } + + return $directory; + } +} diff --git a/packages/documentator/src/Preprocessor/Resolvers/FileResolver.php b/packages/documentator/src/Preprocessor/Resolvers/FileResolver.php new file mode 100644 index 000000000..82328d065 --- /dev/null +++ b/packages/documentator/src/Preprocessor/Resolvers/FileResolver.php @@ -0,0 +1,25 @@ + + */ +class FileResolver implements Resolver { + /** + * @return Generator + */ + #[Override] + public function __invoke(Context $context, mixed $parameters): Generator { + return yield $context->target; + } +} diff --git a/packages/documentator/src/Preprocessor/Targets/DirectoryPath.php b/packages/documentator/src/Preprocessor/Targets/DirectoryPath.php deleted file mode 100644 index 2b5a2d391..000000000 --- a/packages/documentator/src/Preprocessor/Targets/DirectoryPath.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -class DirectoryPath implements Resolver { - public function __construct() { - // empty - } - - #[Override] - public function resolve(Context $context, mixed $parameters): string { - $path = Path::getPath(dirname($context->path), $context->target); - - if (!is_dir($path)) { - throw new TargetIsNotDirectory($context); - } - - return $path; - } -} diff --git a/packages/documentator/src/Preprocessor/Targets/DirectoryPathTest.php b/packages/documentator/src/Preprocessor/Targets/DirectoryPathTest.php deleted file mode 100644 index 224666197..000000000 --- a/packages/documentator/src/Preprocessor/Targets/DirectoryPathTest.php +++ /dev/null @@ -1,56 +0,0 @@ -resolve($context, $params), - ); - } - - public function testResolveAbsolute(): void { - $dir = __DIR__; - $target = $dir; - $params = null; - $context = new Context($dir, $target, null); - $resolver = new DirectoryPath(); - - self::assertSame( - Path::normalize($dir), - $resolver->resolve($context, $params), - ); - } - - public function testResolveNotADirectory(): void { - $dir = __DIR__; - $target = 'not/a/directory'; - $params = null; - $context = new Context($dir, $target, null); - $resolver = new DirectoryPath(); - - self::expectException(TargetIsNotDirectory::class); - self::expectExceptionMessage("The `{$target}` is not a directory (in `{$dir}`)."); - - $resolver->resolve($context, $params); - } -} diff --git a/packages/documentator/src/Preprocessor/Targets/FileContent.php b/packages/documentator/src/Preprocessor/Targets/FileContent.php deleted file mode 100644 index 9967ca068..000000000 --- a/packages/documentator/src/Preprocessor/Targets/FileContent.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ -class FilePath implements Resolver { - public function __construct() { - // empty - } - - #[Override] - public function resolve(Context $context, mixed $parameters): string { - $path = Path::getPath(dirname($context->path), $context->target); - - if (!is_file($path) || !is_readable($path)) { - throw new TargetIsNotFile($context); - } - - return $path; - } -} diff --git a/packages/documentator/src/Preprocessor/Targets/FilePathTest.php b/packages/documentator/src/Preprocessor/Targets/FilePathTest.php deleted file mode 100644 index 79d5d8390..000000000 --- a/packages/documentator/src/Preprocessor/Targets/FilePathTest.php +++ /dev/null @@ -1,56 +0,0 @@ -resolve($context, $params), - ); - } - - public function testResolveAbsolute(): void { - $file = __FILE__; - $target = $file; - $params = null; - $context = new Context($file, $target, null); - $resolver = new FilePath(); - - self::assertSame( - Path::normalize($file), - $resolver->resolve($context, $params), - ); - } - - public function testResolveNotAFile(): void { - $file = __FILE__; - $target = 'not/a/file'; - $params = null; - $context = new Context($file, $target, null); - $resolver = new FilePath(); - - self::expectException(TargetIsNotFile::class); - self::expectExceptionMessage("The `{$target}` is not a file (in `{$file}`)."); - - $resolver->resolve($context, $params); - } -} diff --git a/packages/documentator/src/Preprocessor/Token.php b/packages/documentator/src/Preprocessor/Token.php new file mode 100644 index 000000000..e17158ae8 --- /dev/null +++ b/packages/documentator/src/Preprocessor/Token.php @@ -0,0 +1,36 @@ + + */ + public readonly Instruction $instruction, + /** + * @var Resolver|Resolver + */ + public readonly Resolver $resolver, + public readonly Context $context, + /** + * @var TParameters + */ + public readonly mixed $parameters, + /** + * @var array + */ + public array $matches, + ) { + // empty + } +} diff --git a/packages/documentator/src/Preprocessor/TokenList.php b/packages/documentator/src/Preprocessor/TokenList.php new file mode 100644 index 000000000..3b59a2619 --- /dev/null +++ b/packages/documentator/src/Preprocessor/TokenList.php @@ -0,0 +1,17 @@ +> + */ + public readonly array $tokens, + ) { + // empty + } +} diff --git a/packages/documentator/src/Testing/Package/ProcessorHelper.php b/packages/documentator/src/Testing/Package/ProcessorHelper.php new file mode 100644 index 000000000..e64024c1b --- /dev/null +++ b/packages/documentator/src/Testing/Package/ProcessorHelper.php @@ -0,0 +1,83 @@ + $instruction + * @param T $target + * @param P $parameters + */ + public static function runInstruction( + Instruction $instruction, + Context $context, + mixed $target, + mixed $parameters, + ): string { + $result = ($instruction)($context, $target, $parameters); + $result = $result instanceof Generator + ? Cast::toString(self::getResult($context->root, $context->file, $result)) + : $result; + + return $result; + } + + /** + * @param Generator $generator + */ + protected static function getResult(Directory $root, File $file, Generator $generator): mixed { + while ($generator->valid()) { + $generator->send(self::getFile($root, $file, $generator)); + } + + return $generator->getReturn(); + } + + /** + * @param Generator $generator + */ + protected static function getFile(Directory $root, File $file, Generator $generator): File { + $path = $generator->current(); + $path = match (true) { + $path instanceof SplFileInfo => $path->getPathname(), + $path instanceof File => $path->getPath(), + default => $path, + }; + $directory = dirname($file->getPath()); + $dependency = $root->getFile(Path::getPath($directory, $path)); + + if (!$dependency) { + throw new FileDependencyNotFound($root, $file, $path); + } + + return $dependency; + } +} diff --git a/packages/eloquent/README.md b/packages/eloquent/README.md index 97e44f976..eabad5262 100644 --- a/packages/eloquent/README.md +++ b/packages/eloquent/README.md @@ -3,7 +3,7 @@ This package contains useful extensions and mixins for [Eloquent](https://laravel.com/docs/eloquent). [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -25,7 +25,7 @@ This package contains useful extensions and mixins for [Eloquent](https://larave | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "eloquent"}}) [//]: # (start: 1c6aa4607fbf4f4c0efb2249a42271075a45316e15a4fe7f914d8bb883f71ea2) @@ -101,21 +101,21 @@ foreach ($query->getChangeSafeIterator() as $user) { | `getChangeSafeIteratorIterator()` | Return [`ChunkedChangeSafeIterator`](./src/Iterators/ChunkedChangeSafeIterator.php) instance. | [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/eloquent/UPGRADE.md b/packages/eloquent/UPGRADE.md index 4db3e25b6..d844e9738 100644 --- a/packages/eloquent/UPGRADE.md +++ b/packages/eloquent/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,24 +25,24 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) diff --git a/packages/formatter/README.md b/packages/formatter/README.md index eec043db9..bf28c6dd7 100644 --- a/packages/formatter/README.md +++ b/packages/formatter/README.md @@ -3,7 +3,7 @@ This package provides a customizable wrapper around [Intl](https://www.php.net/manual/en/book.intl) formatters to use it inside Laravel application. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -25,7 +25,7 @@ This package provides a customizable wrapper around [Intl](https://www.php.net/m | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "formatter"}}) [//]: # (start: ca18ec42d5b2c99e52f3a550acc6e29f65958871ab3405d38e82ef8eab2ad415) @@ -44,7 +44,7 @@ composer require lastdragon-ru/lara-asp-formatter Formatter is very simple to use: [include:example]: ./docs/Examples/Usage.php -[//]: # (start: c709a4b715d1bde109a5d27982a2a5d6f481b5c72338e162e394ccbb6fc9208a) +[//]: # (start: adef85def212f87b8f157b40eaa0695da87e1a6f63e1e1ebc9fff474ecad3fee) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -79,7 +79,7 @@ The `$locale->decimal(123.454321)` is: "123,45" ``` -[//]: # (end: c709a4b715d1bde109a5d27982a2a5d6f481b5c72338e162e394ccbb6fc9208a) +[//]: # (end: adef85def212f87b8f157b40eaa0695da87e1a6f63e1e1ebc9fff474ecad3fee) Please check [source code](./src/Formatter.php) to see available methods and [config example](defaults/config.php) to available settings 🤗 @@ -92,7 +92,7 @@ php artisan vendor:publish --provider=LastDragon_ru\\LaraASP\\Formatter\\Provide ``` [include:example]: ./docs/Examples/Config.php -[//]: # (start: 5a587883c875573a9d3678bc736730f7a394c6f0ed287bfe4ccd2d2b9009a42e) +[//]: # (start: 79abdc1016ae295c77f37d2c430cec8b2de87be7096c32913e441a5d5057ec31) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -156,7 +156,7 @@ The `$locale->date($datetime, 'custom')` is: "30.12.2023" ``` -[//]: # (end: 5a587883c875573a9d3678bc736730f7a394c6f0ed287bfe4ccd2d2b9009a42e) +[//]: # (end: 79abdc1016ae295c77f37d2c430cec8b2de87be7096c32913e441a5d5057ec31) # Duration @@ -184,7 +184,7 @@ The syntax is the same as [ICU Date/Time format syntax](https://unicode-org.gith [//]: # (end: 363cfceaffb54119c82e514732db74b5265a5fc6724699580b2d3c677c1258f7) [include:example]: ./docs/Examples/Duration.php -[//]: # (start: faff341985cd0ca05372c01461e1e4c151f5131fc7a76722fd00aac905a68ff9) +[//]: # (start: 4601baed9dde5929ecc10d49ca83c24f5f9b1394fefd9f200fbc3085d5469cf1) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -219,24 +219,24 @@ The `$locale->duration(1234543)` is: "342:55:43.000" ``` -[//]: # (end: faff341985cd0ca05372c01461e1e4c151f5131fc7a76722fd00aac905a68ff9) +[//]: # (end: 4601baed9dde5929ecc10d49ca83c24f5f9b1394fefd9f200fbc3085d5469cf1) [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/formatter/UPGRADE.md b/packages/formatter/UPGRADE.md index bdfeb0e03..87c2b6cd8 100644 --- a/packages/formatter/UPGRADE.md +++ b/packages/formatter/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,26 +25,26 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) * [ ] If you are passing `\IntlDateFormatter::*` constants as `$format` argument for `Formatter::time()`/`Formatter::date()`/`Formatter::datetime()`, add a new custom format(s) which will refer to `\IntlDateFormatter::*` constant(s). diff --git a/packages/graphql-printer/README.md b/packages/graphql-printer/README.md index c9fdeb5ce..a0dd0ddaf 100644 --- a/packages/graphql-printer/README.md +++ b/packages/graphql-printer/README.md @@ -3,7 +3,7 @@ Independent (from Laravel and Lighthouse) package that allow you to print GraphQL Schema and Queries in highly customized way eg you can choose indent size, print only used/wanted/all types, print only one type, print used/wanted/all directives ([it is not possible with standard printer](https://github.com/webonyx/graphql-php/issues/552)) and even check which types/directives are used in the Schema/Query. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -18,7 +18,7 @@ Independent (from Laravel and Lighthouse) package that allow you to print GraphQ | | `^15.2.4` | `4.2.0 ⋯ 4.0.0` | | | `^14.11.9` | `3.0.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "graphql-printer"}}) [//]: # (start: dcf3043aff3a50970117872a9bba432cb3ef84a034a0fc88bcdc6d9dcae2ec06) @@ -37,7 +37,7 @@ composer require lastdragon-ru/lara-asp-graphql-printer There are two primary methods: `Printer::print()` and `Printer::export()`. The `print()` will print the current type only, meanwhile `export()` will print the current type and all used types/directives: [include:example]: ./docs/Examples/Usage.php -[//]: # (start: c709a4b715d1bde109a5d27982a2a5d6f481b5c72338e162e394ccbb6fc9208a) +[//]: # (start: adef85def212f87b8f157b40eaa0695da87e1a6f63e1e1ebc9fff474ecad3fee) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -113,7 +113,7 @@ type B } ``` -[//]: # (end: c709a4b715d1bde109a5d27982a2a5d6f481b5c72338e162e394ccbb6fc9208a) +[//]: # (end: adef85def212f87b8f157b40eaa0695da87e1a6f63e1e1ebc9fff474ecad3fee) # Customization @@ -132,7 +132,7 @@ Please see: The Printer allows filter out types and directives. This may be useful to exclude them from the schema completely. Filtering also works for queries. Please note that types filtering will work only if the schema is known (the schema is required to determine the type of argument nodes). For some AST node types, their type may also be required. [include:example]: ./docs/Examples/Filtering.php -[//]: # (start: 963f066509a17e2999eaa0fa940bd0f608ad2fc212eb6511f11b69eae9f7478e) +[//]: # (start: f2eda67ec1e0063562eb72a70bc2fe190de9eb9d4e0fefd01dbf3ca1bbfc48ab) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -215,7 +215,7 @@ query { } ``` -[//]: # (end: 963f066509a17e2999eaa0fa940bd0f608ad2fc212eb6511f11b69eae9f7478e) +[//]: # (end: f2eda67ec1e0063562eb72a70bc2fe190de9eb9d4e0fefd01dbf3ca1bbfc48ab) # Laravel/Lighthouse @@ -224,7 +224,7 @@ It is highly recommended to use [`lara-asp-graphql`][pkg:graphql#Printer] packag # Testing Assertions [include:document-list]: ./docs/Assertions -[//]: # (start: 86d73ad55f2c494dfe35350837400088c82dfa7457eafd0d30392ba96bbbdc9a) +[//]: # (start: faab128ff134f31373650be0e1d23f4adffa84372a29292f956b844fb6baae6d) [//]: # (warning: Generated automatically. Do not edit.) ## `assertGraphQLExportableEquals` @@ -239,32 +239,32 @@ Prints and compares two GraphQL schemas/types/nodes/etc. [Read more](). -[//]: # (end: 86d73ad55f2c494dfe35350837400088c82dfa7457eafd0d30392ba96bbbdc9a) +[//]: # (end: faab128ff134f31373650be0e1d23f4adffa84372a29292f956b844fb6baae6d) [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [include:file]: ../../docs/Shared/Links.md -[//]: # (start: 9ac5c57eb03fcabb221c8db950c2dc20215f17f6e4ab17fd3a5def405da61f91) +[//]: # (start: e3121fcf0782621da11db7a735b38993c2b6560b7b7014aa164a809a3e515040) [//]: # (warning: Generated automatically. Do not edit.) [pkg:graphql#Printer]: https://github.com/LastDragon-ru/lara-asp/tree/main/packages/graphql#Printer -[//]: # (end: 9ac5c57eb03fcabb221c8db950c2dc20215f17f6e4ab17fd3a5def405da61f91) +[//]: # (end: e3121fcf0782621da11db7a735b38993c2b6560b7b7014aa164a809a3e515040) diff --git a/packages/graphql-printer/UPGRADE.md b/packages/graphql-printer/UPGRADE.md index 9da8be17d..61a12a295 100644 --- a/packages/graphql-printer/UPGRADE.md +++ b/packages/graphql-printer/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,4 +25,4 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) diff --git a/packages/graphql-printer/docs/Assertions/AssertGraphQLExportableEquals.md b/packages/graphql-printer/docs/Assertions/AssertGraphQLExportableEquals.md index 0de5dafe1..cb2bdde0f 100644 --- a/packages/graphql-printer/docs/Assertions/AssertGraphQLExportableEquals.md +++ b/packages/graphql-printer/docs/Assertions/AssertGraphQLExportableEquals.md @@ -3,7 +3,7 @@ Exports and compares two GraphQL schemas/types/nodes/etc. [include:example]: ./AssertGraphQLExportableEqualsTest.php -[//]: # (start: f79b9dacbf93b9659f2c2a8a84646ad6b8603e38651064954060c16eac2f3fc0) +[//]: # (start: 2852b7456553efa57ca27c58f94107dd1a13536fc09ad9878c4f8ff405c53045) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -81,4 +81,4 @@ final class AssertGraphQLExportableEqualsTest extends TestCase { } ``` -[//]: # (end: f79b9dacbf93b9659f2c2a8a84646ad6b8603e38651064954060c16eac2f3fc0) +[//]: # (end: 2852b7456553efa57ca27c58f94107dd1a13536fc09ad9878c4f8ff405c53045) diff --git a/packages/graphql-printer/docs/Assertions/AssertGraphQLPrintableEquals.md b/packages/graphql-printer/docs/Assertions/AssertGraphQLPrintableEquals.md index c01451484..506610e91 100644 --- a/packages/graphql-printer/docs/Assertions/AssertGraphQLPrintableEquals.md +++ b/packages/graphql-printer/docs/Assertions/AssertGraphQLPrintableEquals.md @@ -3,7 +3,7 @@ Prints and compares two GraphQL schemas/types/nodes/etc. [include:example]: ./AssertGraphQLPrintableEqualsTest.php -[//]: # (start: 50e51325f68526f816540bf59f9479e5a12f5183dcf5feacf1ed62c2a5bcadb7) +[//]: # (start: d6417605333d8076842d697742023cd15a6e5c9eac1d02bfd605315b3ea401ed) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -63,4 +63,4 @@ final class AssertGraphQLPrintableEqualsTest extends TestCase { } ``` -[//]: # (end: 50e51325f68526f816540bf59f9479e5a12f5183dcf5feacf1ed62c2a5bcadb7) +[//]: # (end: d6417605333d8076842d697742023cd15a6e5c9eac1d02bfd605315b3ea401ed) diff --git a/packages/graphql/README.md b/packages/graphql/README.md index 2e1c6b159..237436b46 100644 --- a/packages/graphql/README.md +++ b/packages/graphql/README.md @@ -3,7 +3,7 @@ This package provides highly powerful `@searchBy`, `@sortBy`, `@stream` directives for [lighthouse-php](https://lighthouse-php.com/). The `@searchBy` directive provides basic conditions like `=`, `>`, `<`, etc, relations, `not ()`, enums, and custom operators support. All are strictly typed so you no need to use `Mixed` type anymore. The `@sortBy` is not only about standard sorting by columns but also allows use relations. 😎 [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -29,7 +29,7 @@ This package provides highly powerful `@searchBy`, `@sortBy`, `@stream` directiv | | `^5.6.1` | `0.12.0` , `0.11.0` | | | `^5.4` | `0.10.0 ⋯ 0.5.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "graphql"}}) [//]: # (start: 3672f37b7c4365391f12ad7a15e2e629126d25f774c584c29e7930695f44040a) @@ -54,7 +54,7 @@ php artisan vendor:publish --provider=LastDragon_ru\\LaraASP\\GraphQL\\Provider # Directives [include:document-list]: ./docs/Directives -[//]: # (start: 73f7f4a1d86b7731354837c827f1b9f9aa729879639aeab4fe63985913469f48) +[//]: # (start: 5c1942eeb33ecb83f532572514cc32d67c83ab539a597f895822259278fcb8c2) [//]: # (warning: Generated automatically. Do not edit.) ## `@searchBy` @@ -81,7 +81,7 @@ Converts scalar into GraphQL Type. Similar to Lighthouse's `@scalar` directive, [Read more](). -[//]: # (end: 73f7f4a1d86b7731354837c827f1b9f9aa729879639aeab4fe63985913469f48) +[//]: # (end: 5c1942eeb33ecb83f532572514cc32d67c83ab539a597f895822259278fcb8c2) # Scalars @@ -97,7 +97,7 @@ Converts scalar into GraphQL Type. Similar to Lighthouse's `@scalar` directive, > ``` [include:document-list]: ./docs/Scalars -[//]: # (start: 12e162fc2ab7e9e247529882b53731fb8f8aacc4c5532610d40d36e90977b8f2) +[//]: # (start: d7fa880330d41b72ca3aff09300ebc180dd416ac96df6dcc3e5846e780656ad3) [//]: # (warning: Generated automatically. Do not edit.) ## `JsonString` @@ -106,7 +106,7 @@ Represents [JSON](https://json.org) string. [Read more](). -[//]: # (end: 12e162fc2ab7e9e247529882b53731fb8f8aacc4c5532610d40d36e90977b8f2) +[//]: # (end: d7fa880330d41b72ca3aff09300ebc180dd416ac96df6dcc3e5846e780656ad3) # Scout @@ -182,7 +182,7 @@ class Comment extends Model { If you implement custom directives which internally enhance the Builder (like standard directives do), you may get `BuilderUnknown` error because the proper/expected builder type was not detected. In this case, your directive should implement [`BuilderInfoProvider`](./src/Builder/Contracts/BuilderInfoProvider.php) interface and to specify the builder type explicitly. [include:example]: docs/Examples/BuilderInfoProvider.php -[//]: # (start: b68f7337a010486bff0e1669240841cc48572f37ac74466da4fc0364db6a1067) +[//]: # (start: 5a03ff4c8b599bd4b2a0373e04f1cbd343a5f9113c5776dd43935731c251b552) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -214,14 +214,14 @@ class CustomDirective implements Directive, BuilderInfoProvider { } ``` -[//]: # (end: b68f7337a010486bff0e1669240841cc48572f37ac74466da4fc0364db6a1067) +[//]: # (end: 5a03ff4c8b599bd4b2a0373e04f1cbd343a5f9113c5776dd43935731c251b552) # Printer The package provides bindings for [`Printer`][pkg:graphql-printer] so you can simply use: [include:example]: ./docs/Examples/Printer.php -[//]: # (start: 7a581dc1c9875e776a31524d2dd484da37a2b4dd60025986e9ef348c06d29a3d) +[//]: # (start: fdd23dac1ad08b05f6acbf1e76428ec36838c96e07f84f5bb303a8b2d6981582) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -552,12 +552,12 @@ type User { -[//]: # (end: 7a581dc1c9875e776a31524d2dd484da37a2b4dd60025986e9ef348c06d29a3d) +[//]: # (end: fdd23dac1ad08b05f6acbf1e76428ec36838c96e07f84f5bb303a8b2d6981582) # Testing Assertions [include:document-list]: ./docs/Assertions -[//]: # (start: 86d73ad55f2c494dfe35350837400088c82dfa7457eafd0d30392ba96bbbdc9a) +[//]: # (start: faab128ff134f31373650be0e1d23f4adffa84372a29292f956b844fb6baae6d) [//]: # (warning: Generated automatically. Do not edit.) ## `assertGraphQLIntrospectionEquals` @@ -590,30 +590,30 @@ Validates default internal schema (with all directives). Faster than `lighthouse [Read more](). -[//]: # (end: 86d73ad55f2c494dfe35350837400088c82dfa7457eafd0d30392ba96bbbdc9a) +[//]: # (end: faab128ff134f31373650be0e1d23f4adffa84372a29292f956b844fb6baae6d) [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [include:file]: ../../docs/Shared/Links.md -[//]: # (start: 9ac5c57eb03fcabb221c8db950c2dc20215f17f6e4ab17fd3a5def405da61f91) +[//]: # (start: e3121fcf0782621da11db7a735b38993c2b6560b7b7014aa164a809a3e515040) [//]: # (warning: Generated automatically. Do not edit.) [pkg:graphql#@searchBy]: https://github.com/LastDragon-ru/lara-asp/tree/main/packages/graphql/docs/Directives/@searchBy.md @@ -622,4 +622,4 @@ This package is the part of Awesome Set of Packages for Laravel. Please use the [pkg:graphql-printer]: https://github.com/LastDragon-ru/lara-asp/tree/main/packages/graphql-printer -[//]: # (end: 9ac5c57eb03fcabb221c8db950c2dc20215f17f6e4ab17fd3a5def405da61f91) +[//]: # (end: e3121fcf0782621da11db7a735b38993c2b6560b7b7014aa164a809a3e515040) diff --git a/packages/graphql/UPGRADE.md b/packages/graphql/UPGRADE.md index 39fb7e5cd..6b8f41312 100644 --- a/packages/graphql/UPGRADE.md +++ b/packages/graphql/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,7 +25,7 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) ## Tips @@ -38,12 +38,12 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) ## General [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) * [ ] The `\LastDragon_ru\LaraASP\GraphQL\Scalars\JsonStringType` is not implement `\LastDragon_ru\LaraASP\GraphQL\Builder\Contracts\TypeDefinition` anymore. To add the scalar into the Schema, you can use `@type`/`@scalar` directive, or create a custom implementation of `TypeDefinition` contract to use with `Builder`/`Manipulator`. @@ -71,12 +71,12 @@ This section is actual only if you are extending the package. Please review and ## General [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) * [ ] [Input type auto-generation](README.md#input-type-auto-generation) reworked and may include more/fewer fields. Please check the documentation and update the schema if needed. diff --git a/packages/graphql/docs/Assertions/AssertGraphQLIntrospectionEquals.md b/packages/graphql/docs/Assertions/AssertGraphQLIntrospectionEquals.md index 852a5ede1..b53bf0db4 100644 --- a/packages/graphql/docs/Assertions/AssertGraphQLIntrospectionEquals.md +++ b/packages/graphql/docs/Assertions/AssertGraphQLIntrospectionEquals.md @@ -6,7 +6,7 @@ Compares default public schema (as the client sees it through introspection). [include:example]: ./AssertGraphQLIntrospectionEqualsTest.php -[//]: # (start: 1e34791857e79d61db977fbe4be017b38ffb53811f06d451e227c376c5c218c6) +[//]: # (start: bd67a06e7e90174d00b11ce5b2284329d25b85cbb3bad6f39926f4ecdf685748) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -436,6 +436,6 @@ final class AssertGraphQLIntrospectionEqualsTest extends TestCase { } ``` -[//]: # (end: 1e34791857e79d61db977fbe4be017b38ffb53811f06d451e227c376c5c218c6) +[//]: # (end: bd67a06e7e90174d00b11ce5b2284329d25b85cbb3bad6f39926f4ecdf685748) diff --git a/packages/graphql/docs/Assertions/AssertGraphQLSchemaEquals.md b/packages/graphql/docs/Assertions/AssertGraphQLSchemaEquals.md index f4022f661..61c364857 100644 --- a/packages/graphql/docs/Assertions/AssertGraphQLSchemaEquals.md +++ b/packages/graphql/docs/Assertions/AssertGraphQLSchemaEquals.md @@ -3,7 +3,7 @@ Compares default internal schema (with all directives). [include:example]: ./AssertGraphQLSchemaEqualsTest.php -[//]: # (start: 1bcc4bdce373bad283736df3c40bf88ff6b8faa72cbd12e3a5750ae22ac6f439) +[//]: # (start: 3a4b27b9fd58b85e3dbfd8da1b72182bd4b0311bb285febb3f68e4a33b325c92) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -110,4 +110,4 @@ final class AssertGraphQLSchemaEqualsTest extends TestCase { } ``` -[//]: # (end: 1bcc4bdce373bad283736df3c40bf88ff6b8faa72cbd12e3a5750ae22ac6f439) +[//]: # (end: 3a4b27b9fd58b85e3dbfd8da1b72182bd4b0311bb285febb3f68e4a33b325c92) diff --git a/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoBreakingChanges.md b/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoBreakingChanges.md index 7f89baaba..e52c7f8ea 100644 --- a/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoBreakingChanges.md +++ b/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoBreakingChanges.md @@ -3,7 +3,7 @@ Checks that no breaking changes in the default internal schema (with all directives). [include:example]: ./AssertGraphQLSchemaNoBreakingChangesTest.php -[//]: # (start: e9f72298446f8034d254998ac3b4396702a8981a7c00f14eb9ccebdadf73ea3f) +[//]: # (start: 6f681afa633484fa9258e31bdef2ef42c8abf7b40943980fa23c6416cdb5587b) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -80,4 +80,4 @@ final class AssertGraphQLSchemaNoBreakingChangesTest extends TestCase { } ``` -[//]: # (end: e9f72298446f8034d254998ac3b4396702a8981a7c00f14eb9ccebdadf73ea3f) +[//]: # (end: 6f681afa633484fa9258e31bdef2ef42c8abf7b40943980fa23c6416cdb5587b) diff --git a/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoDangerousChanges.md b/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoDangerousChanges.md index 39abea36e..105c4f0d7 100644 --- a/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoDangerousChanges.md +++ b/packages/graphql/docs/Assertions/AssertGraphQLSchemaNoDangerousChanges.md @@ -3,7 +3,7 @@ Checks that no dangerous changes in the default internal schema (with all directives). [include:example]: ./AssertGraphQLSchemaNoDangerousChangesTest.php -[//]: # (start: b1e5a522b2299596e819ef4f028b17963100062611b89a1ee97699e6e847dc6c) +[//]: # (start: ebd9d48ce66dae20bfd7353a16e43121f61834ed58637913860e4e3cbfd57aa0) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -79,4 +79,4 @@ final class AssertGraphQLSchemaNoDangerousChangesTest extends TestCase { } ``` -[//]: # (end: b1e5a522b2299596e819ef4f028b17963100062611b89a1ee97699e6e847dc6c) +[//]: # (end: ebd9d48ce66dae20bfd7353a16e43121f61834ed58637913860e4e3cbfd57aa0) diff --git a/packages/graphql/docs/Assertions/AssertGraphQLSchemaValid.md b/packages/graphql/docs/Assertions/AssertGraphQLSchemaValid.md index bed96dbb9..a793eb911 100644 --- a/packages/graphql/docs/Assertions/AssertGraphQLSchemaValid.md +++ b/packages/graphql/docs/Assertions/AssertGraphQLSchemaValid.md @@ -3,7 +3,7 @@ Validates default internal schema (with all directives). Faster than `lighthouse:validate-schema` command because loads only used directives. [include:example]: ./AssertGraphQLSchemaValidTest.php -[//]: # (start: dd5e2cd2a0dfa08e0c41fb2cebb63acf79841b33dcf16658c765936ca150b73e) +[//]: # (start: e0356d8f3cfdce8a23ff4abee80bad3af51080e957de2a787df0cf7334429c47) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -74,4 +74,4 @@ final class AssertGraphQLSchemaValidTest extends TestCase { } ``` -[//]: # (end: dd5e2cd2a0dfa08e0c41fb2cebb63acf79841b33dcf16658c765936ca150b73e) +[//]: # (end: e0356d8f3cfdce8a23ff4abee80bad3af51080e957de2a787df0cf7334429c47) diff --git a/packages/graphql/docs/Directives/@searchBy.md b/packages/graphql/docs/Directives/@searchBy.md index c3c3393ae..23259ed46 100644 --- a/packages/graphql/docs/Directives/@searchBy.md +++ b/packages/graphql/docs/Directives/@searchBy.md @@ -3,7 +3,7 @@ Probably the most powerful directive to provide search (`where` conditions) for your GraphQL queries. [include:graphql-directive]: @searchBy -[//]: # (start: 6fc59903c0b30f293d154a4e848626ee52d76fad258360243058c413339a0ba4) +[//]: # (start: 3d8928e2d49d225b63f3b0f44358262d285ebbba9319e92cad8629a897b6f2f3) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -15,7 +15,7 @@ on | ARGUMENT_DEFINITION ``` -[//]: # (end: 6fc59903c0b30f293d154a4e848626ee52d76fad258360243058c413339a0ba4) +[//]: # (end: 3d8928e2d49d225b63f3b0f44358262d285ebbba9319e92cad8629a897b6f2f3) ## Basic usage @@ -33,7 +33,7 @@ Out of the box directives provides following features: Let's start: [include:example]: ../../src/SearchBy/Directives/DirectiveTest/Example.schema.graphql -[//]: # (start: cc0325309f64ed94ef1e996dc2a624162a7ebb35fb0e02191bf74e20a17cb2f3) +[//]: # (start: 029b65fdc24245537949ce83045a9468e0eb80cc433c62fc97287c84a523c5d4) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -67,7 +67,7 @@ type Comment { } ``` -[//]: # (end: cc0325309f64ed94ef1e996dc2a624162a7ebb35fb0e02191bf74e20a17cb2f3) +[//]: # (end: 029b65fdc24245537949ce83045a9468e0eb80cc433c62fc97287c84a523c5d4) That's all, just search 😃 (or look at [generated GraphQL schema](../../src/SearchBy/Directives/DirectiveTest/Example.expected.graphql)) @@ -158,7 +158,7 @@ As you can see in the example above you can use the special placeholder `_` inst The `@searchByIgnored` can be used as Ignored marker. [include:graphql-directive]: @searchByIgnored -[//]: # (start: a9b2c25f23dff4186502cc93cc34a25e406edce92710315aecdfae2bbe0d1d1a) +[//]: # (start: 19241090248b7789ee3b6de5b3922352e534a08c330be9c8ec139eaedffefabb) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -175,7 +175,7 @@ on | SCALAR ``` -[//]: # (end: a9b2c25f23dff4186502cc93cc34a25e406edce92710315aecdfae2bbe0d1d1a) +[//]: # (end: 19241090248b7789ee3b6de5b3922352e534a08c330be9c8ec139eaedffefabb) ## Operators @@ -234,7 +234,7 @@ scalar MyScalar Keep in mind, when you define/extend the scalar/enum, it will override all existing operators, so if you just want to add new operators, the `@searchByExtendOperators` directive should be used. [include:graphql-directive]: @searchByExtendOperators -[//]: # (start: df58b83a1ba68755665e0657a0ec9e4040fa2887c91de730680491d84e9e3251) +[//]: # (start: 2eba3af220a941ff3782355618d583640e7f1983e3c37d062c7e2bafb805a3d2) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -250,7 +250,7 @@ on | SCALAR ``` -[//]: # (end: df58b83a1ba68755665e0657a0ec9e4040fa2887c91de730680491d84e9e3251) +[//]: # (end: 2eba3af220a941ff3782355618d583640e7f1983e3c37d062c7e2bafb805a3d2) ### Schema diff --git a/packages/graphql/docs/Directives/@sortBy.md b/packages/graphql/docs/Directives/@sortBy.md index 2147c3ca2..9df731f80 100644 --- a/packages/graphql/docs/Directives/@sortBy.md +++ b/packages/graphql/docs/Directives/@sortBy.md @@ -3,7 +3,7 @@ Probably the most powerful directive to provide sort (`order by` conditions) for your GraphQL queries. [include:graphql-directive]: @sortBy -[//]: # (start: b8a3b70da2455b8cbed2b3385a56c1e1cd9865302ab83b073700e4608bd628d2) +[//]: # (start: 0c8e9abdba8e2ff3e7959a659114f1257f8a4ea44c7e45d3a14c4d952fae36d9) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -15,14 +15,14 @@ on | ARGUMENT_DEFINITION ``` -[//]: # (end: b8a3b70da2455b8cbed2b3385a56c1e1cd9865302ab83b073700e4608bd628d2) +[//]: # (end: 0c8e9abdba8e2ff3e7959a659114f1257f8a4ea44c7e45d3a14c4d952fae36d9) ## Basic usage How to use (and [generated GraphQL schema](../../src/SortBy/Directives/DirectiveTest/Example.expected.graphql)): [include:example]: ../../src/SortBy/Directives/DirectiveTest/Example.schema.graphql -[//]: # (start: 49b8762fdb7c1c571d71e331c248f86862b782b2981072697949f5dd0f8616ee) +[//]: # (start: f25acc8f93904eb379c14bc196a2910b8aefb043eb78258055fda6e8a97c1122) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -50,7 +50,7 @@ type User { } ``` -[//]: # (end: 49b8762fdb7c1c571d71e331c248f86862b782b2981072697949f5dd0f8616ee) +[//]: # (end: f25acc8f93904eb379c14bc196a2910b8aefb043eb78258055fda6e8a97c1122) And: @@ -75,7 +75,7 @@ Addition rules for Implicit type: The `@sortByIgnored` can be used as Ignored marker. [include:graphql-directive]: @sortByIgnored -[//]: # (start: 9466556f0c9243ad61ee9e72054a332e844bfe6346c488ba279f76aa7a3a0609) +[//]: # (start: 901001aa3a0a77b903d442b3bc60b868ae0832096d28d9cc01d8044bb5c6bb8f) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -92,7 +92,7 @@ on | SCALAR ``` -[//]: # (end: 9466556f0c9243ad61ee9e72054a332e844bfe6346c488ba279f76aa7a3a0609) +[//]: # (end: 901001aa3a0a77b903d442b3bc60b868ae0832096d28d9cc01d8044bb5c6bb8f) ## Operators diff --git a/packages/graphql/docs/Directives/@stream.md b/packages/graphql/docs/Directives/@stream.md index af50efe5a..c499da20d 100644 --- a/packages/graphql/docs/Directives/@stream.md +++ b/packages/graphql/docs/Directives/@stream.md @@ -7,7 +7,7 @@ Unlike the `@paginate` (and similar) directive, the `@stream` provides a uniform > The directive is experimental. The true cursor pagination is not implemented yet, the limit/offset is used internally. Any feedback would be greatly appreciated. [include:graphql-directive]: @stream -[//]: # (start: c6aae43244e8267f05923095595267c57bd8ff8b55fd9ff5cf802851fbf5c3de) +[//]: # (start: 40989476b2e056faf0b02b1ab9461df23fa334344e79278fa983f269f3fd0363) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -69,7 +69,7 @@ input StreamBuilder { } ``` -[//]: # (end: c6aae43244e8267f05923095595267c57bd8ff8b55fd9ff5cf802851fbf5c3de) +[//]: # (end: 40989476b2e056faf0b02b1ab9461df23fa334344e79278fa983f269f3fd0363) ## Motivation @@ -176,11 +176,11 @@ Keep in mind: * Some engines may perform counting (seems actual for `Database` only) [include:file]: ../../../../docs/Shared/Links.md -[//]: # (start: a1d73b35e4ad53ef7c5e723c17abd87804cf0221167e796513476212788cd826) +[//]: # (start: d7f8daa25a800052b6112dd44af19f2413af63e989683a3dc13efa8a95084aba) [//]: # (warning: Generated automatically. Do not edit.) [pkg:graphql#@searchBy]: https://github.com/LastDragon-ru/lara-asp/tree/main/packages/graphql/docs/Directives/@searchBy.md [pkg:graphql#@sortBy]: https://github.com/LastDragon-ru/lara-asp/tree/main/packages/graphql/docs/Directives/@sortBy.md -[//]: # (end: a1d73b35e4ad53ef7c5e723c17abd87804cf0221167e796513476212788cd826) +[//]: # (end: d7f8daa25a800052b6112dd44af19f2413af63e989683a3dc13efa8a95084aba) diff --git a/packages/graphql/docs/Directives/@type.md b/packages/graphql/docs/Directives/@type.md index 5115edd2b..00e653f6b 100644 --- a/packages/graphql/docs/Directives/@type.md +++ b/packages/graphql/docs/Directives/@type.md @@ -3,7 +3,7 @@ Converts scalar into GraphQL Type. Similar to Lighthouse's `@scalar` directive, but uses Laravel Container to resolve instance and also supports PHP enums. [include:graphql-directive]: @type -[//]: # (start: 185f96f580a0c2ae26608f2c53ad97a03a28301e4c189b5abe2c3163adecc2f9) +[//]: # (start: 9cc8aa297d4585260951ac6341e80b5161cd70bef8eefb1ad877eded0553f6d5) [//]: # (warning: Generated automatically. Do not edit.) ```graphql @@ -32,4 +32,4 @@ on | SCALAR ``` -[//]: # (end: 185f96f580a0c2ae26608f2c53ad97a03a28301e4c189b5abe2c3163adecc2f9) +[//]: # (end: 9cc8aa297d4585260951ac6341e80b5161cd70bef8eefb1ad877eded0553f6d5) diff --git a/packages/graphql/docs/Scalars/JsonString.md b/packages/graphql/docs/Scalars/JsonString.md index 2bfce067f..550120304 100644 --- a/packages/graphql/docs/Scalars/JsonString.md +++ b/packages/graphql/docs/Scalars/JsonString.md @@ -7,9 +7,9 @@ By default, the type validates the string and throws an error if it is not a val Please note that the scalar doesn't encode/decode value to/from JSON, it just contains a valid JSON string. If you want automatically convert value to/from JSON, you can use the `JSON` type from [`mll-lab/graphql-php-scalars`](https://github.com/mll-lab/graphql-php-scalars) package. If you need something more typesafe, consider using [`Serializer`][pkg:serializer]. [include:file]: ../../../../docs/Shared/Links.md -[//]: # (start: a1d73b35e4ad53ef7c5e723c17abd87804cf0221167e796513476212788cd826) +[//]: # (start: d7f8daa25a800052b6112dd44af19f2413af63e989683a3dc13efa8a95084aba) [//]: # (warning: Generated automatically. Do not edit.) [pkg:serializer]: https://github.com/LastDragon-ru/lara-asp/tree/main/packages/serializer -[//]: # (end: a1d73b35e4ad53ef7c5e723c17abd87804cf0221167e796513476212788cd826) +[//]: # (end: d7f8daa25a800052b6112dd44af19f2413af63e989683a3dc13efa8a95084aba) diff --git a/packages/migrator/README.md b/packages/migrator/README.md index b219bf70a..5fc6590a0 100644 --- a/packages/migrator/README.md +++ b/packages/migrator/README.md @@ -7,7 +7,7 @@ This package improves standard Laravel migrations to add support for raw SQL fil > The Migrator uses the same mechanism as [Squashing Migrations](https://laravel.com/docs/migrations#squashing-migrations) so not all databases are supported, please see Laravel Documentation for more details. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -29,7 +29,7 @@ This package improves standard Laravel migrations to add support for raw SQL fil | | `^8.22.1` | `3.0.0 ⋯ 0.2.0` | | | `^8.0` | `0.1.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "migrator"}}) [//]: # (start: 71480f577837f2b64afb81d2af134daeb17eef704953d93e8f393d804443e2a4) @@ -102,21 +102,21 @@ class MySeeder extends RawSeeder { ``` [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/migrator/UPGRADE.md b/packages/migrator/UPGRADE.md index 4db3e25b6..d844e9738 100644 --- a/packages/migrator/UPGRADE.md +++ b/packages/migrator/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,24 +25,24 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) diff --git a/packages/serializer/README.md b/packages/serializer/README.md index 7aff772e9..313a733ec 100644 --- a/packages/serializer/README.md +++ b/packages/serializer/README.md @@ -3,7 +3,7 @@ This package provides a customizable wrapper around the [Symfony Serializer Component](https://symfony.com/doc/current/components/serializer.html) to use it inside Laravel application. [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -19,7 +19,7 @@ This package provides a customizable wrapper around the [Symfony Serializer Comp | | `^9.21.0` | `5.6.0 ⋯ 5.0.0-beta.1` | | | `^9.0.0` | `5.0.0-beta.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "serializer"}}) [//]: # (start: d8b5372aebffede51da53eb1cdc31143e965ae14f00992219dae456a565cda4a) @@ -36,7 +36,7 @@ composer require lastdragon-ru/lara-asp-serializer # Usage [include:example]: ./docs/Examples/Usage.php -[//]: # (start: c709a4b715d1bde109a5d27982a2a5d6f481b5c72338e162e394ccbb6fc9208a) +[//]: # (start: adef85def212f87b8f157b40eaa0695da87e1a6f63e1e1ebc9fff474ecad3fee) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -92,7 +92,7 @@ LastDragon_ru\LaraASP\Serializer\Docs\Examples\Usage\User { } ``` -[//]: # (end: c709a4b715d1bde109a5d27982a2a5d6f481b5c72338e162e394ccbb6fc9208a) +[//]: # (end: adef85def212f87b8f157b40eaa0695da87e1a6f63e1e1ebc9fff474ecad3fee) # Extending @@ -115,7 +115,7 @@ php artisan vendor:publish --provider=LastDragon_ru\\LaraASP\\Serializer\\Provid You can use the [`LastDragon_ru\LaraASP\Serializer\Casts\Serialized`](./src/Casts/Serialized.php) attribute to populate a model attribute to/from an object: [include:example]: ./docs/Examples/Attribute.php -[//]: # (start: 772b9d40577fb51685a1f6f6851c03c48d3b8bf3c966be28f918c966eeb102ad) +[//]: # (start: f35a6e7b23df02996a9581e4c34db9192ceb148e1fa7ed361c57fc6a017bd8e9) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -174,7 +174,7 @@ The `$user->getAttributes()` is: ] ``` -[//]: # (end: 772b9d40577fb51685a1f6f6851c03c48d3b8bf3c966be28f918c966eeb102ad) +[//]: # (end: f35a6e7b23df02996a9581e4c34db9192ceb148e1fa7ed361c57fc6a017bd8e9) # Upgrading @@ -183,13 +183,13 @@ Please follow [Upgrade Guide](UPGRADE.md). [//]: # (end: e9139abedb89f69284102c9112b548fd7add07cf196259916ea4f1c98977223b) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [^1]: diff --git a/packages/serializer/UPGRADE.md b/packages/serializer/UPGRADE.md index 4db3e25b6..d844e9738 100644 --- a/packages/serializer/UPGRADE.md +++ b/packages/serializer/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,24 +25,24 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) diff --git a/packages/spa/README.md b/packages/spa/README.md index e6a3142e9..bab98c90b 100644 --- a/packages/spa/README.md +++ b/packages/spa/README.md @@ -1,7 +1,7 @@ # (Laravel) SPA Helpers [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -21,7 +21,7 @@ | | `^9.0.0` | `5.0.0-beta.0 ⋯ 0.12.0` | | | `^8.22.1` | `3.0.0 ⋯ 0.4.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/Installation.md ({"data": {"package": "spa"}}) [//]: # (start: 457a42c9e8cb9eef36f7f83a3cdfc837870f5d9814b59bd304b8383789bc83fb) @@ -36,21 +36,21 @@ composer require lastdragon-ru/lara-asp-spa [//]: # (end: 457a42c9e8cb9eef36f7f83a3cdfc837870f5d9814b59bd304b8383789bc83fb) [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/spa/UPGRADE.md b/packages/spa/UPGRADE.md index 4db3e25b6..d844e9738 100644 --- a/packages/spa/UPGRADE.md +++ b/packages/spa/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,24 +25,24 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) diff --git a/packages/testing/README.md b/packages/testing/README.md index 9529252b8..bc0a46cc3 100644 --- a/packages/testing/README.md +++ b/packages/testing/README.md @@ -3,7 +3,7 @@ This package provides various useful asserts for [PHPUnit](https://phpunit.de/) and better solution for HTTP tests - testing HTTP response has never been so easy! And this not only about `TestResponse` but any PSR response 😎 [include:exec]: <../../dev/artisan lara-asp-documentator:requirements> -[//]: # (start: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (start: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [//]: # (warning: Generated automatically. Do not edit.) # Requirements @@ -27,7 +27,7 @@ This package provides various useful asserts for [PHPUnit](https://phpunit.de/) | PHPUnit | `^11.0.0` | `HEAD ⋯ 6.2.0` | | | `^10.1.0` | `HEAD ⋯ 6.0.0` | -[//]: # (end: 196f435a1c8bc8d5966e42b9fd090d5ccc17c75206e617d7f8369cd9328846ea) +[//]: # (end: 0c754acbee0a8071717d81a4c18765bb2d605f138e08492b868c0e3f27e481ed) [include:template]: ../../docs/Shared/InstallationDev.md ({"data": {"package": "testing"}}) [//]: # (start: 9c57d43303e5ef82308c0c83e328e2a47be808a50cd12d6fc5bcfd9229e2fa7c) @@ -54,7 +54,7 @@ composer require --dev lastdragon-ru/lara-asp-testing In the general case, you just need to update `tests/TestCase.php` to include most important things, but you also can include only desired features, please see related traits and extensions below. [include:example]: ./docs/Examples/TestCase.php -[//]: # (start: e4763d33cca5eca34565862b6815638a0c60d817f1a34476f47915afd0ad952e) +[//]: # (start: 12b81ed79328f93948eb5166a1b17448848d73e368c86214bbd70643f3d984d1) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -80,7 +80,7 @@ abstract class TestCase extends BaseTestCase { } ``` -[//]: # (end: e4763d33cca5eca34565862b6815638a0c60d817f1a34476f47915afd0ad952e) +[//]: # (end: 12b81ed79328f93948eb5166a1b17448848d73e368c86214bbd70643f3d984d1) # Comparators @@ -91,7 +91,7 @@ abstract class TestCase extends BaseTestCase { ## [`DatabaseQueryComparator`](./src/Comparators/DatabaseQueryComparator.php) [include:docblock]: ./src/Comparators/DatabaseQueryComparator.php -[//]: # (start: 7a62eb5ab5b51b15a59381fa5096469c57dcc949fdd58877a499377d9bf38783) +[//]: # (start: f9663658d43ee8d678c25ea8356d1ad3a864f18ce04cffe33cb298d512d09a54) [//]: # (warning: Generated automatically. Do not edit.) Compares two `LastDragon_ru\LaraASP\Testing\Database\QueryLog\Query`. @@ -101,12 +101,12 @@ We are performing following normalization before comparison to be more precise: * Renumber `laravel_reserved_*` (it will always start from `0` and will not contain gaps) * Format the query by [`doctrine/sql-formatter`](https://github.com/doctrine/sql-formatter) package -[//]: # (end: 7a62eb5ab5b51b15a59381fa5096469c57dcc949fdd58877a499377d9bf38783) +[//]: # (end: f9663658d43ee8d678c25ea8356d1ad3a864f18ce04cffe33cb298d512d09a54) ## [`EloquentModelComparator`](./src/Comparators/EloquentModelComparator.php) [include:docblock]: ./src/Comparators/EloquentModelComparator.php -[//]: # (start: 742d5ba3dd2046d479175b032d84d30a4df86f84392aaf531a00a6734f096a5d) +[//]: # (start: 21a1517908b0ebbdac7d871b4238da730999c4a6e2ae510e80340c75fd71829b) [//]: # (warning: Generated automatically. Do not edit.) Compares two Eloquent Models. @@ -117,17 +117,17 @@ the database may have different types for the same properties. For example, `string` and (strict) comparison will fail. This comparator normalizes properties types before comparison. -[//]: # (end: 742d5ba3dd2046d479175b032d84d30a4df86f84392aaf531a00a6734f096a5d) +[//]: # (end: 21a1517908b0ebbdac7d871b4238da730999c4a6e2ae510e80340c75fd71829b) ## [`ScalarStrictComparator`](./src/Comparators/ScalarStrictComparator.php) [include:docblock]: ./src/Comparators/ScalarStrictComparator.php -[//]: # (start: 3880fe84d738503ce8fff5b3ea187ef860c1d6bf96ce2347e9dc1daeb78f9815) +[//]: # (start: 99205ddfc4ddcb011425e6a66609a1b037355394e6ecb7fcf0574ee7fac62fb5) [//]: # (warning: Generated automatically. Do not edit.) Makes comparison of scalars strict. -[//]: # (end: 3880fe84d738503ce8fff5b3ea187ef860c1d6bf96ce2347e9dc1daeb78f9815) +[//]: # (end: 99205ddfc4ddcb011425e6a66609a1b037355394e6ecb7fcf0574ee7fac62fb5) # Extensions @@ -136,14 +136,14 @@ Makes comparison of scalars strict. ### [`RefreshDatabaseIfEmpty`](./src/Database/RefreshDatabaseIfEmpty.php) 💀 [include:docblock]: ./src/Database/RefreshDatabaseIfEmpty.php -[//]: # (start: 8a2c47eb73624557058f09279338b44619ddc48d2bd07d975721ad9383bd1df3) +[//]: # (start: 409cdf673b12522f3685ee8d9af264a248731e871295df0fae40aebe9fa43c86) [//]: # (warning: Generated automatically. Do not edit.) The trait is very similar to standard `Illuminate\Foundation\Testing\RefreshDatabase` but there is one difference: it will refresh the database only if it is empty. This is very useful for local testing and allow significantly reduce bootstrap time. -[//]: # (end: 8a2c47eb73624557058f09279338b44619ddc48d2bd07d975721ad9383bd1df3) +[//]: # (end: 409cdf673b12522f3685ee8d9af264a248731e871295df0fae40aebe9fa43c86) ```php ). -[//]: # (end: 86d73ad55f2c494dfe35350837400088c82dfa7457eafd0d30392ba96bbbdc9a) +[//]: # (end: faab128ff134f31373650be0e1d23f4adffa84372a29292f956b844fb6baae6d) # Laravel Response Testing @@ -835,7 +835,7 @@ Limitations/Notes: [//]: # (end: 998fe7ccccc11e3c54b93f9d6ea507c288be425a1dc4eca1cf5abe09d77c572e) [include:example]: ./docs/Examples/MockProperties.php -[//]: # (start: bbc1e289c2ec3a43c467e48c9785aea2ba6bbff92b4c966f1ac934c1b1b6c9d1) +[//]: # (start: 58e6cbe9ad230f1706e6853e1aefd9a6ead8ed091478b1070fa3c8be9e43dd78) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -877,7 +877,7 @@ $mock $mock->a(); ``` -[//]: # (end: bbc1e289c2ec3a43c467e48c9785aea2ba6bbff92b4c966f1ac934c1b1b6c9d1) +[//]: # (end: 58e6cbe9ad230f1706e6853e1aefd9a6ead8ed091478b1070fa3c8be9e43dd78) # Custom Test Requirements @@ -913,21 +913,21 @@ class SomePackageTest extends TestCase { ``` [include:file]: ../../docs/Shared/Upgrading.md -[//]: # (start: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (start: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [//]: # (warning: Generated automatically. Do not edit.) # Upgrading Please follow [Upgrade Guide](UPGRADE.md). -[//]: # (end: 3c3826915e1d570b3982fdc6acf484950f0add7bb09d71c8c99b4a0e0fc5b43a) +[//]: # (end: 5f4a27dda34e5e151a62fe3459daf4bb3b85705d38810060e71fcadc25669c0f) [include:file]: ../../docs/Shared/Contributing.md -[//]: # (start: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (start: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) [//]: # (warning: Generated automatically. Do not edit.) # Contributing This package is the part of Awesome Set of Packages for Laravel. Please use the [main repository](https://github.com/LastDragon-ru/lara-asp) to [report issues](https://github.com/LastDragon-ru/lara-asp/issues), send [pull requests](https://github.com/LastDragon-ru/lara-asp/pulls), or [ask questions](https://github.com/LastDragon-ru/lara-asp/discussions). -[//]: # (end: 6b81b030ae74b2d149ec76cbec1b053da8da4e0ac4fd865f560548f3ead955e8) +[//]: # (end: 3f7cfa48046722fb9d277c71e074ff8406787772f90d17405b7554a4464cbfee) diff --git a/packages/testing/UPGRADE.md b/packages/testing/UPGRADE.md index d289b8958..9ec840f67 100644 --- a/packages/testing/UPGRADE.md +++ b/packages/testing/UPGRADE.md @@ -1,7 +1,7 @@ # Upgrade Guide [include:file]: ../../docs/Shared/Upgrade.md -[//]: # (start: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (start: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) [//]: # (warning: Generated automatically. Do not edit.) ## Instructions @@ -25,17 +25,17 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) | 🤝 | Backward-compatible change. Please note that despite you can ignore it now, but it will be mandatory in the future. | |:--:|:--------------------------------------------------------------------------------------------------------------------| -[//]: # (end: 5af9759519da3fa710fb21785e61682fda687a6ebdfb6f0dde4ed03162cb031d) +[//]: # (end: 3fcf292b870e49aabe885c416dfaf6c6c66d4571e87d3d3975d9cfe34ea6c9fe) # Upgrade from v6 [include:file]: ../../docs/Shared/Upgrade/FromV6.md -[//]: # (start: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (start: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Direct usages of `Container::getInstances()` were replaced by explicit constructor parameters. You may need to update your code accordingly (#151). -[//]: # (end: 8dae6cc48a78a268dcc7b747e512f85b410c9a9392ffac0734f4b17d390f1883) +[//]: # (end: b0b74ef74f156294a37f3ec42299e221e5e693f3b42297f5cfa79cab99b1df7e) * [ ] Following traits required `app()` method to get access to the Container (#151) * `\LastDragon_ru\LaraASP\Testing\Assertions\Application\ScheduleAssertions` @@ -55,11 +55,11 @@ Please also see [changelog](https://github.com/LastDragon-ru/lara-asp/releases) # Upgrade from v5 [include:file]: ../../docs/Shared/Upgrade/FromV5.md -[//]: # (start: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (start: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) [//]: # (warning: Generated automatically. Do not edit.) * [ ] Laravel v9 is not supported anymore. Migrate to the newer version. -[//]: # (end: 599c87007f162e34f4fd0c7874d4fcf8676e5d8c761d27a9456b284c7d1d12f2) +[//]: # (end: 6367638a165291d78965aaeae9ab03b304b0a420eb3f5ad9af0424296cc609ea) * [ ] Replace `CronableAssertions::assertCronableRegistered()` to `ScheduleAssertions::assertScheduled()`. diff --git a/packages/testing/docs/Assertions/AssertDatabaseQueryEquals.md b/packages/testing/docs/Assertions/AssertDatabaseQueryEquals.md index c9220d510..2e8640f9f 100644 --- a/packages/testing/docs/Assertions/AssertDatabaseQueryEquals.md +++ b/packages/testing/docs/Assertions/AssertDatabaseQueryEquals.md @@ -3,7 +3,7 @@ Asserts that SQL Query equals SQL Query. [include:example]: ./AssertDatabaseQueryEqualsTest.php -[//]: # (start: 65d62248ad4d9d80f20c4988a5dfc7a946864fb5d63547ccee2b721b84c9b46f) +[//]: # (start: 1b82cb78e263737ccb1a4a8b04b9ba995b0e5b3158260a64ca8bd3616416220b) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -57,4 +57,4 @@ final class AssertDatabaseQueryEqualsTest extends TestCase { } ``` -[//]: # (end: 65d62248ad4d9d80f20c4988a5dfc7a946864fb5d63547ccee2b721b84c9b46f) +[//]: # (end: 1b82cb78e263737ccb1a4a8b04b9ba995b0e5b3158260a64ca8bd3616416220b) diff --git a/packages/testing/docs/Assertions/AssertJsonMatchesSchema.md b/packages/testing/docs/Assertions/AssertJsonMatchesSchema.md index bf9b55c28..663b1d558 100644 --- a/packages/testing/docs/Assertions/AssertJsonMatchesSchema.md +++ b/packages/testing/docs/Assertions/AssertJsonMatchesSchema.md @@ -3,7 +3,7 @@ Asserts that JSON matches [schema](https://json-schema.org/). Validation based on the [Opis JSON Schema](https://github.com/opis/json-schema) package. [include:example]: ./AssertJsonMatchesSchemaTest.php -[//]: # (start: a6b4c98bfb1a397c027ee2360f01310c9319d9742b9361bab757e4c1b4d7caa3) +[//]: # (start: 14b834083ec3dd5506e9e3f58f85f8497006137d303059f7d38fc3728bccbd4f) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -61,4 +61,4 @@ final class AssertJsonMatchesSchemaTest extends TestCase { } ``` -[//]: # (end: a6b4c98bfb1a397c027ee2360f01310c9319d9742b9361bab757e4c1b4d7caa3) +[//]: # (end: 14b834083ec3dd5506e9e3f58f85f8497006137d303059f7d38fc3728bccbd4f) diff --git a/packages/testing/docs/Assertions/AssertPsrResponse.md b/packages/testing/docs/Assertions/AssertPsrResponse.md index cff2721e1..43b31a260 100644 --- a/packages/testing/docs/Assertions/AssertPsrResponse.md +++ b/packages/testing/docs/Assertions/AssertPsrResponse.md @@ -3,7 +3,7 @@ Asserts that PSR Response satisfies given constraint (we have a lot of built-in [constraints](../../src/Constraints/Response) and [responses](../../src/Responses), but, of course, you can create a custom). [include:example]: ./AssertPsrResponseTest.php -[//]: # (start: d56396d7203ebdf44cbccb48d522ccf24fea7657aac3b2508e11e1850086dd37) +[//]: # (start: 291741a02f1b16db5d7b0d47b81f82b5fd9e98f8ae4732059a073f19f06f5775) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -97,4 +97,4 @@ final class AssertPsrResponseTest extends TestCase { } ``` -[//]: # (end: d56396d7203ebdf44cbccb48d522ccf24fea7657aac3b2508e11e1850086dd37) +[//]: # (end: 291741a02f1b16db5d7b0d47b81f82b5fd9e98f8ae4732059a073f19f06f5775) diff --git a/packages/testing/docs/Assertions/AssertQueryLogEquals.md b/packages/testing/docs/Assertions/AssertQueryLogEquals.md index 9a4b91856..0a490df7c 100644 --- a/packages/testing/docs/Assertions/AssertQueryLogEquals.md +++ b/packages/testing/docs/Assertions/AssertQueryLogEquals.md @@ -3,7 +3,7 @@ Asserts that `QueryLog` equals `QueryLog`. [include:example]: ./AssertQueryLogEqualsTest.php -[//]: # (start: 709fad07f8fc6f28709758f6f33f1a1773cf0652c99028faa15f621efa619a93) +[//]: # (start: a49e0d438a4dffcc57ee95b71e064d88cc63d12932af4825af3a26db59bce0a3) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -74,4 +74,4 @@ final class AssertQueryLogEqualsTest extends TestCase { } ``` -[//]: # (end: 709fad07f8fc6f28709758f6f33f1a1773cf0652c99028faa15f621efa619a93) +[//]: # (end: a49e0d438a4dffcc57ee95b71e064d88cc63d12932af4825af3a26db59bce0a3) diff --git a/packages/testing/docs/Assertions/AssertScheduled.md b/packages/testing/docs/Assertions/AssertScheduled.md index 92424c9d4..c551b2328 100644 --- a/packages/testing/docs/Assertions/AssertScheduled.md +++ b/packages/testing/docs/Assertions/AssertScheduled.md @@ -3,7 +3,7 @@ Asserts that Schedule contains task. [include:example]: ./AssertScheduledTest.php -[//]: # (start: f506843658b5143b195bd01075e1807073a382bfbeb5f689afa2063fed136a69) +[//]: # (start: f6ecb0bbb1637366b3cb0769a8e98ecdcdcdc4a8e151c4d9cc08f304dd9df8a1) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -58,4 +58,4 @@ final class AssertScheduledTest extends TestCase { } ``` -[//]: # (end: f506843658b5143b195bd01075e1807073a382bfbeb5f689afa2063fed136a69) +[//]: # (end: f6ecb0bbb1637366b3cb0769a8e98ecdcdcdc4a8e151c4d9cc08f304dd9df8a1) diff --git a/packages/testing/docs/Assertions/AssertScoutQueryEquals.md b/packages/testing/docs/Assertions/AssertScoutQueryEquals.md index a80e40e35..9f4996446 100644 --- a/packages/testing/docs/Assertions/AssertScoutQueryEquals.md +++ b/packages/testing/docs/Assertions/AssertScoutQueryEquals.md @@ -3,7 +3,7 @@ Asserts that Scout Query equals Scout Query. [include:example]: ./AssertScoutQueryEqualsTest.php -[//]: # (start: 5046607ec467c82fe8c461c1bb3f7ca5d3c8ea78b67a4cd01448cc96ac775551) +[//]: # (start: 095a46ecac5d8728830790ea09a3c4fe3fbecbc26ff470a7f1dfc4abe053801d) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -56,4 +56,4 @@ final class AssertScoutQueryEqualsTest extends TestCase { } ``` -[//]: # (end: 5046607ec467c82fe8c461c1bb3f7ca5d3c8ea78b67a4cd01448cc96ac775551) +[//]: # (end: 095a46ecac5d8728830790ea09a3c4fe3fbecbc26ff470a7f1dfc4abe053801d) diff --git a/packages/testing/docs/Assertions/AssertThatResponse.md b/packages/testing/docs/Assertions/AssertThatResponse.md index 05b8ff1c2..d3c5a85d6 100644 --- a/packages/testing/docs/Assertions/AssertThatResponse.md +++ b/packages/testing/docs/Assertions/AssertThatResponse.md @@ -7,7 +7,7 @@ Asserts that PSR Response satisfies given constraint (we have a lot of built-in > Assertion is deprecated, please use [`assertPsrResponse()`](./AssertPsrResponse.md) instead. [include:example]: ./AssertThatResponseTest.php -[//]: # (start: 132bbbc2e0a7ab0e29a2a98ce604860cb8685539926640afeae680ebc8e2c2f3) +[//]: # (start: f476a946090593d6411394fdbee0737d373265353cb0a009e073aeb1c6af9750) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -101,4 +101,4 @@ final class AssertThatResponseTest extends TestCase { } ``` -[//]: # (end: 132bbbc2e0a7ab0e29a2a98ce604860cb8685539926640afeae680ebc8e2c2f3) +[//]: # (end: f476a946090593d6411394fdbee0737d373265353cb0a009e073aeb1c6af9750) diff --git a/packages/testing/docs/Assertions/AssertXmlMatchesSchema.md b/packages/testing/docs/Assertions/AssertXmlMatchesSchema.md index 9ea391646..b14081e01 100644 --- a/packages/testing/docs/Assertions/AssertXmlMatchesSchema.md +++ b/packages/testing/docs/Assertions/AssertXmlMatchesSchema.md @@ -3,7 +3,7 @@ Asserts that XML matches schema [XSD](https://en.wikipedia.org/wiki/XML_Schema_(W3C)) or [Relax NG](https://en.wikipedia.org/wiki/RELAX_NG). Validation based on the standard methods of [`DOMDocument`](https://www.php.net/manual/en/class.domdocument.php) class. [include:example]: ./AssertXmlMatchesSchemaTest.php -[//]: # (start: 85e7c95b662fc2552c7a3083d2b6415feedc20e27ab7e3cc11232f1f3de52c1a) +[//]: # (start: f32d299baa99ca918c0fc7d63cbc99ee427103a45f7732347fa5a4be6729510b) [//]: # (warning: Generated automatically. Do not edit.) ```php @@ -65,4 +65,4 @@ final class AssertXmlMatchesSchemaTest extends TestCase { } ``` -[//]: # (end: 85e7c95b662fc2552c7a3083d2b6415feedc20e27ab7e3cc11232f1f3de52c1a) +[//]: # (end: f32d299baa99ca918c0fc7d63cbc99ee427103a45f7732347fa5a4be6729510b) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d5c0e95b7..467457ce7 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,6 +5,11 @@ parameters: count: 1 path: packages/core/src/Observer/DispatcherTest.php + - + message: "#^Generator expects value type LastDragon_ru\\\\LaraASP\\\\Documentator\\\\Processor\\\\FileSystem\\\\File\\|SplFileInfo\\|string, mixed given\\.$#" + count: 1 + path: packages/documentator/src/Preprocessor/Preprocessor.php + - message: "#^Parameter \\#1 \\$offset of method LastDragon_ru\\\\LaraASP\\\\Eloquent\\\\Iterators\\\\IteratorImpl\\\\:\\:setOffset\\(\\) expects int\\|string\\|null, mixed given\\.$#" count: 1