diff --git a/composer.json b/composer.json index 101f8e1ffd..5536c447a3 100644 --- a/composer.json +++ b/composer.json @@ -48,18 +48,19 @@ "league/commonmark": "^2.2", "league/flysystem": "^1.0", "league/tactician": "^1.0", - "league/uri": "^6.7", - "league/uri-interfaces": "^2.0", + "league/uri": "^7.5", + "league/uri-interfaces": "^7.5", "monolog/monolog": "^2.9", "nikic/php-parser": "^5.0", "phar-io/manifest": "^2.0", "phar-io/version": "^3.2", + "phpdocumentor/filesystem": "^1.7", "phpdocumentor/flyfinder": "^1.0", "phpdocumentor/graphviz": "^2.0", - "phpdocumentor/guides": "^1.5", - "phpdocumentor/guides-graphs": "^1.4", - "phpdocumentor/guides-markdown": "^1.5", - "phpdocumentor/guides-restructured-text": "^1.5", + "phpdocumentor/guides": "^1.7", + "phpdocumentor/guides-graphs": "^1.7", + "phpdocumentor/guides-markdown": "^1.7", + "phpdocumentor/guides-restructured-text": "^1.7", "phpdocumentor/json-path": "^0.1.0", "phpdocumentor/reflection": "^6.0", "phpdocumentor/reflection-common": "^2.0", diff --git a/composer.lock b/composer.lock index 02e789107a..f011d900d9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "76b7593cc895edba0f63fddf16411d0d", + "content-hash": "f98278ea3f25d649f601474d8be7778d", "packages": [ { "name": "cypresslab/php-curry", @@ -132,27 +132,29 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.4", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12", - "phpstan/phpstan": "1.4.10 || 2.0.3", - "phpstan/phpstan-phpunit": "^1.0 || ^2", + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "psr/log": "^1 || ^2 || ^3" + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -160,7 +162,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\Deprecations\\": "src" + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" } }, "notification-url": "https://packagist.org/downloads/", @@ -171,9 +173,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.4" + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" }, - "time": "2024-12-07T21:18:45+00:00" + "time": "2024-01-30T19:34:25+00:00" }, { "name": "doctrine/lexer", @@ -254,16 +256,16 @@ }, { "name": "jawira/plantuml", - "version": "v1.2025.0", + "version": "v1.2024.8", "source": { "type": "git", "url": "https://github.com/jawira/plantuml.git", - "reference": "f96d6523a30947001d0a9cb8d591d55aac33bea6" + "reference": "f15235edc4d5ac85ec5e035d7d5d998484440a3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jawira/plantuml/zipball/f96d6523a30947001d0a9cb8d591d55aac33bea6", - "reference": "f96d6523a30947001d0a9cb8d591d55aac33bea6", + "url": "https://api.github.com/repos/jawira/plantuml/zipball/f15235edc4d5ac85ec5e035d7d5d998484440a3a", + "reference": "f15235edc4d5ac85ec5e035d7d5d998484440a3a", "shasum": "" }, "bin": [ @@ -289,30 +291,32 @@ ], "support": { "issues": "https://github.com/jawira/plantuml/issues", - "source": "https://github.com/jawira/plantuml/tree/v1.2025.0" + "source": "https://github.com/jawira/plantuml/tree/v1.2024.8" }, - "time": "2025-01-10T14:00:43+00:00" + "time": "2024-11-22T14:00:40+00:00" }, { "name": "jawira/plantuml-encoding", - "version": "v1.1.1", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/jawira/plantuml-encoding.git", - "reference": "fe8bce2d7ff5bb5cccf374349999cef7d6246a32" + "reference": "cec097dfc062e7e13655d9594eacce5f9df639ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jawira/plantuml-encoding/zipball/fe8bce2d7ff5bb5cccf374349999cef7d6246a32", - "reference": "fe8bce2d7ff5bb5cccf374349999cef7d6246a32", + "url": "https://api.github.com/repos/jawira/plantuml-encoding/zipball/cec097dfc062e7e13655d9594eacce5f9df639ad", + "reference": "cec097dfc062e7e13655d9594eacce5f9df639ad", "shasum": "" }, "require": { "ext-zlib": "*", - "php": ">=7.4" + "php": ">=7.0" }, "require-dev": { - "phpstan/phpstan": "^2" + "jawira/skeleton": "^2.14", + "phpstan/phpstan": "^1.0", + "vimeo/psalm": "^4.0" }, "type": "library", "autoload": { @@ -340,9 +344,9 @@ ], "support": { "issues": "https://github.com/jawira/plantuml-encoding/issues", - "source": "https://github.com/jawira/plantuml-encoding/tree/v1.1.1" + "source": "https://github.com/jawira/plantuml-encoding/tree/v1.1.0" }, - "time": "2024-12-22T17:49:30+00:00" + "time": "2022-05-31T18:58:21+00:00" }, { "name": "jean85/pretty-package-versions", @@ -594,16 +598,16 @@ }, { "name": "league/csv", - "version": "9.21.0", + "version": "9.18.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "72196d11ebba22d868954cb39c0c7346207430cc" + "reference": "b02d010e4055ae992247f6ffd1e7b103ef2a0790" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/72196d11ebba22d868954cb39c0c7346207430cc", - "reference": "72196d11ebba22d868954cb39c0c7346207430cc", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/b02d010e4055ae992247f6ffd1e7b103ef2a0790", + "reference": "b02d010e4055ae992247f6ffd1e7b103ef2a0790", "shasum": "" }, "require": { @@ -615,12 +619,12 @@ "ext-xdebug": "*", "friendsofphp/php-cs-fixer": "^3.64.0", "phpbench/phpbench": "^1.3.1", - "phpstan/phpstan": "^1.12.11", + "phpstan/phpstan": "^1.12.6", "phpstan/phpstan-deprecation-rules": "^1.2.1", - "phpstan/phpstan-phpunit": "^1.4.1", + "phpstan/phpstan-phpunit": "^1.4.0", "phpstan/phpstan-strict-rules": "^1.6.1", - "phpunit/phpunit": "^10.5.16 || ^11.4.3", - "symfony/var-dumper": "^6.4.8 || ^7.1.8" + "phpunit/phpunit": "^10.5.16 || ^11.4.1", + "symfony/var-dumper": "^6.4.8 || ^7.1.5" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", @@ -677,7 +681,7 @@ "type": "github" } ], - "time": "2025-01-08T19:27:58+00:00" + "time": "2024-10-18T08:14:48+00:00" }, { "name": "league/flysystem", @@ -886,54 +890,44 @@ }, { "name": "league/uri", - "version": "6.8.0", + "version": "7.5.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39" + "reference": "81fb5145d2644324614cc532b28efd0215bda430" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/a700b4656e4c54371b799ac61e300ab25a2d1d39", - "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430", + "reference": "81fb5145d2644324614cc532b28efd0215bda430", "shasum": "" }, "require": { - "ext-json": "*", - "league/uri-interfaces": "^2.3", - "php": "^8.1", - "psr/http-message": "^1.0.1" + "league/uri-interfaces": "^7.5", + "php": "^8.1" }, "conflict": { "league/uri-schemes": "^1.0" }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.9.5", - "nyholm/psr7": "^1.5.1", - "php-http/psr7-integration-tests": "^1.1.1", - "phpbench/phpbench": "^1.2.6", - "phpstan/phpstan": "^1.8.5", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.1.1", - "phpstan/phpstan-strict-rules": "^1.4.3", - "phpunit/phpunit": "^9.5.24", - "psr/http-factory": "^1.0.1" - }, "suggest": { - "ext-fileinfo": "Needed to create Data URI from a filepath", - "ext-intl": "Needed to improve host validation", - "league/uri-components": "Needed to easily manipulate URI objects", - "psr/http-factory": "Needed to use the URI factory" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -973,8 +967,8 @@ "support": { "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", - "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.8.0" + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.5.1" }, "funding": [ { @@ -982,46 +976,44 @@ "type": "github" } ], - "time": "2022-09-13T19:58:47+00:00" + "time": "2024-12-08T08:40:02+00:00" }, { "name": "league/uri-interfaces", - "version": "2.3.0", + "version": "7.5.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742", + "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742", "shasum": "" }, "require": { - "ext-json": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phpstan/phpstan": "^0.12.90", - "phpstan/phpstan-phpunit": "^0.12.19", - "phpstan/phpstan-strict-rules": "^0.12.9", - "phpunit/phpunit": "^8.5.15 || ^9.5" + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" }, "suggest": { - "ext-intl": "to use the IDNA feature", - "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src/" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1035,17 +1027,32 @@ "homepage": "https://nyamsprod.com" } ], - "description": "Common interface for URI representation", - "homepage": "http://github.com/thephpleague/uri-interfaces", + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", "rfc3986", "rfc3987", + "rfc6570", "uri", - "url" + "url", + "ws" ], "support": { - "issues": "https://github.com/thephpleague/uri-interfaces/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.5.0" }, "funding": [ { @@ -1053,7 +1060,7 @@ "type": "github" } ], - "time": "2021-06-28T04:27:21+00:00" + "time": "2024-12-08T08:18:47+00:00" }, { "name": "masterminds/html5", @@ -1630,6 +1637,49 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpdocumentor/filesystem", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/filesystem.git", + "reference": "28a38af80ca5b4a492caca83051988d3741430d1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/filesystem/zipball/28a38af80ca5b4a492caca83051988d3741430d1", + "reference": "28a38af80ca5b4a492caca83051988d3741430d1", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\FileSystem\\": "src/" + }, + "classmap": [ + "Flysystem/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Filesystem abstraction for phpdocumentor projects.", + "homepage": "https://www.phpdoc.org", + "support": { + "issues": "https://github.com/phpDocumentor/filesystem/issues", + "source": "https://github.com/phpDocumentor/filesystem/tree/1.7.0" + }, + "time": "2025-01-29T20:10:47+00:00" + }, { "name": "phpdocumentor/flyfinder", "version": "1.1.0", @@ -1736,40 +1786,45 @@ }, { "name": "phpdocumentor/guides", - "version": "1.6.5", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/guides-core.git", - "reference": "e2a1ae9c20b4db3d600d55214a9cae42d911d02f" + "reference": "ba5db0c601700065636509ba5bc82c7ce6440008" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/guides-core/zipball/e2a1ae9c20b4db3d600d55214a9cae42d911d02f", - "reference": "e2a1ae9c20b4db3d600d55214a9cae42d911d02f", + "url": "https://api.github.com/repos/phpDocumentor/guides-core/zipball/ba5db0c601700065636509ba5bc82c7ce6440008", + "reference": "ba5db0c601700065636509ba5bc82c7ce6440008", "shasum": "" }, "require": { - "doctrine/deprecations": "^1.0", + "doctrine/deprecations": "^1.1", "ext-json": "*", "ext-zlib": "*", - "league/flysystem": "^1.1", + "league/flysystem": "^1.1 || ^3.0", "league/tactician": "^1.1", - "league/uri": "^6.5 || ^7.0", + "league/uri": "^7.5.1", "php": "^8.1", - "phpdocumentor/flyfinder": "^1.1", + "phpdocumentor/flyfinder": "^1.1 || ^2.0", "psr/event-dispatcher": "^1.0", - "symfony/clock": "^6.4.3", + "symfony/clock": "^6.4.8", "symfony/html-sanitizer": "^6.4.8", "symfony/http-client": "^6.4.9", - "symfony/string": "^5.4 || ^6.3 || ^7.0", - "symfony/translation-contracts": "^3.4.1", + "symfony/string": "^6.4.9", + "symfony/translation-contracts": "^3.5.1", "twig/twig": "~2.15 || ^3.0", "webmozart/assert": "^1.11" }, "require-dev": { - "psr/log": "^2.0 || ^3.0" + "psr/log": "^3.0.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Guides\\": "src/" @@ -1783,9 +1838,9 @@ "homepage": "https://www.phpdoc.org", "support": { "issues": "https://github.com/phpDocumentor/guides-core/issues", - "source": "https://github.com/phpDocumentor/guides-core/tree/1.6.5" + "source": "https://github.com/phpDocumentor/guides-core/tree/1.7.0" }, - "time": "2025-01-10T15:14:06+00:00" + "time": "2025-01-29T20:10:47+00:00" }, { "name": "phpdocumentor/guides-graphs", @@ -2455,6 +2510,61 @@ }, "time": "2019-01-08T18:20:26+00:00" }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, { "name": "psr/http-message", "version": "1.1", @@ -2805,16 +2915,16 @@ }, { "name": "symfony/console", - "version": "v6.4.17", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "799445db3f15768ecc382ac5699e6da0520a0a04" + "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/799445db3f15768ecc382ac5699e6da0520a0a04", - "reference": "799445db3f15768ecc382ac5699e6da0520a0a04", + "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", "shasum": "" }, "require": { @@ -2879,7 +2989,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.17" + "source": "https://github.com/symfony/console/tree/v6.4.7" }, "funding": [ { @@ -2895,7 +3005,7 @@ "type": "tidelift" } ], - "time": "2024-12-07T12:07:30+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/contracts", @@ -3360,25 +3470,23 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.13", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "4856c9cf585d5a0313d8d35afd681a526f038dd3" + "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/4856c9cf585d5a0313d8d35afd681a526f038dd3", - "reference": "4856c9cf585d5a0313d8d35afd681a526f038dd3", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/78dde75f8f6dbbca4ec436a4b0087f7af02076d4", + "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4", "shasum": "" }, "require": { "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" - }, - "require-dev": { - "symfony/process": "^5.4|^6.4|^7.0" + "symfony/polyfill-mbstring": "~1.8", + "symfony/process": "^5.4|^6.4" }, "type": "library", "autoload": { @@ -3406,7 +3514,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.13" + "source": "https://github.com/symfony/filesystem/tree/v6.4.7" }, "funding": [ { @@ -3422,20 +3530,20 @@ "type": "tidelift" } ], - "time": "2024-10-25T15:07:50+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/finder", - "version": "v6.4.17", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7" + "reference": "511c48990be17358c23bf45c5d71ab85d40fb764" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7", - "reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7", + "url": "https://api.github.com/repos/symfony/finder/zipball/511c48990be17358c23bf45c5d71ab85d40fb764", + "reference": "511c48990be17358c23bf45c5d71ab85d40fb764", "shasum": "" }, "require": { @@ -3470,7 +3578,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.4.17" + "source": "https://github.com/symfony/finder/tree/v6.4.7" }, "funding": [ { @@ -3486,20 +3594,20 @@ "type": "tidelift" } ], - "time": "2024-12-29T13:51:37+00:00" + "time": "2024-04-23T10:36:43+00:00" }, { "name": "symfony/html-sanitizer", - "version": "v6.4.18", + "version": "v6.4.13", "source": { "type": "git", "url": "https://github.com/symfony/html-sanitizer.git", - "reference": "28e9fb12a6784c64b1b5e6fc92853bb7a3c4bf05" + "reference": "881f62f73376bcd97cdfebec4069338a16e2b76c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/28e9fb12a6784c64b1b5e6fc92853bb7a3c4bf05", - "reference": "28e9fb12a6784c64b1b5e6fc92853bb7a3c4bf05", + "url": "https://api.github.com/repos/symfony/html-sanitizer/zipball/881f62f73376bcd97cdfebec4069338a16e2b76c", + "reference": "881f62f73376bcd97cdfebec4069338a16e2b76c", "shasum": "" }, "require": { @@ -3539,7 +3647,7 @@ "sanitizer" ], "support": { - "source": "https://github.com/symfony/html-sanitizer/tree/v6.4.18" + "source": "https://github.com/symfony/html-sanitizer/tree/v6.4.13" }, "funding": [ { @@ -3555,27 +3663,27 @@ "type": "tidelift" } ], - "time": "2025-01-17T13:18:31+00:00" + "time": "2024-09-25T14:18:03+00:00" }, { "name": "symfony/http-client", - "version": "v6.4.18", + "version": "v6.4.15", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "394b440934056b8d9d6ba250001458e9d7998b7f" + "reference": "cb4073c905cd12b8496d24ac428a9228c1750670" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/394b440934056b8d9d6ba250001458e9d7998b7f", - "reference": "394b440934056b8d9d6ba250001458e9d7998b7f", + "url": "https://api.github.com/repos/symfony/http-client/zipball/cb4073c905cd12b8496d24ac428a9228c1750670", + "reference": "cb4073c905cd12b8496d24ac428a9228c1750670", "shasum": "" }, "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "~3.4.4|^3.5.2", + "symfony/http-client-contracts": "^3.4.1", "symfony/service-contracts": "^2.5|^3" }, "conflict": { @@ -3632,7 +3740,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.18" + "source": "https://github.com/symfony/http-client/tree/v6.4.15" }, "funding": [ { @@ -3648,7 +3756,7 @@ "type": "tidelift" } ], - "time": "2025-01-28T15:49:13+00:00" + "time": "2024-11-13T13:40:18+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3676,8 +3784,8 @@ "type": "library", "extra": { "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3752,8 +3860,8 @@ "type": "library", "extra": { "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3913,8 +4021,8 @@ "type": "library", "extra": { "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3997,8 +4105,8 @@ "type": "library", "extra": { "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -4227,8 +4335,8 @@ "type": "library", "extra": { "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -4285,16 +4393,16 @@ }, { "name": "symfony/process", - "version": "v6.4.15", + "version": "v6.4.14", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "3cb242f059c14ae08591c5c4087d1fe443564392" + "reference": "25214adbb0996d18112548de20c281be9f27279f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3cb242f059c14ae08591c5c4087d1fe443564392", - "reference": "3cb242f059c14ae08591c5c4087d1fe443564392", + "url": "https://api.github.com/repos/symfony/process/zipball/25214adbb0996d18112548de20c281be9f27279f", + "reference": "25214adbb0996d18112548de20c281be9f27279f", "shasum": "" }, "require": { @@ -4326,7 +4434,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.4.15" + "source": "https://github.com/symfony/process/tree/v6.4.14" }, "funding": [ { @@ -4342,7 +4450,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:19:14+00:00" + "time": "2024-11-06T09:25:01+00:00" }, { "name": "symfony/property-access", @@ -4814,16 +4922,16 @@ }, { "name": "symfony/yaml", - "version": "v6.4.18", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "bf598c9d9bb4a22f495a4e26e4c4fce2f8ecefc5" + "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/bf598c9d9bb4a22f495a4e26e4c4fce2f8ecefc5", - "reference": "bf598c9d9bb4a22f495a4e26e4c4fce2f8ecefc5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", + "reference": "53e8b1ef30a65f78eac60fddc5ee7ebbbdb1dee0", "shasum": "" }, "require": { @@ -4866,7 +4974,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.18" + "source": "https://github.com/symfony/yaml/tree/v6.4.7" }, "funding": [ { @@ -4882,20 +4990,20 @@ "type": "tidelift" } ], - "time": "2025-01-07T09:44:41+00:00" + "time": "2024-04-28T10:28:08+00:00" }, { "name": "twig/twig", - "version": "v3.19.0", + "version": "v3.17.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "d4f8c2b86374f08efc859323dbcd95c590f7124e" + "reference": "677ef8da6497a03048192aeeb5aa3018e379ac71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/d4f8c2b86374f08efc859323dbcd95c590f7124e", - "reference": "d4f8c2b86374f08efc859323dbcd95c590f7124e", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/677ef8da6497a03048192aeeb5aa3018e379ac71", + "reference": "677ef8da6497a03048192aeeb5aa3018e379ac71", "shasum": "" }, "require": { @@ -4950,7 +5058,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.19.0" + "source": "https://github.com/twigphp/Twig/tree/v3.17.1" }, "funding": [ { @@ -4962,7 +5070,7 @@ "type": "tidelift" } ], - "time": "2025-01-29T07:06:14+00:00" + "time": "2024-12-12T09:58:10+00:00" }, { "name": "webmozart/assert", @@ -7498,16 +7606,16 @@ }, { "name": "vincentlanglet/twig-cs-fixer", - "version": "3.5.1", + "version": "3.5.0", "source": { "type": "git", "url": "https://github.com/VincentLanglet/Twig-CS-Fixer.git", - "reference": "0ab7a8154f7b3a6a42cbe3a467074a47bc32dcf5" + "reference": "f81af33e48c384be7e0e3689f02e6e712fa68beb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/VincentLanglet/Twig-CS-Fixer/zipball/0ab7a8154f7b3a6a42cbe3a467074a47bc32dcf5", - "reference": "0ab7a8154f7b3a6a42cbe3a467074a47bc32dcf5", + "url": "https://api.github.com/repos/VincentLanglet/Twig-CS-Fixer/zipball/f81af33e48c384be7e0e3689f02e6e712fa68beb", + "reference": "f81af33e48c384be7e0e3689f02e6e712fa68beb", "shasum": "" }, "require": { @@ -7528,18 +7636,21 @@ "ergebnis/composer-normalize": "^2.29", "friendsofphp/php-cs-fixer": "^3.13.0", "infection/infection": "^0.26.16 || ^0.27.0", - "phpstan/phpstan": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpstan/phpstan-strict-rules": "^2.0", - "phpstan/phpstan-symfony": "^2.0", - "phpstan/phpstan-webmozart-assert": "^2.0", + "phpstan/phpstan": "^1.9.1", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpstan/phpstan-symfony": "^1.2.16", + "phpstan/phpstan-webmozart-assert": "^1.2.2", "phpunit/phpunit": "^9.5.26 || ^10.0.9", - "rector/rector": "^2.0.0", + "psalm/plugin-phpunit": "^0.18.4", + "psalm/plugin-symfony": "^5.0.0", + "rector/rector": "^1.0.0", "shipmonk/composer-dependency-analyser": "^1.6", "symfony/process": "^5.4 || ^6.4 || ^7.0", "symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0", "symfony/ux-twig-component": "^2.2.0", - "twig/cache-extra": "^3.2" + "twig/cache-extra": "^3.2", + "vimeo/psalm": "^5.2.0" }, "bin": [ "bin/twig-cs-fixer" @@ -7563,7 +7674,7 @@ "homepage": "https://github.com/VincentLanglet/Twig-CS-Fixer", "support": { "issues": "https://github.com/VincentLanglet/Twig-CS-Fixer/issues", - "source": "https://github.com/VincentLanglet/Twig-CS-Fixer/tree/3.5.1" + "source": "https://github.com/VincentLanglet/Twig-CS-Fixer/tree/3.5.0" }, "funding": [ { @@ -7571,7 +7682,7 @@ "type": "github" } ], - "time": "2025-01-16T18:36:36+00:00" + "time": "2024-12-13T16:55:11+00:00" } ], "aliases": [], @@ -7593,5 +7704,5 @@ "platform-overrides": { "php": "8.1.2" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/phpstan.neon b/phpstan.neon index 659be057ab..0a1c7f3bec 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -16,9 +16,6 @@ parameters: - '#.*NodeDefinition::fixXmlConfig.*#' - '#.*NodeDefinition::addDefaultsIfNotSet.*#' - # FlyFinder plugin adds a find method to FlySystem's Filesystem - - '#Call to an undefined method League\\Flysystem\\Filesystem::find\(\)#' - # PHPStan has issue when involving templates and parent types - '#Parameter \#1 \$matcher of method phpDocumentor\\Descriptor\\Builder\\AssemblerFactory::(register|registerFallback)\(\) expects phpDocumentor\\Descriptor\\Builder\\Matcher, phpDocumentor\\Descriptor\\Builder\\Matcher<.+> given\.#' diff --git a/src/phpDocumentor/Configuration/ApiSpecification.php b/src/phpDocumentor/Configuration/ApiSpecification.php index 78d58bd4ab..9656ce8784 100644 --- a/src/phpDocumentor/Configuration/ApiSpecification.php +++ b/src/phpDocumentor/Configuration/ApiSpecification.php @@ -6,8 +6,8 @@ use ArrayAccess; use phpDocumentor\Configuration\Definition\Version3; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use RuntimeException; use Webmozart\Assert\Assert; diff --git a/src/phpDocumentor/Configuration/CommandlineOptionsMiddleware.php b/src/phpDocumentor/Configuration/CommandlineOptionsMiddleware.php index f4d222843c..9eb769a381 100644 --- a/src/phpDocumentor/Configuration/CommandlineOptionsMiddleware.php +++ b/src/phpDocumentor/Configuration/CommandlineOptionsMiddleware.php @@ -14,8 +14,8 @@ namespace phpDocumentor\Configuration; use League\Uri\Contracts\UriInterface; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use Symfony\Component\Filesystem\Path as SymfonyPath; use Webmozart\Assert\Assert; @@ -127,7 +127,7 @@ private function overwriteTemplates(Configuration $configuration): Configuration { if (isset($this->options['template']) && $this->options['template']) { $configuration['phpdocumentor']['templates'] = array_map( - static fn ($templateName) => ['name' => $templateName], + static fn ($templateName) => new TemplateDefinition($templateName), (array) $this->options['template'], ); } diff --git a/src/phpDocumentor/Configuration/Configuration.php b/src/phpDocumentor/Configuration/Configuration.php index 37b2f13159..f217d2feba 100644 --- a/src/phpDocumentor/Configuration/Configuration.php +++ b/src/phpDocumentor/Configuration/Configuration.php @@ -14,8 +14,8 @@ namespace phpDocumentor\Configuration; use ArrayObject; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; /** * @template-extends ArrayObject&ConfigurationMap diff --git a/src/phpDocumentor/Configuration/ConfigurationFactory.php b/src/phpDocumentor/Configuration/ConfigurationFactory.php index 4017b01a37..194ce4e0e6 100644 --- a/src/phpDocumentor/Configuration/ConfigurationFactory.php +++ b/src/phpDocumentor/Configuration/ConfigurationFactory.php @@ -144,6 +144,16 @@ private function createConfigurationFromArray(array $configuration): Configurati } } + if (isset($configuration['phpdocumentor']['templates'])) { + foreach ($configuration['phpdocumentor']['templates'] as $templateNumber => $template) { + $configuration['phpdocumentor']['templates'][$templateNumber] = new TemplateDefinition( + $template['name'], + $template['location'], + $template['parameters'], + ); + } + } + return new Configuration($configuration); } } diff --git a/src/phpDocumentor/Configuration/Definition/Version3.php b/src/phpDocumentor/Configuration/Definition/Version3.php index aea5485376..297fec9c42 100644 --- a/src/phpDocumentor/Configuration/Definition/Version3.php +++ b/src/phpDocumentor/Configuration/Definition/Version3.php @@ -14,8 +14,8 @@ namespace phpDocumentor\Configuration\Definition; use phpDocumentor\Configuration\SymfonyConfigFactory; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; diff --git a/src/phpDocumentor/Configuration/PathNormalizingMiddleware.php b/src/phpDocumentor/Configuration/PathNormalizingMiddleware.php index a5738aaa7e..189186080b 100644 --- a/src/phpDocumentor/Configuration/PathNormalizingMiddleware.php +++ b/src/phpDocumentor/Configuration/PathNormalizingMiddleware.php @@ -14,9 +14,8 @@ namespace phpDocumentor\Configuration; use League\Uri\Contracts\UriInterface; -use phpDocumentor\Dsn; -use phpDocumentor\Path; -use Symfony\Component\Filesystem\Path as SymfonyPath; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use function array_map; use function array_merge; @@ -85,18 +84,18 @@ private function makeDsnRelativeToConfig(Configuration $configuration, UriInterf } } - /** @var array{name: string, location?: ?Path, parameters?: array} $template */ + /** @var TemplateDefinition $template */ foreach ($configuration['phpdocumentor']['templates'] as $key => $template) { - if (isset($template['location']) === false) { + if (isset($template->location) === false) { continue; } - $location = $template['location']; - if ($location instanceof Path && SymfonyPath::isAbsolute((string) $location) === false) { + $location = $template->location; + if ($location instanceof Path && Path::isAbsolutePath((string) $location) === false) { $location = new Path($configPath . '/' . $location); } - $template['location'] = $location; + $template->location = $location; $configuration['phpdocumentor']['templates'][$key] = $template; } diff --git a/src/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddleware.php b/src/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddleware.php index 4757f29cdf..ff0aa212a6 100644 --- a/src/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddleware.php +++ b/src/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddleware.php @@ -14,8 +14,8 @@ namespace phpDocumentor\Configuration; use League\Uri\Contracts\UriInterface; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Transformer\Writer\Twig\EnvironmentFactory; use function file_exists; diff --git a/src/phpDocumentor/Configuration/Source.php b/src/phpDocumentor/Configuration/Source.php index e001e770b7..268665caa8 100644 --- a/src/phpDocumentor/Configuration/Source.php +++ b/src/phpDocumentor/Configuration/Source.php @@ -16,8 +16,8 @@ use ArrayAccess; use BadMethodCallException; use OutOfBoundsException; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use ReturnTypeWillChange; use function array_map; diff --git a/src/phpDocumentor/Configuration/TemplateDefinition.php b/src/phpDocumentor/Configuration/TemplateDefinition.php new file mode 100644 index 0000000000..b0e542f699 --- /dev/null +++ b/src/phpDocumentor/Configuration/TemplateDefinition.php @@ -0,0 +1,17 @@ +mountManager->getFilesystem($dsnId); } catch (LogicException) { - $filesystem = new Filesystem($this->createAdapter($dsn)); + $filesystem = new FlySystemFilesystem($this->createAdapter($dsn)); $this->mountManager->mountFilesystem($dsnId, $filesystem); } - $filesystem->addPlugin(new Finder()); + Assert::isInstanceOf($filesystem, FlySystemFilesystem::class); - Assert::isInstanceOf($filesystem, Filesystem::class); - - return $filesystem; + return FlySystemAdapter::createFromFileSystem($filesystem); } private function createAdapter(Dsn $dsn): AdapterInterface diff --git a/src/phpDocumentor/Path.php b/src/phpDocumentor/FileSystem/Path.php similarity index 98% rename from src/phpDocumentor/Path.php rename to src/phpDocumentor/FileSystem/Path.php index 72df89d0a8..05482c8348 100644 --- a/src/phpDocumentor/Path.php +++ b/src/phpDocumentor/FileSystem/Path.php @@ -11,7 +11,7 @@ * @link https://phpdoc.org */ -namespace phpDocumentor; +namespace phpDocumentor\FileSystem; use Stringable; use Webmozart\Assert\Assert; diff --git a/src/phpDocumentor/Parser/SpecificationFactory.php b/src/phpDocumentor/FileSystem/SpecificationFactory.php similarity index 91% rename from src/phpDocumentor/Parser/SpecificationFactory.php rename to src/phpDocumentor/FileSystem/SpecificationFactory.php index fe2febb920..a6382f26bd 100644 --- a/src/phpDocumentor/Parser/SpecificationFactory.php +++ b/src/phpDocumentor/FileSystem/SpecificationFactory.php @@ -11,15 +11,14 @@ * @link https://phpdoc.org */ -namespace phpDocumentor\Parser; +namespace phpDocumentor\FileSystem; use Flyfinder\Specification\Glob; use Flyfinder\Specification\HasExtension; use Flyfinder\Specification\IsHidden; use Flyfinder\Specification\NotSpecification; use Flyfinder\Specification\SpecificationInterface; -use phpDocumentor\Parser\SpecificationFactoryInterface as FactoryInterface; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\SpecificationFactoryInterface as FactoryInterface; /** * Factory class to build Specification used by FlyFinder when reading files to process. @@ -30,7 +29,7 @@ final class SpecificationFactory implements FactoryInterface * Creates a SpecificationInterface object based on the ignore and extension parameters. * * @param list $paths - * @param array|null> $ignore + * @param array{paths: list, hidden: bool} $ignore * @param list $extensions */ public function create(array $paths, array $ignore, array $extensions): SpecificationInterface diff --git a/src/phpDocumentor/Parser/SpecificationFactoryInterface.php b/src/phpDocumentor/FileSystem/SpecificationFactoryInterface.php similarity index 85% rename from src/phpDocumentor/Parser/SpecificationFactoryInterface.php rename to src/phpDocumentor/FileSystem/SpecificationFactoryInterface.php index 8eaaa8cd48..6ff7aaceb3 100644 --- a/src/phpDocumentor/Parser/SpecificationFactoryInterface.php +++ b/src/phpDocumentor/FileSystem/SpecificationFactoryInterface.php @@ -11,10 +11,9 @@ * @link https://phpdoc.org */ -namespace phpDocumentor\Parser; +namespace phpDocumentor\FileSystem; use Flyfinder\Specification\SpecificationInterface; -use phpDocumentor\Path; /** * Interface for Specifications used to filter the FileSystem. @@ -25,7 +24,7 @@ interface SpecificationFactoryInterface * Creates a SpecificationInterface object based on the ignore and extension parameters. * * @param list $paths - * @param array|null> $ignore + * @param array{paths: list, hidden: bool} $ignore * @param list $extensions */ public function create(array $paths, array $ignore, array $extensions): SpecificationInterface; diff --git a/src/phpDocumentor/Parser/Cache/Locator.php b/src/phpDocumentor/Parser/Cache/Locator.php index 362bddc62b..b693b8795c 100644 --- a/src/phpDocumentor/Parser/Cache/Locator.php +++ b/src/phpDocumentor/Parser/Cache/Locator.php @@ -13,7 +13,7 @@ namespace phpDocumentor\Parser\Cache; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use RuntimeException; use Symfony\Contracts\Cache\CacheInterface; use Webmozart\Assert\Assert; diff --git a/src/phpDocumentor/Parser/FileCollector.php b/src/phpDocumentor/Parser/FileCollector.php index 9c3d714889..d90ab55489 100644 --- a/src/phpDocumentor/Parser/FileCollector.php +++ b/src/phpDocumentor/Parser/FileCollector.php @@ -13,19 +13,18 @@ namespace phpDocumentor\Parser; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\FileSystem; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\File; interface FileCollector { /** - * @param Dsn $dsn dsn of source. - * @param list $paths - * @param array $ignore array containing keys 'paths' and 'hidden' - * @param list $extensions + * @param list $paths + * @param array{paths: string[], hidden: bool} $ignore array containing keys 'paths' and 'hidden' + * @param list $extensions * * @return File[] */ - public function getFiles(Dsn $dsn, array $paths, array $ignore, array $extensions): array; + public function getFiles(FileSystem $fileSystem, array $paths, array $ignore, array $extensions): array; } diff --git a/src/phpDocumentor/Parser/FlySystemCollector.php b/src/phpDocumentor/Parser/FlySystemCollector.php index b7578a3151..c1e8480030 100644 --- a/src/phpDocumentor/Parser/FlySystemCollector.php +++ b/src/phpDocumentor/Parser/FlySystemCollector.php @@ -13,14 +13,14 @@ namespace phpDocumentor\Parser; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\FileSystem; +use phpDocumentor\FileSystem\Path; +use phpDocumentor\FileSystem\SpecificationFactoryInterface; final class FlySystemCollector implements FileCollector { public function __construct( private readonly SpecificationFactoryInterface $specificationFactory, - private readonly FlySystemFactory $flySystemFactory, ) { } @@ -31,12 +31,10 @@ public function __construct( * * @return list */ - public function getFiles(Dsn $dsn, array $paths, array $ignore, array $extensions): array + public function getFiles(FileSystem $fileSystem, array $paths, array $ignore, array $extensions): array { $specs = $this->specificationFactory->create($paths, $ignore, $extensions); - $fileSystem = $this->flySystemFactory->create($dsn); - $files = []; foreach ($fileSystem->find($specs) as $file) { diff --git a/src/phpDocumentor/Parser/FlySystemFile.php b/src/phpDocumentor/Parser/FlySystemFile.php index 40b4767f17..47bd2fc282 100644 --- a/src/phpDocumentor/Parser/FlySystemFile.php +++ b/src/phpDocumentor/Parser/FlySystemFile.php @@ -13,8 +13,8 @@ namespace phpDocumentor\Parser; -use League\Flysystem\FileNotFoundException; -use League\Flysystem\FilesystemInterface; +use phpDocumentor\FileSystem\FileNotFoundException; +use phpDocumentor\FileSystem\FileSystem; use phpDocumentor\Reflection\File; use Webmozart\Assert\Assert; @@ -22,7 +22,7 @@ final class FlySystemFile implements File { - public function __construct(private readonly FilesystemInterface $fileSystem, private readonly string $fileName) + public function __construct(private readonly FileSystem $fileSystem, private readonly string $fileName) { } diff --git a/src/phpDocumentor/Pipeline/Stage/Parser/CollectFiles.php b/src/phpDocumentor/Pipeline/Stage/Parser/CollectFiles.php index c123206c02..3b594cb044 100644 --- a/src/phpDocumentor/Pipeline/Stage/Parser/CollectFiles.php +++ b/src/phpDocumentor/Pipeline/Stage/Parser/CollectFiles.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Pipeline\Stage\Parser; +use phpDocumentor\FileSystem\FileSystemFactory; use phpDocumentor\Parser\FileCollector; use Psr\Log\LoggerInterface; @@ -21,6 +22,7 @@ final class CollectFiles { public function __construct( + private readonly FileSystemFactory $fileSystemFactory, private readonly FileCollector $fileCollector, private readonly LoggerInterface $logger, ) { @@ -32,7 +34,7 @@ public function __invoke(ApiSetPayload $payload): ApiSetPayload $this->logger->info('Collecting files from ' . $apiConfig->source()->dsn()); $files = $this->fileCollector->getFiles( - $apiConfig->source()->dsn(), + $this->fileSystemFactory->create($apiConfig->source()->dsn()), $apiConfig->source()->globPatterns(), $apiConfig['ignore'], $apiConfig['extensions'], diff --git a/src/phpDocumentor/Pipeline/Stage/Parser/ParseGuides.php b/src/phpDocumentor/Pipeline/Stage/Parser/ParseGuides.php index 01e513df84..45af6ce633 100644 --- a/src/phpDocumentor/Pipeline/Stage/Parser/ParseGuides.php +++ b/src/phpDocumentor/Pipeline/Stage/Parser/ParseGuides.php @@ -15,10 +15,10 @@ use League\Tactician\CommandBus; use phpDocumentor\Descriptor\GuideSetDescriptor; +use phpDocumentor\FileSystem\FlySystemFactory; use phpDocumentor\Guides\DocumentCollector; use phpDocumentor\Guides\Event\PostParseDocument; use phpDocumentor\Guides\Handlers\ParseDirectoryCommand; -use phpDocumentor\Parser\FlySystemFactory; use phpDocumentor\Pipeline\Stage\Payload; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; diff --git a/src/phpDocumentor/Pipeline/Stage/Transform.php b/src/phpDocumentor/Pipeline/Stage/Transform.php index 9c028f9cb4..dd13306a2a 100644 --- a/src/phpDocumentor/Pipeline/Stage/Transform.php +++ b/src/phpDocumentor/Pipeline/Stage/Transform.php @@ -14,10 +14,10 @@ namespace phpDocumentor\Pipeline\Stage; use Exception; -use League\Flysystem\FilesystemInterface; -use phpDocumentor\Dsn; use phpDocumentor\Event\Dispatcher; -use phpDocumentor\Parser\FlySystemFactory; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FileSystem; +use phpDocumentor\FileSystem\FlySystemFactory; use phpDocumentor\Transformer\Event\PostTransformEvent; use phpDocumentor\Transformer\Event\PreTransformationEvent; use phpDocumentor\Transformer\Event\PreTransformEvent; @@ -26,7 +26,7 @@ use phpDocumentor\Transformer\Transformer; use phpDocumentor\Transformer\Writer\WriterAbstract; use Psr\Log\LoggerInterface; -use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem; use Webmozart\Assert\Assert; use function count; @@ -74,7 +74,6 @@ public function __invoke(Payload $payload): Payload $templates = $this->templateFactory->getTemplates( $configuration['phpdocumentor']['templates'], - $this->createFileSystem($configuration['phpdocumentor']['paths']['output']), ); $project = $payload->getBuilder()->getProjectDescriptor(); $transformations = $templates->getTransformations(); @@ -88,10 +87,12 @@ public function __invoke(Payload $payload): Payload Transformer::EVENT_PRE_TRANSFORM, ); + $destination = $this->flySystemFactory->create($configuration['phpdocumentor']['paths']['output']); + foreach ($project->getVersions() as $version) { $documentationSets = $version->getDocumentationSets(); foreach ($documentationSets as $documentationSet) { - $this->transformer->execute($project, $documentationSet, $transformations); + $this->transformer->execute($destination, $project, $documentationSet, $transformations); } } @@ -138,10 +139,10 @@ function (PreTransformationEvent $event): void { ); } - private function createFileSystem(Dsn $dsn): FilesystemInterface + private function createFileSystem(Dsn $dsn): FileSystem { $target = $dsn->getPath(); - $fileSystem = new Filesystem(); + $fileSystem = new SymfonyFilesystem(); if (! $fileSystem->isAbsolutePath((string) $target)) { $target = getcwd() . DIRECTORY_SEPARATOR . $target; } diff --git a/src/phpDocumentor/Transformer/Template.php b/src/phpDocumentor/Transformer/Template.php index 31159863fa..907d2600c3 100644 --- a/src/phpDocumentor/Transformer/Template.php +++ b/src/phpDocumentor/Transformer/Template.php @@ -18,7 +18,7 @@ use Countable; use InvalidArgumentException; use IteratorAggregate; -use League\Flysystem\MountManager; +use phpDocumentor\FileSystem\FileSystem; use phpDocumentor\Transformer\Template\Parameter; use ReturnTypeWillChange; @@ -58,7 +58,7 @@ final class Template implements ArrayAccess, Countable, IteratorAggregate * * @param string $name Name for this template. */ - public function __construct(private readonly string $name, private readonly MountManager $files) + public function __construct(private readonly string $name, private readonly FileSystem $files) { } @@ -137,20 +137,7 @@ public function getExtends(): string|null return $this->extends; } - /** - * FlySystem filesystem / MountManager containing the template files, base templates files - * and destination filesystem. - * - * This MountManager has three mounts: - * - * - template://, the files of this template - * - templates://, the base folder containing phpDocumentor's global templates (i.e. `/data/templates`) - * - destination://, the destination where the template needs to write to - * - * By combining this in one mount manager it is easier for writers to copy files between destinations (since - * MountManager's can copy between filesystems) and for writers to read and write from various locations. - */ - public function files(): MountManager + public function files(): FileSystem { return $this->files; } diff --git a/src/phpDocumentor/Transformer/Template/Factory.php b/src/phpDocumentor/Transformer/Template/Factory.php index 96da3cafcd..725f638feb 100644 --- a/src/phpDocumentor/Transformer/Template/Factory.php +++ b/src/phpDocumentor/Transformer/Template/Factory.php @@ -15,13 +15,11 @@ use DirectoryIterator; use InvalidArgumentException; -use League\Flysystem\Adapter\AbstractAdapter; -use League\Flysystem\Filesystem; -use League\Flysystem\FilesystemInterface; -use League\Flysystem\MountManager; -use phpDocumentor\Dsn; -use phpDocumentor\Parser\FlySystemFactory; -use phpDocumentor\Path; +use phpDocumentor\Configuration\TemplateDefinition; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FileSystem; +use phpDocumentor\FileSystem\FlySystemFactory; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Transformer\Template; use phpDocumentor\Transformer\Transformation; use phpDocumentor\Transformer\Writer\Collection as WriterCollection; @@ -57,9 +55,9 @@ public function __construct( * Attempts to find, construct and return a template object with the given template name or (relative/absolute) * path. * - * @param array}> $templates + * @param list $templates */ - public function getTemplates(array $templates, FilesystemInterface $output): Collection + public function getTemplates(array $templates): Collection { $stopWatch = new Stopwatch(); $loadedTemplates = []; @@ -67,15 +65,13 @@ public function getTemplates(array $templates, FilesystemInterface $output): Col foreach ($templates as $template) { $stopWatch->start('load template'); - $location = $template['location'] ?? null; - $templateNameOrLocation = $location instanceof Path - ? ($location . '/' . $template['name']) - : $template['name']; + $templateNameOrLocation = $template->location instanceof Path + ? ($template->location . '/' . $template->name) + : $template->name; - $loadedTemplates[$template['name']] = $this->loadTemplate( - $output, + $loadedTemplates[$template->name] = $this->loadTemplate( $templateNameOrLocation, - $template['parameters'] ?? [], + $template->parameters, ); $stopWatch->stop('load template'); } @@ -84,12 +80,12 @@ public function getTemplates(array $templates, FilesystemInterface $output): Col } /** @param array $parameters */ - private function loadTemplate(FilesystemInterface $output, string $template, array $parameters): Template + private function loadTemplate(string $template, array $parameters): Template { - $template = $this->createTemplateFromXml($output, $template, $parameters); + $template = $this->createTemplateFromXml($template, $parameters); if ($template->getExtends() !== null) { - $parentTemplate = $this->loadTemplate($output, $template->getExtends(), $parameters); + $parentTemplate = $this->loadTemplate($template->getExtends(), $parameters); $template->merge($parentTemplate); } @@ -145,26 +141,20 @@ public function getTemplatesPath(): string * @param array $templateParams */ private function createTemplateFromXml( - FilesystemInterface $filesystem, string $nameOrPath, array $templateParams, ): Template { // create the filesystems that a template needs to be able to manipulate, the source folder containing this // template its files; the destination to where it can write its files and a global templates folder where to // get global template files from - $files = new MountManager( - [ - 'templates' => $this->getTemplatesDirectory(), - 'template' => $this->resolve($nameOrPath), - 'destination' => $filesystem, - ], - ); - - $xml = $files->read('template://' . self::TEMPLATE_DEFINITION_FILENAME); + + $templateFileSystem = $this->resolve($nameOrPath); + + $xml = $templateFileSystem->read(self::TEMPLATE_DEFINITION_FILENAME); Assert::string($xml); $xml = new SimpleXMLElement($xml); - $template = new Template((string) $xml->name, $files); + $template = new Template((string) $xml->name, $templateFileSystem); $template->setAuthor((string) $xml->author . ((string) $xml->email ? ' <' . $xml->email . '>' : '')); $template->setVersion((string) $xml->version); $template->setCopyright((string) $xml->copyright); @@ -206,9 +196,9 @@ private function createTemplateFromXml( return $template; } - private function resolve(string $nameOrPath): FilesystemInterface + private function resolve(string $nameOrPath): FileSystem { - $configPath = rtrim($nameOrPath, DIRECTORY_SEPARATOR) . '/template.xml'; + $configPath = rtrim($nameOrPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . self::TEMPLATE_DEFINITION_FILENAME; if (file_exists($configPath) && is_readable($configPath)) { return $this->flySystemFactory->create(Dsn::createFromString(rtrim($nameOrPath, DIRECTORY_SEPARATOR))); } @@ -216,9 +206,9 @@ private function resolve(string $nameOrPath): FilesystemInterface // if we load a global template $globalTemplatesFilesystem = $this->getTemplatesDirectory(); if ($globalTemplatesFilesystem->has($nameOrPath)) { - $templateFilesystem = $this->createNewFilesystemFromSubfolder($globalTemplatesFilesystem, $nameOrPath); + $templateFilesystem = $this->createNewFilesystemFromSubfolder($nameOrPath); - if (! $templateFilesystem->has('template.xml')) { + if (! $templateFilesystem->has(self::TEMPLATE_DEFINITION_FILENAME)) { throw new TemplateNotFound($nameOrPath); } @@ -243,21 +233,12 @@ private function getTemplatesDirectory(): Filesystem } private function createNewFilesystemFromSubfolder( - Filesystem $hostFilesystem, string $subfolder, ): Filesystem { - $hostFilesystemAdapter = $hostFilesystem->getAdapter(); - if (! $hostFilesystemAdapter instanceof AbstractAdapter) { - throw new RuntimeException( - 'Failed to load template, The filesystem of the global templates does not support ' - . 'getting a subfolder from it', - ); - } - - $templateAdapter = clone $hostFilesystemAdapter; - $globalRoot = $templateAdapter->getPathPrefix(); - $templateAdapter->setPathPrefix($globalRoot . $subfolder); + $dsnString = $this->getTemplatesPath(); + $globalDsn = Dsn::createFromString($dsnString); + $template = $globalDsn->withPath(new Path($globalDsn->getPath() . DIRECTORY_SEPARATOR . $subfolder)); - return new Filesystem($templateAdapter); + return $this->flySystemFactory->create($template); } } diff --git a/src/phpDocumentor/Transformer/Template/TemplateNotFound.php b/src/phpDocumentor/Transformer/Template/TemplateNotFound.php index 2aa50f8a92..abfcaa10f8 100644 --- a/src/phpDocumentor/Transformer/Template/TemplateNotFound.php +++ b/src/phpDocumentor/Transformer/Template/TemplateNotFound.php @@ -22,6 +22,6 @@ final class TemplateNotFound extends InvalidArgumentException { public function __construct(string $template) { - parent::__construct(sprintf('The given template %s could not be found or is not readable', $template)); + parent::__construct(sprintf('The given template "%s" could not be found or is not readable', $template)); } } diff --git a/src/phpDocumentor/Transformer/Transformer.php b/src/phpDocumentor/Transformer/Transformer.php index 04e04b8890..57a6d42af2 100644 --- a/src/phpDocumentor/Transformer/Transformer.php +++ b/src/phpDocumentor/Transformer/Transformer.php @@ -16,9 +16,8 @@ use League\Flysystem\FilesystemInterface; use phpDocumentor\Descriptor\DocumentationSetDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor; -use phpDocumentor\Dsn; use phpDocumentor\Event\Dispatcher; -use phpDocumentor\Parser\FlySystemFactory; +use phpDocumentor\FileSystem\FileSystem; use phpDocumentor\Transformer\Event\PostTransformationEvent; use phpDocumentor\Transformer\Event\PreTransformationEvent; use phpDocumentor\Transformer\Event\WriterInitializationEvent; @@ -27,7 +26,6 @@ use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; -use Webmozart\Assert\Assert; use function in_array; use function sprintf; @@ -49,13 +47,8 @@ class Transformer final public const EVENT_POST_TRANSFORM = 'transformer.transform.post'; - final public const COMPILER_PRIORITY = 5000; - - /** @var string|null $target Target location where to output the artifacts */ - protected $target = null; - /** @var FilesystemInterface|null $destination The destination filesystem to write to */ - private FilesystemInterface|null $destination = null; + private FileSystem $destination; /** @var Writer\Collection $writers */ protected $writers; @@ -66,7 +59,6 @@ class Transformer public function __construct( Writer\Collection $writerCollection, private readonly LoggerInterface $logger, - private readonly FlySystemFactory $flySystemFactory, private readonly EventDispatcherInterface $eventDispatcher, ) { $this->writers = $writerCollection; @@ -77,37 +69,9 @@ public function getDescription(): string return 'Transform analyzed project into artifacts'; } - /** - * Sets the target location where to output the artifacts. - * - * @param string $target The target location where to output the artifacts. - */ - public function setTarget(string $target): void - { - $this->target = $target; - $this->destination = $this->flySystemFactory->create(Dsn::createFromString($target)); - } - - /** - * Returns the location where to store the artifacts. - */ - public function getTarget(): string|null - { - return $this->target; - } - - public function setDestination(FilesystemInterface $filesystem): void + public function destination(): FileSystem { - $this->destination = $filesystem; - } - - public function destination(): FilesystemInterface - { - $destination = $this->destination; - - Assert::notNull($destination); - - return $destination; + return $this->destination; } /** @@ -116,10 +80,12 @@ public function destination(): FilesystemInterface * @param Transformation[] $transformations */ public function execute( + FileSystem $destination, ProjectDescriptor $project, DocumentationSetDescriptor $documentationSet, array $transformations, ): void { + $this->destination = $destination; $this->initializeWriters($project, $documentationSet, $transformations); $this->transform($project, $documentationSet, $transformations); diff --git a/src/phpDocumentor/Transformer/Writer/Graph.php b/src/phpDocumentor/Transformer/Writer/Graph.php index 665346f301..88f8a5d8ce 100644 --- a/src/phpDocumentor/Transformer/Writer/Graph.php +++ b/src/phpDocumentor/Transformer/Writer/Graph.php @@ -70,7 +70,7 @@ public function transform( return; } - $filename = $this->getDestinationPath($transformation); + $filename = $transformation->getArtifact(); switch ($transformation->getSource() ?: 'class') { case 'class': @@ -81,9 +81,4 @@ public function transform( } } } - - private function getDestinationPath(Transformation $transformation): string - { - return $transformation->getTransformer()->getTarget() . DIRECTORY_SEPARATOR . $transformation->getArtifact(); - } } diff --git a/src/phpDocumentor/Transformer/Writer/IoTrait.php b/src/phpDocumentor/Transformer/Writer/IoTrait.php index cd07118641..499f35ade1 100644 --- a/src/phpDocumentor/Transformer/Writer/IoTrait.php +++ b/src/phpDocumentor/Transformer/Writer/IoTrait.php @@ -13,12 +13,9 @@ namespace phpDocumentor\Transformer\Writer; -use League\Flysystem\FileNotFoundException; -use League\Uri\UriString; use phpDocumentor\Transformer\Transformation; use function ltrim; -use function str_starts_with; use function strpos; use function substr; @@ -26,47 +23,24 @@ trait IoTrait { protected function copy(Transformation $transformation, string $path, string $destination): void { - $path = $this->normalizeSourcePath($path); - $destination = $this->normalizeDestination($destination); - - $metadata = $transformation->template()->files()->getMetadata($path); - $type = $metadata ? ($metadata['type'] ?? null) : null; - - if ($type === 'file') { - if ($transformation->template()->files()->has($destination)) { - $transformation->template()->files()->delete($destination); - } - - $transformation->template()->files()->copy($path, $destination); - - return; + if ($transformation->template()->files()->has($path)) { + $transformation->getTransformer()->destination()->put( + $destination, + $transformation->template()->files()->read($path), + ); } $this->copyDirectory($transformation, $path, $destination); } - protected function readSourceFile(Transformation $transformation, string $path): string - { - $path = $this->normalizeSourcePath($path); - $contents = $transformation->template()->files()->read($path); - if ($contents === false) { - throw new FileNotFoundException($path); - } - - return $contents; - } - protected function persistTo(Transformation $transformation, string $path, string $contents): void { - $path = $this->normalizeDestination($path); - - $transformation->template()->files()->put($path, $contents); + $transformation->getTransformer()->destination()->put($path, $contents); } private function copyDirectory(Transformation $transformation, string $path, string $destination): void { $list = $transformation->template()->files()->listContents($path, true); - $scheme = UriString::parse($path)['scheme']; foreach ($list as $file) { if ($file['type'] !== 'file') { continue; @@ -77,15 +51,9 @@ private function copyDirectory(Transformation $transformation, string $path, str // already contains 'images' $destinationPath = $this->stripFirstPartOfPath($file['path']); - // if the provided $path is a reference to a global template, then we need to strip another level - // since that contains the templateName - if ($this->isGlobalTemplateReference($path)) { - $destinationPath = $this->stripFirstPartOfPath($destinationPath); - } - $this->copy( $transformation, - $scheme . '://' . $file['path'], + $file['path'], $destination . '/' . $destinationPath, ); } @@ -100,35 +68,4 @@ private function stripFirstPartOfPath(string $path): string return ltrim(substr($path, $findPathSeparator), '/'); } - - private function isGlobalTemplateReference(string $path): bool - { - return str_starts_with($path, 'templates/') - || str_starts_with($path, 'templates://'); - } - - private function normalizeSourcePath(string $path): string - { - // if it has a scheme, it must have been normalized before - if (UriString::parse($path)['scheme']) { - return $path; - } - - if ($this->isGlobalTemplateReference($path)) { - // the base folder of the global filesystem is already templates; so we need to strip that off - return 'templates://' . $this->stripFirstPartOfPath($path); - } - - return 'template://' . $path; - } - - private function normalizeDestination(string $destination): string - { - // prepend destination scheme if none was set - if (! UriString::parse($destination)['scheme']) { - $destination = 'destination://' . $destination; - } - - return $destination; - } } diff --git a/src/phpDocumentor/Transformer/Writer/RenderGuide.php b/src/phpDocumentor/Transformer/Writer/RenderGuide.php index 14c1a33092..8f5bc12fda 100644 --- a/src/phpDocumentor/Transformer/Writer/RenderGuide.php +++ b/src/phpDocumentor/Transformer/Writer/RenderGuide.php @@ -18,11 +18,11 @@ use phpDocumentor\Descriptor\DocumentDescriptor; use phpDocumentor\Descriptor\GuideSetDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor; -use phpDocumentor\Dsn; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FlySystemFactory; use phpDocumentor\Guides\Handlers\RenderCommand; use phpDocumentor\Guides\RenderContext; use phpDocumentor\Guides\TemplateRenderer; -use phpDocumentor\Parser\FlySystemFactory; use phpDocumentor\Transformer\Template; use phpDocumentor\Transformer\Transformation; use phpDocumentor\Transformer\Writer\Twig\EnvironmentFactory; @@ -86,7 +86,7 @@ private function renderDocumentationSet( ): void { $dsn = $documentationSet->getSource()->dsn(); $stopwatch = $this->startRenderingSetMessage($dsn); - $destination = $transformation->template()->files()->getFilesystem('destination'); + $destination = $transformation->getTransformer()->destination(); $documents = array_map( static fn (DocumentDescriptor $dd) => $dd->getDocumentNode(), $documentationSet->getDocuments()->getAll(), diff --git a/src/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactory.php b/src/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactory.php index d05afb3970..996dd9b800 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactory.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactory.php @@ -16,14 +16,14 @@ use League\CommonMark\ConverterInterface; use phpDocumentor\Descriptor\DocumentationSetDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Guides\Graphs\Twig\UmlExtension; use phpDocumentor\Guides\Twig\AssetsExtension; -use phpDocumentor\Path; use phpDocumentor\Transformer\Template; use Twig\Environment; use Twig\Extension\DebugExtension; use Twig\Loader\ChainLoader; -use Twig\Loader\FilesystemLoader; +use Twig\Loader\FilesystemLoader as TwigFilesystemLoader; class EnvironmentFactory { @@ -51,17 +51,14 @@ public function create( DocumentationSetDescriptor $documentationSet, Template $template, ): Environment { - $mountManager = $template->files(); - $loaders = []; if ($this->templateOverridesAt instanceof Path) { - $loaders[] = new FilesystemLoader([(string) $this->templateOverridesAt]); + $loaders[] = new TwigFilesystemLoader([(string) $this->templateOverridesAt]); } - $loaders[] = new FlySystemLoader($mountManager->getFilesystem('template'), '', 'base'); - $loaders[] = new FlySystemLoader($mountManager->getFilesystem('template'), 'guides', 'base'); - $loaders[] = new FlySystemLoader($mountManager->getFilesystem('templates')); - $loaders[] = new FilesystemLoader($this->guidesTemplateBasePath); + $loaders[] = new FileSystemLoader($template->files(), '', 'base'); + $loaders[] = new FileSystemLoader($template->files(), 'guides', 'base'); + $loaders[] = new TwigFilesystemLoader($this->guidesTemplateBasePath); $env = new Environment(new ChainLoader($loaders)); diff --git a/src/phpDocumentor/Transformer/Writer/Twig/Extension.php b/src/phpDocumentor/Transformer/Writer/Twig/Extension.php index 5950e92fb6..c2a5bdfacd 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/Extension.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/Extension.php @@ -47,7 +47,7 @@ use phpDocumentor\Descriptor\Tag\ExampleDescriptor; use phpDocumentor\Descriptor\Tag\LinkDescriptor; use phpDocumentor\Descriptor\Tag\SeeDescriptor; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\DocBlock\Tags\Reference; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Type; diff --git a/src/phpDocumentor/Transformer/Writer/Twig/FlySystemLoader.php b/src/phpDocumentor/Transformer/Writer/Twig/FileSystemLoader.php similarity index 74% rename from src/phpDocumentor/Transformer/Writer/Twig/FlySystemLoader.php rename to src/phpDocumentor/Transformer/Writer/Twig/FileSystemLoader.php index baf26143f1..97236fdc46 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/FlySystemLoader.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/FileSystemLoader.php @@ -14,8 +14,7 @@ namespace phpDocumentor\Transformer\Writer\Twig; use InvalidArgumentException; -use League\Flysystem\FileNotFoundException; -use League\Flysystem\FilesystemInterface; +use phpDocumentor\FileSystem\FileSystem; use Twig\Error\LoaderError; use Twig\Loader\LoaderInterface; use Twig\Source; @@ -26,7 +25,7 @@ use function strlen; use function substr; -final class FlySystemLoader implements LoaderInterface +final class FileSystemLoader implements LoaderInterface { /** * @var string|null prefix used to allow extends of base templates. For example @@ -35,7 +34,7 @@ final class FlySystemLoader implements LoaderInterface private $overloadPrefix; public function __construct( - private readonly FilesystemInterface $filesystem, + private readonly FileSystem $filesystem, private readonly string $templatePath = '', string|null $overloadPrefix = null, ) { @@ -87,28 +86,17 @@ public function isFresh(string $name, $time): bool { $this->guardTemplateExistsAndIsFile($name); - $timestamp = $this->filesystem->getTimestamp($this->resolveTemplateName($name)); + $timestamp = $this->filesystem->lastModified($this->resolveTemplateName($name)); - return (int) $time >= (int) $timestamp; + return (int) $time >= $timestamp; } /** @throws LoaderError */ private function guardTemplateExistsAndIsFile(string $name): void { - try { - $path = $this->resolveTemplateName($name); - $metadata = $this->filesystem->getMetadata($path); - if ($metadata === false) { - throw new FileNotFoundException($path); - } - - if ($metadata['type'] !== 'file') { - throw new LoaderError( - sprintf('Cannot use anything other than a file as a template, received: %s', $path), - ); - } - } catch (FileNotFoundException) { - throw new LoaderError(sprintf('Template "%s" could not be found on the given filesystem', $name)); + $path = $this->resolveTemplateName($name); + if (! $this->filesystem->has($path)) { + throw new LoaderError(sprintf("File '%s' does not exist", $path)); } } diff --git a/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer.php b/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer.php index 5b1cff13ef..25f36d15c6 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer.php @@ -16,7 +16,7 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\DocumentationSetDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\DocBlock\Tags\Reference; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Type; diff --git a/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapter.php b/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapter.php index 2b23ee2ba8..7884bd22d5 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapter.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapter.php @@ -16,7 +16,7 @@ use InvalidArgumentException; use phpDocumentor\Descriptor\ApiSetDescriptor; use phpDocumentor\Descriptor\DescriptorAbstract; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\DocBlock\Tags\Reference; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Type; diff --git a/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/UrlGenerator.php b/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/UrlGenerator.php index b4a07dcee0..5f62920ca6 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/UrlGenerator.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/UrlGenerator.php @@ -18,7 +18,7 @@ use phpDocumentor\Descriptor\Descriptor; use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\GuideSetDescriptor; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\DocBlock\Tags\Reference; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Type; diff --git a/src/phpDocumentor/Transformer/Writer/Twig/LinkRendererInterface.php b/src/phpDocumentor/Transformer/Writer/Twig/LinkRendererInterface.php index 04cce0dff8..4c609a6767 100644 --- a/src/phpDocumentor/Transformer/Writer/Twig/LinkRendererInterface.php +++ b/src/phpDocumentor/Transformer/Writer/Twig/LinkRendererInterface.php @@ -5,7 +5,7 @@ namespace phpDocumentor\Transformer\Writer\Twig; use phpDocumentor\Descriptor\DescriptorAbstract; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\DocBlock\Tags\Reference; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Type; diff --git a/tests/unit/phpDocumentor/Configuration/CommandlineOptionsMiddlewareTest.php b/tests/unit/phpDocumentor/Configuration/CommandlineOptionsMiddlewareTest.php index a29b46790c..dc6b3f9e2b 100644 --- a/tests/unit/phpDocumentor/Configuration/CommandlineOptionsMiddlewareTest.php +++ b/tests/unit/phpDocumentor/Configuration/CommandlineOptionsMiddlewareTest.php @@ -13,8 +13,8 @@ namespace phpDocumentor\Configuration; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use PHPUnit\Framework\TestCase; use function current; diff --git a/tests/unit/phpDocumentor/Configuration/Definition/Version3Test.php b/tests/unit/phpDocumentor/Configuration/Definition/Version3Test.php index 44b9b5d7a1..49ce9632cd 100644 --- a/tests/unit/phpDocumentor/Configuration/Definition/Version3Test.php +++ b/tests/unit/phpDocumentor/Configuration/Definition/Version3Test.php @@ -14,8 +14,8 @@ namespace phpDocumentor\Configuration\Definition; use phpDocumentor\Configuration\SymfonyConfigFactory; -use phpDocumentor\Dsn; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use PHPUnit\Framework\TestCase; use function array_merge; diff --git a/tests/unit/phpDocumentor/Configuration/PathNormalizingMiddlewareTest.php b/tests/unit/phpDocumentor/Configuration/PathNormalizingMiddlewareTest.php index fb030cae7b..58e31b73dd 100644 --- a/tests/unit/phpDocumentor/Configuration/PathNormalizingMiddlewareTest.php +++ b/tests/unit/phpDocumentor/Configuration/PathNormalizingMiddlewareTest.php @@ -14,7 +14,7 @@ */ use League\Uri\Uri; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use PHPUnit\Framework\TestCase; use function dirname; diff --git a/tests/unit/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddlewareTest.php b/tests/unit/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddlewareTest.php index 24a472005d..cc7b39aea1 100644 --- a/tests/unit/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddlewareTest.php +++ b/tests/unit/phpDocumentor/Configuration/ProvideTemplateOverridePathMiddlewareTest.php @@ -14,7 +14,7 @@ namespace phpDocumentor\Configuration; use League\Uri\Uri; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Transformer\Writer\Twig\EnvironmentFactory; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; diff --git a/tests/unit/phpDocumentor/Configuration/SourceTest.php b/tests/unit/phpDocumentor/Configuration/SourceTest.php index 23b057bad3..87a56fcafe 100644 --- a/tests/unit/phpDocumentor/Configuration/SourceTest.php +++ b/tests/unit/phpDocumentor/Configuration/SourceTest.php @@ -6,7 +6,7 @@ use BadMethodCallException; use phpDocumentor\Faker\Faker; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use PHPUnit\Framework\TestCase; /** @coversDefaultClass \phpDocumentor\Configuration\Source */ @@ -14,7 +14,7 @@ final class SourceTest extends TestCase { use Faker; - /** @uses \phpDocumentor\Dsn */ + /** @uses \phpDocumentor\FileSystem\Dsn */ public function testSourceReturnsDsn(): void { $dsn = self::faker()->dsn(); @@ -23,7 +23,7 @@ public function testSourceReturnsDsn(): void self::assertSame($dsn, $source->dsn()); } - /** @uses \phpDocumentor\Dsn */ + /** @uses \phpDocumentor\FileSystem\Dsn */ public function testWithDsnReturnsNewInstanceOfSource(): void { $dsn = self::faker()->dsn(); @@ -35,7 +35,7 @@ public function testWithDsnReturnsNewInstanceOfSource(): void self::assertNotSame($newSource, $source); } - /** @uses \phpDocumentor\Dsn */ + /** @uses \phpDocumentor\FileSystem\Dsn */ public function testWithDsnReturnsSetsNewDsn(): void { $dsn = self::faker()->dsn(); diff --git a/tests/unit/phpDocumentor/DsnTest.php b/tests/unit/phpDocumentor/DsnTest.php index b083ea7a9a..e6d4d6a912 100644 --- a/tests/unit/phpDocumentor/DsnTest.php +++ b/tests/unit/phpDocumentor/DsnTest.php @@ -13,13 +13,15 @@ namespace phpDocumentor; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\Path; use PHPUnit\Framework\TestCase; -/** @coversDefaultClass \phpDocumentor\Dsn */ +/** @coversDefaultClass \phpDocumentor\FileSystem\Dsn */ class DsnTest extends TestCase { /** - * @uses \phpDocumentor\Path + * @uses \phpDocumentor\FileSystem\Path * * @dataProvider provideDsnsToTestAgainst */ diff --git a/tests/unit/phpDocumentor/Faker/Provider.php b/tests/unit/phpDocumentor/Faker/Provider.php index 2597204541..4101e91f7e 100644 --- a/tests/unit/phpDocumentor/Faker/Provider.php +++ b/tests/unit/phpDocumentor/Faker/Provider.php @@ -45,10 +45,10 @@ use phpDocumentor\Descriptor\TagDescriptor; use phpDocumentor\Descriptor\TraitDescriptor; use phpDocumentor\Descriptor\VersionDescriptor; -use phpDocumentor\Dsn; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FlySystemFactory; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Guides\Nodes\ProjectNode; -use phpDocumentor\Parser\FlySystemFactory; -use phpDocumentor\Path; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Project; diff --git a/tests/unit/phpDocumentor/Parser/FlySystemCollectorTest.php b/tests/unit/phpDocumentor/Parser/FlySystemCollectorTest.php index 85a0f3d42d..e4649a85f5 100644 --- a/tests/unit/phpDocumentor/Parser/FlySystemCollectorTest.php +++ b/tests/unit/phpDocumentor/Parser/FlySystemCollectorTest.php @@ -14,7 +14,9 @@ namespace phpDocumentor\Parser; use League\Flysystem\MountManager; -use phpDocumentor\Dsn; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FlySystemFactory; +use phpDocumentor\FileSystem\SpecificationFactory; use PHPUnit\Framework\TestCase; use function stripos; @@ -26,8 +28,8 @@ final class FlySystemCollectorTest extends TestCase { /** - * @uses \phpDocumentor\Parser\SpecificationFactory - * @uses \phpDocumentor\Parser\FlySystemFactory + * @uses \phpDocumentor\FileSystem\SpecificationFactory + * @uses \phpDocumentor\FileSystem\FlySystemFactory */ public function testSingleSourceDir(): void { diff --git a/tests/unit/phpDocumentor/Parser/FlySystemFactoryTest.php b/tests/unit/phpDocumentor/Parser/FlySystemFactoryTest.php index a6e0a30215..3c099f9128 100644 --- a/tests/unit/phpDocumentor/Parser/FlySystemFactoryTest.php +++ b/tests/unit/phpDocumentor/Parser/FlySystemFactoryTest.php @@ -19,7 +19,8 @@ use League\Flysystem\Filesystem; use League\Flysystem\MountManager; use LogicException; -use phpDocumentor\Dsn; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FlySystemFactory; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; @@ -31,7 +32,7 @@ use const DIRECTORY_SEPARATOR; use const PHP_OS_FAMILY; -/** @coversDefaultClass \phpDocumentor\Parser\FlySystemFactory */ +/** @coversDefaultClass \phpDocumentor\FileSystem\FlySystemFactory */ final class FlySystemFactoryTest extends TestCase { use ProphecyTrait; diff --git a/tests/unit/phpDocumentor/Parser/SpecificationFactoryTest.php b/tests/unit/phpDocumentor/Parser/SpecificationFactoryTest.php index 4688d845f5..c5dc7861dc 100644 --- a/tests/unit/phpDocumentor/Parser/SpecificationFactoryTest.php +++ b/tests/unit/phpDocumentor/Parser/SpecificationFactoryTest.php @@ -19,9 +19,10 @@ use Flyfinder\Specification\IsHidden; use Flyfinder\Specification\NotSpecification; use Flyfinder\Specification\OrSpecification; +use phpDocumentor\FileSystem\SpecificationFactory; use PHPUnit\Framework\TestCase; -/** @coversDefaultClass \phpDocumentor\Parser\SpecificationFactory */ +/** @coversDefaultClass \phpDocumentor\FileSystem\SpecificationFactory */ final class SpecificationFactoryTest extends TestCase { private SpecificationFactory $fixture; diff --git a/tests/unit/phpDocumentor/PathTest.php b/tests/unit/phpDocumentor/PathTest.php index 6581d615d1..aba6442aec 100644 --- a/tests/unit/phpDocumentor/PathTest.php +++ b/tests/unit/phpDocumentor/PathTest.php @@ -13,9 +13,10 @@ namespace phpDocumentor; +use phpDocumentor\FileSystem\Path; use PHPUnit\Framework\TestCase; -/** @coversDefaultClass \phpDocumentor\Path */ +/** @coversDefaultClass \phpDocumentor\FileSystem\Path */ final class PathTest extends TestCase { public function testItCanContainALocationOnAStorageService(): void diff --git a/tests/unit/phpDocumentor/Pipeline/Stage/ConfigureTest.php b/tests/unit/phpDocumentor/Pipeline/Stage/ConfigureTest.php index c9b976bd5e..2c7bc8c243 100644 --- a/tests/unit/phpDocumentor/Pipeline/Stage/ConfigureTest.php +++ b/tests/unit/phpDocumentor/Pipeline/Stage/ConfigureTest.php @@ -17,8 +17,8 @@ use League\Uri\Contracts\UriInterface; use phpDocumentor\Configuration\Configuration; use phpDocumentor\Configuration\ConfigurationFactory; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Parser\Cache\Locator; -use phpDocumentor\Path; use phpDocumentor\Transformer\Writer\Twig\EnvironmentFactory; use PHPUnit\Framework\TestCase; use Prophecy\Argument; diff --git a/tests/unit/phpDocumentor/Pipeline/Stage/Parser/CollectFilesTest.php b/tests/unit/phpDocumentor/Pipeline/Stage/Parser/CollectFilesTest.php index f151f440d9..818cf5ea2f 100644 --- a/tests/unit/phpDocumentor/Pipeline/Stage/Parser/CollectFilesTest.php +++ b/tests/unit/phpDocumentor/Pipeline/Stage/Parser/CollectFilesTest.php @@ -15,8 +15,8 @@ use phpDocumentor\Configuration\VersionSpecification; use phpDocumentor\Descriptor\ProjectDescriptorBuilder; -use phpDocumentor\Dsn; use phpDocumentor\Faker\Faker; +use phpDocumentor\FileSystem\Dsn; use phpDocumentor\Parser\FileCollector; use PHPUnit\Framework\TestCase; use Prophecy\Argument; diff --git a/tests/unit/phpDocumentor/Pipeline/Stage/TransformTest.php b/tests/unit/phpDocumentor/Pipeline/Stage/TransformTest.php index 0575908281..a5e7a3f461 100644 --- a/tests/unit/phpDocumentor/Pipeline/Stage/TransformTest.php +++ b/tests/unit/phpDocumentor/Pipeline/Stage/TransformTest.php @@ -10,9 +10,9 @@ use Mockery\MockInterface; use phpDocumentor\Descriptor\ProjectDescriptor; use phpDocumentor\Descriptor\ProjectDescriptorBuilder; -use phpDocumentor\Dsn; use phpDocumentor\Faker\Faker; -use phpDocumentor\Parser\FlySystemFactory; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FlySystemFactory; use phpDocumentor\Transformer\Template\Collection; use phpDocumentor\Transformer\Template\Factory; use phpDocumentor\Transformer\Transformer; diff --git a/tests/unit/phpDocumentor/Transformer/Template/FactoryTest.php b/tests/unit/phpDocumentor/Transformer/Template/FactoryTest.php index 73eee85cfa..f8ca87d047 100644 --- a/tests/unit/phpDocumentor/Transformer/Template/FactoryTest.php +++ b/tests/unit/phpDocumentor/Transformer/Template/FactoryTest.php @@ -15,9 +15,9 @@ use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; -use phpDocumentor\Dsn; use phpDocumentor\Faker\Faker; -use phpDocumentor\Parser\FlySystemFactory; +use phpDocumentor\FileSystem\Dsn; +use phpDocumentor\FileSystem\FlySystemFactory; use phpDocumentor\Transformer\Writer\Collection as WriterCollection; use phpDocumentor\Transformer\Writer\WriterAbstract; use PHPUnit\Framework\TestCase; diff --git a/tests/unit/phpDocumentor/Transformer/TransformerTest.php b/tests/unit/phpDocumentor/Transformer/TransformerTest.php index f7ce0445de..c244a0d8c4 100644 --- a/tests/unit/phpDocumentor/Transformer/TransformerTest.php +++ b/tests/unit/phpDocumentor/Transformer/TransformerTest.php @@ -14,7 +14,7 @@ namespace phpDocumentor\Transformer; use phpDocumentor\Faker\Faker; -use phpDocumentor\Parser\FlySystemFactory; +use phpDocumentor\FileSystem\FlySystemFactory; use phpDocumentor\Transformer\Writer\Collection; use phpDocumentor\Transformer\Writer\WriterAbstract; use PHPUnit\Framework\TestCase; @@ -50,15 +50,12 @@ protected function setUp(): void $this->writer = $this->prophesize(WriterAbstract::class); $this->writer->getName()->willReturn('myTestWriter'); $this->writer->__toString()->willReturn('myTestWriter'); - $this->flySystemFactory = $this->prophesize(FlySystemFactory::class); - $this->flySystemFactory->create(Argument::any())->willReturn(self::faker()->fileSystem()); $eventDispatcher = $this->prophesize(EventDispatcherInterface::class); $eventDispatcher->dispatch(Argument::any(), Argument::any())->willReturnArgument(0); $this->fixture = new Transformer( new Collection(['myTestWriter' => $this->writer->reveal()]), new NullLogger(), - $this->flySystemFactory->reveal(), $eventDispatcher->reveal(), ); } @@ -77,19 +74,6 @@ public function testInitialization(): void self::assertSame('Transform analyzed project into artifacts', $fixture->getDescription()); } - public function testSettingAndGettingATarget(): void - { - $filesystem = self::faker()->fileSystem(); - $this->flySystemFactory->create(Argument::any())->willReturn($filesystem); - - $this->assertEquals('', $this->fixture->getTarget()); - - $this->fixture->setTarget(__DIR__); - - $this->assertEquals(__DIR__, $this->fixture->getTarget()); - $this->assertEquals($filesystem, $this->fixture->destination()); - } - public function testExecute(): void { $apiSet = self::faker()->apiSetDescriptor(); @@ -104,7 +88,7 @@ public function testExecute(): void $this->writer->transform($transformation, $project, $apiSet)->shouldBeCalled(); - $this->fixture->execute($project, $apiSet, [$transformation->reveal()]); + $this->fixture->execute($this->$project, $apiSet, [$transformation->reveal()]); } public function testGetDescription(): void diff --git a/tests/unit/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactoryTest.php b/tests/unit/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactoryTest.php index 5f17602b1b..6a372cb4ad 100644 --- a/tests/unit/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactoryTest.php +++ b/tests/unit/phpDocumentor/Transformer/Writer/Twig/EnvironmentFactoryTest.php @@ -103,9 +103,9 @@ public function testItCreatesATwigEnvironmentWithTheCorrectTemplateLoaders(): vo $this->assertInstanceOf(ChainLoader::class, $loader); $this->assertEquals( [ - new FlySystemLoader($mountManager->getFilesystem('templates'), '', 'base'), - new FlySystemLoader($mountManager->getFilesystem('template'), 'guides', 'base'), - new FlySystemLoader($mountManager->getFilesystem('template')), + new FileSystemLoader($mountManager->getFilesystem('templates'), '', 'base'), + new FileSystemLoader($mountManager->getFilesystem('template'), 'guides', 'base'), + new FileSystemLoader($mountManager->getFilesystem('template')), new FilesystemLoader('./data/templates'), ], $loader->getLoaders(), diff --git a/tests/unit/phpDocumentor/Transformer/Writer/Twig/FlySystemLoaderTest.php b/tests/unit/phpDocumentor/Transformer/Writer/Twig/FlySystemLoaderTest.php index fd9c98ef3e..c11c64a146 100644 --- a/tests/unit/phpDocumentor/Transformer/Writer/Twig/FlySystemLoaderTest.php +++ b/tests/unit/phpDocumentor/Transformer/Writer/Twig/FlySystemLoaderTest.php @@ -11,7 +11,7 @@ use Twig\Error\LoaderError; use Twig\Source; -/** @coversDefaultClass \phpDocumentor\Transformer\Writer\Twig\FlySystemLoader */ +/** @coversDefaultClass \phpDocumentor\Transformer\Writer\Twig\FileSystemLoader */ final class FlySystemLoaderTest extends TestCase { use ProphecyTrait; @@ -22,7 +22,7 @@ public function testExists(string $filename, string $resolvedName, string|null $ $fileSystem = $this->prophesize(FilesystemInterface::class); $fileSystem->has($resolvedName)->willReturn(true); - $loader = new FlySystemLoader($fileSystem->reveal(), '', $overloadPrefix); + $loader = new FileSystemLoader($fileSystem->reveal(), '', $overloadPrefix); $this->assertTrue($loader->exists($filename)); } @@ -34,7 +34,7 @@ public function testGetSourceContext(string $filename, string $resolvedName, str $fileSystem->getMetadata($resolvedName)->willReturn(['type' => 'file']); $fileSystem->read($resolvedName)->willReturn('content'); - $loader = new FlySystemLoader($fileSystem->reveal(), '', $overloadPrefix); + $loader = new FileSystemLoader($fileSystem->reveal(), '', $overloadPrefix); $this->assertEquals( new Source( @@ -52,7 +52,7 @@ public function testGetCacheKey(string $filename, string $resolvedName, string|n $fileSystem = $this->prophesize(FilesystemInterface::class); $fileSystem->getMetadata($resolvedName)->willReturn(['type' => 'file']); - $loader = new FlySystemLoader($fileSystem->reveal(), '', $overloadPrefix); + $loader = new FileSystemLoader($fileSystem->reveal(), '', $overloadPrefix); $this->assertSame($filename, $loader->getCacheKey($filename)); } @@ -64,7 +64,7 @@ public function testIsFresh(string $filename, string $resolvedName, string|null $fileSystem->getMetadata($resolvedName)->willReturn(['type' => 'file']); $fileSystem->getTimestamp($resolvedName)->willReturn(10); - $loader = new FlySystemLoader($fileSystem->reveal(), '', $overloadPrefix); + $loader = new FileSystemLoader($fileSystem->reveal(), '', $overloadPrefix); $this->assertTrue($loader->isFresh($filename, 10)); } @@ -96,7 +96,7 @@ public function testInvalidFileType(): void $fileSystem = $this->prophesize(FilesystemInterface::class); $fileSystem->getMetadata('someDir')->willReturn(['type' => 'dir']); - $loader = new FlySystemLoader($fileSystem->reveal(), ''); + $loader = new FileSystemLoader($fileSystem->reveal(), ''); $loader->getSourceContext('someDir'); } @@ -106,7 +106,7 @@ public function testFileDoesNotExist(): void $fileSystem = $this->prophesize(FilesystemInterface::class); $fileSystem->getMetadata('someDir')->willThrow(new FileNotFoundException('someDir')); - $loader = new FlySystemLoader($fileSystem->reveal(), ''); + $loader = new FileSystemLoader($fileSystem->reveal(), ''); $loader->getSourceContext('someDir'); } @@ -116,7 +116,7 @@ public function testLoadFileWithPrefix(): void $fileSystem->getMetadata('test/file.twig')->willReturn(['type' => 'file']); $fileSystem->read('test/file.twig')->willReturn('content'); - $loader = new FlySystemLoader($fileSystem->reveal(), 'test/'); + $loader = new FileSystemLoader($fileSystem->reveal(), 'test/'); $this->assertEquals( new Source( 'content', diff --git a/tests/unit/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapterTest.php b/tests/unit/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapterTest.php index 93922f0701..fc20a90333 100644 --- a/tests/unit/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapterTest.php +++ b/tests/unit/phpDocumentor/Transformer/Writer/Twig/LinkRenderer/LinkAdapterTest.php @@ -17,7 +17,7 @@ use phpDocumentor\Descriptor\ClassDescriptor; use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Faker\Faker; -use phpDocumentor\Path; +use phpDocumentor\FileSystem\Path; use phpDocumentor\Reflection\DocBlock\Tags\Reference; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Type;