diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27cc5d8..57986ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: path: /tmp/composer-cache key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: php-actions/composer@v5 + - uses: php-actions/composer@v6 - name: Archive build run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./ @@ -40,7 +40,7 @@ jobs: run: tar -xvf /tmp/github-actions/build.tar ./ - name: PHP Unit tests - uses: php-actions/phpunit@v2 + uses: php-actions/phpunit@v3 with: php_version: 8.0 php_extensions: xdebug @@ -61,6 +61,6 @@ jobs: run: tar -xvf /tmp/github-actions/build.tar ./ - name: PHP Static Analysis - uses: php-actions/phpstan@v2 + uses: php-actions/phpstan@v3 with: - path: src/ \ No newline at end of file + path: src/ diff --git a/composer.json b/composer.json index 11c66c9..c9fc62f 100644 --- a/composer.json +++ b/composer.json @@ -3,13 +3,13 @@ "description": "Synchronise two directories.", "require": { - "php": ">=7.2", + "php": ">=8.0", "phpgt/cli": "1.3.*", "webmozart/glob": "4.*" }, "require-dev": { - "phpunit/phpunit": "9.*", + "phpunit/phpunit": "^9.5", "phpstan/phpstan": "^0.12" }, diff --git a/composer.lock b/composer.lock index 6c3b580..76bbe11 100644 --- a/composer.lock +++ b/composer.lock @@ -4,29 +4,31 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "11d482008291e381ae0e701166c0da40", + "content-hash": "dec546656a55609976c28c9900772c68", "packages": [ { "name": "phpgt/cli", - "version": "v1.3.0", + "version": "v1.3.2", "source": { "type": "git", "url": "https://github.com/PhpGt/Cli.git", - "reference": "3432e0a31080bcc40e690e049d6396c9f96cac09" + "reference": "3f00088f76225088602e6d9faa1cf90fbd2205d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Cli/zipball/3432e0a31080bcc40e690e049d6396c9f96cac09", - "reference": "3432e0a31080bcc40e690e049d6396c9f96cac09", + "url": "https://api.github.com/repos/PhpGt/Cli/zipball/3f00088f76225088602e6d9faa1cf90fbd2205d3", + "reference": "3f00088f76225088602e6d9faa1cf90fbd2205d3", "shasum": "" }, "require": { "ext-json": "*", - "php": ">=7.4", - "phpgt/daemon": "*" + "ext-readline": "*", + "php": ">=8.0", + "phpgt/daemon": "1.*" }, "require-dev": { - "phpunit/phpunit": "8.*" + "phpstan/phpstan": ">=0.12.64", + "phpunit/phpunit": "9.*" }, "type": "library", "autoload": { @@ -51,27 +53,38 @@ "terminal", "webengine" ], - "time": "2020-01-03T15:42:11+00:00" + "support": { + "issues": "https://github.com/PhpGt/Cli/issues", + "source": "https://github.com/PhpGt/Cli/tree/v1.3.2" + }, + "funding": [ + { + "url": "https://github.com/sponsors/PhpGt", + "type": "github" + } + ], + "time": "2021-06-15T19:01:44+00:00" }, { "name": "phpgt/daemon", - "version": "v1.1.1", + "version": "v1.1.2", "source": { "type": "git", "url": "https://github.com/PhpGt/Daemon.git", - "reference": "03cc376ec1969530b4478f8278732eb3f97dd09e" + "reference": "6490df99a22818149f30e3af408002ea7f73e035" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhpGt/Daemon/zipball/03cc376ec1969530b4478f8278732eb3f97dd09e", - "reference": "03cc376ec1969530b4478f8278732eb3f97dd09e", + "url": "https://api.github.com/repos/PhpGt/Daemon/zipball/6490df99a22818149f30e3af408002ea7f73e035", + "reference": "6490df99a22818149f30e3af408002ea7f73e035", "shasum": "" }, "require": { "php": ">=7.4" }, "require-dev": { - "phpunit/phpunit": "8.*" + "phpstan/phpstan": ">=0.12.42", + "phpunit/phpunit": "9.*" }, "type": "library", "autoload": { @@ -81,20 +94,30 @@ }, "notification-url": "https://packagist.org/downloads/", "description": "Background script execution with cross-platform compatible streaming.", - "time": "2020-01-03T14:17:34+00:00" + "support": { + "issues": "https://github.com/PhpGt/Daemon/issues", + "source": "https://github.com/PhpGt/Daemon/tree/v1.1.2" + }, + "funding": [ + { + "url": "https://github.com/phpgt", + "type": "github" + } + ], + "time": "2021-02-02T17:33:16+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.20.0", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { @@ -106,7 +129,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -143,6 +166,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -157,34 +183,39 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -206,35 +237,38 @@ "check", "validate" ], - "time": "2020-07-08T17:02:28+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, + "time": "2021-03-09T10:59:23+00:00" }, { "name": "webmozart/glob", - "version": "4.0.0", + "version": "4.3.0", "source": { "type": "git", - "url": "https://github.com/webmozart/glob.git", - "reference": "732b4fc341f8dd418b0b9d8bff9b2458662cd382" + "url": "https://github.com/webmozarts/glob.git", + "reference": "06358fafde0f32edb4513f4fd88fe113a40c90ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/glob/zipball/732b4fc341f8dd418b0b9d8bff9b2458662cd382", - "reference": "732b4fc341f8dd418b0b9d8bff9b2458662cd382", + "url": "https://api.github.com/repos/webmozarts/glob/zipball/06358fafde0f32edb4513f4fd88fe113a40c90ee", + "reference": "06358fafde0f32edb4513f4fd88fe113a40c90ee", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": "^7.3 || ^8.0.0", "webmozart/path-util": "^2.2" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1", - "symfony/filesystem": "^2.5" + "phpunit/phpunit": "^8.0", + "symfony/filesystem": "^5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -253,7 +287,11 @@ } ], "description": "A PHP implementation of Ant's glob.", - "time": "2015-12-28T09:48:22+00:00" + "support": { + "issues": "https://github.com/webmozarts/glob/issues", + "source": "https://github.com/webmozarts/glob/tree/4.3.0" + }, + "time": "2021-01-21T06:17:15+00:00" }, { "name": "webmozart/path-util", @@ -299,6 +337,10 @@ } ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, "time": "2015-12-17T08:42:14+00:00" } ], @@ -352,6 +394,10 @@ "constructor", "instantiate" ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, "funding": [ { "url": "https://www.doctrine-project.org/sponsorship.html", @@ -414,6 +460,10 @@ "object", "object graph" ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, "funding": [ { "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", @@ -424,16 +474,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.13.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "50953a2691a922aa1769461637869a0a2faa3f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", + "reference": "50953a2691a922aa1769461637869a0a2faa3f53", "shasum": "" }, "require": { @@ -472,20 +522,24 @@ "parser", "php" ], - "time": "2020-12-20T10:01:03+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + }, + "time": "2021-09-20T12:20:58+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { @@ -528,20 +582,24 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2020-06-27T14:33:11+00:00" + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/e4782611070e50613683d2b9a57730e9a3ba5451", - "reference": "e4782611070e50613683d2b9a57730e9a3ba5451", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { @@ -575,7 +633,11 @@ } ], "description": "Library for handling version information and constraints", - "time": "2020-12-13T23:18:30+00:00" + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.1.0" + }, + "time": "2021-02-23T14:00:09+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -624,6 +686,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -676,20 +742,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", "shasum": "" }, "require": { @@ -697,7 +767,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -721,37 +792,41 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.0" + }, + "time": "2021-09-17T15:28:14+00:00" }, { "name": "phpspec/prophecy", - "version": "1.12.2", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", + "php": "^7.2 || ~8.0, <8.2", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", + "phpspec/phpspec": "^6.0 || ^7.0", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -784,20 +859,24 @@ "spy", "stub" ], - "time": "2020-12-19T10:15:11+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + }, + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.64", + "version": "0.12.99", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa" + "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", - "reference": "23eb1cb7ae125f45f1d0e48051bcf67a9a9b08aa", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b4d40f1d759942f523be267a1bab6884f46ca3f7", + "reference": "b4d40f1d759942f523be267a1bab6884f46ca3f7", "shasum": "" }, "require": { @@ -826,11 +905,19 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/0.12.99" + }, "funding": [ { "url": "https://github.com/ondrejmirtes", "type": "github" }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, { "url": "https://www.patreon.com/phpstan", "type": "patreon" @@ -840,27 +927,27 @@ "type": "tidelift" } ], - "time": "2020-12-21T11:59:02+00:00" + "time": "2021-09-12T20:09:55+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.5", + "version": "9.2.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d4c798ed8d51506800b441f7a13ecb0f76f12218", + "reference": "d4c798ed8d51506800b441f7a13ecb0f76f12218", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.12.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -907,13 +994,17 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.7" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], - "time": "2020-11-28T06:44:49+00:00" + "time": "2021-09-17T05:39:03+00:00" }, { "name": "phpunit/php-file-iterator", @@ -963,6 +1054,10 @@ "filesystem", "iterator" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1022,6 +1117,10 @@ "keywords": [ "process" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1077,6 +1176,10 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1132,6 +1235,10 @@ "keywords": [ "timer" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1142,16 +1249,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.0", + "version": "9.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe" + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", - "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", "shasum": "" }, "require": { @@ -1163,11 +1270,11 @@ "ext-xml": "*", "ext-xmlwriter": "*", "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", + "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", + "phpunit/php-code-coverage": "^9.2.7", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -1181,7 +1288,7 @@ "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", + "sebastian/type": "^2.3.4", "sebastian/version": "^3.0.2" }, "require-dev": { @@ -1227,6 +1334,10 @@ "testing", "xunit" ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + }, "funding": [ { "url": "https://phpunit.de/donate.html", @@ -1237,7 +1348,7 @@ "type": "github" } ], - "time": "2020-12-04T05:05:53+00:00" + "time": "2021-09-25T07:38:51+00:00" }, { "name": "sebastian/cli-parser", @@ -1283,6 +1394,10 @@ ], "description": "Library for parsing CLI options", "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1335,6 +1450,10 @@ ], "description": "Collection of value objects that represent the PHP code units", "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1386,6 +1505,10 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1456,6 +1579,10 @@ "compare", "equality" ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1509,6 +1636,10 @@ ], "description": "Library for calculating the complexity of PHP code units", "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1571,6 +1702,10 @@ "unidiff", "unified diff" ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1630,6 +1765,10 @@ "environment", "hhvm" ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1703,6 +1842,10 @@ "export", "exporter" ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1713,16 +1856,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { @@ -1763,13 +1906,17 @@ "keywords": [ "global state" ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2021-06-11T13:31:12+00:00" }, { "name": "sebastian/lines-of-code", @@ -1816,6 +1963,10 @@ ], "description": "Library for counting the lines of code in PHP source code", "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1869,6 +2020,10 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1920,6 +2075,10 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -1979,6 +2138,10 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2030,6 +2193,10 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2040,16 +2207,16 @@ }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", "shasum": "" }, "require": { @@ -2082,13 +2249,17 @@ ], "description": "Collection of value objects that represent the types of the PHP type system", "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", @@ -2131,6 +2302,10 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, "funding": [ { "url": "https://github.com/sebastianbergmann", @@ -2141,16 +2316,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { @@ -2177,13 +2352,17 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, "funding": [ { "url": "https://github.com/theseer", "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" + "time": "2021-07-28T10:34:58+00:00" } ], "aliases": [], @@ -2192,8 +2371,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.2" + "php": ">=8.0" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/src/AbstractSync.php b/src/AbstractSync.php index 6756987..783bbbc 100644 --- a/src/AbstractSync.php +++ b/src/AbstractSync.php @@ -2,13 +2,10 @@ namespace Gt\Sync; abstract class AbstractSync { - protected $source; - protected $destination; - - public function __construct(string $source, string $destination) { - $this->source = $source; - $this->destination = $destination; - } + public function __construct( + protected string $source, + protected string $destination + ) {} abstract public function exec(int $settings = 0):void; -} \ No newline at end of file +} diff --git a/src/DirectorySync.php b/src/DirectorySync.php index 675e662..8bdd19d 100644 --- a/src/DirectorySync.php +++ b/src/DirectorySync.php @@ -14,15 +14,17 @@ class DirectorySync extends AbstractSync { const DEFAULT_SETTINGS = self::COMPARE_FILEMTIME; - protected $copiedFiles; - protected $skippedFiles; - protected $deletedFiles; - protected $glob; + /** @var array */ + protected array $copiedFiles; + /** @var array */ + protected array $skippedFiles; + /** @var array */ + protected array $deletedFiles; public function __construct( - string $source, - string $destination, - string $pattern = null + protected string $source, + protected string $destination, + private string $glob = "**/*" ) { $source = Path::makeAbsolute($source, getcwd()); $destination = Path::makeAbsolute($destination, getcwd()); @@ -32,17 +34,6 @@ public function __construct( if(!is_dir($source)) { throw new SyncException("Source directory does not exist: $source"); } - - if($pattern) { - $this->setPattern($pattern); - } - else { - $this->glob = "**/*"; - } - } - - public function setPattern(string $glob):void { - $this->glob = $glob; } /** @@ -107,7 +98,7 @@ public function exec(int $settings = self::DEFAULT_SETTINGS):void { if(!$this->sourceFileExists($relativePath)) { $this->delete($relativePath); - $this->deletedFiles []= $relativePath; + array_push($this->deletedFiles, $relativePath); } } @@ -132,12 +123,12 @@ public function exec(int $settings = self::DEFAULT_SETTINGS):void { if($filesAreIdentical || !$this->fileMatchesGlob($relativePath)) { - $this->skippedFiles []= $relativePath; + array_push($this->skippedFiles, $relativePath); continue; } $this->copy($relativePath); - $this->copiedFiles []= $relativePath; + array_push($this->copiedFiles, $relativePath); } if(!empty($this->copiedFiles) @@ -146,14 +137,17 @@ public function exec(int $settings = self::DEFAULT_SETTINGS):void { } } + /** @return array */ public function getCopiedFilesList():array { return $this->copiedFiles; } + /** @return array */ public function getSkippedFilesList():array { return $this->skippedFiles; } + /** @return array */ public function getDeletedFilesList():array { return $this->deletedFiles; } @@ -255,4 +249,4 @@ protected function checkSettings(int $settings):void { throw new SyncException("Cannot compare both filemtime and hash."); } } -} \ No newline at end of file +} diff --git a/test/phpunit/DirectorySyncTest.php b/test/phpunit/DirectorySyncTest.php index cafabad..660620d 100644 --- a/test/phpunit/DirectorySyncTest.php +++ b/test/phpunit/DirectorySyncTest.php @@ -42,13 +42,13 @@ public function tearDown():void { } } - public function testSourceNotExists() { + public function testSourceNotExists():void { self::expectException(SyncException::class); self::expectExceptionMessage("Source directory does not exist"); new DirectorySync($this->getRandomTmp(), $this->getRandomTmp()); } - public function testDestinationNotExists() { + public function testDestinationNotExists():void { $source = $this->getRandomTmp(); mkdir($source, 0775, true); $dest = $this->getRandomTmp(); @@ -59,7 +59,7 @@ public function testDestinationNotExists() { self::assertDirectoryExists($dest); } - public function testCopy() { + public function testCopy():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -71,7 +71,7 @@ public function testCopy() { self::assertDirectoryContentsIdentical($source, $dest); } - public function testCopyNewFileTouched() { + public function testCopyNewFileTouched():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -90,7 +90,7 @@ public function testCopyNewFileTouched() { self::assertDirectoryContentsIdentical($source, $dest); } - public function testCopyNewFileEditedNotCheckedByDefault() { + public function testCopyNewFileEditedNotCheckedByDefault():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -109,14 +109,14 @@ public function testCopyNewFileEditedNotCheckedByDefault() { self::assertDirectoryContentsIdentical($source, $dest); } - public function testDeleteFiles() { + public function testDeleteFiles():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); $numFiles = rand(10, 250); $this->createRandomFiles($source, $numFiles); $filesToDelete = []; - $numFilesToDelete = rand(1, round($numFiles / 5)); + $numFilesToDelete = rand(1, (int)round($numFiles / 5)); for($i = 0; $i < $numFilesToDelete; $i++) { $f = $this->getRandomFileFromDirectory($source); if(!in_array($f, $filesToDelete)) { @@ -138,7 +138,7 @@ public function testDeleteFiles() { self::assertDirectoryContentsIdentical($source, $dest); } - public function testDeleteDirectory() { + public function testDeleteDirectory():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -155,7 +155,7 @@ public function testDeleteDirectory() { self::assertDirectoryContentsIdentical($source, $dest); } - public function testCopyWrongConfig() { + public function testCopyWrongConfig():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -168,7 +168,7 @@ public function testCopyWrongConfig() { ); } - public function testGetCopiedFilesList() { + public function testGetCopiedFilesList():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -183,11 +183,11 @@ public function testGetCopiedFilesList() { self::assertCount(0, $sut->getCopiedFilesList()); } - public function testGetDeletedFilesList() { + public function testGetDeletedFilesList():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); - $sourceFileList = $this->createRandomFiles($source); + $this->createRandomFiles($source); $sut = new DirectorySync($source, $dest); $sut->exec(); @@ -199,7 +199,7 @@ public function testGetDeletedFilesList() { self::assertCount(1, $sut->getDeletedFilesList()); } - public function testGetSkippedFilesList() { + public function testGetSkippedFilesList():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -215,7 +215,7 @@ public function testGetSkippedFilesList() { self::assertCount(count($sourceFileList), $skippedFilesList); } - public function testCheck() { + public function testCheck():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -227,7 +227,7 @@ public function testCheck() { self::assertTrue($sut->check()); } - public function testSetPattern() { + public function testSetPattern():void { $source = $this->getRandomTmp(); $dest = $this->getRandomTmp(); mkdir($source, 0775, true); @@ -248,8 +248,7 @@ public function testSetPattern() { rename($file2, $file2 . "match"); rename($file3, $file3 . "match"); - $sut = new DirectorySync($source, $dest); - $sut->setPattern("**/*.filematch"); + $sut = new DirectorySync($source, $dest, "**/*.filematch"); $sut->exec(); $copiedFiles = $sut->getCopiedFilesList(); self::assertCount(3, $copiedFiles); @@ -259,6 +258,7 @@ public function testSetPattern() { self::assertCount(0, $copiedFiles); } + /** @return array */ protected function createRandomFiles( string $directory, int $numFiles = 100, @@ -287,7 +287,7 @@ protected function createRandomFiles( mkdir(dirname($path), 0775, true); } file_put_contents($path, uniqid("content-")); - $fileList []= $path; + array_push($fileList, $path); } return $fileList; @@ -305,6 +305,8 @@ protected function getRandomFileFromDirectory(string $dir):string { } } while($fileList); + + return ""; } protected function getRandomSubdirectoryFromDirectory(string $dir):string { @@ -317,7 +319,7 @@ protected function getRandomSubdirectoryFromDirectory(string $dir):string { return $file; } - protected function recursiveDeleteDirectory(string $dir) { + protected function recursiveDeleteDirectory(string $dir):void{ $directory = new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::SKIP_DOTS @@ -501,4 +503,4 @@ protected static function assertDirectoryContentsNotIdentical( true ); } -} \ No newline at end of file +}