From 2fe23dd84bd01826afc394566af36d57f8dba002 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 23 Jun 2019 21:29:05 +0200 Subject: [PATCH 01/61] Make command used to run tests as in other packages --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1bad6b3..88dc8a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ before_install: install: composer install --dev before_script: - mysql -u root -e 'create database activecollab_database_object_test' -script: vendor/bin/phpunit +script: php vendor/bin/phpunit From 969450e24884ecc859707c9c8159d88501e70044 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 21 Dec 2019 15:12:19 +0100 Subject: [PATCH 02/61] Update database connection --- .travis.yml | 2 +- composer.json | 4 +- composer.lock | 707 +++++++++++++++++--------------- test/src/Fixtures/Container.php | 5 +- 4 files changed, 370 insertions(+), 348 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88dc8a1..788ed16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - 7.1 + - 7.3 services: - mysql before_install: diff --git a/composer.json b/composer.json index 8d96cab..9095952 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,8 @@ } ], "require": { - "php": ">=7.1", - "activecollab/databaseconnection": "^3.0", + "php": ">=7.3", + "activecollab/databaseconnection": "^3.0||^4.0", "activecollab/etag": "^1.0", "activecollab/object": "^1.0", "doctrine/inflector": "^1.0", diff --git a/composer.lock b/composer.lock index 32cb299..1c1bedb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,28 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0b7a6a190365162173cd286c42a1a6ee", + "content-hash": "f554c337ce4c00b0eaeeeb11114ed218", "packages": [ { "name": "activecollab/containeraccess", - "version": "1.0.4", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/activecollab/containeraccess.git", - "reference": "30bf92724df248f77f7b0debd93eca3e7097513a" + "reference": "950deccdec3dd6484b2149fae48ce346c3afe0b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/containeraccess/zipball/30bf92724df248f77f7b0debd93eca3e7097513a", - "reference": "30bf92724df248f77f7b0debd93eca3e7097513a", + "url": "https://api.github.com/repos/activecollab/containeraccess/zipball/950deccdec3dd6484b2149fae48ce346c3afe0b7", + "reference": "950deccdec3dd6484b2149fae48ce346c3afe0b7", "shasum": "" }, "require": { - "container-interop/container-interop": "^1.2.0", - "php": ">=5.6.0" + "php": ">=7.3", + "psr/container": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~5.3" + "phpunit/phpunit": "^7.0" }, "type": "library", "autoload": { @@ -51,28 +51,28 @@ "ioc", "service-container" ], - "time": "2017-11-12T16:38:02+00:00" + "time": "2019-12-21T13:14:15+00:00" }, { "name": "activecollab/databaseconnection", - "version": "3.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/activecollab/databaseconnection.git", - "reference": "9824e8dd4368f55f72146cac71d6d60f1ac61167" + "reference": "7192b59cda4022a381ab0b9fe0bdd670f9b083ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/9824e8dd4368f55f72146cac71d6d60f1ac61167", - "reference": "9824e8dd4368f55f72146cac71d6d60f1ac61167", + "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/7192b59cda4022a381ab0b9fe0bdd670f9b083ca", + "reference": "7192b59cda4022a381ab0b9fe0bdd670f9b083ca", "shasum": "" }, "require": { - "activecollab/containeraccess": "^1.0", + "activecollab/containeraccess": "^2.0", "activecollab/datevalue": "^2.0", "ext-json": "*", "ext-mysqli": "*", - "php": ">=7.1", + "php": ">=7.3", "psr/log": "^1.0.0" }, "require-dev": { @@ -103,7 +103,7 @@ "activecollab", "mysql" ], - "time": "2019-06-23T17:02:50+00:00" + "time": "2019-12-21T13:48:35+00:00" }, { "name": "activecollab/datevalue", @@ -244,49 +244,18 @@ ], "time": "2016-07-14T19:59:07+00:00" }, - { - "name": "container-interop/container-interop", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14T19:40:03+00:00" - }, { "name": "doctrine/inflector", - "version": "v1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1", + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1", "shasum": "" }, "require": { @@ -311,6 +280,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -319,10 +292,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -340,37 +309,43 @@ "singularize", "string" ], - "time": "2018-01-09T20:05:19+00:00" + "time": "2019-10-30T19:59:35+00:00" }, { "name": "nesbot/carbon", - "version": "2.19.2", + "version": "2.28.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "adcad3f3af52d0ad4ad7b05f43aa58243b6ca67b" + "reference": "e2bcbcd43e67ee6101d321d5de916251d2870ca8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/adcad3f3af52d0ad4ad7b05f43aa58243b6ca67b", - "reference": "adcad3f3af52d0ad4ad7b05f43aa58243b6ca67b", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e2bcbcd43e67ee6101d321d5de916251d2870ca8", + "reference": "e2bcbcd43e67ee6101d321d5de916251d2870ca8", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", - "symfony/translation": "^3.4 || ^4.0" + "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", "kylekatarnls/multi-tester": "^1.1", - "phpmd/phpmd": "^2.6", + "phpmd/phpmd": "dev-php-7.1-compatibility", "phpstan/phpstan": "^0.11", "phpunit/phpunit": "^7.5 || ^8.0", "squizlabs/php_codesniffer": "^3.4" }, + "bin": [ + "bin/carbon" + ], "type": "library", "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" @@ -391,16 +366,20 @@ "name": "Brian Nesbitt", "email": "brian@nesbot.com", "homepage": "http://nesbot.com" + }, + { + "name": "kylekatarnls", + "homepage": "http://github.com/kylekatarnls" } ], - "description": "A simple API extension for DateTime.", + "description": "An API extension for DateTime that supports 281 different languages.", "homepage": "http://carbon.nesbot.com", "keywords": [ "date", "datetime", "time" ], - "time": "2019-06-07T09:56:45+00:00" + "time": "2019-12-16T16:30:25+00:00" }, { "name": "psr/container", @@ -453,16 +432,16 @@ }, { "name": "psr/log", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -471,7 +450,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -496,20 +475,20 @@ "psr", "psr-3" ], - "time": "2018-11-20T15:27:04+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.11.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "shasum": "" }, "require": { @@ -521,7 +500,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -555,46 +534,47 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-11-27T14:18:11+00:00" }, { "name": "symfony/translation", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "5dda505e5f65d759741dfaf4e54b36010a4b57aa" + "reference": "3ae6fad7a3dc2d99a023f9360184628fc44acbb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/5dda505e5f65d759741dfaf4e54b36010a4b57aa", - "reference": "5dda505e5f65d759741dfaf4e54b36010a4b57aa", + "url": "https://api.github.com/repos/symfony/translation/zipball/3ae6fad7a3dc2d99a023f9360184628fc44acbb3", + "reference": "3ae6fad7a3dc2d99a023f9360184628fc44acbb3", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.2" + "symfony/translation-contracts": "^2" }, "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" + "symfony/config": "<4.4", + "symfony/dependency-injection": "<5.0", + "symfony/http-kernel": "<5.0", + "symfony/twig-bundle": "<5.0", + "symfony/yaml": "<4.4" }, "provide": { - "symfony/translation-implementation": "1.0" + "symfony/translation-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/console": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~3.4|~4.0", - "symfony/intl": "~3.4|~4.0", - "symfony/service-contracts": "^1.1.2", - "symfony/var-dumper": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "symfony/config": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/http-kernel": "^5.0", + "symfony/intl": "^4.4|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^4.4|^5.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -604,7 +584,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -631,24 +611,24 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-06-03T20:27:40+00:00" + "time": "2019-12-12T13:03:32+00:00" }, { "name": "symfony/translation-contracts", - "version": "v1.1.5", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c" + "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/cb4b18ad7b92a26e83b65dde940fab78339e6f3c", - "reference": "cb4b18ad7b92a26e83b65dde940fab78339e6f3c", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8cc682ac458d75557203b2f2f14b0b92e1c744ed", + "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "suggest": { "symfony/translation-implementation": "" @@ -656,7 +636,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -688,7 +668,7 @@ "interoperability", "standards" ], - "time": "2019-06-13T11:15:36+00:00" + "time": "2019-11-18T17:27:11+00:00" } ], "packages-dev": [ @@ -756,24 +736,24 @@ }, { "name": "composer/xdebug-handler", - "version": "1.3.3", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" + "reference": "cbe23383749496fe0f373345208b79568e4bc248" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", + "reference": "cbe23383749496fe0f373345208b79568e4bc248", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0", + "php": "^5.3.2 || ^7.0 || ^8.0", "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" }, "type": "library", "autoload": { @@ -791,25 +771,25 @@ "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Restarts a process without xdebug.", + "description": "Restarts a process without Xdebug.", "keywords": [ "Xdebug", "performance" ], - "time": "2019-05-27T17:52:04+00:00" + "time": "2019-11-06T16:40:04+00:00" }, { "name": "doctrine/annotations", - "version": "v1.6.1", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "53120e0eb10355388d6ccbe462f1fea34ddadb24" + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/53120e0eb10355388d6ccbe462f1fea34ddadb24", - "reference": "53120e0eb10355388d6ccbe462f1fea34ddadb24", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", "shasum": "" }, "require": { @@ -818,12 +798,12 @@ }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^7.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -836,6 +816,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -844,10 +828,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -864,20 +844,20 @@ "docblock", "parser" ], - "time": "2019-03-25T19:12:02+00:00" + "time": "2019-10-01T18:55:10+00:00" }, { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { @@ -920,32 +900,34 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "doctrine/lexer", - "version": "1.0.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8" + "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/1febd6c3ef84253d7c815bed85fc622ad207a9f8", - "reference": "1febd6c3ef84253d7c815bed85fc622ad207a9f8", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", + "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.2" }, "require-dev": { - "phpunit/phpunit": "^4.5" + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -958,14 +940,14 @@ "MIT" ], "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, { "name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com" }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" @@ -980,20 +962,20 @@ "parser", "php" ], - "time": "2019-06-08T11:03:04+00:00" + "time": "2019-10-30T14:39:59+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.15.1", + "version": "v2.16.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "20064511ab796593a3990669eff5f5b535001f7c" + "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/20064511ab796593a3990669eff5f5b535001f7c", - "reference": "20064511ab796593a3990669eff5f5b535001f7c", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", + "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", "shasum": "" }, "require": { @@ -1004,15 +986,15 @@ "ext-tokenizer": "*", "php": "^5.6 || ^7.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^3.0 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", "symfony/polyfill-php70": "^1.0", "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" + "symfony/process": "^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", @@ -1023,9 +1005,10 @@ "php-cs-fixer/accessible-object": "^1.0", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3" + "symfony/phpunit-bridge": "^4.3 || ^5.0", + "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { "ext-mbstring": "For handling non-UTF8 characters in cache signature.", @@ -1058,30 +1041,30 @@ "MIT" ], "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-06-01T10:32:12+00:00" + "time": "2019-11-25T22:10:32+00:00" }, { "name": "monolog/monolog", - "version": "1.24.0", + "version": "1.25.3", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" + "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", - "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1", + "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1", "shasum": "" }, "require": { @@ -1146,20 +1129,20 @@ "logging", "psr-3" ], - "time": "2018-11-05T09:00:11+00:00" + "time": "2019-12-20T14:15:16+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.1", + "version": "1.9.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", "shasum": "" }, "require": { @@ -1194,7 +1177,7 @@ "object", "object graph" ], - "time": "2019-04-07T13:18:21+00:00" + "time": "2019-12-15T19:12:40+00:00" }, { "name": "paragonie/random_compat", @@ -1294,35 +1277,33 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1344,30 +1325,30 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.1", + "version": "4.3.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" + "reference": "2ecaa9fef01634c83bfa8dc1fe35fb5cef223a62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2ecaa9fef01634c83bfa8dc1fe35fb5cef223a62", + "reference": "2ecaa9fef01634c83bfa8dc1fe35fb5cef223a62", "shasum": "" }, "require": { "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", "webmozart/assert": "^1.0" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", + "doctrine/instantiator": "^1.0.5", "mockery/mockery": "^1.0", "phpunit/phpunit": "^6.4" }, @@ -1395,41 +1376,40 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-04-30T17:48:53+00:00" + "time": "2019-12-20T13:40:23+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1442,37 +1422,38 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", - "version": "1.8.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "reference": "d638ebbb58daba25a6a0dc7969e1358a0e3c6682" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d638ebbb58daba25a6a0dc7969e1358a0e3c6682", + "reference": "d638ebbb58daba25a6a0dc7969e1358a0e3c6682", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -1505,7 +1486,7 @@ "spy", "stub" ], - "time": "2019-06-13T12:50:23+00:00" + "time": "2019-12-17T16:54:23+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1944,6 +1925,52 @@ ], "time": "2015-09-11T15:10:35+00:00" }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "time": "2019-01-08T18:20:26+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -2459,40 +2486,41 @@ }, { "name": "symfony/console", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64" + "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d50bbeeb0e17e6dd4124ea391eff235e932cbf64", - "reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64", + "url": "https://api.github.com/repos/symfony/console/zipball/fe6e3cd889ca64172d7a742a2eb058541404ef47", + "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1" + "symfony/service-contracts": "^1.1|^2" }, "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3", - "symfony/process": "<3.3" + "symfony/dependency-injection": "<4.4", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" }, "provide": { "psr/log-implementation": "1.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "^4.3", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/var-dumper": "^4.3" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/event-dispatcher": "^4.4|^5.0", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^4.4|^5.0", + "symfony/var-dumper": "^4.4|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -2503,7 +2531,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2530,41 +2558,41 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-06-05T13:25:51+00:00" + "time": "2019-12-17T13:20:22+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f" + "reference": "7b738a51645e10f864cc25c24d232fb03f37b475" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4e6c670af81c4fb0b6c08b035530a9915d0b691f", - "reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7b738a51645e10f864cc25c24d232fb03f37b475", + "reference": "7b738a51645e10f864cc25c24d232fb03f37b475", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/event-dispatcher-contracts": "^1.1" + "php": "^7.2.5", + "symfony/event-dispatcher-contracts": "^2" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<4.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "^3.4|^4.0", - "symfony/service-contracts": "^1.1", - "symfony/stopwatch": "~3.4|~4.0" + "symfony/config": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^4.4|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -2573,7 +2601,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2600,33 +2628,33 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-05-30T16:10:05+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.5", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "c61766f4440ca687de1084a5c00b08e167a2575c" + "reference": "af23c2584d4577d54661c434446fb8fbed6025dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c61766f4440ca687de1084a5c00b08e167a2575c", - "reference": "c61766f4440ca687de1084a5c00b08e167a2575c", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/af23c2584d4577d54661c434446fb8fbed6025dd", + "reference": "af23c2584d4577d54661c434446fb8fbed6025dd", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5", + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/event-dispatcher": "", "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2658,30 +2686,30 @@ "interoperability", "standards" ], - "time": "2019-06-20T06:46:26+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/filesystem", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf" + "reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/bf2af40d738dec5e433faea7b00daa4431d0a4cf", - "reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/1d71f670bc5a07b9ccc97dc44f932177a322d4e6", + "reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2708,29 +2736,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-06-03T20:27:40+00:00" + "time": "2019-11-26T23:25:11+00:00" }, { "name": "symfony/finder", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176" + "reference": "17874dd8ab9a19422028ad56172fb294287a701b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176", - "reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176", + "url": "https://api.github.com/repos/symfony/finder/zipball/17874dd8ab9a19422028ad56172fb294287a701b", + "reference": "17874dd8ab9a19422028ad56172fb294287a701b", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2757,29 +2785,29 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-05-26T20:47:49+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/options-resolver", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332" + "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/914e0edcb7cd0c9f494bc023b1d47534f4542332", - "reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", + "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2811,20 +2839,20 @@ "configuration", "options" ], - "time": "2019-05-10T05:38:46+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.11.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", "shasum": "" }, "require": { @@ -2836,7 +2864,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2852,13 +2880,13 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -2869,20 +2897,20 @@ "polyfill", "portable" ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.11.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "bc4858fb611bda58719124ca079baff854149c89" + "reference": "af23c7bb26a73b850840823662dda371484926c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/bc4858fb611bda58719124ca079baff854149c89", - "reference": "bc4858fb611bda58719124ca079baff854149c89", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", + "reference": "af23c7bb26a73b850840823662dda371484926c4", "shasum": "" }, "require": { @@ -2892,7 +2920,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2928,20 +2956,20 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.11.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c" + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/ab50dcf166d5f577978419edd37aa2bb8eabce0c", - "reference": "ab50dcf166d5f577978419edd37aa2bb8eabce0c", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", "shasum": "" }, "require": { @@ -2950,7 +2978,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -2983,20 +3011,20 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.11.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "d1fb4abcc0c47be136208ad9d68bf59f1ee17abd" + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/d1fb4abcc0c47be136208ad9d68bf59f1ee17abd", - "reference": "d1fb4abcc0c47be136208ad9d68bf59f1ee17abd", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", + "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", "shasum": "" }, "require": { @@ -3005,7 +3033,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -3041,29 +3069,29 @@ "portable", "shim" ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-11-27T16:25:15+00:00" }, { "name": "symfony/process", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c" + "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/856d35814cf287480465bb7a6c413bb7f5f5e69c", - "reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c", + "url": "https://api.github.com/repos/symfony/process/zipball/ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", + "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -3090,24 +3118,24 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-05-30T16:10:05+00:00" + "time": "2019-12-10T11:06:55+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.5", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d" + "reference": "144c5e51266b281231e947b51223ba14acf1a749" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d", - "reference": "f391a00de78ec7ec8cf5cdcdae59ec7b883edb8d", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "psr/container": "^1.0" }, "suggest": { @@ -3116,7 +3144,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -3148,30 +3176,30 @@ "interoperability", "standards" ], - "time": "2019-06-13T11:15:36+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.3.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "6b100e9309e8979cf1978ac1778eb155c1f7d93b" + "reference": "d410282956706e0b08681a5527447a8e6b6f421e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/6b100e9309e8979cf1978ac1778eb155c1f7d93b", - "reference": "6b100e9309e8979cf1978ac1778eb155c1f7d93b", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d410282956706e0b08681a5527447a8e6b6f421e", + "reference": "d410282956706e0b08681a5527447a8e6b6f421e", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/service-contracts": "^1.0" + "php": "^7.2.5", + "symfony/service-contracts": "^1.0|^2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -3198,20 +3226,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-05-27T08:16:38+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/yaml", - "version": "v4.3.1", + "version": "v4.4.2", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "c60ecf5ba842324433b46f58dc7afc4487dbab99" + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c60ecf5ba842324433b46f58dc7afc4487dbab99", - "reference": "c60ecf5ba842324433b46f58dc7afc4487dbab99", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", "shasum": "" }, "require": { @@ -3222,7 +3250,7 @@ "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -3230,7 +3258,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -3257,36 +3285,33 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-04-06T14:04:46+00:00" + "time": "2019-12-10T10:33:21+00:00" }, { "name": "webmozart/assert", - "version": "1.4.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -3308,7 +3333,7 @@ "check", "validate" ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "aliases": [], @@ -3317,7 +3342,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1" + "php": ">=7.3" }, "platform-dev": [] } diff --git a/test/src/Fixtures/Container.php b/test/src/Fixtures/Container.php index c8e8e12..c44e22b 100644 --- a/test/src/Fixtures/Container.php +++ b/test/src/Fixtures/Container.php @@ -8,7 +8,7 @@ namespace ActiveCollab\DatabaseObject\Test\Fixtures; -use Interop\Container\ContainerInterface; +use Psr\Container\ContainerInterface; use InvalidArgumentException; /** @@ -20,9 +20,6 @@ class Container extends \Pimple\Container implements ContainerInterface * Finds an entry of the container by its identifier and returns it. * * @param string $id Identifier of the entry to look for - * - * @throws InvalidArgumentException No entry was found for this identifier - * * @return mixed Entry */ public function get($id) From 6d867b80acaf66ea08ca31f9d78c72998942c0be Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 21 Dec 2019 15:16:04 +0100 Subject: [PATCH 03/61] Remove old compatibility classes --- src/Object.php | 18 ------------------ src/ObjectInterface.php | 19 ------------------- src/Producer.php | 2 +- 3 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 src/Object.php delete mode 100644 src/ObjectInterface.php diff --git a/src/Object.php b/src/Object.php deleted file mode 100644 index 1302e44..0000000 --- a/src/Object.php +++ /dev/null @@ -1,18 +0,0 @@ -. All rights reserved. - */ - -namespace ActiveCollab\DatabaseObject; - -use ActiveCollab\DatabaseObject\Entity\Entity; - -/** - * @package ActiveCollab\DatabaseObject - */ -abstract class Object extends Entity -{ -} diff --git a/src/ObjectInterface.php b/src/ObjectInterface.php deleted file mode 100644 index ccb5442..0000000 --- a/src/ObjectInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -. All rights reserved. - */ - -namespace ActiveCollab\DatabaseObject; - -use ActiveCollab\DatabaseObject\Entity\EntityInterface; - -/** - * @package ActiveCollab\DatabaseObject - * @deprecated - */ -interface ObjectInterface extends EntityInterface -{ -} diff --git a/src/Producer.php b/src/Producer.php index a756483..de6a0a3 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -53,7 +53,7 @@ public function __construct(ConnectionInterface &$connection, PoolInterface &$po */ public function &produce($type, array $attributes = null, $save = true) { - /** @var object|EntityInterface $object */ + /** @var EntityInterface $object */ $object = new $type($this->connection, $this->pool, $this->log); if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { From 02c1887e5febf1379f99377ad4d7ce26a00495ef Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 21 Dec 2019 15:18:57 +0100 Subject: [PATCH 04/61] Update phpunit --- composer.json | 9 +- composer.lock | 569 +++++++++++++++++++++---------------- test/src/Base/TestCase.php | 3 +- 3 files changed, 335 insertions(+), 246 deletions(-) diff --git a/composer.json b/composer.json index 9095952..bfe1b2d 100644 --- a/composer.json +++ b/composer.json @@ -24,14 +24,19 @@ "psr/log": "^1.0.0" }, "require-dev": { + "ext-mysqli": "*", "friendsofphp/php-cs-fixer": "^2.0", "monolog/monolog": "^1.0", - "phpunit/phpunit": "~5.0", + "phpunit/phpunit": "~7.0", "pimple/pimple": "~3.0.0" }, "autoload": { "psr-4": { - "ActiveCollab\\DatabaseObject\\": "src", + "ActiveCollab\\DatabaseObject\\": "src" + } + }, + "autoload-dev": { + "psr-4": { "ActiveCollab\\DatabaseObject\\Test\\": "test/src" } } diff --git a/composer.lock b/composer.lock index 1c1bedb..595b72e 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": "f554c337ce4c00b0eaeeeb11114ed218", + "content-hash": "7178564038f65c930deb2308813babb3", "packages": [ { "name": "activecollab/containeraccess", @@ -1224,6 +1224,108 @@ ], "time": "2018-07-02T15:55:56+00:00" }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, { "name": "php-cs-fixer/diff", "version": "v1.3.0", @@ -1490,40 +1592,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -1538,7 +1640,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1549,29 +1651,32 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.5", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1586,7 +1691,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1596,7 +1701,7 @@ "filesystem", "iterator" ], - "time": "2017-11-27T13:52:08+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -1641,28 +1746,28 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.9", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -1677,7 +1782,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1686,33 +1791,33 @@ "keywords": [ "timer" ], - "time": "2017-02-26T11:10:40+00:00" + "time": "2019-06-07T04:22:29+00:00" }, { "name": "phpunit/php-token-stream", - "version": "2.0.2", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.2.4" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1735,55 +1840,57 @@ "keywords": [ "tokenizer" ], - "time": "2017-11-27T05:48:46+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.27", + "version": "7.5.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c" + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", - "reference": "b7803aeca3ccb99ad0a506fa80b64cd6a56bbc0c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "^1.0.6|^2.0.1", - "symfony/yaml": "~2.1|~3.0|~4.0" + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -1791,7 +1898,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1817,67 +1924,7 @@ "testing", "xunit" ], - "time": "2018-02-01T05:50:59+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2017-06-30T09:13:00+00:00" + "time": "2019-12-06T05:14:37+00:00" }, { "name": "pimple/pimple", @@ -2018,30 +2065,30 @@ }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2072,38 +2119,39 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2018-07-12T15:12:46+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2128,34 +2176,40 @@ "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -2180,34 +2234,34 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -2220,6 +2274,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -2228,17 +2286,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -2247,27 +2301,27 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2019-09-14T09:02:43+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -2275,7 +2329,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2298,33 +2352,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2344,32 +2399,77 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -2397,29 +2497,29 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2439,7 +2539,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -3229,63 +3329,44 @@ "time": "2019-11-18T17:27:11+00:00" }, { - "name": "symfony/yaml", - "version": "v4.4.2", + "name": "theseer/tokenizer", + "version": "1.1.3", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c" + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a08832b974dd5fafe3085a66d41fe4c84bb2628c", - "reference": "a08832b974dd5fafe3085a66d41fe4c84bb2628c", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2019-12-10T10:33:21+00:00" + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", @@ -3344,5 +3425,7 @@ "platform": { "php": ">=7.3" }, - "platform-dev": [] + "platform-dev": { + "ext-mysqli": "*" + } } diff --git a/test/src/Base/TestCase.php b/test/src/Base/TestCase.php index eb11766..d1f7bd4 100644 --- a/test/src/Base/TestCase.php +++ b/test/src/Base/TestCase.php @@ -15,11 +15,12 @@ use Monolog\Logger; use mysqli; use Psr\Log\LoggerInterface; +use PHPUnit\Framework\TestCase as BaseTestCase; /** * @package ActiveCollab\DatabaseObject\Test\Base */ -abstract class TestCase extends \PHPUnit_Framework_TestCase +abstract class TestCase extends BaseTestCase { /** * @var mysqli From 23c1ba07c6d6618a441fcdd225d754ef37cb0883 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 21 Dec 2019 15:21:04 +0100 Subject: [PATCH 05/61] Improve tests --- phpunit.xml | 1 - test/src/Base/TestCase.php | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 8879566..a6f2abb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,7 +8,6 @@ stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" - syntaxCheck="false" processIsolation="false" colors="true"> diff --git a/test/src/Base/TestCase.php b/test/src/Base/TestCase.php index d1f7bd4..0149de8 100644 --- a/test/src/Base/TestCase.php +++ b/test/src/Base/TestCase.php @@ -46,7 +46,12 @@ public function setUp() { parent::setUp(); - $this->link = new \MySQLi('localhost', 'root', '', 'activecollab_database_object_test'); + $this->link = new \MySQLi( + 'localhost', + 'root', + $this->getValidMySqlPassword(), + 'activecollab_database_object_test' + ); if ($this->link->connect_error) { throw new \RuntimeException('Failed to connect to database. MySQL said: ' . $this->link->connect_error); @@ -70,4 +75,9 @@ public function tearDown() parent::tearDown(); } + + protected function getValidMySqlPassword(): string + { + return (string) getenv('DATABASE_CONNECTION_TEST_PASSWORD'); + } } From c28085d498e7d1276aa255535daa6be471a5b75d Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 17 Jan 2020 23:45:13 +0100 Subject: [PATCH 06/61] Improve collection and manager interfaces a bit --- src/Collection.php | 46 ++++++++++++--------------------- src/CollectionInterface.php | 2 ++ src/Entity/Manager.php | 27 ++++--------------- src/Entity/ManagerInterface.php | 12 +++------ 4 files changed, 27 insertions(+), 60 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index fae5820..1782a0c 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseConnection\ConnectionInterface; @@ -14,38 +16,19 @@ use LogicException; use Psr\Log\LoggerInterface; -/** - * @package ActiveCollab\DatabaseObject - */ abstract class Collection implements CollectionInterface { use EtagInterfaceImplementation; - /** - * @var ConnectionInterface - */ protected $connection; - - /** - * @var PoolInterface - */ protected $pool; + protected $logger; - /** - * @var LoggerInterface - */ - protected $log; - - /** - * @param ConnectionInterface $connection - * @param PoolInterface $pool - * @param LoggerInterface $log - */ - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $log) + public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) { $this->connection = $connection; $this->pool = $pool; - $this->log = $log; + $this->logger = $logger; $this->configure(); } @@ -107,15 +90,20 @@ public function &setApplicationIdentifier($value) */ protected function prepareTagFromBits($additional_identifier, $visitor_identifier, $hash) { - return implode(',', [$this->getApplicationIdentifier(), 'collection', get_class($this), $additional_identifier, $visitor_identifier, $hash]); + return implode( + ',', + [ + $this->getApplicationIdentifier(), + 'collection', + get_class($this), + $additional_identifier, + $visitor_identifier, + $hash, + ] + ); } - /** - * Return true if this object can be tagged and cached on client side. - * - * @return bool|null - */ - public function canBeTagged() + public function canBeTagged(): bool { return true; } diff --git a/src/CollectionInterface.php b/src/CollectionInterface.php index e252525..4991e14 100644 --- a/src/CollectionInterface.php +++ b/src/CollectionInterface.php @@ -33,6 +33,8 @@ public function getApplicationIdentifier(); */ public function &setApplicationIdentifier($value); + public function canBeTagged(): bool; + /** * Run the query and return DB result. * diff --git a/src/Entity/Manager.php b/src/Entity/Manager.php index 851df01..9cd9c34 100644 --- a/src/Entity/Manager.php +++ b/src/Entity/Manager.php @@ -6,41 +6,24 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Entity; use ActiveCollab\DatabaseConnection\ConnectionInterface; use ActiveCollab\DatabaseObject\PoolInterface; use Psr\Log\LoggerInterface; -/** - * @package ActiveCollab\DatabaseObject\Entity - */ abstract class Manager implements ManagerInterface { - /** - * @var ConnectionInterface - */ protected $connection; - - /** - * @var PoolInterface - */ protected $pool; + protected $logger; - /** - * @var LoggerInterface - */ - protected $log; - - /** - * @param PoolInterface $pool - * @param ConnectionInterface $connection - * @param LoggerInterface|null $log - */ - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface &$log = null) + public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) { $this->connection = $connection; $this->pool = $pool; - $this->log = $log; + $this->logger = $logger; } } diff --git a/src/Entity/ManagerInterface.php b/src/Entity/ManagerInterface.php index a48adee..7185b75 100644 --- a/src/Entity/ManagerInterface.php +++ b/src/Entity/ManagerInterface.php @@ -6,17 +6,11 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Entity; -/** - * @package ActiveCollab\DatabaseObject\Entity - */ interface ManagerInterface { - /** - * Return type that this manager works with. - * - * @return string - */ - public function getType(); + public function getType(): string; } From b9db65f37abd7db9b18bf5b58765313be8fa704f Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 18 Jan 2020 10:22:35 +0100 Subject: [PATCH 07/61] Make logger required in database object pool --- src/Pool.php | 25 +++++++------------------ test/src/Base/TestCase.php | 6 +++++- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index 7e65e5c..3087a07 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -28,29 +28,18 @@ class Pool implements PoolInterface, ProducerInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - /** - * @var ConnectionInterface - */ protected $connection; - - /** - * @var LoggerInterface - */ - protected $log; + protected $logger; /** * @var EntityInterface[] */ private $objects_pool = []; - /** - * @param ConnectionInterface $connection - * @param LoggerInterface|null $log - */ - public function __construct(ConnectionInterface $connection, LoggerInterface &$log = null) + public function __construct(ConnectionInterface $connection, LoggerInterface $logger) { $this->connection = $connection; - $this->log = $log; + $this->logger = $logger; } /** @@ -278,7 +267,7 @@ public function &getById($type, $id, $use_cache = true) $object_class = in_array('type', $type_fields) ? $row['type'] : $type; /** @var object|EntityInterface $object */ - $object = new $object_class($this->connection, $this, $this->log); + $object = new $object_class($this->connection, $this, $this->logger); if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { $object->setContainer($this->getContainer()); @@ -446,7 +435,7 @@ public function find($type) $default_finder_class = $this->getDefaultFinderClass(); /** @var Finder $finder */ - $finder = new $default_finder_class($this->connection, $this, $this->log, $registered_type); + $finder = new $default_finder_class($this->connection, $this, $this->logger, $registered_type); if ($finder instanceof ContainerAccessInterface && $this->hasContainer()) { $finder->setContainer($this->getContainer()); @@ -487,9 +476,9 @@ public function findBySql($type, $sql, ...$arguments) } if ($this->hasContainer()) { - return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->log], $this->getContainer()); + return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->logger], $this->getContainer()); } else { - return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->log]); + return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->logger]); } } diff --git a/test/src/Base/TestCase.php b/test/src/Base/TestCase.php index 0149de8..3b1813b 100644 --- a/test/src/Base/TestCase.php +++ b/test/src/Base/TestCase.php @@ -14,6 +14,7 @@ use Monolog\Handler\TestHandler; use Monolog\Logger; use mysqli; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use PHPUnit\Framework\TestCase as BaseTestCase; @@ -57,8 +58,11 @@ public function setUp() throw new \RuntimeException('Failed to connect to database. MySQL said: ' . $this->link->connect_error); } + /** @var LoggerInterface|MockObject $logger */ + $logger = $this->createMock(LoggerInterface::class); + $this->connection = new MysqliConnection($this->link); - $this->pool = new Pool($this->connection); + $this->pool = new Pool($this->connection, $logger); $this->logger = new Logger('DatabaseObject test'); $this->logger->pushHandler(new TestHandler()); From 2e2b04a4bfd37f2da6ddf4eb408691a9fd990382 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 18 Jan 2020 10:30:37 +0100 Subject: [PATCH 08/61] Make logger required --- src/Entity/Entity.php | 13 ++++--------- src/Finder.php | 16 +++++----------- src/FinderFactory/FinderFactory.php | 2 +- src/Pool.php | 5 +++-- src/Producer.php | 27 ++++----------------------- test/src/Base/TestCase.php | 3 ++- test/src/CrudTest.php | 24 ++++++++++++------------ test/src/DefaultProducerTest.php | 2 +- test/src/FinderFactoryTest.php | 6 ++++-- test/src/Fixtures/Writers/Writer.php | 9 ++------- test/src/ProducerTest.php | 10 +++++----- test/src/TraitTest.php | 2 +- 12 files changed, 44 insertions(+), 75 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 28ae7ae..356806d 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -47,7 +47,7 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface /** * @var LoggerInterface */ - protected $log; + protected $logger; /** * Name of the table. @@ -96,16 +96,11 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface */ protected $default_field_values = []; - /** - * @param ConnectionInterface $connection - * @param PoolInterface $pool - * @param LoggerInterface|null $log - */ - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface &$log = null) + public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) { $this->connection = $connection; $this->pool = $pool; - $this->log = $log; + $this->logger = $logger; if ($traits = $pool->getTraitNamesByType(get_class($this))) { foreach ($traits as $trait) { @@ -410,7 +405,7 @@ public function copy($save = false) $object_class = get_class($this); /** @var EntityInterface $copy */ - $copy = new $object_class($this->connection, $this->pool, $this->log); + $copy = new $object_class($this->connection, $this->pool, $this->logger); foreach ($this->getFields() as $field) { if ($this->isPrimaryKey($field)) { diff --git a/src/Finder.php b/src/Finder.php index b5d8e8d..d38ea95 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -36,7 +36,7 @@ class Finder implements FinderInterface, ContainerAccessInterface /** * @var LoggerInterface */ - private $log; + private $logger; /** * @var string @@ -68,22 +68,16 @@ class Finder implements FinderInterface, ContainerAccessInterface */ private $join; - /** - * @param PoolInterface $pool - * @param ConnectionInterface $connection - * @param LoggerInterface|null $log - * @param string $type - */ public function __construct( ConnectionInterface $connection, PoolInterface $pool, - LoggerInterface &$log = null, + LoggerInterface $logger, string $type ) { $this->connection = $connection; $this->pool = $pool; - $this->log = $log; + $this->logger = $logger; $this->type = $type; $this->order_by = $this->pool->getEscapedTypeOrderBy($type); } @@ -295,7 +289,7 @@ public function execute() [ &$this->connection, &$this->pool, - &$this->log, + &$this->logger, ], $this->getContainer() ); @@ -309,7 +303,7 @@ public function execute() [ &$this->connection, &$this->pool, - &$this->log, + &$this->logger, ] ); } diff --git a/src/FinderFactory/FinderFactory.php b/src/FinderFactory/FinderFactory.php index 4b7e534..4517e5d 100644 --- a/src/FinderFactory/FinderFactory.php +++ b/src/FinderFactory/FinderFactory.php @@ -25,7 +25,7 @@ class FinderFactory implements FinderFactoryInterface public function __construct( ConnectionInterface $connection, PoolInterface $pool, - LoggerInterface $logger = null + LoggerInterface $logger ) { $this->connection = $connection; diff --git a/src/Pool.php b/src/Pool.php index 3087a07..85b75c5 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -159,7 +159,7 @@ public function &getDefaultProducer(): ProducerInterface if (empty($this->default_producer)) { $default_producer_class = $this->getDefaultProducerClass(); - $this->default_producer = new $default_producer_class($this->connection, $this); + $this->default_producer = new $default_producer_class($this->connection, $this, $this->logger); if ($this->default_producer instanceof ContainerAccessInterface && $this->hasContainer()) { $this->default_producer->setContainer($this->getContainer()); @@ -226,13 +226,14 @@ public function registerProducer($type, ProducerInterface $producer) * @param string $type * @param string $producer_class */ + public function registerProducerByClass($type, $producer_class) { if (class_exists($producer_class)) { $producer_class_reflection = new ReflectionClass($producer_class); if ($producer_class_reflection->implementsInterface(ProducerInterface::class)) { - $this->registerProducer($type, new $producer_class($this->connection, $this)); + $this->registerProducer($type, new $producer_class($this->connection, $this, $this->logger)); } else { throw new InvalidArgumentException("Class '$producer_class' does not implement '" . ProducerInterface::class . "' interface"); } diff --git a/src/Producer.php b/src/Producer.php index de6a0a3..db8f45e 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -14,38 +14,19 @@ use ActiveCollab\DatabaseObject\Entity\EntityInterface; use Psr\Log\LoggerInterface; -/** - * @package ActiveCollab\DatabaseObject - */ class Producer implements ProducerInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - /** - * @var ConnectionInterface - */ protected $connection; - - /** - * @var PoolInterface - */ protected $pool; + protected $logger; - /** - * @var LoggerInterface - */ - protected $log; - - /** - * @param ConnectionInterface $connection - * @param PoolInterface $pool - * @param LoggerInterface|null $log - */ - public function __construct(ConnectionInterface &$connection, PoolInterface &$pool, LoggerInterface &$log = null) + public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) { $this->connection = $connection; $this->pool = $pool; - $this->log = $log; + $this->logger = $logger; } /** @@ -54,7 +35,7 @@ public function __construct(ConnectionInterface &$connection, PoolInterface &$po public function &produce($type, array $attributes = null, $save = true) { /** @var EntityInterface $object */ - $object = new $type($this->connection, $this->pool, $this->log); + $object = new $type($this->connection, $this->pool, $this->logger); if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { $object->setContainer($this->getContainer()); diff --git a/test/src/Base/TestCase.php b/test/src/Base/TestCase.php index 3b1813b..0c1edbf 100644 --- a/test/src/Base/TestCase.php +++ b/test/src/Base/TestCase.php @@ -17,6 +17,7 @@ use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use PHPUnit\Framework\TestCase as BaseTestCase; +use RuntimeException; /** * @package ActiveCollab\DatabaseObject\Test\Base @@ -55,7 +56,7 @@ public function setUp() ); if ($this->link->connect_error) { - throw new \RuntimeException('Failed to connect to database. MySQL said: ' . $this->link->connect_error); + throw new RuntimeException('Failed to connect to database. MySQL said: ' . $this->link->connect_error); } /** @var LoggerInterface|MockObject $logger */ diff --git a/test/src/CrudTest.php b/test/src/CrudTest.php index 23e7f4c..fb3e26f 100644 --- a/test/src/CrudTest.php +++ b/test/src/CrudTest.php @@ -23,7 +23,7 @@ class CrudTest extends WritersTypeTestCase */ public function testNewInstancesGetDefaultFieldValues() { - $unknown_writer = new Writer($this->connection, $this->pool); + $unknown_writer = new Writer($this->connection, $this->pool, $this->logger); $this->assertEquals('Unknown Writer', $unknown_writer->getName()); } @@ -32,7 +32,7 @@ public function testNewInstancesGetDefaultFieldValues() */ public function testFieldsWithDefaultValueCantBeNull() { - $unknown_writer = new Writer($this->connection, $this->pool); + $unknown_writer = new Writer($this->connection, $this->pool, $this->logger); $unknown_writer->setName(null); } @@ -42,7 +42,7 @@ public function testFieldsWithDefaultValueCantBeNull() */ public function testCantLoadFromEmptyRow() { - $writer = new Writer($this->connection, $this->pool); + $writer = new Writer($this->connection, $this->pool, $this->logger); $writer->loadFromRow([]); } @@ -51,7 +51,7 @@ public function testCantLoadFromEmptyRow() */ public function testIdIsPrimaryKey() { - $unknown_writer = new Writer($this->connection, $this->pool); + $unknown_writer = new Writer($this->connection, $this->pool, $this->logger); $this->assertSame('id', $unknown_writer->getPrimaryKey()); $this->assertTrue($unknown_writer->isPrimaryKey('id')); @@ -130,7 +130,7 @@ public function testGetByIdThrowsAnExceptionOnUnregisteredType() */ public function testCreate() { - $chekhov = new Writer($this->connection, $this->pool); + $chekhov = new Writer($this->connection, $this->pool, $this->logger); $chekhov->setName('Anton Chekhov'); $chekhov->setBirthday(new DateValue('1860-01-29')); @@ -149,7 +149,7 @@ public function testCreate() */ public function testExceptionOnInvalidCreate() { - (new Writer($this->connection, $this->pool)) + (new Writer($this->connection, $this->pool, $this->logger)) ->setName('Anton Chekhov') ->save(); } @@ -209,7 +209,7 @@ public function testModifications() */ public function testChangeIdToNewRecord() { - $chekhov = new Writer($this->connection, $this->pool); + $chekhov = new Writer($this->connection, $this->pool, $this->logger); $chekhov->setName('Anton Chekhov'); $chekhov->setBirthday(new DateValue('1860-01-29')); @@ -238,7 +238,7 @@ public function testChangeIdToNewRecord() */ public function testChangeIdToExistingRecord() { - $chekhov = new Writer($this->connection, $this->pool); + $chekhov = new Writer($this->connection, $this->pool, $this->logger); $chekhov->setName('Anton Chekhov'); $chekhov->setBirthday(new DateValue('1860-01-29')); @@ -277,7 +277,7 @@ public function testDelete() */ public function testSetAttributeWithEventHandler() { - $writer = new Writer($this->connection, $this->pool); + $writer = new Writer($this->connection, $this->pool, $this->logger); $this->assertNull($writer->custom_attribute_value); $writer->setAttribute('custom_attribute', 13.5); $this->assertSame(13.5, $writer->custom_attribute_value); @@ -288,7 +288,7 @@ public function testSetAttributeWithEventHandler() */ public function testSetAttributeWithSetter() { - $writer = new Writer($this->connection, $this->pool); + $writer = new Writer($this->connection, $this->pool, $this->logger); $this->assertNull($writer->getCustomFieldValue()); $writer->setAttribute('custom_field_value', 12); $this->assertSame(12, $writer->getCustomFieldValue()); @@ -299,7 +299,7 @@ public function testSetAttributeWithSetter() */ public function testSetAttributeIgnoresUnknownAttributes() { - $writer = new Writer($this->connection, $this->pool); + $writer = new Writer($this->connection, $this->pool, $this->logger); $this->assertEquals('protected', $writer->getProtectedCustomFieldValue()); $writer->setAttribute('protected_custom_field_value', 12); $this->assertEquals('protected', $writer->getProtectedCustomFieldValue()); @@ -310,7 +310,7 @@ public function testSetAttributeIgnoresUnknownAttributes() */ public function testUnknownAttributeDoesNotProduceAnError() { - $writer = new Writer($this->connection, $this->pool); + $writer = new Writer($this->connection, $this->pool, $this->logger); $writer->setAttribute('unknown_attribute', 12); } } diff --git a/test/src/DefaultProducerTest.php b/test/src/DefaultProducerTest.php index 66d528f..ccacfcf 100644 --- a/test/src/DefaultProducerTest.php +++ b/test/src/DefaultProducerTest.php @@ -27,7 +27,7 @@ public function testDefaultProducer() public function testDefaultProducerCanBeSet() { $this->assertInstanceOf(Producer::class, $this->pool->getDefaultProducer()); - $this->pool->setDefaultProducer(new CustomProducer($this->connection, $this->pool)); + $this->pool->setDefaultProducer(new CustomProducer($this->connection, $this->pool, $this->logger)); $this->assertInstanceOf(CustomProducer::class, $this->pool->getDefaultProducer()); } diff --git a/test/src/FinderFactoryTest.php b/test/src/FinderFactoryTest.php index c4d6144..d127c9e 100644 --- a/test/src/FinderFactoryTest.php +++ b/test/src/FinderFactoryTest.php @@ -21,7 +21,8 @@ public function testFinderFactoryProducesFinder() { $finder = (new FinderFactory( $this->connection, - $this->pool + $this->pool, + $this->logger ))->produceFinder(Writer::class); $this->assertInstanceOf(FinderInterface::class, $finder); @@ -32,7 +33,8 @@ public function testFinderFactoryCanSetWhere() { $finder = (new FinderFactory( $this->connection, - $this->pool + $this->pool, + $this->logger ))->produceFinder(Writer::class, '`name` = ?', 'Leo Tolstoy'); $this->assertInstanceOf(FinderInterface::class, $finder); diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index 93b8baf..1b39751 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -45,14 +45,9 @@ class Writer extends BaseWriter implements ScrapInterface */ public $scrapped_using_custom_producer = false; - /** - * @param ConnectionInterface $connection - * @param PoolInterface $pool - * @param LoggerInterface|null $log - */ - public function __construct(ConnectionInterface &$connection, PoolInterface &$pool, LoggerInterface &$log = null) + public function __construct(ConnectionInterface &$connection, PoolInterface &$pool, LoggerInterface $logger) { - parent::__construct($connection, $pool, $log); + parent::__construct($connection, $pool, $logger); $this->registerEventHandler('on_set_attribute', function ($attribute, $value) { if ($attribute == 'custom_attribute') { diff --git a/test/src/ProducerTest.php b/test/src/ProducerTest.php index 08082cc..b7952ac 100644 --- a/test/src/ProducerTest.php +++ b/test/src/ProducerTest.php @@ -40,7 +40,7 @@ public function testDefaultProducerIsUsedByDefault() */ public function testCustomProducerCanBeSetForType() { - $this->pool->registerProducer(Writer::class, new CustomProducer($this->connection, $this->pool)); + $this->pool->registerProducer(Writer::class, new CustomProducer($this->connection, $this->pool, $this->logger)); /** @var Writer $object */ $object = $this->pool->produce(Writer::class, [ @@ -58,7 +58,7 @@ public function testCustomProducerCanBeSetForType() */ public function testCustomProducerCanBeSetForSubtype() { - $this->pool->registerProducer(AwesomeWriter::class, new CustomProducer($this->connection, $this->pool)); + $this->pool->registerProducer(AwesomeWriter::class, new CustomProducer($this->connection, $this->pool, $this->logger)); /** @var Writer $object */ $object = $this->pool->produce(AwesomeWriter::class, [ @@ -95,7 +95,7 @@ public function testCustomProducerCanBeSetByClassName() public function testCustomProducerCantBeSetForUnregisteredType() { $this->assertFalse($this->pool->isTypeRegistered(User::class)); - $this->pool->registerProducer(User::class, new CustomProducer($this->connection, $this->pool)); + $this->pool->registerProducer(User::class, new CustomProducer($this->connection, $this->pool, $this->logger)); } /** @@ -103,8 +103,8 @@ public function testCustomProducerCantBeSetForUnregisteredType() */ public function testCustomProducerCantBeSetTwice() { - $this->pool->registerProducer(Writer::class, new CustomProducer($this->connection, $this->pool)); - $this->pool->registerProducer(AwesomeWriter::class, new CustomProducer($this->connection, $this->pool)); + $this->pool->registerProducer(Writer::class, new CustomProducer($this->connection, $this->pool, $this->logger)); + $this->pool->registerProducer(AwesomeWriter::class, new CustomProducer($this->connection, $this->pool, $this->logger)); } /** diff --git a/test/src/TraitTest.php b/test/src/TraitTest.php index eb72a22..e049544 100644 --- a/test/src/TraitTest.php +++ b/test/src/TraitTest.php @@ -48,7 +48,7 @@ public function testClassTraits() */ public function testIfTraitsAreCalledWhenNewInstanceIsCreated() { - $unknown_writer = new Writer($this->connection, $this->pool); + $unknown_writer = new Writer($this->connection, $this->pool, $this->logger); $this->assertTrue($unknown_writer->is_russian); $this->assertTrue($unknown_writer->is_classic_writer); From 5fa0729898558164b2003262bb2a86c4f4c86626 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 18 Jan 2020 10:43:57 +0100 Subject: [PATCH 09/61] Clean up interfaces a bit --- src/Collection.php | 5 +-- src/CollectionInterface.php | 5 ++- src/Finder.php | 22 ++---------- src/FinderInterface.php | 5 ++- src/Pool.php | 45 +++++++----------------- src/PoolInterface.php | 36 +++---------------- src/Producer.php | 15 ++------ src/ProducerInterface.php | 36 +++---------------- src/ScrapInterface.php | 15 +++----- test/src/Fixtures/CustomProducer.php | 34 +++--------------- test/src/Fixtures/Writers/Collection.php | 2 +- test/src/Fixtures/Writers/Writer.php | 9 ++--- 12 files changed, 47 insertions(+), 182 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 1782a0c..405a170 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -33,9 +33,6 @@ public function __construct(ConnectionInterface $connection, PoolInterface $pool $this->configure(); } - /** - * Pre-configure the collection when it is created. - */ protected function configure() { } @@ -47,7 +44,7 @@ protected function configure() * * @return bool */ - protected function isReady() + protected function isReady(): bool { return true; } diff --git a/src/CollectionInterface.php b/src/CollectionInterface.php index 4991e14..017b058 100644 --- a/src/CollectionInterface.php +++ b/src/CollectionInterface.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseConnection\Result\ResultInterface; @@ -13,9 +15,6 @@ use ActiveCollab\Etag\EtagInterface; use JsonSerializable; -/** - * @package ActiveCollab\DatabaseObject\Collection - */ interface CollectionInterface extends EtagInterface, JsonSerializable { /** diff --git a/src/Finder.php b/src/Finder.php index d38ea95..a20b7a1 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\ContainerAccess\ContainerAccessInterface; @@ -16,31 +18,13 @@ use InvalidArgumentException; use Psr\Log\LoggerInterface; -/** - * @package ActiveCollab\DatabaseObject - */ class Finder implements FinderInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - /** - * @var ConnectionInterface - */ private $connection; - - /** - * @var PoolInterface - */ private $pool; - - /** - * @var LoggerInterface - */ private $logger; - - /** - * @var string - */ private $type; /** @@ -315,7 +299,7 @@ public function execute() private $load_by_type_field; - private function loadByTypeField(): string + private function loadByTypeField(): bool { if ($this->load_by_type_field === null) { $this->load_by_type_field = in_array('type', $this->pool->getTypeFields($this->type)); diff --git a/src/FinderInterface.php b/src/FinderInterface.php index 8474412..0c1d5b9 100644 --- a/src/FinderInterface.php +++ b/src/FinderInterface.php @@ -6,14 +6,13 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseConnection\Result\ResultInterface; use ActiveCollab\DatabaseObject\Entity\EntityInterface; -/** - * @package ActiveCollab\DatabaseObject - */ interface FinderInterface { public function getType(): string; diff --git a/src/Pool.php b/src/Pool.php index 85b75c5..f53ae56 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\ContainerAccess\ContainerAccessInterface; @@ -21,9 +23,6 @@ use ReflectionClass; use RuntimeException; -/** - * @package ActiveCollab\DatabaseObject - */ class Pool implements PoolInterface, ProducerInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; @@ -42,15 +41,7 @@ public function __construct(ConnectionInterface $connection, LoggerInterface $lo $this->logger = $logger; } - /** - * Produce new instance of $type. - * - * @param string $type - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &produce($type, array $attributes = null, $save = true) + public function produce($type, array $attributes = null, $save = true): EntityInterface { $registered_type = $this->requireRegisteredType($type); @@ -67,15 +58,7 @@ public function &produce($type, array $attributes = null, $save = true) } } - /** - * Update an instance. - * - * @param EntityInterface $instance - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &modify(EntityInterface &$instance, array $attributes = null, $save = true) + public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface { if ($instance->isNew()) { throw new RuntimeException('Only objects that are saved to database can be modified'); @@ -92,14 +75,7 @@ public function &modify(EntityInterface &$instance, array $attributes = null, $s return $instance; } - /** - * Scrap an instance (move it to trash, if object supports, or delete it). - * - * @param EntityInterface $instance - * @param bool $force_delete - * @return EntityInterface - */ - public function &scrap(EntityInterface &$instance, $force_delete = false) + public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface { if ($instance->isNew()) { throw new RuntimeException('Only objects that are saved to database can be modified'); @@ -216,7 +192,7 @@ public function registerProducer($type, ProducerInterface $producer) $this->producers[$registered_type] = $producer; } else { - throw new LogicException("Producer for '$type' is already registered"); + throw new LogicException(sprintf("Producer for '%s' is already registered", $type)); } } @@ -226,7 +202,6 @@ public function registerProducer($type, ProducerInterface $producer) * @param string $type * @param string $producer_class */ - public function registerProducerByClass($type, $producer_class) { if (class_exists($producer_class)) { @@ -235,7 +210,13 @@ public function registerProducerByClass($type, $producer_class) if ($producer_class_reflection->implementsInterface(ProducerInterface::class)) { $this->registerProducer($type, new $producer_class($this->connection, $this, $this->logger)); } else { - throw new InvalidArgumentException("Class '$producer_class' does not implement '" . ProducerInterface::class . "' interface"); + throw new InvalidArgumentException( + sprintf( + "Class '%s' does not implement '%s' interface", + $producer_class, + ProducerInterface::class + ) + ); } } } diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 63183d9..1bc0d4c 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -6,44 +6,18 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseConnection\Result\ResultInterface; use ActiveCollab\DatabaseObject\Entity\EntityInterface; -/** - * @package ActiveCollab\DatabaseObject - */ interface PoolInterface { - /** - * Produce new instance of $type. - * - * @param string $type - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &produce($type, array $attributes = null, $save = true); - - /** - * Update an instance. - * - * @param EntityInterface $instance - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &modify(EntityInterface &$instance, array $attributes = null, $save = true); - - /** - * Scrap an instance (move it to trash, if object supports, or delete it). - * - * @param EntityInterface $instance - * @param bool $force_delete - * @return EntityInterface - */ - public function &scrap(EntityInterface &$instance, $force_delete = false); + public function produce($type, array $attributes = null, $save = true): EntityInterface; + public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; + public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; /** * @return string diff --git a/src/Producer.php b/src/Producer.php index db8f45e..75d801d 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -29,10 +29,7 @@ public function __construct(ConnectionInterface $connection, PoolInterface $pool $this->logger = $logger; } - /** - * {@inheritdoc} - */ - public function &produce($type, array $attributes = null, $save = true) + public function produce($type, array $attributes = null, $save = true): EntityInterface { /** @var EntityInterface $object */ $object = new $type($this->connection, $this->pool, $this->logger); @@ -58,10 +55,7 @@ public function &produce($type, array $attributes = null, $save = true) return $object; } - /** - * {@inheritdoc} - */ - public function &modify(EntityInterface &$instance, array $attributes = null, $save = true) + public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface { if ($attributes) { foreach ($attributes as $k => $v) { @@ -80,10 +74,7 @@ public function &modify(EntityInterface &$instance, array $attributes = null, $s return $instance; } - /** - * {@inheritdoc} - */ - public function &scrap(EntityInterface &$instance, $force_delete = false) + public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface { if (!$force_delete && $instance instanceof ScrapInterface) { return $instance->scrap(); diff --git a/src/ProducerInterface.php b/src/ProducerInterface.php index c79e21a..df9ea9d 100644 --- a/src/ProducerInterface.php +++ b/src/ProducerInterface.php @@ -6,41 +6,15 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseObject\Entity\EntityInterface; -/** - * @package ActiveCollab\DatabaseObject - */ interface ProducerInterface { - /** - * Produce new instance of $type. - * - * @param string $type - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &produce($type, array $attributes = null, $save = true); - - /** - * Update an instance. - * - * @param EntityInterface $instance - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &modify(EntityInterface &$instance, array $attributes = null, $save = true); - - /** - * Scrap an instance (move it to trash, if object supports, or delete it). - * - * @param EntityInterface $instance - * @param bool $force_delete - * @return EntityInterface - */ - public function &scrap(EntityInterface &$instance, $force_delete = false); + public function produce($type, array $attributes = null, $save = true): EntityInterface; + public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; + public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; } diff --git a/src/ScrapInterface.php b/src/ScrapInterface.php index d315a7b..b1ba2bc 100644 --- a/src/ScrapInterface.php +++ b/src/ScrapInterface.php @@ -6,18 +6,13 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; -/** - * @package ActiveCollab\DatabaseObject - */ +use ActiveCollab\DatabaseObject\Entity\EntityInterface; + interface ScrapInterface { - /** - * Scrap the object, instead of permanently deleting it. - * - * @param bool|false $bulk - * @return $this - */ - public function &scrap($bulk = false); + public function scrap($bulk = false): EntityInterface; } diff --git a/test/src/Fixtures/CustomProducer.php b/test/src/Fixtures/CustomProducer.php index a05ffbb..551db41 100644 --- a/test/src/Fixtures/CustomProducer.php +++ b/test/src/Fixtures/CustomProducer.php @@ -6,26 +6,17 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures; use ActiveCollab\DatabaseObject\Entity\EntityInterface; use ActiveCollab\DatabaseObject\Producer; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Users - */ class CustomProducer extends Producer { - /** - * Produce new instance of $type. - * - * @param string $type - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &produce($type, array $attributes = null, $save = true) + public function produce($type, array $attributes = null, $save = true): EntityInterface { $object = parent::produce($type, $attributes, $save); @@ -36,15 +27,7 @@ public function &produce($type, array $attributes = null, $save = true) return $object; } - /** - * Update an instance. - * - * @param EntityInterface $instance - * @param array|null $attributes - * @param bool $save - * @return EntityInterface - */ - public function &modify(EntityInterface &$instance, array $attributes = null, $save = true) + public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface { $instance = parent::modify($instance, $attributes, $save); @@ -55,14 +38,7 @@ public function &modify(EntityInterface &$instance, array $attributes = null, $s return $instance; } - /** - * Scrap an instance (move it to trash, if object can be trashed, or delete it). - * - * @param EntityInterface $instance - * @param bool $force_delete - * @return EntityInterface - */ - public function &scrap(EntityInterface &$instance, $force_delete = false) + public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface { $instance = parent::scrap($instance, $force_delete); diff --git a/test/src/Fixtures/Writers/Collection.php b/test/src/Fixtures/Writers/Collection.php index 3b9d69c..119f1ac 100644 --- a/test/src/Fixtures/Writers/Collection.php +++ b/test/src/Fixtures/Writers/Collection.php @@ -30,7 +30,7 @@ public function getType() /** * {@inheritdoc} */ - protected function isReady() + protected function isReady(): bool { return $this->is_ready; } diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index 1b39751..502791a 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -9,6 +9,7 @@ namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; use ActiveCollab\DatabaseConnection\ConnectionInterface; +use ActiveCollab\DatabaseObject\Entity\EntityInterface; use ActiveCollab\DatabaseObject\PoolInterface; use ActiveCollab\DatabaseObject\ScrapInterface; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Traits\ClassicWriter; @@ -136,13 +137,7 @@ public function validate(ValidatorInterface &$validator) parent::validate($validator); } - /** - * Scrap the object, instead of permanently deleting it. - * - * @param bool|false $bulk - * @return $this - */ - public function &scrap($bulk = false) + public function scrap($bulk = false): EntityInterface { $this->is_scrapped = true; From 6f5deb2471eaa3b31d67f7cba2e874bace914fd1 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 18 Jan 2020 10:53:32 +0100 Subject: [PATCH 10/61] Add types to pool interface, work in progress --- src/Pool.php | 99 ++++---------------- src/PoolInterface.php | 86 +++-------------- test/src/ContainerPropagatesToObjectTest.php | 11 ++- 3 files changed, 40 insertions(+), 156 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index f53ae56..cdc4d44 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -95,18 +95,12 @@ public function scrap(EntityInterface &$instance, $force_delete = false): Entity private $default_producer_class = Producer::class; - /** - * {@inheritdoc} - */ - public function getDefaultProducerClass() + public function getDefaultProducerClass(): string { return $this->default_producer_class; } - /** - * {@inheritdoc} - */ - public function &setDefaultProducerClass($default_producer_class) + public function setDefaultProducerClass(string $default_producer_class): PoolInterface { if (!class_exists($default_producer_class, true)) { throw new InvalidArgumentException('Producer class not found.'); @@ -127,10 +121,7 @@ public function &setDefaultProducerClass($default_producer_class) */ private $default_producer; - /** - * {@inheritdoc} - */ - public function &getDefaultProducer(): ProducerInterface + public function getDefaultProducer(): ProducerInterface { if (empty($this->default_producer)) { $default_producer_class = $this->getDefaultProducerClass(); @@ -145,10 +136,7 @@ public function &getDefaultProducer(): ProducerInterface return $this->default_producer; } - /** - * {@inheritdoc} - */ - public function &setDefaultProducer(ProducerInterface $producer) + public function setDefaultProducer(ProducerInterface $producer): PoolInterface { $this->default_producer = $producer; @@ -160,13 +148,7 @@ public function &setDefaultProducer(ProducerInterface $producer) */ private $producers = []; - /** - * Return producer for registered type. - * - * @param string $registered_type - * @return ProducerInterface - */ - protected function &getProducerForRegisteredType($registered_type) + protected function getProducerForRegisteredType(string $registered_type): ProducerInterface { if (empty($this->producers[$registered_type])) { return $this->getDefaultProducer(); @@ -175,13 +157,7 @@ protected function &getProducerForRegisteredType($registered_type) } } - /** - * Register producer instance for the given type. - * - * @param string $type - * @param ProducerInterface $producer - */ - public function registerProducer($type, ProducerInterface $producer) + public function registerProducer(string $type, ProducerInterface $producer): PoolInterface { $registered_type = $this->requireRegisteredType($type); @@ -194,15 +170,11 @@ public function registerProducer($type, ProducerInterface $producer) } else { throw new LogicException(sprintf("Producer for '%s' is already registered", $type)); } + + return $this; } - /** - * Register producerby providing a producer class name. - * - * @param string $type - * @param string $producer_class - */ - public function registerProducerByClass($type, $producer_class) + public function registerProducerByClass(string $type, string $producer_class): PoolInterface { if (class_exists($producer_class)) { $producer_class_reflection = new ReflectionClass($producer_class); @@ -219,18 +191,11 @@ public function registerProducerByClass($type, $producer_class) ); } } + + return $this; } - /** - * Return object from object pool by the given type and ID; if object is not found, return NULL. - * - * @param string $type - * @param int $id - * @param bool $use_cache - * @return object - * @throws InvalidArgumentException - */ - public function &getById($type, $id, $use_cache = true) + public function getById(string $type, int $id, bool $use_cache = true): ?EntityInterface { $registered_type = $this->requireRegisteredType($type); @@ -266,17 +231,7 @@ public function &getById($type, $id, $use_cache = true) } } - /** - * Return object from object pool by the given type and ID; if object is not found, raise an exception. - * - * @param string $type - * @param int $id - * @param bool $use_cache - * @return object - * @throws ObjectNotFoundException - * @throws InvalidArgumentException - */ - public function &mustGetById($type, $id, $use_cache = true) + public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface { $result = $this->getById($type, $id, $use_cache); @@ -287,14 +242,7 @@ public function &mustGetById($type, $id, $use_cache = true) return $result; } - /** - * Reload an object of the give type with the given ID. - * - * @param string $type - * @param int $id - * @return object - */ - public function &reload($type, $id) + public function reload(string $type, int $id): ?EntityInterface { return $this->getById($type, $id, false); } @@ -338,12 +286,7 @@ private function &addToObjectPool($registered_type, $id, &$value_to_store) return $this->objects_pool[$registered_type][$id]; } - /** - * Add object to the pool. - * - * @param EntityInterface $object - */ - public function remember(EntityInterface &$object) + public function remember(EntityInterface $object): void { if ($object->isLoaded()) { $this->addToObjectPool($this->requireRegisteredType(get_class($object)), $object->getId(), $object); @@ -351,11 +294,7 @@ public function remember(EntityInterface &$object) throw new InvalidArgumentException('Object needs to be saved in the database to be remembered'); } } - - /** - * {@inheritdoc} - */ - public function forget($type, $id) + public function forget(string $type, int $id): void { $this->requireRegisteredType($type); @@ -381,7 +320,7 @@ public function forget($type, $id) * @param array|string|null $conditions * @return int */ - public function count($type, $conditions = null) + public function count(string $type, $conditions = null): int { $this->requireRegisteredType($type); @@ -399,7 +338,7 @@ public function count($type, $conditions = null) * @param int $id * @return bool */ - public function exists($type, $id) + public function exists(string $type, int $id): bool { return (bool) $this->count($type, ['`id` = ?', $id]); } @@ -410,7 +349,7 @@ public function exists($type, $id) * @param string $type * @return Finder */ - public function find($type) + public function find(string $type): FinderInterface { $registered_type = $this->requireRegisteredType($type); diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 1bc0d4c..f1db31f 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -19,74 +19,16 @@ public function produce($type, array $attributes = null, $save = true): EntityIn public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; - /** - * @return string - */ - public function getDefaultProducerClass(); - - /** - * @return ProducerInterface - */ - public function &getDefaultProducer(): ProducerInterface; - - /** - * @param ProducerInterface $producer - * @return $this - */ - public function &setDefaultProducer(ProducerInterface $producer); + public function getDefaultProducerClass(): string; + public function getDefaultProducer(): ProducerInterface; + public function setDefaultProducer(ProducerInterface $producer): PoolInterface; + public function setDefaultProducerClass(string $default_producer_class): PoolInterface; + public function registerProducer(string $type, ProducerInterface $producer): PoolInterface; + public function registerProducerByClass(string $type, string $producer_class): PoolInterface; - /** - * Set default producer class. - * - * @param string $default_producer_class - * @return $this - */ - public function setDefaultProducerClass($default_producer_class); - - /** - * Register producer instance for the given type. - * - * @param string $type - * @param ProducerInterface $producer - */ - public function registerProducer($type, ProducerInterface $producer); - - /** - * Register producerby providing a producer class name. - * - * @param string $type - * @param string $producer_class - */ - public function registerProducerByClass($type, $producer_class); - - /** - * Return object from object pool by the given type and ID; if object is not found, return NULL. - * - * @param string $type - * @param int $id - * @param bool $use_cache - * @return object|null - */ - public function &getById($type, $id, $use_cache = true); - - /** - * Return object from object pool by the given type and ID; if object is not found, raise an exception. - * - * @param string $type - * @param int $id - * @param bool $use_cache - * @return object - */ - public function &mustGetById($type, $id, $use_cache = true); - - /** - * Reload an object of the give type with the given ID. - * - * @param string $type - * @param int $id - * @return object - */ - public function &reload($type, $id); + public function getById(string $type, int $id, bool $use_cache = true): ?EntityInterface; + public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface; + public function reload(string $type, int $id): ?EntityInterface; /** * Check if object #ID of $type is in the pool. @@ -102,7 +44,7 @@ public function isInPool($type, $id); * * @param EntityInterface $object */ - public function remember(EntityInterface &$object); + public function remember(EntityInterface $object): void; /** * Forget object if it is loaded in memory. @@ -110,7 +52,7 @@ public function remember(EntityInterface &$object); * @param string $type * @param array|int $id */ - public function forget($type, $id); + public function forget(string $type, int $id): void; /** * Return number of records of the given type that match the given conditions. @@ -119,7 +61,7 @@ public function forget($type, $id); * @param array|string|null $conditions * @return int */ - public function count($type, $conditions = null); + public function count(string $type, $conditions = null): int; /** * Return true if object of the given type with the given ID exists. @@ -128,7 +70,7 @@ public function count($type, $conditions = null); * @param int $id * @return bool */ - public function exists($type, $id); + public function exists(string $type, int $id): bool; /** * Find records by type. @@ -136,7 +78,7 @@ public function exists($type, $id); * @param string $type * @return Finder */ - public function find($type); + public function find(string $type): FinderInterface; /** * Return result by a prepared SQL statement. diff --git a/test/src/ContainerPropagatesToObjectTest.php b/test/src/ContainerPropagatesToObjectTest.php index 17703ba..c7972c1 100644 --- a/test/src/ContainerPropagatesToObjectTest.php +++ b/test/src/ContainerPropagatesToObjectTest.php @@ -63,10 +63,13 @@ public function testFindIdInstantination() public function testInstantinationUsingProducer() { /** @var Writer $special_writer */ - $special_writer = $this->pool->produce(Writer::class, [ - 'name' => 'Special Writer', - 'birthday' => '2013-10-02', - ]); + $special_writer = $this->pool->produce( + Writer::class, + [ + 'name' => 'Special Writer', + 'birthday' => '2013-10-02', + ] + ); $this->assertInstanceOf(Writer::class, $special_writer); $this->assertTrue($special_writer->is_special); From 3ab64f2b08c2e7273dcd77732ea5a9b864879b81 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 18 Jan 2020 11:01:57 +0100 Subject: [PATCH 11/61] Improve pool interface --- src/Pool.php | 92 +++++++---------------------- src/PoolInterface.php | 133 ++++++------------------------------------ 2 files changed, 40 insertions(+), 185 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index cdc4d44..61f01e8 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -247,14 +247,7 @@ public function reload(string $type, int $id): ?EntityInterface return $this->getById($type, $id, false); } - /** - * Check if object #ID of $type is in the pool. - * - * @param string $type - * @param int $id - * @return bool - */ - public function isInPool($type, $id) + public function isInPool(string $type, int $id): bool { $this->requireRegisteredType($type); @@ -365,10 +358,7 @@ public function find(string $type): FinderInterface return $finder; } - /** - * @return string - */ - public function getDefaultFinderClass() + public function getDefaultFinderClass(): string { return Finder::class; } @@ -376,7 +366,7 @@ public function getDefaultFinderClass() /** * {@inheritdoc} */ - public function findBySql($type, $sql, ...$arguments) + public function findBySql(string $type, string $sql, ...$arguments) { if (empty($type)) { throw new InvalidArgumentException('Type is required'); @@ -406,7 +396,7 @@ public function findBySql($type, $sql, ...$arguments) /** * {@inheritdoc} */ - public function getTypeTable($type, $escaped = false) + public function getTypeTable(string $type, bool $escaped = false): string { $registered_type = $this->requireRegisteredType($type); @@ -421,18 +411,12 @@ public function getTypeTable($type, $escaped = false) } } - /** - * {@inheritdoc} - */ - public function getTypeFields($type) + public function getTypeFields(string $type): array { return $this->types[$this->requireRegisteredType($type)]['fields']; } - /** - * {@inheritdoc} - */ - public function getGeneratedTypeFields($type) + public function getGeneratedTypeFields(string $type): array { return $this->types[$this->requireRegisteredType($type)]['generated_fields']; } @@ -445,7 +429,7 @@ public function getGeneratedTypeFields($type) * @param callable $callback * @return mixed */ - public function getTypeProperty($type, $property, callable $callback) + public function getTypeProperty(string $type, string $property, callable $callback) { $registered_type = $this->requireRegisteredType($type); @@ -471,13 +455,7 @@ private function getSelectOneByType($type) return $this->types[$type]['sql_select_by_ids']; } - /** - * Return a list of escaped field names for the given type. - * - * @param string $type - * @return string - */ - public function getEscapedTypeFields($type) + public function getEscapedTypeFields(string $type): string { return $this->getTypeProperty($type, 'escaped_fields', function () use ($type) { $table_name = $this->getTypeTable($type, true); @@ -496,24 +474,12 @@ public function getEscapedTypeFields($type) }); } - /** - * Return default order by for the given type. - * - * @param string $type - * @return string[] - */ - public function getTypeOrderBy($type) + public function getTypeOrderBy(string $type): array { return $this->types[$this->requireRegisteredType($type)]['order_by']; } - /** - * Return escaped list of fields that we can order by. - * - * @param string $type - * @return string - */ - public function getEscapedTypeOrderBy($type) + public function getEscapedTypeOrderBy(string $type): string { return $this->getTypeProperty($type, 'escaped_order_by', function () use ($type) { $table_name = $this->getTypeTable($type, true); @@ -533,10 +499,7 @@ public function getEscapedTypeOrderBy($type) */ private $types = []; - /** - * @return array - */ - public function getRegisteredTypes() + public function getRegisteredTypes(): array { return array_keys($this->types); } @@ -554,7 +517,7 @@ public function getRegisteredTypes() * @param string $type * @return string|null */ - public function getRegisteredType($type) + public function getRegisteredType(string $type): ?string { $type = ltrim($type, '\\'); @@ -584,10 +547,7 @@ public function getRegisteredType($type) return $this->known_types[$type]; } - /** - * {@inheritdoc} - */ - public function requireRegisteredType($type) + public function requireRegisteredType(string $type): string { if ($registered_type = $this->getRegisteredType($type)) { return $registered_type; @@ -596,13 +556,7 @@ public function requireRegisteredType($type) } } - /** - * Return true if $type is registered. - * - * @param string $type - * @return bool - */ - public function isTypeRegistered($type) + public function isTypeRegistered(string $type): bool { return (bool) $this->getRegisteredType($type); } @@ -612,10 +566,7 @@ public function isTypeRegistered($type) */ private $polymorph_type_interface; - /** - * {@inheritdoc} - */ - public function getPolymorphTypeInterface() + public function getPolymorphTypeInterface(): ?string { return $this->polymorph_type_interface; } @@ -623,7 +574,7 @@ public function getPolymorphTypeInterface() /** * {@inheritdoc} */ - public function &setPolymorphTypeInterface($value) + public function &setPolymorphTypeInterface(?string $value): PoolInterface { $this->polymorph_type_interface = $value; @@ -641,7 +592,7 @@ public function &setPolymorphTypeInterface($value) * @param string $type * @return bool */ - public function isTypePolymorph($type) + public function isTypePolymorph(string $type): bool { $registered_type = $this->getRegisteredType($type); @@ -661,10 +612,7 @@ public function isTypePolymorph($type) return $this->polymorph_types[$registered_type]; } - /** - * @param string[] $types - */ - public function registerType(...$types) + public function registerType(string ...$types): PoolInterface { foreach ($types as $type) { $type = ltrim($type, '\\'); @@ -692,6 +640,8 @@ public function registerType(...$types) throw new InvalidArgumentException("Type '$type' is not defined"); } } + + return $this; } /** @@ -720,7 +670,7 @@ private function &getTraitsResolver() * @param string $type * @return array */ - public function getTraitNamesByType($type) + public function getTraitNamesByType(string $type): array { return $this->getTraitsResolver()->getClassTraits($type); } diff --git a/src/PoolInterface.php b/src/PoolInterface.php index f1db31f..7c59d4d 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -29,29 +29,8 @@ public function registerProducerByClass(string $type, string $producer_class): P public function getById(string $type, int $id, bool $use_cache = true): ?EntityInterface; public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface; public function reload(string $type, int $id): ?EntityInterface; - - /** - * Check if object #ID of $type is in the pool. - * - * @param string $type - * @param int $id - * @return bool - */ - public function isInPool($type, $id); - - /** - * Add object to the pool. - * - * @param EntityInterface $object - */ + public function isInPool(string $type, int $id): bool; public function remember(EntityInterface $object): void; - - /** - * Forget object if it is loaded in memory. - * - * @param string $type - * @param array|int $id - */ public function forget(string $type, int $id): void; /** @@ -88,16 +67,9 @@ public function find(string $type): FinderInterface; * @param mixed $arguments * @return ResultInterface|EntityInterface[]|null */ - public function findBySql($type, $sql, ...$arguments); + public function findBySql(string $type, string $sql, ...$arguments); - /** - * Return table name by type. - * - * @param string $type - * @param bool $escaped - * @return string - */ - public function getTypeTable($type, $escaped = false); + public function getTypeTable(string $type, bool $escaped = false): string; /** * Return a list of fields that are managed by the type. @@ -105,15 +77,8 @@ public function getTypeTable($type, $escaped = false); * @param string $type * @return array */ - public function getTypeFields($type); - - /** - * Return a list of generated type fields that $type is aware of. - * - * @param string $type - * @return array - */ - public function getGeneratedTypeFields($type); + public function getTypeFields(string $type): array; + public function getGeneratedTypeFields(string $type): array; /** * Get a particular type property, and make it (using $callback) if it is not set already. @@ -123,67 +88,21 @@ public function getGeneratedTypeFields($type); * @param callable $callback * @return mixed */ - public function getTypeProperty($type, $property, callable $callback); - - /** - * Return a list of escaped field names for the given type. - * - * @param string $type - * @return string - */ - public function getEscapedTypeFields($type); - - /** - * Return default order by for the given type. - * - * @param string $type - * @return string[] - */ - public function getTypeOrderBy($type); - - /** - * Return escaped list of fields that we can order by. - * - * @param string $type - * @return string - */ - public function getEscapedTypeOrderBy($type); - - /** - * @return array - */ - public function getRegisteredTypes(); - - /** - * Return registered type for the given $type. This function is subclassing aware. - * - * @param string $type - * @return string|null - */ - public function getRegisteredType($type); - - /** - * Get registered type's class, or throw an execption if type is not regiestered. - * - * @param string $type - * @return string - */ - public function requireRegisteredType($type); - - /** - * Return true if $type is registered. - * - * @param string $type - * @return bool - */ - public function isTypeRegistered($type); + public function getTypeProperty(string $type, string $property, callable $callback); + public function getEscapedTypeFields(string $type): string; + public function getTypeOrderBy(string $type): array; + public function getEscapedTypeOrderBy(string $type): string; + public function getRegisteredTypes(): array; + public function getRegisteredType(string $type): ?string; + public function requireRegisteredType(string $type): string; + public function isTypeRegistered(string $type): bool; /** * Return interface that is used to detect if type is polymorph. * * @return string|null */ - public function getPolymorphTypeInterface(); + public function getPolymorphTypeInterface(): ?string; /** * Set interface that is used to detect if type is polymorph. @@ -191,7 +110,7 @@ public function getPolymorphTypeInterface(); * @param string|null $value * @return $this */ - public function &setPolymorphTypeInterface($value); + public function &setPolymorphTypeInterface(?string $value): PoolInterface; /** * Return true if $type is polymorph (has type column that is used to figure out a class of individual record). @@ -199,23 +118,9 @@ public function &setPolymorphTypeInterface($value); * @param string $type * @return bool */ - public function isTypePolymorph($type); - - /** - * @param string[] $types - */ - public function registerType(...$types); + public function isTypePolymorph(string $type): bool; + public function registerType(string ...$types): PoolInterface; - /** - * Return trait names by object. - * - * @param string $type - * @return array - */ - public function getTraitNamesByType($type); - - /** - * @return string - */ - public function getDefaultFinderClass(); + public function getTraitNamesByType(string $type): array; + public function getDefaultFinderClass(): string; } From 063e2c94cfe9604ce575aa29a6a2b3a0ed65ffb6 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 24 Jan 2020 23:42:45 +0100 Subject: [PATCH 12/61] Add exists() and existsOne() methods to finder interface --- src/Finder.php | 10 ++++++++++ src/FinderInterface.php | 3 +++ test/src/FindTest.php | 44 ++++++++++++++++++++++++++++++----------- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/Finder.php b/src/Finder.php index a20b7a1..0981a58 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -212,6 +212,16 @@ public function count(): int return $this->connection->executeFirstCell($sql); } + public function exists(): bool + { + return $this->count() > 0; + } + + public function existsOne(): bool + { + return $this->count() === 1; + } + /** * {@inheritdoc} */ diff --git a/src/FinderInterface.php b/src/FinderInterface.php index 0c1d5b9..0de044c 100644 --- a/src/FinderInterface.php +++ b/src/FinderInterface.php @@ -71,6 +71,9 @@ public function &joinTable($table_name, $field_name = null): FinderInterface; */ public function count(): int; + public function exists(): bool; + public function existsOne(): bool; + /** * Return all records that match the given criteria. * diff --git a/test/src/FindTest.php b/test/src/FindTest.php index ee811f4..19eb6dc 100644 --- a/test/src/FindTest.php +++ b/test/src/FindTest.php @@ -14,25 +14,22 @@ use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DateValue\DateValue; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test */ class FindTest extends WritersTypeTestCase { - /** - * Test count all. - */ public function testCount() { $this->assertEquals(3, $this->pool->count(Writer::class)); } - /** - * @expectedException \InvalidArgumentException - */ public function testCountThrowsAnExceptionOnUnregisteredType() { + $this->expectException(InvalidArgumentException::class); + $this->pool->count(DateValue::class); } @@ -41,7 +38,10 @@ public function testCountThrowsAnExceptionOnUnregisteredType() */ public function testCountWithConditions() { - $this->assertEquals(2, $this->pool->count(Writer::class, ['birthday > ?', new DateValue('1800-01-01')])); + $this->assertEquals( + 2, + $this->pool->count(Writer::class, ['birthday > ?', new DateValue('1800-01-01')]) + ); } /** @@ -122,6 +122,28 @@ public function testCountUsingFinder() $this->assertEquals(3, $this->pool->find(Writer::class)->count()); } + public function testExistsUsingFinder() + { + $this->assertEquals(3, $this->pool->find(Writer::class)->count()); + + $this->assertTrue($this->pool->find(Writer::class)->exists()); + $this->assertFalse($this->pool->find(Writer::class)->existsOne()); + + $this->connection->execute('DELETE FROM `writers` WHERE `name` != ?', 'Leo Tolstoy'); + + $this->assertEquals(1, $this->pool->find(Writer::class)->count()); + + $this->assertTrue($this->pool->find(Writer::class)->exists()); + $this->assertTrue($this->pool->find(Writer::class)->existsOne()); + + $this->connection->execute('DELETE FROM `writers`'); + + $this->assertEquals(0, $this->pool->find(Writer::class)->count()); + + $this->assertFalse($this->pool->find(Writer::class)->exists()); + $this->assertFalse($this->pool->find(Writer::class)->existsOne()); + } + /** * Test find by conditions. */ @@ -166,7 +188,7 @@ public function testFindByMultipleConditions() } /** - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testConditionsPatternNeedsToBeString() { @@ -235,7 +257,7 @@ public function testHydratedObjectsAreFullyFunctional() } /** - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testFindBySqlRequiresType() { @@ -243,7 +265,7 @@ public function testFindBySqlRequiresType() } /** - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testFindBySqlRequiresRegisteredType() { @@ -251,7 +273,7 @@ public function testFindBySqlRequiresRegisteredType() } /** - * @expectedException \InvalidArgumentException + * @expectedException InvalidArgumentException */ public function testFindBySqlRequiresSqlStatement() { From 46da2ddda12663de0d4eb31351f6ee4f345de3bb Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 25 Jan 2020 15:01:21 +0100 Subject: [PATCH 13/61] Remove methods that return this by reference --- src/Finder.php | 10 +++++----- src/FinderInterface.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Finder.php b/src/Finder.php index 0981a58..ff99f7d 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -97,7 +97,7 @@ public function __toString(): string * @param mixed ...$arguments * @return FinderInterface|$this */ - public function &where($pattern, ...$arguments): FinderInterface + public function where($pattern, ...$arguments): FinderInterface { if (!is_string($pattern)) { throw new InvalidArgumentException('Conditions pattern needs to be string'); @@ -135,7 +135,7 @@ private function getWhere(): string * @param string $order_by * @return FinderInterface|$this */ - public function &orderBy($order_by): FinderInterface + public function orderBy($order_by): FinderInterface { $this->order_by = $order_by; @@ -147,7 +147,7 @@ public function &orderBy($order_by): FinderInterface * @param int $limit * @return FinderInterface|$this */ - public function &limit($offset, $limit): FinderInterface + public function limit($offset, $limit): FinderInterface { $this->offset = $offset; $this->limit = $limit; @@ -160,7 +160,7 @@ public function &limit($offset, $limit): FinderInterface * @param string $field_name * @return FinderInterface|$this */ - public function &join($type, $field_name = null): FinderInterface + public function join($type, $field_name = null): FinderInterface { return $this->joinTable($this->pool->getTypeTable($type), $field_name); } @@ -170,7 +170,7 @@ public function &join($type, $field_name = null): FinderInterface * @param string $field_name * @return FinderInterface|$this */ - public function &joinTable($table_name, $field_name = null): FinderInterface + public function joinTable($table_name, $field_name = null): FinderInterface { $join_table = $this->connection->escapeTableName($table_name); $join_field = $this->connection->escapeFieldName($field_name ? $field_name : $this->getJoinFieldNameFromType()); diff --git a/src/FinderInterface.php b/src/FinderInterface.php index 0de044c..3a95563 100644 --- a/src/FinderInterface.php +++ b/src/FinderInterface.php @@ -31,34 +31,34 @@ public function __toString(): string; * @param mixed ...$arguments * @return FinderInterface */ - public function &where($pattern, ...$arguments): FinderInterface; + public function where($pattern, ...$arguments): FinderInterface; /** * @param string $order_by * @return FinderInterface */ - public function &orderBy($order_by): FinderInterface; + public function orderBy($order_by): FinderInterface; /** * @param int $offset * @param int $limit * @return FinderInterface */ - public function &limit($offset, $limit): FinderInterface; + public function limit($offset, $limit): FinderInterface; /** * @param string $type * @param string $field_name * @return FinderInterface */ - public function &join($type, $field_name = null): FinderInterface; + public function join($type, $field_name = null): FinderInterface; /** * @param string $table_name * @param string $field_name * @return FinderInterface */ - public function &joinTable($table_name, $field_name = null): FinderInterface; + public function joinTable($table_name, $field_name = null): FinderInterface; // --------------------------------------------------- // Execution From 38918f44ee7f7a12f34bdeb6f70152d38dac5e3a Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 25 Jan 2020 15:06:39 +0100 Subject: [PATCH 14/61] Improve finder interface --- src/Finder.php | 37 ++++++++----------------------------- src/FinderInterface.php | 40 +++++----------------------------------- test/src/FindTest.php | 6 +++--- 3 files changed, 16 insertions(+), 67 deletions(-) diff --git a/src/Finder.php b/src/Finder.php index ff99f7d..f1be5f3 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -97,12 +97,8 @@ public function __toString(): string * @param mixed ...$arguments * @return FinderInterface|$this */ - public function where($pattern, ...$arguments): FinderInterface + public function where(string $pattern, ...$arguments): FinderInterface { - if (!is_string($pattern)) { - throw new InvalidArgumentException('Conditions pattern needs to be string'); - } - $conditions_to_prepare = [$pattern]; if (!empty($arguments)) { @@ -131,23 +127,14 @@ private function getWhere(): string } } - /** - * @param string $order_by - * @return FinderInterface|$this - */ - public function orderBy($order_by): FinderInterface + public function orderBy(string $order_by): FinderInterface { $this->order_by = $order_by; return $this; } - /** - * @param int $offset - * @param int $limit - * @return FinderInterface|$this - */ - public function limit($offset, $limit): FinderInterface + public function limit(int $offset, int $limit): FinderInterface { $this->offset = $offset; $this->limit = $limit; @@ -155,25 +142,17 @@ public function limit($offset, $limit): FinderInterface return $this; } - /** - * @param string $type - * @param string $field_name - * @return FinderInterface|$this - */ - public function join($type, $field_name = null): FinderInterface + public function join(string $type, string $field_name = null): FinderInterface { return $this->joinTable($this->pool->getTypeTable($type), $field_name); } - /** - * @param string $table_name - * @param string $field_name - * @return FinderInterface|$this - */ - public function joinTable($table_name, $field_name = null): FinderInterface + public function joinTable(string $table_name, string $field_name = null): FinderInterface { $join_table = $this->connection->escapeTableName($table_name); - $join_field = $this->connection->escapeFieldName($field_name ? $field_name : $this->getJoinFieldNameFromType()); + $join_field = $this->connection->escapeFieldName( + $field_name ? $field_name : $this->getJoinFieldNameFromType() + ); $this->join = "LEFT JOIN $join_table ON {$this->getEscapedTableName()}.`id` = $join_table.$join_field"; diff --git a/src/FinderInterface.php b/src/FinderInterface.php index 3a95563..2b8acd1 100644 --- a/src/FinderInterface.php +++ b/src/FinderInterface.php @@ -24,41 +24,11 @@ public function __toString(): string; // Configuration // --------------------------------------------------- - /** - * Set finder conditions. - * - * @param string $pattern - * @param mixed ...$arguments - * @return FinderInterface - */ - public function where($pattern, ...$arguments): FinderInterface; - - /** - * @param string $order_by - * @return FinderInterface - */ - public function orderBy($order_by): FinderInterface; - - /** - * @param int $offset - * @param int $limit - * @return FinderInterface - */ - public function limit($offset, $limit): FinderInterface; - - /** - * @param string $type - * @param string $field_name - * @return FinderInterface - */ - public function join($type, $field_name = null): FinderInterface; - - /** - * @param string $table_name - * @param string $field_name - * @return FinderInterface - */ - public function joinTable($table_name, $field_name = null): FinderInterface; + public function where(string $pattern, ...$arguments): FinderInterface; + public function orderBy(string $order_by): FinderInterface; + public function limit(int $offset, int $limit): FinderInterface; + public function join(string $type, string $field_name = null): FinderInterface; + public function joinTable(string $table_name, string $field_name = null): FinderInterface; // --------------------------------------------------- // Execution diff --git a/test/src/FindTest.php b/test/src/FindTest.php index 19eb6dc..c4f4bf5 100644 --- a/test/src/FindTest.php +++ b/test/src/FindTest.php @@ -15,6 +15,7 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DateValue\DateValue; use InvalidArgumentException; +use TypeError; /** * @package ActiveCollab\DatabaseObject\Test @@ -187,11 +188,10 @@ public function testFindByMultipleConditions() $this->assertEquals('Fyodor Dostoyevsky', $should_be_fyodor[0]->getName()); } - /** - * @expectedException InvalidArgumentException - */ public function testConditionsPatternNeedsToBeString() { + $this->expectException(TypeError::class); + $this->pool->find(Writer::class)->where(['`name` LIKE ?', '%Leo%']); } From b21c8fc5177d014633a0bb161710d0b7fef85d05 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 25 Jan 2020 15:07:46 +0100 Subject: [PATCH 15/61] Improve code style --- test/src/FindTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/src/FindTest.php b/test/src/FindTest.php index c4f4bf5..18b5c37 100644 --- a/test/src/FindTest.php +++ b/test/src/FindTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseConnection\Result\Result; @@ -17,9 +19,6 @@ use InvalidArgumentException; use TypeError; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class FindTest extends WritersTypeTestCase { public function testCount() From 9d5217ec648ad35f3bc458a588dacd09e3a6231d Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Mon, 16 Aug 2021 10:56:32 +0200 Subject: [PATCH 16/61] Upgrade phpunit --- .gitignore | 1 + composer.json | 2 +- composer.lock | 1239 +++++++++++++---- phpunit.xml | 41 +- test/src/Base/TestCase.php | 4 +- test/src/Base/WritersTypeTestCase.php | 4 +- test/src/ContainerPropagatesToFinderTest.php | 2 +- test/src/ContainerPropagatesToObjectTest.php | 2 +- test/src/CrudTest.php | 43 +- test/src/DefaultProducerTest.php | 13 +- test/src/EmailValidatorTest.php | 10 +- test/src/EntityCopyTest.php | 2 +- test/src/EntityIsTest.php | 2 +- test/src/EntityModifyFieldsTest.php | 9 +- test/src/FindJoinTest.php | 10 +- test/src/FindTest.php | 22 +- test/src/FinderFactoryTest.php | 2 +- test/src/GeneratedFieldsTest.php | 25 +- test/src/GreaterThanOrEqualsValidatorTest.php | 19 +- test/src/GreaterThanValidatorTest.php | 17 +- test/src/InArrayValidatorTest.php | 10 +- test/src/LowerThanOrEqualsValidatorTest.php | 19 +- test/src/LowerThanValidatorTest.php | 17 +- test/src/PoolProduceTest.php | 9 +- test/src/PresenceValidatorTest.php | 17 +- test/src/ProducerTest.php | 25 +- test/src/SerializeTest.php | 6 +- test/src/TraitTest.php | 4 +- test/src/TypeCollectionTest.php | 52 +- test/src/TypeRegistrationTest.php | 11 +- test/src/UniqueValidatorTest.php | 18 +- test/src/UrlValidatorTest.php | 12 +- test/src/ValidatorTest.php | 6 +- 33 files changed, 1118 insertions(+), 557 deletions(-) diff --git a/.gitignore b/.gitignore index fbc76ff..8fc20cd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .php_cs.cache *.idea .php_cs.cache +.phpunit.result.cache /vendor diff --git a/composer.json b/composer.json index bfe1b2d..fb8660a 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "ext-mysqli": "*", "friendsofphp/php-cs-fixer": "^2.0", "monolog/monolog": "^1.0", - "phpunit/phpunit": "~7.0", + "phpunit/phpunit": "~9.0", "pimple/pimple": "~3.0.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 595b72e..9e4c385 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": "7178564038f65c930deb2308813babb3", + "content-hash": "c6e16b94bf049f08558b0e7587d1c5e8", "packages": [ { "name": "activecollab/containeraccess", @@ -848,36 +848,31 @@ }, { "name": "doctrine/instantiator", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -891,7 +886,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -900,7 +895,25 @@ "constructor", "instantiate" ], - "time": "2019-10-21T16:45:58+00:00" + "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", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-11-10T18:47:58+00:00" }, { "name": "doctrine/lexer", @@ -1133,20 +1146,20 @@ }, { "name": "myclabs/deep-copy", - "version": "1.9.4", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", - "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "replace": { "myclabs/deep-copy": "self.version" @@ -1177,7 +1190,73 @@ "object", "object graph" ], - "time": "2019-12-15T19:12:40+00:00" + "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", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v4.12.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", + "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=7.0" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" + }, + "time": "2021-07-21T10:44:31+00:00" }, { "name": "paragonie/random_compat", @@ -1226,28 +1305,29 @@ }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1277,24 +1357,28 @@ } ], "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+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": "2.0.1", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "bae7c545bef187884426f042434e561ab1ddb182" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", + "reference": "bae7c545bef187884426f042434e561ab1ddb182", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -1324,7 +1408,11 @@ } ], "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+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": "php-cs-fixer/diff", @@ -1379,28 +1467,25 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~6" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -1427,44 +1512,45 @@ "reflection", "static analysis" ], - "time": "2018-08-07T13:53:10+00:00" + "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" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.3", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2ecaa9fef01634c83bfa8dc1fe35fb5cef223a62" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2ecaa9fef01634c83bfa8dc1fe35fb5cef223a62", - "reference": "2ecaa9fef01634c83bfa8dc1fe35fb5cef223a62", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", - "webmozart/assert": "^1.0" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1475,38 +1561,44 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-12-20T13:40:23+00:00" + "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.0.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { - "php": "^7.1", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { @@ -1525,37 +1617,41 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", - "version": "1.10.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d638ebbb58daba25a6a0dc7969e1358a0e3c6682" + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d638ebbb58daba25a6a0dc7969e1358a0e3c6682", - "reference": "d638ebbb58daba25a6a0dc7969e1358a0e3c6682", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", + "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.2.3|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.1", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + "phpspec/phpspec": "^6.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.10.x-dev" + "dev-master": "1.11.x-dev" } }, "autoload": { @@ -1588,44 +1684,52 @@ "spy", "stub" ], - "time": "2019-12-17T16:54:23+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + }, + "time": "2021-03-17T13:42:18+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "9.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "f6293e1b30a2354e8428e004689671b83871edde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", + "reference": "f6293e1b30a2354e8428e004689671b83871edde", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "nikic/php-parser": "^4.10.2", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -1651,32 +1755,42 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-03-28T07:26:59+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", + "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1701,26 +1815,48 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "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", + "type": "github" + } + ], + "time": "2020-09-28T05:57:25+00:00" }, { - "name": "phpunit/php-text-template", - "version": "1.2.1", + "name": "phpunit/php-invoker", + "version": "3.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1737,37 +1873,47 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", "keywords": [ - "template" + "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", + "type": "github" + } ], - "time": "2015-06-21T13:50:34+00:00" + "time": "2020-09-28T05:58:55+00:00" }, { - "name": "phpunit/php-timer", - "version": "2.1.2", + "name": "phpunit/php-text-template", + "version": "2.0.4", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1786,38 +1932,47 @@ "role": "lead" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", "keywords": [ - "timer" + "template" ], - "time": "2019-06-07T04:22:29+00:00" + "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", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" }, { - "name": "phpunit/php-token-stream", - "version": "3.1.1", + "name": "phpunit/php-timer", + "version": "5.0.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", "shasum": "" }, "require": { - "ext-tokenizer": "*", - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1832,65 +1987,78 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", "keywords": [ - "tokenizer" + "timer" ], - "time": "2019-09-17T06:23:10+00:00" + "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", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.18", + "version": "9.5.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" + "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb", + "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.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-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^2.3.4", + "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1898,12 +2066,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "9.5-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1924,7 +2095,21 @@ "testing", "xunit" ], - "time": "2019-12-06T05:14:37+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8" + }, + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-31T15:17:34+00:00" }, { "name": "pimple/pimple", @@ -2019,29 +2204,141 @@ "time": "2019-01-08T18:20:26+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", + "name": "sebastian/cli-parser", "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "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", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "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", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2061,34 +2358,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "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", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2101,6 +2408,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -2112,10 +2423,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -2125,33 +2432,100 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "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", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2164,13 +2538,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -2181,27 +2555,37 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "388b6ced16caa751030f6a69e588299fa09200ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", + "reference": "388b6ced16caa751030f6a69e588299fa09200ac", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-posix": "*" @@ -2209,7 +2593,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.1-dev" } }, "autoload": { @@ -2234,34 +2618,44 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:52:38+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2301,27 +2695,40 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:24:23+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^9.3" }, "suggest": { "ext-uopz": "*" @@ -2329,7 +2736,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2352,34 +2759,101 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "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": "2021-06-11T13:31:12+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "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", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2399,32 +2873,42 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "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", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2444,32 +2928,42 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "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", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2482,14 +2976,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -2497,29 +2991,42 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "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", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", "shasum": "" }, "require": { - "php": "^7.1" + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2539,29 +3046,95 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "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", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "2.3.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "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": "2021-06-15T12:49:02+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "c6c1022351a901512170118436c764e473f6de8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": ">=7.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2582,7 +3155,17 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" }, { "name": "symfony/console", @@ -2943,20 +3526,20 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" @@ -2964,7 +3547,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -2997,7 +3584,24 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/polyfill-php70", @@ -3330,23 +3934,23 @@ }, { "name": "theseer/tokenizer", - "version": "1.1.3", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -3366,33 +3970,49 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-06-13T22:48:21+00:00" + "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": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.10.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "phpstan/phpstan": "<0.12.20", + "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/" @@ -3414,7 +4034,11 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+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" } ], "aliases": [], @@ -3427,5 +4051,6 @@ }, "platform-dev": { "ext-mysqli": "*" - } + }, + "plugin-api-version": "2.1.0" } diff --git a/phpunit.xml b/phpunit.xml index a6f2abb..62daf8a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,26 +1,17 @@ - - - - ./test/src - - - - - - - - ./src - - + + + + + ./src + + + + + + + + ./test/src + + + diff --git a/test/src/Base/TestCase.php b/test/src/Base/TestCase.php index 0c1edbf..0f616c4 100644 --- a/test/src/Base/TestCase.php +++ b/test/src/Base/TestCase.php @@ -44,7 +44,7 @@ abstract class TestCase extends BaseTestCase */ protected $logger; - public function setUp() + public function setUp(): void { parent::setUp(); @@ -72,7 +72,7 @@ public function setUp() /** * Tear down test environment. */ - public function tearDown() + public function tearDown(): void { $this->connection = null; $this->pool = null; diff --git a/test/src/Base/WritersTypeTestCase.php b/test/src/Base/WritersTypeTestCase.php index f91e697..9a686a5 100644 --- a/test/src/Base/WritersTypeTestCase.php +++ b/test/src/Base/WritersTypeTestCase.php @@ -19,7 +19,7 @@ abstract class WritersTypeTestCase extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -56,7 +56,7 @@ public function setUp() /** * Tear down test environment. */ - public function tearDown() + public function tearDown(): void { if ($this->connection->tableExists('writers')) { $this->connection->dropTable('writers'); diff --git a/test/src/ContainerPropagatesToFinderTest.php b/test/src/ContainerPropagatesToFinderTest.php index b8330ec..7317bf2 100644 --- a/test/src/ContainerPropagatesToFinderTest.php +++ b/test/src/ContainerPropagatesToFinderTest.php @@ -21,7 +21,7 @@ class ContainerPropagatesToFinderTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/src/ContainerPropagatesToObjectTest.php b/test/src/ContainerPropagatesToObjectTest.php index c7972c1..e3807cb 100644 --- a/test/src/ContainerPropagatesToObjectTest.php +++ b/test/src/ContainerPropagatesToObjectTest.php @@ -21,7 +21,7 @@ class ContainerPropagatesToObjectTest extends WritersTypeTestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/src/CrudTest.php b/test/src/CrudTest.php index fb3e26f..0761fbd 100644 --- a/test/src/CrudTest.php +++ b/test/src/CrudTest.php @@ -8,10 +8,14 @@ namespace ActiveCollab\DatabaseObject\Test; +use ActiveCollab\DatabaseObject\Exception\ObjectNotFoundException; +use ActiveCollab\DatabaseObject\Exception\ValidationException; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\AwesomeWriter; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DateValue\DateValue; +use InvalidArgumentException; +use LogicException; /** * @package ActiveCollab\DatabaseObject\Test @@ -27,21 +31,17 @@ public function testNewInstancesGetDefaultFieldValues() $this->assertEquals('Unknown Writer', $unknown_writer->getName()); } - /** - * @expectedException \InvalidArgumentException - */ public function testFieldsWithDefaultValueCantBeNull() { + $this->expectException(InvalidArgumentException::class); $unknown_writer = new Writer($this->connection, $this->pool, $this->logger); $unknown_writer->setName(null); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Database row expected - */ public function testCantLoadFromEmptyRow() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Database row expected"); $writer = new Writer($this->connection, $this->pool, $this->logger); $writer->loadFromRow([]); } @@ -73,12 +73,10 @@ public function testGetById() $this->assertSame('1828-09-09', $tolstoy->getBirthday()->format('Y-m-d')); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage ID is expected to be a number larger than 0 - */ public function testGetByIdOnInvalidIdException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("ID is expected to be a number larger than 0"); $this->pool->getById(Writer::class, 0); } @@ -93,11 +91,10 @@ public function testGetByIdForNonExistingRecord() /** * Test if Pool::mustGetById() throws an exception when record was not found. - * - * @expectedException \ActiveCollab\DatabaseObject\Exception\ObjectNotFoundException */ public function testMustGetByIdThrowsAnException() { + $this->expectException(ObjectNotFoundException::class); $this->assertFalse($this->pool->exists(Writer::class, 890)); $this->assertNull($this->pool->mustGetById(Writer::class, 890)); } @@ -117,11 +114,9 @@ public function testSublassingAwareGetById() $this->assertSame('1828-09-09', $tolstoy->getBirthday()->format('Y-m-d')); } - /** - * @expectedException \InvalidArgumentException - */ public function testGetByIdThrowsAnExceptionOnUnregisteredType() { + $this->expectException(InvalidArgumentException::class); $this->pool->getById(DateValue::class, 1); } @@ -143,12 +138,10 @@ public function testCreate() $this->assertEquals('1860-01-29', $chekhov->getBirthday()->format('Y-m-d')); } - /** - * @expectedException \ActiveCollab\DatabaseObject\Exception\ValidationException - * @expectedExceptionMessage Value of 'birthday' is required - */ public function testExceptionOnInvalidCreate() { + $this->expectException(ValidationException::class); + $this->expectExceptionMessage("Value of 'birthday' is required"); (new Writer($this->connection, $this->pool, $this->logger)) ->setName('Anton Chekhov') ->save(); @@ -184,12 +177,12 @@ public function testModifications() /** @var Writer $tolstoy */ $tolstoy = $this->pool->getById(Writer::class, 1); - $this->assertInternalType('array', $tolstoy->getModifications()); + $this->assertIsArray($tolstoy->getModifications()); $this->assertEmpty($tolstoy->getModifications()); $tolstoy->setName('Lev Nikolayevich Tolstoy')->setBirthday(new DateValue('1828-09-10')); - $this->assertInternalType('array', $tolstoy->getModifications()); + $this->assertIsArray($tolstoy->getModifications()); $this->assertCount(2, $tolstoy->getModifications()); $this->assertEquals('Leo Tolstoy', $tolstoy->getModifications()['name'][0]); @@ -200,7 +193,7 @@ public function testModifications() $tolstoy->save(); - $this->assertInternalType('array', $tolstoy->getModifications()); + $this->assertIsArray($tolstoy->getModifications()); $this->assertEmpty($tolstoy->getModifications()); } @@ -233,11 +226,9 @@ public function testChangeIdToNewRecord() $this->assertEquals(1, $this->connection->executeFirstCell('SELECT COUNT(`id`) AS "row_count" FROM `writers` WHERE `id` = ?', 18)); } - /** - * @expectedException \LogicException - */ public function testChangeIdToExistingRecord() { + $this->expectException(LogicException::class); $chekhov = new Writer($this->connection, $this->pool, $this->logger); $chekhov->setName('Anton Chekhov'); diff --git a/test/src/DefaultProducerTest.php b/test/src/DefaultProducerTest.php index ccacfcf..5464139 100644 --- a/test/src/DefaultProducerTest.php +++ b/test/src/DefaultProducerTest.php @@ -13,6 +13,7 @@ use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\CustomProducer; use ActiveCollab\DatabaseObject\Validator; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -38,21 +39,17 @@ public function testCustomProducerCanBeSetByClassName() $this->assertInstanceOf(CustomProducer::class, $this->pool->getDefaultProducer()); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Producer class not found. - */ public function testUnknownClassCantBeSetAsDefaultProducer() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Producer class not found."); $this->pool->setDefaultProducerClass('Unknown class'); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Producer class does not implement producer interface. - */ public function testDefaultProducerClassNeedsToImlementProducerInterface() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Producer class does not implement producer interface."); $this->pool->setDefaultProducerClass(Validator::class); } } diff --git a/test/src/EmailValidatorTest.php b/test/src/EmailValidatorTest.php index 2135c03..d8caf58 100644 --- a/test/src/EmailValidatorTest.php +++ b/test/src/EmailValidatorTest.php @@ -20,7 +20,7 @@ class EmailValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -42,7 +42,7 @@ public function testValidEmailAddressPassesValidation() $email_errors = $validator->getFieldErrors('email'); - $this->assertInternalType('array', $email_errors); + $this->assertIsArray($email_errors); $this->assertCount(0, $email_errors); } @@ -60,7 +60,7 @@ public function testInvalidEmailAddressFailsValidation() $email_errors = $validator->getFieldErrors('email'); - $this->assertInternalType('array', $email_errors); + $this->assertIsArray($email_errors); $this->assertCount(1, $email_errors); } @@ -78,7 +78,7 @@ public function testNullPassesValidationWhenAllowed() $email_errors = $validator->getFieldErrors('email'); - $this->assertInternalType('array', $email_errors); + $this->assertIsArray($email_errors); $this->assertCount(0, $email_errors); } @@ -96,7 +96,7 @@ public function testNullFailsValidationWhenNotAllowed() $email_errors = $validator->getFieldErrors('email'); - $this->assertInternalType('array', $email_errors); + $this->assertIsArray($email_errors); $this->assertCount(1, $email_errors); } } diff --git a/test/src/EntityCopyTest.php b/test/src/EntityCopyTest.php index 1966eb1..b4dea55 100644 --- a/test/src/EntityCopyTest.php +++ b/test/src/EntityCopyTest.php @@ -27,7 +27,7 @@ class EntityCopyTest extends WritersTypeTestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/src/EntityIsTest.php b/test/src/EntityIsTest.php index 141b398..4738a3d 100644 --- a/test/src/EntityIsTest.php +++ b/test/src/EntityIsTest.php @@ -25,7 +25,7 @@ class EntityIsTest extends WritersTypeTestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/test/src/EntityModifyFieldsTest.php b/test/src/EntityModifyFieldsTest.php index 6745402..554ab23 100644 --- a/test/src/EntityModifyFieldsTest.php +++ b/test/src/EntityModifyFieldsTest.php @@ -11,6 +11,7 @@ use ActiveCollab\DatabaseObject\Entity\EntityInterface; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -25,7 +26,7 @@ class EntityModifyFieldsTest extends WritersTypeTestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -33,12 +34,10 @@ public function setUp() $this->assertInstanceOf(Writer::class, $this->writer); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage 'not a field' is not a known field - */ public function testMissingFieldCantBeSet() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("'not a field' is not a known field"); $this->writer->setFieldValue('not a field', 'yes, a value'); } diff --git a/test/src/FindJoinTest.php b/test/src/FindJoinTest.php index a336167..38bcdcb 100644 --- a/test/src/FindJoinTest.php +++ b/test/src/FindJoinTest.php @@ -20,7 +20,7 @@ class FindJoinTest extends WritersTypeTestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -45,7 +45,7 @@ public function setUp() /** * Tear down test environment. */ - public function tearDown() + public function tearDown(): void { if ($this->connection->tableExists('writer_groups')) { $this->connection->dropTable('writer_groups'); @@ -122,19 +122,19 @@ public function testFindAllIds() { $ids = $this->pool->find(Writer::class)->orderBy('`id`')->ids(); - $this->assertInternalType('array', $ids); + $this->assertIsArray($ids); $this->assertCount(3, $ids); $this->assertEquals([1, 2, 3], $ids); $ids = $this->pool->find(Writer::class)->orderBy('`id`')->joinTable('writer_groups')->where('`writer_groups`.`group_id` = ?', 1)->ids(); - $this->assertInternalType('array', $ids); + $this->assertIsArray($ids); $this->assertCount(2, $ids); $this->assertEquals([1, 2], $ids); $ids = $this->pool->find(Writer::class)->orderBy('`id`')->joinTable('writer_groups')->where('`writer_groups`.`group_id` = ?', 2)->ids(); - $this->assertInternalType('array', $ids); + $this->assertIsArray($ids); $this->assertCount(1, $ids); $this->assertEquals([3], $ids); } diff --git a/test/src/FindTest.php b/test/src/FindTest.php index 18b5c37..5066b13 100644 --- a/test/src/FindTest.php +++ b/test/src/FindTest.php @@ -99,7 +99,7 @@ public function testFindAllIds() { $ids = $this->pool->find(Writer::class)->ids(); - $this->assertInternalType('array', $ids); + $this->assertIsArray($ids); $this->assertCount(3, $ids); } @@ -110,7 +110,7 @@ public function testFindIdsAlwaysReturnsArray() { $ids = $this->pool->find(Writer::class)->where('id = ?', -1)->ids(); - $this->assertInternalType('array', $ids); + $this->assertIsArray($ids); $this->assertCount(0, $ids); } @@ -163,7 +163,7 @@ public function testFindByConditions() public function testFindByMultipleConditions() { $finder_1 = $this->pool->find(Writer::class)->where('`birthday` > ?', '1800-01-01'); - $this->assertContains("WHERE `birthday` > '1800-01-01'", (string) $finder_1); + $this->assertStringContainsString("WHERE `birthday` > '1800-01-01'", (string) $finder_1); /* @var Writer[] $should_be_fyodor */ $should_be_fyodor_and_leo = $finder_1->all(); @@ -175,7 +175,7 @@ public function testFindByMultipleConditions() ->where('`birthday` > ?', '1800-01-01') ->where('`birthday` < ?', '1825-01-01'); - $this->assertContains("WHERE (`birthday` > '1800-01-01') AND (`birthday` < '1825-01-01')", (string) $finder_2); + $this->assertStringContainsString("WHERE (`birthday` > '1800-01-01') AND (`birthday` < '1825-01-01')", (string) $finder_2); /** @var Writer[] $should_be_fyodor */ $should_be_fyodor = $finder_2->all(); @@ -209,7 +209,7 @@ public function testFindIdsByCondition() { $ids = $this->pool->find(Writer::class)->where('`name` LIKE ?', '%Leo%')->ids(); - $this->assertInternalType('array', $ids); + $this->assertIsArray($ids); $this->assertCount(1, $ids); $this->assertSame(1, $ids[0]); } @@ -255,27 +255,21 @@ public function testHydratedObjectsAreFullyFunctional() $this->assertEquals('Lev Nikolayevich Tolstoy', $should_be_leo->getName()); } - /** - * @expectedException InvalidArgumentException - */ public function testFindBySqlRequiresType() { + $this->expectException(InvalidArgumentException::class); $this->pool->findBySql('', 'SELECT * FROM `writers` ORDER BY `name`'); } - /** - * @expectedException InvalidArgumentException - */ public function testFindBySqlRequiresRegisteredType() { + $this->expectException(InvalidArgumentException::class); $this->pool->findBySql(DateValue::class, 'SELECT * FROM `writers` ORDER BY `name`'); } - /** - * @expectedException InvalidArgumentException - */ public function testFindBySqlRequiresSqlStatement() { + $this->expectException(InvalidArgumentException::class); $this->pool->findBySql(Writer::class, ''); } diff --git a/test/src/FinderFactoryTest.php b/test/src/FinderFactoryTest.php index d127c9e..f9ab4f9 100644 --- a/test/src/FinderFactoryTest.php +++ b/test/src/FinderFactoryTest.php @@ -40,6 +40,6 @@ public function testFinderFactoryCanSetWhere() $this->assertInstanceOf(FinderInterface::class, $finder); $this->assertSame(Writer::class, $finder->getType()); - $this->assertContains("`name` = 'Leo Tolstoy'", (string) $finder); + $this->assertStringContainsString("`name` = 'Leo Tolstoy'", (string) $finder); } } diff --git a/test/src/GeneratedFieldsTest.php b/test/src/GeneratedFieldsTest.php index f424c93..e5b0a9d 100644 --- a/test/src/GeneratedFieldsTest.php +++ b/test/src/GeneratedFieldsTest.php @@ -14,6 +14,7 @@ use ActiveCollab\DateValue\DateTimeValue; use ActiveCollab\DateValue\DateValue; use ActiveCollab\DateValue\DateValueInterface; +use LogicException; /** * @package ActiveCollab\DatabaseObject\Test @@ -23,7 +24,7 @@ class GeneratedFieldsTest extends TestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -46,7 +47,7 @@ public function setUp() $this->pool->registerType(StatsSnapshot::class); } - public function tearDown() + public function tearDown(): void { $this->connection->dropTable('stats_snapshots'); $this->connection->execute('DROP TRIGGER IF EXISTS `insert_stats_snapshots`'); @@ -80,12 +81,10 @@ public function testIsUsedOnDayIsGeneratedField() $this->assertContains('is_used_on_day', $this->pool->getGeneratedTypeFields(StatsSnapshot::class)); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage Generated field is_used_on_day cannot be set by directly assigning a value - */ public function testGeneratedFieldCantBeSetDuringProduction() { + $this->expectException(LogicException::class); + $this->expectExceptionMessage("Generated field is_used_on_day cannot be set by directly assigning a value"); $this->pool->produce(StatsSnapshot::class, [ 'account_id' => 1, 'day' => new DateValue(), @@ -96,12 +95,10 @@ public function testGeneratedFieldCantBeSetDuringProduction() ]); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage Generated field is_used_on_day cannot be set by directly assigning a value - */ public function testGeneratedFieldCantBeSetUsingSetField() { + $this->expectException(LogicException::class); + $this->expectExceptionMessage("Generated field is_used_on_day cannot be set by directly assigning a value"); $this->produceSnapshot()->setFieldValue('is_used_on_day', true); } @@ -114,12 +111,12 @@ public function testPoolUsesTheCorrectListOfGeneratedFields() public function testPoolIncludesGeneratedFieldsInTypeFieldsList() { $generated_type_fields = $this->pool->getGeneratedTypeFields(StatsSnapshot::class); - $this->assertInternalType('array', $generated_type_fields); + $this->assertIsArray($generated_type_fields); $this->assertContains('is_used_on_day', $generated_type_fields); $escaped_type_fields = $this->pool->getEscapedTypeFields(StatsSnapshot::class); - $this->assertInternalType('string', $escaped_type_fields); - $this->assertContains('is_used_on_day', $escaped_type_fields); + $this->assertIsString($escaped_type_fields); + $this->assertStringContainsString('is_used_on_day', $escaped_type_fields); } public function testGeneratedFieldsAreHydrated() @@ -134,7 +131,7 @@ public function testGeneratedFieldsAreHydrated() $this->assertSame(1, $insert_id); $row = $this->connection->executeFirstRow('SELECT * FROM stats_snapshots WHERE id = ?', $insert_id); - $this->assertInternalType('array', $row); + $this->assertIsArray($row); $this->assertArrayHasKey('is_used_on_day', $row); $this->assertTrue($row['is_used_on_day']); diff --git a/test/src/GreaterThanOrEqualsValidatorTest.php b/test/src/GreaterThanOrEqualsValidatorTest.php index 3d2c18e..22364f7 100644 --- a/test/src/GreaterThanOrEqualsValidatorTest.php +++ b/test/src/GreaterThanOrEqualsValidatorTest.php @@ -11,6 +11,7 @@ use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\User; use ActiveCollab\DatabaseObject\Validator; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -25,7 +26,7 @@ class GreaterThanOrEqualsValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -33,12 +34,10 @@ public function setUp() $this->assertTrue($this->pool->isTypeRegistered(User::class)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value '' is not a valid field name - */ public function testFieldNameIsRequired() { + $this->expectExceptionMessage("Value '' is not a valid field name"); + $this->expectException(InvalidArgumentException::class); $validator = new Validator($this->connection, 'users', null, null, []); $validator->greaterThanOrEquals('', 123); } @@ -57,7 +56,7 @@ public function testValueGreaterThanPassesValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -75,7 +74,7 @@ public function testEqualValueThanPassesValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -93,7 +92,7 @@ public function testValueNotInArrayFailsValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } @@ -111,7 +110,7 @@ public function testNullPassesValidationWhenAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -129,7 +128,7 @@ public function testNullFailsValidationWhenNotAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } } diff --git a/test/src/GreaterThanValidatorTest.php b/test/src/GreaterThanValidatorTest.php index 1f4eae4..22f1bea 100644 --- a/test/src/GreaterThanValidatorTest.php +++ b/test/src/GreaterThanValidatorTest.php @@ -11,6 +11,7 @@ use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\User; use ActiveCollab\DatabaseObject\Validator; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -25,7 +26,7 @@ class GreaterThanValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -33,12 +34,10 @@ public function setUp() $this->assertTrue($this->pool->isTypeRegistered(User::class)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value '' is not a valid field name - */ public function testFieldNameIsRequired() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Value '' is not a valid field name"); $validator = new Validator($this->connection, 'users', null, null, []); $validator->greaterThan('', 123); } @@ -57,7 +56,7 @@ public function testValueGreaterThanPassesValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -75,7 +74,7 @@ public function testValueNotInArrayFailsValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } @@ -93,7 +92,7 @@ public function testNullPassesValidationWhenAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -111,7 +110,7 @@ public function testNullFailsValidationWhenNotAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } } diff --git a/test/src/InArrayValidatorTest.php b/test/src/InArrayValidatorTest.php index 88d80ee..f704e83 100644 --- a/test/src/InArrayValidatorTest.php +++ b/test/src/InArrayValidatorTest.php @@ -25,7 +25,7 @@ class InArrayValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -47,7 +47,7 @@ public function testValueInArrayPassesValidation() $continent_errors = $validator->getFieldErrors('continent'); - $this->assertInternalType('array', $continent_errors); + $this->assertIsArray($continent_errors); $this->assertCount(0, $continent_errors); } @@ -65,7 +65,7 @@ public function testValueNotInArrayFailsValidation() $continent_errors = $validator->getFieldErrors('continent'); - $this->assertInternalType('array', $continent_errors); + $this->assertIsArray($continent_errors); $this->assertCount(1, $continent_errors); } @@ -83,7 +83,7 @@ public function testNullPassesValidationWhenAllowed() $continent_errors = $validator->getFieldErrors('continent'); - $this->assertInternalType('array', $continent_errors); + $this->assertIsArray($continent_errors); $this->assertCount(0, $continent_errors); } @@ -101,7 +101,7 @@ public function testNullFailsValidationWhenNotAllowed() $continent_errors = $validator->getFieldErrors('continent'); - $this->assertInternalType('array', $continent_errors); + $this->assertIsArray($continent_errors); $this->assertCount(1, $continent_errors); } } diff --git a/test/src/LowerThanOrEqualsValidatorTest.php b/test/src/LowerThanOrEqualsValidatorTest.php index d10b825..714cd38 100644 --- a/test/src/LowerThanOrEqualsValidatorTest.php +++ b/test/src/LowerThanOrEqualsValidatorTest.php @@ -11,6 +11,7 @@ use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\User; use ActiveCollab\DatabaseObject\Validator; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -25,7 +26,7 @@ class LowerThanOrEqualsValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -33,12 +34,10 @@ public function setUp() $this->assertTrue($this->pool->isTypeRegistered(User::class)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value '' is not a valid field name - */ public function testFieldNameIsRequired() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Value '' is not a valid field name"); $validator = new Validator($this->connection, 'users', null, null, []); $validator->lowerThanOrEquals('', 123); } @@ -57,7 +56,7 @@ public function testValueLowerThanPassesValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -75,7 +74,7 @@ public function testEqualValuePassesValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -93,7 +92,7 @@ public function testValueNotInArrayFailsValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } @@ -111,7 +110,7 @@ public function testNullPassesValidationWhenAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -129,7 +128,7 @@ public function testNullFailsValidationWhenNotAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } } diff --git a/test/src/LowerThanValidatorTest.php b/test/src/LowerThanValidatorTest.php index 18e22ac..44ed80d 100644 --- a/test/src/LowerThanValidatorTest.php +++ b/test/src/LowerThanValidatorTest.php @@ -11,6 +11,7 @@ use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\User; use ActiveCollab\DatabaseObject\Validator; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -25,7 +26,7 @@ class LowerThanValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -33,12 +34,10 @@ public function setUp() $this->assertTrue($this->pool->isTypeRegistered(User::class)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value '' is not a valid field name - */ public function testFieldNameIsRequired() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Value '' is not a valid field name"); $validator = new Validator($this->connection, 'users', null, null, []); $validator->lowerThan('', 123); } @@ -57,7 +56,7 @@ public function testValueLowerThanPassesValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -75,7 +74,7 @@ public function testValueNotInArrayFailsValidation() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } @@ -93,7 +92,7 @@ public function testNullPassesValidationWhenAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(0, $age_errors); } @@ -111,7 +110,7 @@ public function testNullFailsValidationWhenNotAllowed() $age_errors = $validator->getFieldErrors('age'); - $this->assertInternalType('array', $age_errors); + $this->assertIsArray($age_errors); $this->assertCount(1, $age_errors); } } diff --git a/test/src/PoolProduceTest.php b/test/src/PoolProduceTest.php index 184ada6..35885f1 100644 --- a/test/src/PoolProduceTest.php +++ b/test/src/PoolProduceTest.php @@ -13,6 +13,7 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DatabaseObject\Validator; use ActiveCollab\DateValue\DateValue; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -146,19 +147,15 @@ public function testProducedObjectUpdateIsSavedToPool() $this->assertEquals('Anton Pavlovich Chekhov', $object_from_pool_second_take->getName()); } - /** - * @expectedException \InvalidArgumentException - */ public function testExceptionOnUnknonwClass() { + $this->expectException(InvalidArgumentException::class); $this->pool->produce('Definitely not a Class'); } - /** - * @expectedException \InvalidArgumentException - */ public function testExceptionOnNonObjectClass() { + $this->expectException(InvalidArgumentException::class); $this->pool->produce(Validator::class); } } diff --git a/test/src/PresenceValidatorTest.php b/test/src/PresenceValidatorTest.php index 3b12429..444f06a 100644 --- a/test/src/PresenceValidatorTest.php +++ b/test/src/PresenceValidatorTest.php @@ -10,18 +10,17 @@ use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Validator; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test */ class PresenceValidatorTest extends WritersTypeTestCase { - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Value '' is not a valid field name - */ public function testFieldNameIsRequired() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Value '' is not a valid field name"); $validator = new Validator($this->connection, 'writers', null, null, []); $validator->present(''); } @@ -40,7 +39,7 @@ public function testPass() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } @@ -58,7 +57,7 @@ public function testFail() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(1, $name_errors); } @@ -91,7 +90,7 @@ public function testBooleanPresenceFail() $is_alive_errors = $validator->getFieldErrors('is_alive'); - $this->assertInternalType('array', $is_alive_errors); + $this->assertIsArray($is_alive_errors); $this->assertCount(1, $is_alive_errors); } @@ -109,7 +108,7 @@ public function testFailBecauseTheresNoValue() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(1, $name_errors); } @@ -127,7 +126,7 @@ public function testTypeCheck() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } } diff --git a/test/src/ProducerTest.php b/test/src/ProducerTest.php index b7952ac..f063bb8 100644 --- a/test/src/ProducerTest.php +++ b/test/src/ProducerTest.php @@ -14,6 +14,9 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\AwesomeWriter; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DateValue\DateValue; +use InvalidArgumentException; +use LogicException; +use RuntimeException; /** * @package ActiveCollab\DatabaseObject\Test @@ -89,38 +92,30 @@ public function testCustomProducerCanBeSetByClassName() $this->assertSame(1234, $object->custom_attribute_value); } - /** - * @expectedException \InvalidArgumentException - */ public function testCustomProducerCantBeSetForUnregisteredType() { + $this->expectException(InvalidArgumentException::class); $this->assertFalse($this->pool->isTypeRegistered(User::class)); $this->pool->registerProducer(User::class, new CustomProducer($this->connection, $this->pool, $this->logger)); } - /** - * @expectedException \LogicException - */ public function testCustomProducerCantBeSetTwice() { + $this->expectException(LogicException::class); $this->pool->registerProducer(Writer::class, new CustomProducer($this->connection, $this->pool, $this->logger)); $this->pool->registerProducer(AwesomeWriter::class, new CustomProducer($this->connection, $this->pool, $this->logger)); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Class 'stdClass' does not implement 'ActiveCollab\DatabaseObject\ProducerInterface' interface - */ public function testCustomProducerRequiresProducerInterface() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Class 'stdClass' does not implement 'ActiveCollab\DatabaseObject\ProducerInterface' interface"); $this->pool->registerProducerByClass(Writer::class, \stdClass::class); } - /** - * @expectedException \RuntimeException - */ public function testUnsavedObjectsCantBeModified() { + $this->expectException(RuntimeException::class); $object = $this->pool->produce(Writer::class, [ 'name' => 'Anton Chekhov', 'birthday' => new DateValue('1860-01-20'), @@ -184,11 +179,9 @@ public function testModifyUsingCustomProducer() $this->assertTrue($object->modified_using_custom_producer); } - /** - * @expectedException \RuntimeException - */ public function testUnsavedObjectsCantBeScrapped() { + $this->expectException(RuntimeException::class); $object = $this->pool->produce(Writer::class, [ 'name' => 'Anton Chekhov', 'birthday' => new DateValue('1860-01-20'), diff --git a/test/src/SerializeTest.php b/test/src/SerializeTest.php index 3edce1f..571dc10 100644 --- a/test/src/SerializeTest.php +++ b/test/src/SerializeTest.php @@ -26,7 +26,7 @@ class SerializeTest extends WritersTypeTestCase /** * {@inheritdoc} */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -42,7 +42,7 @@ public function testEntityIsSerializable() public function testSerialization() { $data = json_decode(json_encode($this->writer), true); - $this->assertInternalType('array', $data); + $this->assertIsArray($data); $this->assertArrayHasKey('id', $data); $this->assertSame($this->writer->getId(), $data['id']); @@ -59,7 +59,7 @@ public function testSerialization() public function testExtendedSerializationIsEmptyByDefault() { - $this->assertInternalType('array', $this->writer->jsonSerializeDetails()); + $this->assertIsArray($this->writer->jsonSerializeDetails()); $this->assertEmpty($this->writer->jsonSerializeDetails()); } } diff --git a/test/src/TraitTest.php b/test/src/TraitTest.php index e049544..aa4b701 100644 --- a/test/src/TraitTest.php +++ b/test/src/TraitTest.php @@ -23,7 +23,7 @@ class TraitTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -35,7 +35,7 @@ public function testClassTraits() { $trait_names = (new TraitsResolver())->getClassTraits(Writer::class); - $this->assertInternalType('array', $trait_names); + $this->assertIsArray($trait_names); $this->assertCount(3, $trait_names); $this->assertContains(Implementation::class, $trait_names); diff --git a/test/src/TypeCollectionTest.php b/test/src/TypeCollectionTest.php index 6270707..6e19ae5 100644 --- a/test/src/TypeCollectionTest.php +++ b/test/src/TypeCollectionTest.php @@ -12,6 +12,8 @@ use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Collection as WritersCollection; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; +use InvalidArgumentException; +use LogicException; /** * Test data object collection. @@ -23,7 +25,7 @@ class TypeCollectionTest extends WritersTypeTestCase /** * Tear down test environment. */ - public function tearDown() + public function tearDown(): void { if ($this->connection->tableExists('favorite_writers')) { $this->connection->dropTable('favorite_writers'); @@ -66,12 +68,10 @@ public function testSetConditionsFromArray() $this->assertEquals($collection->getConditions(), "type = 'File'"); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage When pattern is an array, no extra arguments are allowed - */ public function testSetConditionsFromArrayAcceptsOnlyPatternArgument() { + $this->expectException(LogicException::class); + $this->expectExceptionMessage("When pattern is an array, no extra arguments are allowed"); $collection = new WritersCollection($this->connection, $this->pool, $this->logger); $collection->where(['type = ?', 'File'], 1, 2, 3); @@ -88,30 +88,24 @@ public function testSetConditionsFromArrayOfArguments() $this->assertEquals($collection->getConditions(), "type = 'File'"); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Pattern argument is required - */ public function testEmptyPatternStringThrowsAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Pattern argument is required"); (new WritersCollection($this->connection, $this->pool, $this->logger))->where(''); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Pattern argument is required - */ public function testEmptyPatternArrayThrowsAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Pattern argument is required"); (new WritersCollection($this->connection, $this->pool, $this->logger))->where([]); } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Pattern can be string or an array - */ public function testInvalidConditionsTypeThrowsAnException() { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Pattern can be string or an array"); (new WritersCollection($this->connection, $this->pool, $this->logger))->where(123); } @@ -137,35 +131,27 @@ public function testSetOrderBy() $this->assertEquals($collection->getOrderBy(), '`writers`.`created_at` DESC'); } - /** - * @expectedException \LogicException - */ public function testCoundShouldNotWorkWhenCollectionIsNotReady() { + $this->expectException(LogicException::class); (new WritersCollection($this->connection, $this->pool, $this->logger))->setAsNotReady()->executeIds(); } - /** - * @expectedException \LogicException - */ public function testExecuteShouldNotWorkWhenCollectionIsNotReady() { + $this->expectException(LogicException::class); (new WritersCollection($this->connection, $this->pool, $this->logger))->setAsNotReady()->execute(); } - /** - * @expectedException \LogicException - */ public function testExecuteIdsShouldNotWorkWhenCollectionIsNotReady() { + $this->expectException(LogicException::class); (new WritersCollection($this->connection, $this->pool, $this->logger))->setAsNotReady()->executeIds(); } - /** - * @expectedException \LogicException - */ public function testGetTagShouldNotWorkWhenCollectionIsNotReady() { + $this->expectException(LogicException::class); (new WritersCollection($this->connection, $this->pool, $this->logger))->setAsNotReady()->getEtag('ilija.studen@activecollab.com'); } @@ -245,11 +231,9 @@ public function testIsPaginated() $this->assertTrue($paginated->isPaginated()); } - /** - * @expectedException \LogicException - */ public function testSetCurrentPageForNonPaginatedCollectionThrowsAnError() { + $this->expectException(LogicException::class); (new WritersCollection($this->connection, $this->pool, $this->logger))->currentPage(1); } @@ -356,11 +340,9 @@ public function testSourceAndTargetJoinFieldsSpecified() $this->assertEquals('target_id', $collection->getTargetJoinField()); } - /** - * @expectedException \InvalidArgumentException - */ public function testInvalidSourceAndTargetJoinFieldException() { + $this->expectException(InvalidArgumentException::class); (new WritersCollection($this->connection, $this->pool, $this->logger)) ->setJoinTable('writes_books', ['invalid', 'number', 'of', 'arguments']); } diff --git a/test/src/TypeRegistrationTest.php b/test/src/TypeRegistrationTest.php index 27e6dfb..ebf79ca 100644 --- a/test/src/TypeRegistrationTest.php +++ b/test/src/TypeRegistrationTest.php @@ -17,6 +17,7 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DatabaseObject\Validator; use ActiveCollab\DateValue\DateValue; +use InvalidArgumentException; /** * @package ActiveCollab\DatabaseObject\Test @@ -40,11 +41,9 @@ public function testRegisterEmptyList() $this->assertSame([], $this->pool->getRegisteredTypes()); } - /** - * @expectedException \InvalidArgumentException - */ public function testExceptionWhenRegisteringInvalidClass() { + $this->expectException(InvalidArgumentException::class); $this->pool->registerType(DateValue::class); } @@ -100,7 +99,7 @@ public function testFieldsForRegisteredTypes() $fileds = $this->pool->getTypeFields(Writer::class); - $this->assertInternalType('array', $fileds); + $this->assertIsArray($fileds); $this->assertContains('id', $fileds); $this->assertContains('name', $fileds); @@ -116,7 +115,7 @@ public function testFieldsForClassThatExtendsRegisteredType() $fileds = $this->pool->getTypeFields(AwesomeWriter::class); - $this->assertInternalType('array', $fileds); + $this->assertIsArray($fileds); $this->assertContains('id', $fileds); $this->assertContains('name', $fileds); @@ -195,7 +194,7 @@ public function testTraitNamesByType() { $trait_names = $this->pool->getTraitNamesByType(Writer::class); - $this->assertInternalType('array', $trait_names); + $this->assertIsArray($trait_names); $this->assertCount(3, $trait_names); $this->assertContains(Implementation::class, $trait_names); diff --git a/test/src/UniqueValidatorTest.php b/test/src/UniqueValidatorTest.php index ef4320b..bc74481 100644 --- a/test/src/UniqueValidatorTest.php +++ b/test/src/UniqueValidatorTest.php @@ -35,7 +35,7 @@ public function testNoErrorOnNull() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } @@ -53,7 +53,7 @@ public function testNewRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } @@ -71,7 +71,7 @@ public function testNewRecordReportsAnErrorOnDuplicateValue() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(1, $name_errors); } @@ -89,7 +89,7 @@ public function testExistingRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } @@ -107,7 +107,7 @@ public function testExistingRecordReportsAnErrorOnDuplicateValue() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(1, $name_errors); } @@ -125,7 +125,7 @@ public function testExistingRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } @@ -143,7 +143,7 @@ public function testExistingRecordReportsAnErrorOnDuplicateValueOnIdChange() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(1, $name_errors); } @@ -161,7 +161,7 @@ public function testNoErrorWhenUniqueWhereIsNotMatched() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(0, $name_errors); } @@ -179,7 +179,7 @@ public function testErrorWhenUniqueWhereIsMatched() $name_errors = $validator->getFieldErrors('name'); - $this->assertInternalType('array', $name_errors); + $this->assertIsArray($name_errors); $this->assertCount(1, $name_errors); } } diff --git a/test/src/UrlValidatorTest.php b/test/src/UrlValidatorTest.php index 9105779..6dc488f 100644 --- a/test/src/UrlValidatorTest.php +++ b/test/src/UrlValidatorTest.php @@ -20,7 +20,7 @@ class UrlValidatorTest extends TestCase /** * Set up test environment. */ - public function setUp() + public function setUp(): void { parent::setUp(); @@ -42,7 +42,7 @@ public function testValidUrlAddressPassesValidation() $url_errors = $validator->getFieldErrors('homepage_url'); - $this->assertInternalType('array', $url_errors); + $this->assertIsArray($url_errors); $this->assertCount(0, $url_errors); } @@ -57,7 +57,7 @@ public function testNoUrlFailsValidation() $url_errors = $validator->getFieldErrors('homepage_url'); - $this->assertInternalType('array', $url_errors); + $this->assertIsArray($url_errors); $this->assertCount(1, $url_errors); $this->assertContains("Value of 'homepage_url' is required", $url_errors); } @@ -76,7 +76,7 @@ public function testInvalidUrlAddressFailsValidation() $url_errors = $validator->getFieldErrors('homepage_url'); - $this->assertInternalType('array', $url_errors); + $this->assertIsArray($url_errors); $this->assertCount(1, $url_errors); $this->assertContains("Value of 'homepage_url' is not a valid URL", $url_errors); } @@ -95,7 +95,7 @@ public function testNullPassesValidationWhenAllowed() $url_errors = $validator->getFieldErrors('homepage_url'); - $this->assertInternalType('array', $url_errors); + $this->assertIsArray($url_errors); $this->assertCount(0, $url_errors); } @@ -113,7 +113,7 @@ public function testNullFailsValidationWhenNotAllowed() $url_errors = $validator->getFieldErrors('homepage_url'); - $this->assertInternalType('array', $url_errors); + $this->assertIsArray($url_errors); $this->assertCount(1, $url_errors); $this->assertContains("Value of 'homepage_url' is required", $url_errors); } diff --git a/test/src/ValidatorTest.php b/test/src/ValidatorTest.php index 57edbbf..dfbff49 100644 --- a/test/src/ValidatorTest.php +++ b/test/src/ValidatorTest.php @@ -52,16 +52,16 @@ public function testValidatorReturnsAllErrors() $errors = $validator->getErrors(); - $this->assertInternalType('array', $errors); + $this->assertIsArray($errors); $this->assertCount(2, $errors); $this->assertArrayHasKey('name', $errors); - $this->assertInternalType('array', $errors['name']); + $this->assertIsArray($errors['name']); $this->assertCount(1, $errors['name']); $this->assertEquals("Value of 'name' needs to be unique", $errors['name'][0]); $this->assertArrayHasKey('birthday', $errors); - $this->assertInternalType('array', $errors['birthday']); + $this->assertIsArray($errors['birthday']); $this->assertCount(1, $errors['birthday']); $this->assertEquals("Value of 'birthday' is required", $errors['birthday'][0]); } From 7cdcbf80fc9293fa808118ec34dcf7ead09afe05 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Mon, 16 Aug 2021 10:58:46 +0200 Subject: [PATCH 17/61] Make forgetting multiple objects in the pool easier --- src/Pool.php | 6 +----- src/PoolInterface.php | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index 61f01e8..d14d9d1 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -287,15 +287,11 @@ public function remember(EntityInterface $object): void throw new InvalidArgumentException('Object needs to be saved in the database to be remembered'); } } - public function forget(string $type, int $id): void + public function forget(string $type, int ...$ids_to_forget): void { $this->requireRegisteredType($type); - $ids_to_forget = (array) $id; - foreach ($ids_to_forget as $id_to_forget) { - $id_to_forget = (int) $id_to_forget; - if ($id_to_forget < 1) { throw new InvalidArgumentException('ID is expected to be a number larger than 0'); } diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 7c59d4d..03b3c3a 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -31,7 +31,7 @@ public function mustGetById(string $type, int $id, bool $use_cache = true): Enti public function reload(string $type, int $id): ?EntityInterface; public function isInPool(string $type, int $id): bool; public function remember(EntityInterface $object): void; - public function forget(string $type, int $id): void; + public function forget(string $type, int ...$ids_to_forget): void; /** * Return number of records of the given type that match the given conditions. From b2b0fc96372c81267e7e2f4d3599642b4a2c9215 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 10 Dec 2021 12:34:50 +0100 Subject: [PATCH 18/61] Rename getters that can cause issues with associations --- src/Entity/Entity.php | 56 +++++++++++-------- src/Entity/EntityInterface.php | 19 ++++--- src/Pool.php | 4 +- src/Producer.php | 4 +- test/src/EntityCopyTest.php | 4 +- test/src/EntityIsTest.php | 6 +- .../CustomObject/CustomObjectPool.php | 5 +- .../StatSnapshots/Base/StatsSnapshot.php | 6 +- test/src/Fixtures/Users/Base/User.php | 4 +- test/src/Fixtures/Writers/BaseWriter.php | 4 +- test/src/GeneratedFieldsTest.php | 4 +- 11 files changed, 64 insertions(+), 52 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 356806d..751f01f 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -77,24 +77,22 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface /** * Table fields that are managed by this entity. - * - * @var array */ - protected $fields = []; + protected $entity_fields = []; /** * Generated fields that are loaded, but not managed by the entity. * * @var array */ - protected $generated_fields = []; + protected $generated_entity_fields = []; /** * List of default field values. * * @var array */ - protected $default_field_values = []; + protected $default_entity_field_values = []; public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) { @@ -201,8 +199,8 @@ public function is($object) if ($this->isLoaded()) { return $object->isLoaded() && get_class($this) == get_class($object) && $this->getId() == $object->getId(); } else { - foreach ($this->getFields() as $field_name) { - if (!$object->fieldExists($field_name) || + foreach ($this->getEntityFields() as $field_name) { + if (!$object->entityFieldExists($field_name) || !$this->areFieldValuesSame( $this->getFieldValue($field_name), $object->getFieldValue($field_name) @@ -276,7 +274,7 @@ public function loadFromRow(array $row) foreach ($row as $k => $v) { if ($this->isGeneratedField($k)) { $found_generated_fields[] = $k; - } elseif ($this->fieldExists($k)) { + } elseif ($this->entityFieldExists($k)) { $this->setFieldValue($k, $v); } } @@ -313,7 +311,7 @@ public function &save() // --------------------------------------------------- if ($this->isNew()) { - foreach ($this->default_field_values as $field_name => $field_value) { + foreach ($this->default_entity_field_values as $field_name => $field_value) { if (empty($this->values[$field_name]) && !array_key_exists($field_name, $this->values)) { $this->setFieldValue($field_name, $field_value); } @@ -335,7 +333,7 @@ public function &save() $values_to_validate = $this->values; - foreach ($this->fields as $field_name) { + foreach ($this->entity_fields as $field_name) { if (empty($values_to_validate[$field_name]) && !array_key_exists($field_name, $values_to_validate)) { $values_to_validate[$field_name] = null; } @@ -407,7 +405,7 @@ public function copy($save = false) /** @var EntityInterface $copy */ $copy = new $object_class($this->connection, $this->pool, $this->logger); - foreach ($this->getFields() as $field) { + foreach ($this->getEntityFields() as $field) { if ($this->isPrimaryKey($field)) { continue; } @@ -627,19 +625,29 @@ public function isPrimaryKey($field) } /** - * {@inheritdoc} + * @deprecated Use getEntityFields() instead. */ public function getFields() { - return $this->fields; + return $this->getEntityFields(); + } + + public function getEntityFields(): array + { + return $this->entity_fields; } /** - * {@inheritdoc} + * @deprecated Use entityFieldExists() instead. */ public function fieldExists($field) { - return in_array($field, $this->fields) || in_array($field, $this->generated_fields); + return $this->entityFieldExists($field); + } + + public function entityFieldExists(string $entity_field): bool + { + return in_array($entity_field, $this->entity_fields) || in_array($entity_field, $this->generated_entity_fields); } /** @@ -647,7 +655,7 @@ public function fieldExists($field) */ public function getGeneratedFields() { - return $this->generated_fields; + return $this->generated_entity_fields; } /** @@ -655,7 +663,7 @@ public function getGeneratedFields() */ public function generatedFieldExists($field) { - return in_array($field, $this->generated_fields); + return in_array($field, $this->generated_entity_fields); } /** @@ -698,10 +706,10 @@ protected function &setGeneratedFieldsValueCaster(ValueCasterInterface $value_ca public function getFieldValue($field, $default = null) { if (empty($this->values[$field]) && !array_key_exists($field, $this->values)) { - return empty($this->default_field_values[$field]) - && !array_key_exists($field, $this->default_field_values) ? + return empty($this->default_entity_field_values[$field]) + && !array_key_exists($field, $this->default_entity_field_values) ? $default : - $this->default_field_values[$field]; + $this->default_entity_field_values[$field]; } else { return $this->values[$field]; } @@ -742,12 +750,12 @@ public function getOldFieldValue($field) */ public function &setFieldValue($field, $value) { - if ($this->fieldExists($field)) { + if ($this->entityFieldExists($field)) { if ($field === 'id') { $value = $value === null ? null : (int) $value; } - if ($value === null && array_key_exists($field, $this->default_field_values)) { + if ($value === null && array_key_exists($field, $this->default_entity_field_values)) { throw new InvalidArgumentException("Value of '$field' can't be null"); } @@ -925,10 +933,10 @@ private function refreshGeneratedFieldValues($id) { $result = []; - if (!empty($this->generated_fields)) { + if (!empty($this->generated_entity_fields)) { $result = $this->connection->selectFirstRow( $this->getTableName(), - $this->generated_fields, + $this->generated_entity_fields, $this->getWherePartById($id) ); diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index 90c714d..b0d2a07 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -155,20 +155,25 @@ public function getModifiedAttributes(); public function isModifiedAttribute($attribute); /** - * Return a list of fields that are managed by this entity. - * - * @return array + * @deprecated Use getEntityFields() instead. */ public function getFields(); /** - * Return true if $field exists (both generated and non-generated fields are checked). - * - * @param string $field Field name - * @return bool + * Return a list of fields that are managed by this entity. + */ + public function getEntityFields(): array; + + /** + * @deprecated Use entityFieldExists() instead. */ public function fieldExists($field); + /** + * Return true if $field exists (both generated and non-generated fields are checked). + */ + public function entityFieldExists(string $entity_field): bool; + /** * Return a list of fields that this entity is aware of, but does not manage. * diff --git a/src/Pool.php b/src/Pool.php index d14d9d1..22e3c88 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -625,8 +625,8 @@ public function registerType(string ...$types): PoolInterface $this->types[$type] = [ 'table_name' => $default_properties['table_name'], - 'fields' => $default_properties['fields'], - 'generated_fields' => $default_properties['generated_fields'], + 'fields' => $default_properties['entity_fields'], + 'generated_fields' => $default_properties['generated_entity_fields'], 'order_by' => $default_properties['order_by'], ]; } else { diff --git a/src/Producer.php b/src/Producer.php index 75d801d..57ec75c 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -40,7 +40,7 @@ public function produce($type, array $attributes = null, $save = true): EntityIn if ($attributes) { foreach ($attributes as $k => $v) { - if ($object->fieldExists($k)) { + if ($object->entityFieldExists($k)) { $object->setFieldValue($k, $v); } else { $object->setAttribute($k, $v); @@ -59,7 +59,7 @@ public function modify(EntityInterface &$instance, array $attributes = null, $sa { if ($attributes) { foreach ($attributes as $k => $v) { - if ($instance->fieldExists($k)) { + if ($instance->entityFieldExists($k)) { $instance->setFieldValue($k, $v); } else { $instance->setAttribute($k, $v); diff --git a/test/src/EntityCopyTest.php b/test/src/EntityCopyTest.php index b4dea55..33016a5 100644 --- a/test/src/EntityCopyTest.php +++ b/test/src/EntityCopyTest.php @@ -43,7 +43,7 @@ public function testCopyWithSave() $this->assertTrue($writer_copy->isLoaded()); $this->assertNotEquals($this->writer->getId(), $writer_copy->getId()); - foreach ($writer_copy->getFields() as $field) { + foreach ($writer_copy->getEntityFields() as $field) { if ($writer_copy->isPrimaryKey($field)) { continue; } @@ -67,7 +67,7 @@ public function testCopyWithoutSave() $this->assertFalse($writer_copy->isLoaded()); $this->assertEmpty($writer_copy->getId()); - foreach ($writer_copy->getFields() as $field) { + foreach ($writer_copy->getEntityFields() as $field) { if ($writer_copy->isPrimaryKey($field)) { continue; } diff --git a/test/src/EntityIsTest.php b/test/src/EntityIsTest.php index 4738a3d..a65f98b 100644 --- a/test/src/EntityIsTest.php +++ b/test/src/EntityIsTest.php @@ -42,7 +42,7 @@ public function testFailWhenNotAllFieldsAreTheSame() { $field_values = []; - foreach ($this->writer->getFields() as $field_name) { + foreach ($this->writer->getEntityFields() as $field_name) { $field_values[$field_name] = $this->writer->getFieldValue($field_name); } @@ -57,7 +57,7 @@ public function testPassWhenAllFieldsAreTheSame() { $writer_field_values = []; - foreach ($this->writer->getFields() as $field_name) { + foreach ($this->writer->getEntityFields() as $field_name) { $writer_field_values[$field_name] = $this->writer->getFieldValue($field_name); } @@ -65,7 +65,7 @@ public function testPassWhenAllFieldsAreTheSame() $new_writer_field_values = []; - foreach ($new_writer->getFields() as $field_name) { + foreach ($new_writer->getEntityFields() as $field_name) { $new_writer_field_values[$field_name] = $new_writer->getFieldValue($field_name); } diff --git a/test/src/Fixtures/CustomObject/CustomObjectPool.php b/test/src/Fixtures/CustomObject/CustomObjectPool.php index 83f7fa6..7212bf0 100644 --- a/test/src/Fixtures/CustomObject/CustomObjectPool.php +++ b/test/src/Fixtures/CustomObject/CustomObjectPool.php @@ -6,13 +6,12 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\CustomObject; use ActiveCollab\DatabaseObject\Pool; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\CustomObject - */ class CustomObjectPool extends Pool { } diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index 2f4fc06..d77a285 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -30,21 +30,21 @@ abstract class StatsSnapshot extends Entity * * @var array */ - protected $fields = ['id', 'account_id', 'day', 'stats']; + protected $entity_fields = ['id', 'account_id', 'day', 'stats']; /** * Generated fields that are loaded, but not managed by the entity. * * @var array */ - protected $generated_fields = ['is_used_on_day', 'plan_name', 'number_of_users']; + protected $generated_entity_fields = ['is_used_on_day', 'plan_name', 'number_of_users']; /** * List of default field values. * * @var array */ - protected $default_field_values = []; + protected $default_entity_field_values = []; /** * {@inheritdoc} diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index ffc2bae..d7a4904 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -28,14 +28,14 @@ abstract class User extends Entity * * @var array */ - protected $fields = ['id', 'type', 'first_name', 'last_name', 'email', 'homepage_url', 'password']; + protected $entity_fields = ['id', 'type', 'first_name', 'last_name', 'email', 'homepage_url', 'password']; /** * List of default field values. * * @var array */ - protected $default_field_values = [ + protected $default_entity_field_values = [ 'type' => 'ActiveCollab\DatabaseObject\Test\Fixtures\Users\User', 'first_name' => '', 'last_name' => '', diff --git a/test/src/Fixtures/Writers/BaseWriter.php b/test/src/Fixtures/Writers/BaseWriter.php index 5fe71a4..52809e5 100644 --- a/test/src/Fixtures/Writers/BaseWriter.php +++ b/test/src/Fixtures/Writers/BaseWriter.php @@ -30,14 +30,14 @@ abstract class BaseWriter extends Entity implements EntityInterface * * @var array */ - protected $fields = ['id', 'name', 'birthday', 'created_at', 'updated_at']; + protected $entity_fields = ['id', 'name', 'birthday', 'created_at', 'updated_at']; /** * List of default field values. * * @var array */ - protected $default_field_values = ['name' => 'Unknown Writer']; + protected $default_entity_field_values = ['name' => 'Unknown Writer']; /** * Name of AI field (if any). diff --git a/test/src/GeneratedFieldsTest.php b/test/src/GeneratedFieldsTest.php index e5b0a9d..43384a3 100644 --- a/test/src/GeneratedFieldsTest.php +++ b/test/src/GeneratedFieldsTest.php @@ -65,8 +65,8 @@ public function testFieldsVsGeneratedFieldsChecks() { $snapshot = $this->produceSnapshot(); - $this->assertTrue($snapshot->fieldExists('account_id')); - $this->assertTrue($snapshot->fieldExists('is_used_on_day')); + $this->assertTrue($snapshot->entityFieldExists('account_id')); + $this->assertTrue($snapshot->entityFieldExists('is_used_on_day')); $this->assertFalse($snapshot->generatedFieldExists('account_id')); $this->assertTrue($snapshot->generatedFieldExists('is_used_on_day')); From d733d96517869eae297fbcbe586f09d86ccd406a Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 11 Dec 2021 18:34:17 +0100 Subject: [PATCH 19/61] Add only one validator, work in progress --- composer.json | 2 +- composer.lock | 1845 +++++++++++++++++++++-------- src/Validator.php | 219 ++-- src/ValidatorInterface.php | 60 +- test/src/OnlyOneValidatorTest.php | 40 + test/src/UniqueValidatorTest.php | 12 +- test/src/UrlValidatorTest.php | 3 - 7 files changed, 1554 insertions(+), 627 deletions(-) create mode 100644 test/src/OnlyOneValidatorTest.php diff --git a/composer.json b/composer.json index fb8660a..98eba2a 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=7.3", + "php": ">=8.0", "activecollab/databaseconnection": "^3.0||^4.0", "activecollab/etag": "^1.0", "activecollab/object": "^1.0", diff --git a/composer.lock b/composer.lock index 9e4c385..8b1e8df 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": "c6e16b94bf049f08558b0e7587d1c5e8", + "content-hash": "9354d67e92268040ff0fdefa7b7fd695", "packages": [ { "name": "activecollab/containeraccess", @@ -51,6 +51,10 @@ "ioc", "service-container" ], + "support": { + "issues": "https://github.com/activecollab/containeraccess/issues", + "source": "https://github.com/activecollab/containeraccess/tree/2.0.0" + }, "time": "2019-12-21T13:14:15+00:00" }, { @@ -103,6 +107,10 @@ "activecollab", "mysql" ], + "support": { + "issues": "https://github.com/activecollab/databaseconnection/issues", + "source": "https://github.com/activecollab/databaseconnection/tree/4.0.0" + }, "time": "2019-12-21T13:48:35+00:00" }, { @@ -152,6 +160,10 @@ "date", "datetime" ], + "support": { + "issues": "https://github.com/activecollab/datevalue/issues", + "source": "https://github.com/activecollab/datevalue/tree/2.0.0" + }, "time": "2019-06-23T16:19:52+00:00" }, { @@ -197,6 +209,10 @@ "Etag", "activecollab" ], + "support": { + "issues": "https://github.com/activecollab/etag/issues", + "source": "https://github.com/activecollab/etag/tree/master" + }, "time": "2015-11-09T09:18:16+00:00" }, { @@ -242,37 +258,46 @@ "keywords": [ "activecollab" ], + "support": { + "issues": "https://github.com/activecollab/object/issues", + "source": "https://github.com/activecollab/object/tree/1.0.0" + }, "time": "2016-07-14T19:59:07+00:00" }, { "name": "doctrine/inflector", - "version": "1.3.1", + "version": "1.4.4", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1" + "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1", - "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", + "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.2" + "doctrine/coding-standard": "^8.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector", + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -301,41 +326,70 @@ "email": "schmittjoh@gmail.com" } ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", "keywords": [ "inflection", - "pluralize", - "singularize", - "string" + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" ], - "time": "2019-10-30T19:59:35+00:00" + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/1.4.4" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2021-04-16T17:34:40+00:00" }, { "name": "nesbot/carbon", - "version": "2.28.0", + "version": "2.55.2", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "e2bcbcd43e67ee6101d321d5de916251d2870ca8" + "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e2bcbcd43e67ee6101d321d5de916251d2870ca8", - "reference": "e2bcbcd43e67ee6101d321d5de916251d2870ca8", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2", + "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", - "symfony/translation": "^3.4 || ^4.0 || ^5.0" + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php80": "^1.16", + "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", - "kylekatarnls/multi-tester": "^1.1", - "phpmd/phpmd": "dev-php-7.1-compatibility", - "phpstan/phpstan": "^0.11", - "phpunit/phpunit": "^7.5 || ^8.0", + "doctrine/dbal": "^2.0 || ^3.0", + "doctrine/orm": "^2.7", + "friendsofphp/php-cs-fixer": "^3.0", + "kylekatarnls/multi-tester": "^2.0", + "phpmd/phpmd": "^2.9", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^0.12.54", + "phpunit/phpunit": "^7.5.20 || ^8.5.14", "squizlabs/php_codesniffer": "^3.4" }, "bin": [ @@ -344,12 +398,18 @@ "type": "library", "extra": { "branch-alias": { + "dev-3.x": "3.x-dev", "dev-master": "2.x-dev" }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -365,45 +425,55 @@ { "name": "Brian Nesbitt", "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" + "homepage": "https://markido.com" }, { "name": "kylekatarnls", - "homepage": "http://github.com/kylekatarnls" + "homepage": "https://github.com/kylekatarnls" } ], "description": "An API extension for DateTime that supports 281 different languages.", - "homepage": "http://carbon.nesbot.com", + "homepage": "https://carbon.nesbot.com", "keywords": [ "date", "datetime", "time" ], - "time": "2019-12-16T16:30:25+00:00" + "support": { + "docs": "https://carbon.nesbot.com/docs", + "issues": "https://github.com/briannesbitt/Carbon/issues", + "source": "https://github.com/briannesbitt/Carbon" + }, + "funding": [ + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2021-12-03T14:59:52+00:00" }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -416,7 +486,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -428,20 +498,24 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/log", - "version": "1.1.2", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -465,7 +539,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -475,24 +549,27 @@ "psr", "psr-3" ], - "time": "2019-11-01T11:05:21+00:00" + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.23.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", + "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-mbstring": "For best performance" @@ -500,7 +577,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -534,47 +615,150 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T12:26:48+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.23.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", + "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-07-28T13:41:28+00:00" }, { "name": "symfony/translation", - "version": "v5.0.2", + "version": "v6.0.1", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "3ae6fad7a3dc2d99a023f9360184628fc44acbb3" + "reference": "b7956e00c6e03546f2ba489fc50f7c47933e76b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/3ae6fad7a3dc2d99a023f9360184628fc44acbb3", - "reference": "3ae6fad7a3dc2d99a023f9360184628fc44acbb3", + "url": "https://api.github.com/repos/symfony/translation/zipball/b7956e00c6e03546f2ba489fc50f7c47933e76b8", + "reference": "b7956e00c6e03546f2ba489fc50f7c47933e76b8", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": ">=8.0.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2" + "symfony/translation-contracts": "^2.3|^3.0" }, "conflict": { - "symfony/config": "<4.4", - "symfony/dependency-injection": "<5.0", - "symfony/http-kernel": "<5.0", - "symfony/twig-bundle": "<5.0", - "symfony/yaml": "<4.4" + "symfony/config": "<5.4", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/twig-bundle": "<5.4", + "symfony/yaml": "<5.4" }, "provide": { - "symfony/translation-implementation": "2.0" + "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/console": "^4.4|^5.0", - "symfony/dependency-injection": "^5.0", - "symfony/finder": "^4.4|^5.0", - "symfony/http-kernel": "^5.0", - "symfony/intl": "^4.4|^5.0", - "symfony/service-contracts": "^1.1.2|^2", - "symfony/yaml": "^4.4|^5.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -582,12 +766,10 @@ "symfony/yaml": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { + "files": [ + "Resources/functions.php" + ], "psr-4": { "Symfony\\Component\\Translation\\": "" }, @@ -609,26 +791,43 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Translation Component", + "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", - "time": "2019-12-12T13:03:32+00:00" + "support": { + "source": "https://github.com/symfony/translation/tree/v6.0.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-12-08T15:13:44+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.0.1", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed" + "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8cc682ac458d75557203b2f2f14b0b92e1c744ed", - "reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", + "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=8.0.2" }, "suggest": { "symfony/translation-implementation": "" @@ -636,7 +835,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -668,40 +871,58 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-07T12:43:40+00:00" } ], "packages-dev": [ { - "name": "composer/semver", - "version": "1.5.0", + "name": "composer/pcre", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e" + "url": "https://github.com/composer/pcre.git", + "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/46d9139568ccb8d9e7cdd4539cab7347568a5e2e", - "reference": "46d9139568ccb8d9e7cdd4539cab7347568a5e2e", + "url": "https://api.github.com/repos/composer/pcre/zipball/3d322d715c43a1ac36c7fe215fa59336265500f2", + "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + "phpstan/phpstan": "^1", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-main": "1.x-dev" } }, "autoload": { "psr-4": { - "Composer\\Semver\\": "src" + "Composer\\Pcre\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -709,56 +930,69 @@ "MIT" ], "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" } ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", "keywords": [ - "semantic", - "semver", - "validation", - "versioning" + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/1.0.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], - "time": "2019-03-19T17:25:45+00:00" + "time": "2021-12-06T15:17:27+00:00" }, { - "name": "composer/xdebug-handler", - "version": "1.4.0", + "name": "composer/semver", + "version": "3.2.6", "source": { "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "cbe23383749496fe0f373345208b79568e4bc248" + "url": "https://github.com/composer/semver.git", + "reference": "83e511e247de329283478496f7a1e114c9517506" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", - "reference": "cbe23383749496fe0f373345208b79568e4bc248", + "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", + "reference": "83e511e247de329283478496f7a1e114c9517506", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "phpstan/phpstan": "^0.12.54", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { "psr-4": { - "Composer\\XdebugHandler\\": "src" + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -767,45 +1001,143 @@ ], "authors": [ { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "Restarts a process without Xdebug.", + "description": "Semver library that offers utilities, version constraint parsing and validation.", "keywords": [ - "Xdebug", - "performance" + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.2.6" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-10-25T11:34:17+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6555461e76962fd0379c444c46fd558a0fcfb65e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6555461e76962fd0379c444c46fd558a0fcfb65e", + "reference": "6555461e76962fd0379c444c46fd558a0fcfb65e", + "shasum": "" + }, + "require": { + "composer/pcre": "^1", + "php": "^5.3.2 || ^7.0 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/2.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } ], - "time": "2019-11-06T16:40:04+00:00" + "time": "2021-12-08T13:07:32+00:00" }, { "name": "doctrine/annotations", - "version": "v1.8.0", + "version": "1.13.2", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", - "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^7.1" + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5" + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" @@ -838,13 +1170,17 @@ } ], "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", "keywords": [ "annotations", "docblock", "parser" ], - "time": "2019-10-01T18:55:10+00:00" + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.13.2" + }, + "time": "2021-08-05T19:00:23+00:00" }, { "name": "doctrine/instantiator", @@ -917,20 +1253,20 @@ }, { "name": "doctrine/lexer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6" + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", - "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.2 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^6.0", @@ -975,31 +1311,49 @@ "parser", "php" ], - "time": "2019-10-30T14:39:59+00:00" + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2020-05-25T17:44:05+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.16.1", + "version": "v2.19.3", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", - "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8", "shasum": "" }, "require": { - "composer/semver": "^1.4", - "composer/xdebug-handler": "^1.2", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.2 || ^2.0", "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", - "php": "^5.6 || ^7.0", + "php": "^5.6 || ^7.0 || ^8.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", "symfony/finder": "^3.0 || ^4.0 || ^5.0", @@ -1010,21 +1364,24 @@ "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.2", + "keradus/cli-executor": "^1.4", "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.1", + "php-coveralls/php-coveralls": "^2.4.2", "php-cs-fixer/accessible-object": "^1.0", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", - "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3 || ^5.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy-phpunit": "^1.1 || ^2.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpunitgoodpractices/polyfill": "^1.5", + "phpunitgoodpractices/traits": "^1.9.1", + "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", + "symfony/phpunit-bridge": "^5.2.1", "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters.", "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." @@ -1033,6 +1390,11 @@ "php-cs-fixer" ], "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.19-dev" + } + }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -1046,6 +1408,8 @@ "tests/Test/IntegrationCaseFactory.php", "tests/Test/IntegrationCaseFactoryInterface.php", "tests/Test/InternalIntegrationCaseFactory.php", + "tests/Test/IsIdenticalConstraint.php", + "tests/Test/TokensWithObservedTransformers.php", "tests/TestCase.php" ] }, @@ -1064,20 +1428,30 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-11-25T22:10:32+00:00" + "support": { + "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.19.3" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2021-11-15T17:17:55+00:00" }, { "name": "monolog/monolog", - "version": "1.25.3", + "version": "1.26.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1" + "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fa82921994db851a8becaf3787a9e73c5976b6f1", - "reference": "fa82921994db851a8becaf3787a9e73c5976b6f1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5", + "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5", "shasum": "" }, "require": { @@ -1091,11 +1465,10 @@ "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", + "phpstan/phpstan": "^0.12.59", "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", "ruflin/elastica": ">=0.90 <3.0", "sentry/sentry": "^0.13", "swiftmailer/swiftmailer": "^5.3|^6.0" @@ -1114,11 +1487,6 @@ "sentry/sentry": "Allow sending log messages to a Sentry server" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { "Monolog\\": "src/Monolog" @@ -1142,7 +1510,21 @@ "logging", "psr-3" ], - "time": "2019-12-20T14:15:16+00:00" + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/1.26.1" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2021-05-28T08:32:12+00:00" }, { "name": "myclabs/deep-copy", @@ -1204,16 +1586,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.12.0", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -1254,54 +1636,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" - }, - "time": "2021-07-21T10:44:31+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v9.99.99", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", - "shasum": "" - }, - "require": { - "php": "^7" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*", - "vimeo/psalm": "^1" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "polyfill", - "pseudorandom", - "random" - ], - "time": "2018-07-02T15:55:56+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phar-io/manifest", @@ -1416,23 +1753,23 @@ }, { "name": "php-cs-fixer/diff", - "version": "v1.3.0", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", - "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", + "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^5.6 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0", "symfony/process": "^3.3" }, "type": "library", @@ -1446,14 +1783,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, { "name": "SpacePossum" } @@ -1463,7 +1800,11 @@ "keywords": [ "diff" ], - "time": "2018-02-15T16:58:55+00:00" + "support": { + "issues": "https://github.com/PHP-CS-Fixer/diff/issues", + "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" + }, + "time": "2020-10-14T08:39:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1520,16 +1861,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -1540,7 +1881,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1570,22 +1912,22 @@ "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" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -1593,7 +1935,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -1619,39 +1962,39 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" }, - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-10-02T14:08:47+00:00" }, { "name": "phpspec/prophecy", - "version": "1.13.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea", - "reference": "be1996ed8adc35c3fd795488a653f4b518be70ea", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "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": { @@ -1686,29 +2029,29 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.13.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-03-17T13:42:18+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.6", + "version": "9.2.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f6293e1b30a2354e8428e004689671b83871edde" + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f6293e1b30a2354e8428e004689671b83871edde", - "reference": "f6293e1b30a2354e8428e004689671b83871edde", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", + "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", + "nikic/php-parser": "^4.13.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1757,7 +2100,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.6" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" }, "funding": [ { @@ -1765,20 +2108,20 @@ "type": "github" } ], - "time": "2021-03-28T07:26:59+00:00" + "time": "2021-12-05T09:12:13+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "3.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", "shasum": "" }, "require": { @@ -1817,7 +2160,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" }, "funding": [ { @@ -1825,7 +2168,7 @@ "type": "github" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2021-12-02T12:48:52+00:00" }, { "name": "phpunit/php-invoker", @@ -2010,16 +2353,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.8", + "version": "9.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb" + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/191768ccd5c85513b4068bdbe99bb6390c7d54fb", - "reference": "191768ccd5c85513b4068bdbe99bb6390c7d54fb", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", "shasum": "" }, "require": { @@ -2035,7 +2378,7 @@ "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", @@ -2097,7 +2440,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" }, "funding": [ { @@ -2109,7 +2452,7 @@ "type": "github" } ], - "time": "2021-07-31T15:17:34+00:00" + "time": "2021-09-25T07:38:51+00:00" }, { "name": "pimple/pimple", @@ -2155,8 +2498,61 @@ "container", "dependency injection" ], + "support": { + "issues": "https://github.com/silexphp/Pimple/issues", + "source": "https://github.com/silexphp/Pimple/tree/master" + }, "time": "2015-09-11T15:10:35+00:00" }, + { + "name": "psr/cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/3.0.0" + }, + "time": "2021-02-03T23:26:27+00:00" + }, { "name": "psr/event-dispatcher", "version": "1.0.0", @@ -2201,6 +2597,10 @@ "psr", "psr-14" ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, "time": "2019-01-08T18:20:26+00:00" }, { @@ -2632,16 +3032,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", "shasum": "" }, "require": { @@ -2690,14 +3090,14 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" }, "funding": [ { @@ -2705,7 +3105,7 @@ "type": "github" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2021-11-11T14:18:36+00:00" }, { "name": "sebastian/global-state", @@ -3169,41 +3569,46 @@ }, { "name": "symfony/console", - "version": "v5.0.2", + "version": "v5.4.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47" + "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fe6e3cd889ca64172d7a742a2eb058541404ef47", - "reference": "fe6e3cd889ca64172d7a742a2eb058541404ef47", + "url": "https://api.github.com/repos/symfony/console/zipball/9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", + "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1|^2" + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" }, "conflict": { + "psr/log": ">=3", "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", "symfony/event-dispatcher": "<4.4", "symfony/lock": "<4.4", "symfony/process": "<4.4" }, "provide": { - "psr/log-implementation": "1.0" + "psr/log-implementation": "1.0|2.0" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -3212,11 +3617,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -3239,60 +3639,63 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Console Component", + "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", - "time": "2019-12-17T13:20:22+00:00" + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-12-09T11:22:43+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v5.0.2", + "name": "symfony/deprecation-contracts", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7b738a51645e10f864cc25c24d232fb03f37b475" + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7b738a51645e10f864cc25c24d232fb03f37b475", - "reference": "7b738a51645e10f864cc25c24d232fb03f37b475", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/event-dispatcher-contracts": "^2" - }, - "conflict": { - "symfony/dependency-injection": "<4.4" - }, - "provide": { - "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/expression-language": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^4.4|^5.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "3.0-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "function.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -3301,34 +3704,136 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" - }, - { - "name": "symfony/event-dispatcher-contracts", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "af23c2584d4577d54661c434446fb8fbed6025dd" + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-01T23:48:49+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v5.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", + "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", + "symfony/polyfill-php80": "^1.16" + }, + "conflict": { + "symfony/dependency-injection": "<4.4" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-23T10:19:22+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "aa5422287b75594b90ee9cd807caf8f0df491385" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/af23c2584d4577d54661c434446fb8fbed6025dd", - "reference": "af23c2584d4577d54661c434446fb8fbed6025dd", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/aa5422287b75594b90ee9cd807caf8f0df491385", + "reference": "aa5422287b75594b90ee9cd807caf8f0df491385", "shasum": "" }, "require": { - "php": "^7.2.5", + "php": ">=8.0.2", "psr/event-dispatcher": "^1" }, "suggest": { @@ -3337,7 +3842,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3369,32 +3878,46 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-07-15T12:33:35+00:00" }, { "name": "symfony/filesystem", - "version": "v5.0.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6" + "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/1d71f670bc5a07b9ccc97dc44f932177a322d4e6", - "reference": "1d71f670bc5a07b9ccc97dc44f932177a322d4e6", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/731f917dc31edcffec2c6a777f3698c33bea8f01", + "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/polyfill-ctype": "~1.8" + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -3417,33 +3940,47 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", - "time": "2019-11-26T23:25:11+00:00" + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-28T13:39:27+00:00" }, { "name": "symfony/finder", - "version": "v5.0.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "17874dd8ab9a19422028ad56172fb294287a701b" + "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/17874dd8ab9a19422028ad56172fb294287a701b", - "reference": "17874dd8ab9a19422028ad56172fb294287a701b", + "url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590", + "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" @@ -3466,33 +4003,48 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/finder/tree/v5.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-28T15:25:38+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.0.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68" + "reference": "b0fb78576487af19c500aaddb269fd36701d4847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", - "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b0fb78576487af19c500aaddb269fd36701d4847", + "reference": "b0fb78576487af19c500aaddb269fd36701d4847", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-php73": "~1.0", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\OptionsResolver\\": "" @@ -3515,14 +4067,31 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony OptionsResolver Component", + "description": "Provides an improved replacement for the array_replace PHP function", "homepage": "https://symfony.com", "keywords": [ "config", "configuration", "options" ], - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v5.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-23T10:19:22+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3604,32 +4173,119 @@ "time": "2021-02-19T12:13:01+00:00" }, { - "name": "symfony/polyfill-php70", - "version": "v1.13.1", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.23.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "af23c7bb26a73b850840823662dda371484926c4" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", - "reference": "af23c7bb26a73b850840823662dda371484926c4", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", + "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0|~9.99", - "php": ">=5.3.3" + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T12:26:48+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.23.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", + "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, "files": [ "bootstrap.php" @@ -3652,6 +4308,76 @@ "homepage": "https://symfony.com/contributors" } ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "metapackage", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ @@ -3660,29 +4386,50 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T14:02:19+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.13.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", + "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3715,29 +4462,50 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-05-27T09:17:38+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.13.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", + "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3773,31 +4541,44 @@ "portable", "shim" ], - "time": "2019-11-27T16:25:15+00:00" + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" }, { "name": "symfony/process", - "version": "v5.0.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e" + "reference": "5be20b3830f726e019162b26223110c8f47cf274" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", - "reference": "ea2dc31b59d63abd9bc2356ac72eb7b3f3469f0e", + "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274", + "reference": "5be20b3830f726e019162b26223110c8f47cf274", "shasum": "" }, "require": { - "php": "^7.2.5" + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" @@ -3820,27 +4601,47 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Process Component", + "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", - "time": "2019-12-10T11:06:55+00:00" + "support": { + "source": "https://github.com/symfony/process/tree/v5.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-28T15:25:38+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.0.1", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "144c5e51266b281231e947b51223ba14acf1a749" + "reference": "d664541b99d6fb0247ec5ff32e87238582236204" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", - "reference": "144c5e51266b281231e947b51223ba14acf1a749", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d664541b99d6fb0247ec5ff32e87238582236204", + "reference": "d664541b99d6fb0247ec5ff32e87238582236204", "shasum": "" }, "require": { - "php": "^7.2.5", - "psr/container": "^1.0" + "php": ">=7.2.5", + "psr/container": "^1.1" + }, + "conflict": { + "ext-psr": "<1.1|>=2" }, "suggest": { "symfony/service-implementation": "" @@ -3848,7 +4649,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -3880,32 +4685,44 @@ "interoperability", "standards" ], - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.4.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-04T16:37:19+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.0.2", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "d410282956706e0b08681a5527447a8e6b6f421e" + "reference": "208ef96122bfed82a8f3a61458a07113a08bdcfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d410282956706e0b08681a5527447a8e6b6f421e", - "reference": "d410282956706e0b08681a5527447a8e6b6f421e", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/208ef96122bfed82a8f3a61458a07113a08bdcfe", + "reference": "208ef96122bfed82a8f3a61458a07113a08bdcfe", "shasum": "" }, "require": { - "php": "^7.2.5", - "symfony/service-contracts": "^1.0|^2" + "php": ">=7.2.5", + "symfony/service-contracts": "^1|^2|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" @@ -3928,9 +4745,111 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Stopwatch Component", + "description": "Provides a way to profile code", "homepage": "https://symfony.com", - "time": "2019-11-18T17:27:11+00:00" + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v5.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-23T10:19:22+00:00" + }, + { + "name": "symfony/string", + "version": "v6.0.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "0cfed595758ec6e0a25591bdc8ca733c1896af32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/0cfed595758ec6e0a25591bdc8ca733c1896af32", + "reference": "0cfed595758ec6e0a25591bdc8ca733c1896af32", + "shasum": "" + }, + "require": { + "php": ">=8.0.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.0" + }, + "require-dev": { + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "files": [ + "Resources/functions.php" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v6.0.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-12-08T15:13:44+00:00" }, { "name": "theseer/tokenizer", @@ -4047,7 +4966,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.3" + "php": ">=8.0" }, "platform-dev": { "ext-mysqli": "*" diff --git a/src/Validator.php b/src/Validator.php index 9e4b820..3a4c0a2 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -17,44 +17,20 @@ */ class Validator implements ValidatorInterface { - /** - * @var array - */ - private $errors = []; - - /** - * @var ConnectionInterface - */ - private $connection; - - /** - * @var string - */ - private $table_name; - - /** - * @var int|null - */ - private $object_id; - - /** - * @var int|null - */ - private $old_object_id; - - /** - * @var array - */ - private $field_values; - - /** - * @param ConnectionInterface $connection - * @param string $table_name - * @param int|null $object_id - * @param int|null $old_object_id - * @param array $field_values - */ - public function __construct(ConnectionInterface $connection, $table_name, $object_id, $old_object_id, array $field_values) + private array $errors = []; + private ConnectionInterface $connection; + private string $table_name; + private ?int $object_id; + private ?int $old_object_id; + private array $field_values; + + public function __construct( + ConnectionInterface $connection, + string $table_name, + ?int $object_id, + ?int $old_object_id, + array $field_values + ) { $this->connection = $connection; $this->table_name = $table_name; @@ -112,9 +88,6 @@ private function failPresenceValidation($field_name) return false; } - /** - * {@inheritdoc} - */ public function lowerThan($field_name, $reference_value, $allow_null = false) { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { @@ -122,9 +95,6 @@ public function lowerThan($field_name, $reference_value, $allow_null = false) }, "Value of '$field_name' is not lower than $reference_value"); } - /** - * {@inheritdoc} - */ public function lowerThanOrEquals($field_name, $reference_value, $allow_null = false) { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { @@ -132,9 +102,6 @@ public function lowerThanOrEquals($field_name, $reference_value, $allow_null = f }, "Value of '$field_name' is not lower than or equal to $reference_value"); } - /** - * {@inheritdoc} - */ public function greaterThan($field_name, $reference_value, $allow_null = false) { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { @@ -142,9 +109,6 @@ public function greaterThan($field_name, $reference_value, $allow_null = false) }, "Value of '$field_name' is not greater than $reference_value"); } - /** - * {@inheritdoc} - */ public function greaterThanOrEquals($field_name, $reference_value, $allow_null = false) { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { @@ -154,15 +118,14 @@ public function greaterThanOrEquals($field_name, $reference_value, $allow_null = /** * Validate field value by comparing it to a reference value using a closure. - * - * @param string $field_name - * @param mixed $reference_value - * @param bool $allow_null - * @param callable $compare_with - * @param string $validation_failed_message - * @return bool */ - protected function compareValues($field_name, $reference_value, $allow_null, callable $compare_with, $validation_failed_message) + protected function compareValues( + string $field_name, + mixed $reference_value, + bool $allow_null, + callable $compare_with, + string $validation_failed_message + ): bool { if (empty($field_name)) { throw new InvalidArgumentException("Value '$field_name' is not a valid field name"); @@ -189,10 +152,10 @@ protected function compareValues($field_name, $reference_value, $allow_null, cal } } - /** - * {@inheritdoc} - */ - public function inArray($field_name, array $array_of_values, $allow_null = false) + public function inArray( + string $field_name, + array $array_of_values, bool $allow_null = false + ): bool { if (empty($field_name)) { throw new InvalidArgumentException("Value '$field_name' is not a valid field name"); @@ -219,18 +182,16 @@ public function inArray($field_name, array $array_of_values, $allow_null = false } } - /** - * {@inheritdoc} - */ - public function unique($field_name, ...$context) + public function unique(string $field_name, string ...$context): bool { return $this->uniqueWhere($field_name, '', ...$context); } - /** - * {@inheritdoc} - */ - public function uniqueWhere($field_name, $where, ...$context) + public function uniqueWhere( + string $field_name, + mixed $where, + string ...$context + ): bool { if (empty($field_name)) { throw new InvalidArgumentException("Value '$field_name' is not a valid field name"); @@ -240,13 +201,15 @@ public function uniqueWhere($field_name, $where, ...$context) return true; // NULL is always good for single column keys because MySQL does not check NULL for uniqueness } - $field_names = [$field_name]; + $field_names = [ + $field_name, + ]; - if (count($context)) { + if (!empty($context)) { $field_names = array_merge($field_names, $context); } - // Check if we have existsing columns + // Check if we have existing columns. foreach ($field_names as $v) { if (!array_key_exists($v, $this->field_values)) { throw new InvalidArgumentException("Field '$v' is not known"); @@ -274,30 +237,52 @@ public function uniqueWhere($field_name, $where, ...$context) $conditions = implode(' AND ', $conditions); if (empty($this->object_id)) { - $sql = "SELECT COUNT(`id`) AS 'row_count' FROM {$table_name} WHERE {$conditions}"; + $sql = sprintf("SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE %s", $table_name, $conditions); } else { - $sql = $this->connection->prepare("SELECT COUNT(`id`) AS 'row_count' FROM $table_name WHERE ($conditions) AND (`id` != ?)", ($this->old_object_id ? $this->old_object_id : $this->object_id)); + $sql = $this->connection->prepare( + sprintf( + "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE (%s) AND (`id` != ?)", + $table_name, + $conditions + ), + $this->old_object_id ? $this->old_object_id : $this->object_id + ); } - if ($this->connection->executeFirstCell($sql) > 0) { - if (empty($context)) { - $this->addFieldError($field_name, "Value of '$field_name' needs to be unique"); - } else { - $this->addFieldError($field_name, "Value of '$field_name' needs to be unique in context of " . implode(', ', array_map(function ($field_name) { - return "'$field_name'"; - }, $context))); - } + if ($this->connection->executeFirstCell($sql) === 0) { + return true; + } + + if (empty($context)) { + $this->addFieldError( + $field_name, + sprintf("Value of '%s' needs to be unique", $field_name) + ); return false; } - return true; + $this->addFieldError( + $field_name, + sprintf( + "Value of '%s' needs to be unique in context of %s", + $field_name, + implode( + ', ', + array_map( + function ($field_name) { + return "'$field_name'"; + }, + $context + ) + ) + ) + ); + + return false; } - /** - * {@inheritdoc} - */ - public function presentAndUnique($field_name, ...$context) + public function presentAndUnique(string $field_name, string ...$context): bool { if ($this->present($field_name)) { return $this->unique($field_name, ...$context); @@ -306,10 +291,11 @@ public function presentAndUnique($field_name, ...$context) return false; } - /** - * {@inheritdoc} - */ - public function presentAndUniqueWhere($field_name, $where, ...$context) + public function presentAndUniqueWhere( + string $field_name, + mixed $where, + string ...$context + ): bool { if ($this->present($field_name)) { return $this->uniqueWhere($field_name, $where, ...$context); @@ -318,9 +304,22 @@ public function presentAndUniqueWhere($field_name, $where, ...$context) return false; } - /** - * {@inheritdoc} - */ + public function onlyOneWhere( + string $field_name, + mixed $field_value, + mixed $where, + string ...$context + ): bool + { + if (empty($field_name)) { + throw new InvalidArgumentException( + sprintf("Value '%s' is not a valid field name", $field_name) + ); + } + + return false; + } + public function email($field_name, $allow_null = false) { if (array_key_exists($field_name, $this->field_values)) { @@ -344,9 +343,6 @@ public function email($field_name, $allow_null = false) } } - /** - * {@inheritdoc} - */ public function url($field_name, $allow_null = false) { if (array_key_exists($field_name, $this->field_values)) { @@ -370,34 +366,22 @@ public function url($field_name, $allow_null = false) } } - /** - * {@inheritdoc} - */ - public function getErrors() + public function getErrors(): array { return $this->errors; } - /** - * {@inheritdoc} - */ - public function hasErrors() + public function hasErrors(): bool { return count($this->errors) > 0; } - /** - * {@inheritdoc} - */ - public function getFieldErrors($field_name) + public function getFieldErrors(string $field_name): array { - return isset($this->errors[$field_name]) ? $this->errors[$field_name] : []; + return $this->errors[$field_name] ?? []; } - /** - * {@inheritdoc} - */ - public function addFieldError($field_name, $error_message) + public function addFieldError(string $field_name, string $error_message): void { if (empty($this->errors[$field_name])) { $this->errors[$field_name] = []; @@ -406,10 +390,7 @@ public function addFieldError($field_name, $error_message) $this->errors[$field_name][] = $error_message; } - /** - * @return ValidationException - */ - public function createException() + public function createException(): ValidationException { $message = 'Validation failed'; diff --git a/src/ValidatorInterface.php b/src/ValidatorInterface.php index 00eb1b8..894d33d 100644 --- a/src/ValidatorInterface.php +++ b/src/ValidatorInterface.php @@ -55,29 +55,21 @@ public function greaterThan($field_name, $reference_value, $allow_null = false); */ public function greaterThanOrEquals($field_name, $reference_value, $allow_null = false); - /** - * @param string $field_name - * @param array $array_of_values - * @param bool|false $allow_null - * @return bool - */ - public function inArray($field_name, array $array_of_values, $allow_null = false); + public function inArray( + string $field_name, + array $array_of_values, bool $allow_null = false + ): bool; - /** - * @param string $field_name - * @param string[] $context - * @return bool - */ - public function unique($field_name, ...$context); + public function unique(string $field_name, string ...$context): bool; /** * Check if value that we are trying to save is unique in the given context. - * - * @param string $field_name - * @param array|string $where - * @param string[] $context */ - public function uniqueWhere($field_name, $where, ...$context); + public function uniqueWhere( + string $field_name, + mixed $where, + string ...$context + ): bool; /** * Field value needs to be present and unique. @@ -86,7 +78,7 @@ public function uniqueWhere($field_name, $where, ...$context); * @param string[] $context * @return bool */ - public function presentAndUnique($field_name, ...$context); + public function presentAndUnique(string $field_name, string ...$context): bool; /** * Present and unique, with the given condition. @@ -96,7 +88,11 @@ public function presentAndUnique($field_name, ...$context); * @param string[] $context * @return bool */ - public function presentAndUniqueWhere($field_name, $where, ...$context); + public function presentAndUniqueWhere( + string $field_name, + mixed $where, + string ...$context + ): bool; /** * Validate email address value. @@ -109,36 +105,22 @@ public function email($field_name, $allow_null = false); /** * Return array of validation messages, indexed by field name. - * - * @return array */ - public function getErrors(); + public function getErrors(): array; /** * Return true if there are error. - * - * @return bool */ - public function hasErrors(); + public function hasErrors(): bool; /** * Return field errors. - * - * @param string $field_name - * @return array */ - public function getFieldErrors($field_name); + public function getFieldErrors(string $field_name): array; /** * Report an error for the given field. - * - * @param string $field_name - * @param string $error_message - */ - public function addFieldError($field_name, $error_message); - - /** - * @return ValidationException */ - public function createException(); + public function addFieldError(string $field_name, string $error_message): void; + public function createException(): ValidationException; } diff --git a/test/src/OnlyOneValidatorTest.php b/test/src/OnlyOneValidatorTest.php new file mode 100644 index 0000000..7491144 --- /dev/null +++ b/test/src/OnlyOneValidatorTest.php @@ -0,0 +1,40 @@ +. All rights reserved. + */ + +declare(strict_types=1); + +namespace ActiveCollab\DatabaseObject\Test; + +use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; +use ActiveCollab\DatabaseObject\Validator; + +class OnlyOneValidatorTest extends WritersTypeTestCase +{ + public function testNewRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() + { + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Anton Chekhov', + ] + ); + + $is_only_one = $validator->onlyOneWhere('name', 'Anton Chekhov', ''); + + $this->assertTrue($is_only_one); + $this->assertFalse($validator->hasErrors()); + + $name_errors = $validator->getFieldErrors('name'); + + $this->assertIsArray($name_errors); + $this->assertCount(0, $name_errors); + } +} diff --git a/test/src/UniqueValidatorTest.php b/test/src/UniqueValidatorTest.php index bc74481..6d2d015 100644 --- a/test/src/UniqueValidatorTest.php +++ b/test/src/UniqueValidatorTest.php @@ -18,7 +18,7 @@ class UniqueValidatorTest extends WritersTypeTestCase { /** - * Test if theres no error thrown for NULL even though there are NULL records in the table. + * Test if there's no error thrown for NULL even though there are NULL records in the table. */ public function testNoErrorOnNull() { @@ -44,7 +44,15 @@ public function testNoErrorOnNull() */ public function testNewRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() { - $validator = new Validator($this->connection, 'writers', null, null, ['name' => 'Anton Chekhov']); + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Anton Chekhov', + ] + ); $is_unique = $validator->unique('name'); diff --git a/test/src/UrlValidatorTest.php b/test/src/UrlValidatorTest.php index 6dc488f..70b3e66 100644 --- a/test/src/UrlValidatorTest.php +++ b/test/src/UrlValidatorTest.php @@ -17,9 +17,6 @@ */ class UrlValidatorTest extends TestCase { - /** - * Set up test environment. - */ public function setUp(): void { parent::setUp(); From cf739a63dd923c2954b2fb575907c96f5ad9b538 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 11 Dec 2021 18:49:55 +0100 Subject: [PATCH 20/61] Refactor the way uniqueness SQL is generated --- src/Validator.php | 112 +++++++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 52 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index 3a4c0a2..e689f71 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -193,63 +193,13 @@ public function uniqueWhere( string ...$context ): bool { - if (empty($field_name)) { - throw new InvalidArgumentException("Value '$field_name' is not a valid field name"); - } + $field_names = $this->mustGetFieldNames($field_name, $context); if (empty($context) && (!array_key_exists($field_name, $this->field_values) || $this->field_values[$field_name] === null)) { return true; // NULL is always good for single column keys because MySQL does not check NULL for uniqueness } - $field_names = [ - $field_name, - ]; - - if (!empty($context)) { - $field_names = array_merge($field_names, $context); - } - - // Check if we have existing columns. - foreach ($field_names as $v) { - if (!array_key_exists($v, $this->field_values)) { - throw new InvalidArgumentException("Field '$v' is not known"); - } - } - - $table_name = $this->connection->escapeTableName($this->table_name); - - $conditions = []; - - if ($where) { - $conditions[] = $this->connection->prepareConditions($where); - } - - foreach ($field_names as $v) { - $escaped_field_name = $this->connection->escapeFieldName($v); - - if ($this->field_values[$v] === null) { - $conditions[] = "$escaped_field_name IS NULL"; - } else { - $conditions[] = $this->connection->prepare("$escaped_field_name = ?", $this->field_values[$v]); - } - } - - $conditions = implode(' AND ', $conditions); - - if (empty($this->object_id)) { - $sql = sprintf("SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE %s", $table_name, $conditions); - } else { - $sql = $this->connection->prepare( - sprintf( - "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE (%s) AND (`id` != ?)", - $table_name, - $conditions - ), - $this->old_object_id ? $this->old_object_id : $this->object_id - ); - } - - if ($this->connection->executeFirstCell($sql) === 0) { + if ($this->connection->executeFirstCell($this->prepareUniquenessValidatorSql($field_names, $where)) === 0) { return true; } @@ -282,6 +232,42 @@ function ($field_name) { return false; } + private function prepareUniquenessValidatorSql(array $field_names, mixed $where): string + { + $conditions = []; + + if ($where) { + $conditions[] = $this->connection->prepareConditions($where); + } + + foreach ($field_names as $v) { + $escaped_field_name = $this->connection->escapeFieldName($v); + + if ($this->field_values[$v] === null) { + $conditions[] = "$escaped_field_name IS NULL"; + } else { + $conditions[] = $this->connection->prepare("$escaped_field_name = ?", $this->field_values[$v]); + } + } + + if (empty($this->object_id)) { + return sprintf( + "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE %s", + $this->connection->escapeTableName($this->table_name), + implode(' AND ', $conditions) + ); + } + + return $this->connection->prepare( + sprintf( + "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE (%s) AND (`id` != ?)", + $this->connection->escapeTableName($this->table_name), + implode(' AND ', $conditions) + ), + $this->old_object_id ?? $this->object_id + ); + } + public function presentAndUnique(string $field_name, string ...$context): bool { if ($this->present($field_name)) { @@ -317,9 +303,31 @@ public function onlyOneWhere( ); } + $field_names = $this->mustGetFieldNames($field_name, $context); + return false; } + private function mustGetFieldNames(string $field_name, array $context): array + { + $result = [ + $field_name, + ]; + + if (!empty($context)) { + $result = array_merge($result, $context); + } + + // Check if we have existing columns. + foreach ($result as $v) { + if (!array_key_exists($v, $this->field_values)) { + throw new InvalidArgumentException("Field '$v' is not known"); + } + } + + return $result; + } + public function email($field_name, $allow_null = false) { if (array_key_exists($field_name, $this->field_values)) { From d016492ec9f0fb63d0f40a4cc01d8506e0d6cf09 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 11 Dec 2021 19:14:01 +0100 Subject: [PATCH 21/61] Wrap up only one validator --- src/Validator.php | 64 +++++++++++++++++---- test/src/OnlyOneValidatorTest.php | 93 +++++++++++++++++++++++++++++-- test/src/UniqueValidatorTest.php | 30 +++++++++- test/src/ValidatorTest.php | 2 +- 4 files changed, 169 insertions(+), 20 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index e689f71..12fbae2 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -206,7 +206,7 @@ public function uniqueWhere( if (empty($context)) { $this->addFieldError( $field_name, - sprintf("Value of '%s' needs to be unique", $field_name) + sprintf("Value of '%s' needs to be unique.", $field_name) ); return false; @@ -215,17 +215,9 @@ public function uniqueWhere( $this->addFieldError( $field_name, sprintf( - "Value of '%s' needs to be unique in context of %s", + "Value of '%s' needs to be unique in context of %s.", $field_name, - implode( - ', ', - array_map( - function ($field_name) { - return "'$field_name'"; - }, - $context - ) - ) + $this->implodeFieldNames($context) ) ); @@ -290,6 +282,15 @@ public function presentAndUniqueWhere( return false; } + public function onlyOne( + string $field_name, + mixed $field_value, + string ...$context + ): bool + { + return $this->onlyOneWhere($field_name, $field_value, '', ...$context); + } + public function onlyOneWhere( string $field_name, mixed $field_value, @@ -305,6 +306,34 @@ public function onlyOneWhere( $field_names = $this->mustGetFieldNames($field_name, $context); + // No need to check value if it's not the one that we're looking for. + if ($this->field_values[$field_name] !== $field_value) { + return true; + } + + if ($this->connection->executeFirstCell($this->prepareUniquenessValidatorSql($field_names, $where)) === 0) { + return true; + } + + if (empty($context)) { + $this->addFieldError( + $field_name, + sprintf("Only one record with field '%s' set to '%s' is allowed.", $field_name, $field_value) + ); + + return false; + } + + $this->addFieldError( + $field_name, + sprintf( + "Only one record with field '%s' set to '%s' is allowed in context of %s.", + $field_name, + $field_value, + $this->implodeFieldNames($context) + ) + ); + return false; } @@ -328,6 +357,19 @@ private function mustGetFieldNames(string $field_name, array $context): array return $result; } + private function implodeFieldNames(array $field_names): string + { + return implode( + ', ', + array_map( + function ($field_name) { + return "'$field_name'"; + }, + $field_names + ) + ); + } + public function email($field_name, $allow_null = false) { if (array_key_exists($field_name, $this->field_values)) { diff --git a/test/src/OnlyOneValidatorTest.php b/test/src/OnlyOneValidatorTest.php index 7491144..65bce6c 100644 --- a/test/src/OnlyOneValidatorTest.php +++ b/test/src/OnlyOneValidatorTest.php @@ -15,7 +15,25 @@ class OnlyOneValidatorTest extends WritersTypeTestCase { - public function testNewRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() + public function testRecordWithDifferentFieldValueIsValidated(): void + { + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Alexander Pushkin', + ] + ); + + $is_only_one = $validator->onlyOne('name', 'Not Alexander Pushkin'); + + $this->assertTrue($is_only_one); + $this->assertEmpty($validator->getFieldErrors('name')); + } + + public function testWillValidateMatchingValueThatDoesNotExist(): void { $validator = new Validator( $this->connection, @@ -27,14 +45,79 @@ public function testNewRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() ] ); - $is_only_one = $validator->onlyOneWhere('name', 'Anton Chekhov', ''); + $is_only_one = $validator->onlyOne('name', 'Alexander Pushkin'); $this->assertTrue($is_only_one); - $this->assertFalse($validator->hasErrors()); + $this->assertEmpty($validator->getFieldErrors('name')); + } + + public function testWillInvalidateMatchingValueThatAlreadyExists(): void + { + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Alexander Pushkin', + ] + ); + + $is_only_one = $validator->onlyOne('name', 'Alexander Pushkin'); + + $this->assertFalse($is_only_one); $name_errors = $validator->getFieldErrors('name'); + $this->assertNotEmpty($name_errors); + $this->assertSame( + "Only one record with field 'name' set to 'Alexander Pushkin' is allowed.", + $name_errors[0] + ); + } - $this->assertIsArray($name_errors); - $this->assertCount(0, $name_errors); + public function testWillValidateMatchingValueWhenContextIsNotTheSame(): void + { + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Alexander Pushkin', + + // Same writer, different birthday (Pushkin's birthday is '1799-06-06'). + 'birthday' => '1821-11-11', + ] + ); + + $is_only_one = $validator->onlyOne('name', 'Alexander Pushkin', 'birthday'); + + $this->assertTrue($is_only_one); + $this->assertEmpty($validator->getFieldErrors('name')); + } + + public function testWillInvalidateMatchingValueThatAlreadyExistsInGivenContext(): void + { + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Alexander Pushkin', + 'birthday' => '1799-06-06', + ] + ); + + $is_only_one = $validator->onlyOne('name', 'Alexander Pushkin', 'birthday'); + + $this->assertFalse($is_only_one); + + $name_errors = $validator->getFieldErrors('name'); + $this->assertNotEmpty($name_errors); + $this->assertSame( + "Only one record with field 'name' set to 'Alexander Pushkin' is allowed in context of 'birthday'.", + $name_errors[0] + ); } } diff --git a/test/src/UniqueValidatorTest.php b/test/src/UniqueValidatorTest.php index 6d2d015..38a287a 100644 --- a/test/src/UniqueValidatorTest.php +++ b/test/src/UniqueValidatorTest.php @@ -70,7 +70,15 @@ public function testNewRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() */ public function testNewRecordReportsAnErrorOnDuplicateValue() { - $validator = new Validator($this->connection, 'writers', null, null, ['name' => 'Leo Tolstoy']); + $validator = new Validator( + $this->connection, + 'writers', + null, + null, + [ + 'name' => 'Leo Tolstoy', + ] + ); $is_unique = $validator->unique('name'); @@ -88,7 +96,15 @@ public function testNewRecordReportsAnErrorOnDuplicateValue() */ public function testExistingRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue() { - $validator = new Validator($this->connection, 'writers', 1, null, ['name' => 'Leo Tolstoy']); + $validator = new Validator( + $this->connection, + 'writers', + 1, + null, + [ + 'name' => 'Leo Tolstoy', + ] + ); $is_unique = $validator->unique('name'); @@ -106,7 +122,15 @@ public function testExistingRecordDoesNotReportAnErrorWhenTheresNoDuplicateValue */ public function testExistingRecordReportsAnErrorOnDuplicateValue() { - $validator = new Validator($this->connection, 'writers', 1, null, ['name' => 'Alexander Pushkin']); + $validator = new Validator( + $this->connection, + 'writers', + 1, + null, + [ + 'name' => 'Alexander Pushkin', + ] + ); $is_unique = $validator->unique('name'); diff --git a/test/src/ValidatorTest.php b/test/src/ValidatorTest.php index dfbff49..14983a7 100644 --- a/test/src/ValidatorTest.php +++ b/test/src/ValidatorTest.php @@ -58,7 +58,7 @@ public function testValidatorReturnsAllErrors() $this->assertArrayHasKey('name', $errors); $this->assertIsArray($errors['name']); $this->assertCount(1, $errors['name']); - $this->assertEquals("Value of 'name' needs to be unique", $errors['name'][0]); + $this->assertEquals("Value of 'name' needs to be unique.", $errors['name'][0]); $this->assertArrayHasKey('birthday', $errors); $this->assertIsArray($errors['birthday']); From 62659485356f43b7b3374b81807c7618d09b9e85 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 11 Dec 2021 19:25:02 +0100 Subject: [PATCH 22/61] Add types to validator interface and make it strict --- src/Validator.php | 124 +++++++++++++++++++--------------- src/ValidatorInterface.php | 102 +++++++++++++++++----------- test/src/UrlValidatorTest.php | 6 +- test/src/ValidatorTest.php | 2 +- 4 files changed, 136 insertions(+), 98 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index 12fbae2..808bd73 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseConnection\ConnectionInterface; use ActiveCollab\DatabaseObject\Exception\ValidationException; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject - */ class Validator implements ValidatorInterface { private array $errors = []; @@ -44,11 +43,8 @@ public function __construct( * * Note: strings are trimmed prior to check, and values that empty() would return true for (like '0') are consdiered * to be present (because we check strlen(trim($value)). - * - * @param string $field_name - * @return bool */ - public function present($field_name) + public function present(string $field_name): bool { if (empty($field_name)) { throw new InvalidArgumentException("Value '$field_name' is not a valid field name"); @@ -83,33 +79,49 @@ public function present($field_name) */ private function failPresenceValidation($field_name) { - $this->addFieldError($field_name, "Value of '$field_name' is required"); + $this->addFieldError($field_name, "Value of '$field_name' is required."); return false; } - public function lowerThan($field_name, $reference_value, $allow_null = false) + public function lowerThan( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { return $a < $b; }, "Value of '$field_name' is not lower than $reference_value"); } - public function lowerThanOrEquals($field_name, $reference_value, $allow_null = false) + public function lowerThanOrEquals( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { return $a <= $b; }, "Value of '$field_name' is not lower than or equal to $reference_value"); } - public function greaterThan($field_name, $reference_value, $allow_null = false) + public function greaterThan( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { return $a > $b; }, "Value of '$field_name' is not greater than $reference_value"); } - public function greaterThanOrEquals($field_name, $reference_value, $allow_null = false) + public function greaterThanOrEquals( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool { return $this->compareValues($field_name, $reference_value, $allow_null, function ($a, $b) { return $a >= $b; @@ -173,7 +185,7 @@ public function inArray( if (in_array($this->field_values[$field_name], $array_of_values)) { return true; } else { - $this->addFieldError($field_name, "Value of '$field_name' is not present in the list of supported values"); + $this->addFieldError($field_name, "Value of '$field_name' is not present in the list of supported values."); return false; } @@ -224,42 +236,6 @@ public function uniqueWhere( return false; } - private function prepareUniquenessValidatorSql(array $field_names, mixed $where): string - { - $conditions = []; - - if ($where) { - $conditions[] = $this->connection->prepareConditions($where); - } - - foreach ($field_names as $v) { - $escaped_field_name = $this->connection->escapeFieldName($v); - - if ($this->field_values[$v] === null) { - $conditions[] = "$escaped_field_name IS NULL"; - } else { - $conditions[] = $this->connection->prepare("$escaped_field_name = ?", $this->field_values[$v]); - } - } - - if (empty($this->object_id)) { - return sprintf( - "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE %s", - $this->connection->escapeTableName($this->table_name), - implode(' AND ', $conditions) - ); - } - - return $this->connection->prepare( - sprintf( - "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE (%s) AND (`id` != ?)", - $this->connection->escapeTableName($this->table_name), - implode(' AND ', $conditions) - ), - $this->old_object_id ?? $this->object_id - ); - } - public function presentAndUnique(string $field_name, string ...$context): bool { if ($this->present($field_name)) { @@ -370,7 +346,46 @@ function ($field_name) { ); } - public function email($field_name, $allow_null = false) + private function prepareUniquenessValidatorSql(array $field_names, mixed $where): string + { + $conditions = []; + + if ($where) { + $conditions[] = $this->connection->prepareConditions($where); + } + + foreach ($field_names as $v) { + $escaped_field_name = $this->connection->escapeFieldName($v); + + if ($this->field_values[$v] === null) { + $conditions[] = "$escaped_field_name IS NULL"; + } else { + $conditions[] = $this->connection->prepare("$escaped_field_name = ?", $this->field_values[$v]); + } + } + + if (empty($this->object_id)) { + return sprintf( + "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE %s", + $this->connection->escapeTableName($this->table_name), + implode(' AND ', $conditions) + ); + } + + return $this->connection->prepare( + sprintf( + "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE (%s) AND (`id` != ?)", + $this->connection->escapeTableName($this->table_name), + implode(' AND ', $conditions) + ), + $this->old_object_id ?? $this->object_id + ); + } + + public function email( + string $field_name, + bool $allow_null = false + ): bool { if (array_key_exists($field_name, $this->field_values)) { if ($this->field_values[$field_name] === null) { @@ -384,7 +399,7 @@ public function email($field_name, $allow_null = false) if (filter_var($this->field_values[$field_name], FILTER_VALIDATE_EMAIL)) { return true; } else { - $this->addFieldError($field_name, "Value of '$field_name' is not a valid email address"); + $this->addFieldError($field_name, "Value of '$field_name' is not a valid email address."); return false; } @@ -393,7 +408,10 @@ public function email($field_name, $allow_null = false) } } - public function url($field_name, $allow_null = false) + public function url( + string $field_name, + bool $allow_null = false + ): bool { if (array_key_exists($field_name, $this->field_values)) { if ($this->field_values[$field_name] === null) { @@ -407,7 +425,7 @@ public function url($field_name, $allow_null = false) if (filter_var($this->field_values[$field_name], FILTER_VALIDATE_URL)) { return true; } else { - $this->addFieldError($field_name, "Value of '$field_name' is not a valid URL"); + $this->addFieldError($field_name, "Value of '$field_name' is not a valid URL."); return false; } diff --git a/src/ValidatorInterface.php b/src/ValidatorInterface.php index 894d33d..6171a0c 100644 --- a/src/ValidatorInterface.php +++ b/src/ValidatorInterface.php @@ -6,64 +6,55 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\DatabaseObject\Exception\ValidationException; -/** - * @package ActiveCollab\DatabaseObject - */ interface ValidatorInterface { /** * Check if value of $field_name is present. - * - * @param string $field_name - * @return bool */ - public function present($field_name); + public function present(string $field_name): bool; - /** - * @param string $field_name - * @param int $reference_value - * @param bool|false $allow_null - * @return bool - */ - public function lowerThan($field_name, $reference_value, $allow_null = false); + public function lowerThan( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool; - /** - * @param string $field_name - * @param int $reference_value - * @param bool|false $allow_null - * @return bool - */ - public function lowerThanOrEquals($field_name, $reference_value, $allow_null = false); + public function lowerThanOrEquals( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool; - /** - * @param string $field_name - * @param int $reference_value - * @param bool|false $allow_null - * @return bool - */ - public function greaterThan($field_name, $reference_value, $allow_null = false); + public function greaterThan( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool; - /** - * @param string $field_name - * @param int $reference_value - * @param bool|false $allow_null - * @return bool - */ - public function greaterThanOrEquals($field_name, $reference_value, $allow_null = false); + public function greaterThanOrEquals( + string $field_name, + int $reference_value, + bool $allow_null = false + ): bool; public function inArray( string $field_name, array $array_of_values, bool $allow_null = false ): bool; + /** + * Check if value that we are trying to save is unique in the given context. + */ public function unique(string $field_name, string ...$context): bool; /** - * Check if value that we are trying to save is unique in the given context. + * Check if value that we are trying to save is unique in the given context, with extra filtering. */ public function uniqueWhere( string $field_name, @@ -95,13 +86,42 @@ public function presentAndUniqueWhere( ): bool; /** - * Validate email address value. + * Make sure that that only one record with the given value in the given context exists. * - * @param string $field_name - * @param bool|false $allow_null - * @return bool + * Note: Difference with unique() validation is that there can other non-unique values, as long as there's not more + * than one record with the given value. */ - public function email($field_name, $allow_null = false); + public function onlyOne( + string $field_name, + mixed $field_value, + string ...$context + ): bool; + + /** + * Make sure that that only one record with the given value in the given context exists, with extra filtering. + */ + public function onlyOneWhere( + string $field_name, + mixed $field_value, + mixed $where, + string ...$context + ): bool; + + /** + * Validate email address value. + */ + public function email( + string $field_name, + bool $allow_null = false + ): bool; + + /** + * Validate URL value. + */ + public function url( + string $field_name, + bool $allow_null = false + ): bool; /** * Return array of validation messages, indexed by field name. diff --git a/test/src/UrlValidatorTest.php b/test/src/UrlValidatorTest.php index 70b3e66..b3d9fd7 100644 --- a/test/src/UrlValidatorTest.php +++ b/test/src/UrlValidatorTest.php @@ -56,7 +56,7 @@ public function testNoUrlFailsValidation() $this->assertIsArray($url_errors); $this->assertCount(1, $url_errors); - $this->assertContains("Value of 'homepage_url' is required", $url_errors); + $this->assertContains("Value of 'homepage_url' is required.", $url_errors); } /** @@ -75,7 +75,7 @@ public function testInvalidUrlAddressFailsValidation() $this->assertIsArray($url_errors); $this->assertCount(1, $url_errors); - $this->assertContains("Value of 'homepage_url' is not a valid URL", $url_errors); + $this->assertContains("Value of 'homepage_url' is not a valid URL.", $url_errors); } /** @@ -112,6 +112,6 @@ public function testNullFailsValidationWhenNotAllowed() $this->assertIsArray($url_errors); $this->assertCount(1, $url_errors); - $this->assertContains("Value of 'homepage_url' is required", $url_errors); + $this->assertContains("Value of 'homepage_url' is required.", $url_errors); } } diff --git a/test/src/ValidatorTest.php b/test/src/ValidatorTest.php index 14983a7..b11b19d 100644 --- a/test/src/ValidatorTest.php +++ b/test/src/ValidatorTest.php @@ -63,6 +63,6 @@ public function testValidatorReturnsAllErrors() $this->assertArrayHasKey('birthday', $errors); $this->assertIsArray($errors['birthday']); $this->assertCount(1, $errors['birthday']); - $this->assertEquals("Value of 'birthday' is required", $errors['birthday'][0]); + $this->assertEquals("Value of 'birthday' is required.", $errors['birthday'][0]); } } From 01139d30168a9cf9a83f498df3844ff45d9ae4d8 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 11 Dec 2021 22:28:44 +0100 Subject: [PATCH 23/61] Remove unneeded doc blocks --- src/ValidatorInterface.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/ValidatorInterface.php b/src/ValidatorInterface.php index 6171a0c..f26e5f5 100644 --- a/src/ValidatorInterface.php +++ b/src/ValidatorInterface.php @@ -15,7 +15,7 @@ interface ValidatorInterface { /** - * Check if value of $field_name is present. + * Check if value of $field_name is present (not-empty). */ public function present(string $field_name): bool; @@ -64,20 +64,11 @@ public function uniqueWhere( /** * Field value needs to be present and unique. - * - * @param string $field_name - * @param string[] $context - * @return bool */ public function presentAndUnique(string $field_name, string ...$context): bool; /** * Present and unique, with the given condition. - * - * @param string $field_name - * @param array|string $where - * @param string[] $context - * @return bool */ public function presentAndUniqueWhere( string $field_name, From 59d5d702f05ab69946c7f3979eb866de4b193443 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 26 Dec 2021 12:32:06 +0100 Subject: [PATCH 24/61] Improve PHP 8.1 compatibility --- src/Entity/Entity.php | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 751f01f..0125150 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -13,7 +13,6 @@ use ActiveCollab\DatabaseConnection\ConnectionInterface; use ActiveCollab\DatabaseConnection\Record\ValueCasterInterface; use ActiveCollab\DatabaseObject\Exception\ValidationException; -use ActiveCollab\DatabaseObject\Pool; use ActiveCollab\DatabaseObject\PoolInterface; use ActiveCollab\DatabaseObject\Validator; use ActiveCollab\DatabaseObject\ValidatorInterface; @@ -26,6 +25,7 @@ use InvalidArgumentException; use LogicException; use Psr\Log\LoggerInterface; +use ReturnTypeWillChange; /** * @package ActiveCollab\DatabaseObject @@ -34,21 +34,6 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - /** - * @var ConnectionInterface - */ - protected $connection; - - /** - * @var Pool - */ - protected $pool; - - /** - * @var LoggerInterface - */ - protected $logger; - /** * Name of the table. * @@ -94,12 +79,12 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface */ protected $default_entity_field_values = []; - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) + public function __construct( + protected ConnectionInterface $connection, + protected PoolInterface $pool, + protected LoggerInterface $logger + ) { - $this->connection = $connection; - $this->pool = $pool; - $this->logger = $logger; - if ($traits = $pool->getTraitNamesByType(get_class($this))) { foreach ($traits as $trait) { $trait_constructor = str_replace('\\', '', $trait); @@ -1033,9 +1018,7 @@ protected function triggerEvent($event, array $event_parameters = []) } } - /** - * {@inheritdoc} - */ + #[ReturnTypeWillChange] public function jsonSerialize() { $result = [ From 9f7325b096d572e4c09f01553a18ed6b5ab50f87 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 26 Dec 2021 13:36:07 +0100 Subject: [PATCH 25/61] Remove dependenciy on Pimple for tests --- composer.json | 13 ++- composer.lock | 103 ++++--------------- src/Collection.php | 4 +- test/src/ContainerPropagatesToFinderTest.php | 43 +++++--- test/src/ContainerPropagatesToObjectTest.php | 16 +-- test/src/Fixtures/Container.php | 46 --------- 6 files changed, 70 insertions(+), 155 deletions(-) delete mode 100644 test/src/Fixtures/Container.php diff --git a/composer.json b/composer.json index 98eba2a..b95f010 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,15 @@ "email": "ilija.studen@activecollab.com" } ], + "repositories": [ + { + "type": "vcs", + "url": "/Users/ilijastuden/Projects/Components/databaseconnection" + } + ], "require": { - "php": ">=8.0", - "activecollab/databaseconnection": "^3.0||^4.0", + "php": ">=8.1", + "activecollab/databaseconnection": "dev-master", "activecollab/etag": "^1.0", "activecollab/object": "^1.0", "doctrine/inflector": "^1.0", @@ -27,8 +33,7 @@ "ext-mysqli": "*", "friendsofphp/php-cs-fixer": "^2.0", "monolog/monolog": "^1.0", - "phpunit/phpunit": "~9.0", - "pimple/pimple": "~3.0.0" + "phpunit/phpunit": "~9.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 8b1e8df..49ce2d9 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": "9354d67e92268040ff0fdefa7b7fd695", + "content-hash": "d20fdf1c17334eb50830d1625cc0839f", "packages": [ { "name": "activecollab/containeraccess", @@ -59,31 +59,26 @@ }, { "name": "activecollab/databaseconnection", - "version": "4.0.0", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/activecollab/databaseconnection.git", - "reference": "7192b59cda4022a381ab0b9fe0bdd670f9b083ca" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/7192b59cda4022a381ab0b9fe0bdd670f9b083ca", - "reference": "7192b59cda4022a381ab0b9fe0bdd670f9b083ca", - "shasum": "" + "url": "/Users/ilijastuden/Projects/Components/databaseconnection", + "reference": "fa168fcfc236b0bd6672ff0faca083930322a6d9" }, "require": { "activecollab/containeraccess": "^2.0", "activecollab/datevalue": "^2.0", "ext-json": "*", "ext-mysqli": "*", - "php": ">=7.3", + "php": ">=8.1", "psr/log": "^1.0.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", - "phpunit/phpunit": "~5.0", - "pimple/pimple": "~3.0.0" + "phpunit/phpunit": "~9.0", + "pimple/pimple": "~3.5.0" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -91,7 +86,6 @@ "ActiveCollab\\DatabaseConnection\\Test\\": "test/src" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -107,11 +101,7 @@ "activecollab", "mysql" ], - "support": { - "issues": "https://github.com/activecollab/databaseconnection/issues", - "source": "https://github.com/activecollab/databaseconnection/tree/4.0.0" - }, - "time": "2019-12-21T13:48:35+00:00" + "time": "2021-12-26T12:20:04+00:00" }, { "name": "activecollab/datevalue", @@ -1543,9 +1533,6 @@ "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", @@ -2353,16 +2340,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.10", + "version": "9.5.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" + "reference": "2406855036db1102126125537adb1406f7242fdd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd", + "reference": "2406855036db1102126125537adb1406f7242fdd", "shasum": "" }, "require": { @@ -2440,11 +2427,11 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.11" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { @@ -2452,57 +2439,7 @@ "type": "github" } ], - "time": "2021-09-25T07:38:51+00:00" - }, - { - "name": "pimple/pimple", - "version": "v3.0.2", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", - "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ], - "support": { - "issues": "https://github.com/silexphp/Pimple/issues", - "source": "https://github.com/silexphp/Pimple/tree/master" - }, - "time": "2015-09-11T15:10:35+00:00" + "time": "2021-12-25T07:07:57+00:00" }, { "name": "psr/cache", @@ -4962,14 +4899,16 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "activecollab/databaseconnection": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.0" + "php": ">=8.1" }, "platform-dev": { "ext-mysqli": "*" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/src/Collection.php b/src/Collection.php index 405a170..52e9a72 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -199,10 +199,8 @@ public function getItemsPerPage() /** * Return array or property => value pairs that describes this object. - * - * @return array */ - public function jsonSerialize() + public function jsonSerialize(): mixed { $result = $this->execute(); diff --git a/test/src/ContainerPropagatesToFinderTest.php b/test/src/ContainerPropagatesToFinderTest.php index 7317bf2..fe693a9 100644 --- a/test/src/ContainerPropagatesToFinderTest.php +++ b/test/src/ContainerPropagatesToFinderTest.php @@ -10,8 +10,8 @@ use ActiveCollab\DatabaseObject\Finder; use ActiveCollab\DatabaseObject\Test\Base\TestCase; -use ActiveCollab\DatabaseObject\Test\Fixtures\Container; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; +use Psr\Container\ContainerInterface; /** * @package ActiveCollab\DatabaseObject\Test @@ -25,11 +25,11 @@ public function setUp(): void { parent::setUp(); - $container = new Container(['dependency' => 'it works!']); - - $this->pool->setContainer($container); - $this->assertTrue($this->pool->hasContainer()); - $this->assertInstanceOf(Container::class, $this->pool->getContainer()); +// $container = new Container(['dependency' => 'it works!']); +// +// $this->pool->setContainer($container); +// $this->assertTrue($this->pool->hasContainer()); +// $this->assertInstanceOf(Container::class, $this->pool->getContainer()); $this->pool->registerType(Writer::class); } @@ -39,10 +39,18 @@ public function setUp(): void */ public function testCustomFinderRecivesContainer() { + $container = $this->createMock(ContainerInterface::class); + $container + ->expects($this->once()) + ->method('has') + ->with('dependency') + ->willReturn(true); + + $this->pool->setContainer($container); + /** @var Finder $finder */ $finder = $this->pool->find(Writer::class); - $this->assertInstanceOf(Container::class, $finder->getContainer()); $this->assertTrue($finder->getContainer()->has('dependency')); } @@ -51,15 +59,26 @@ public function testCustomFinderRecivesContainer() */ public function testCustomFinderInstantination() { + $container = $this->createMock(ContainerInterface::class); + $container + ->expects($this->once()) + ->method('has') + ->with('dependency') + ->willReturn(true); + $container + ->expects($this->once()) + ->method('get') + ->with('dependency') + ->willReturn('it works!'); + + $this->pool->setContainer($container); + /** @var Finder $finder */ $finder = $this->pool->find(Writer::class); $this->assertInstanceOf(Finder::class, $finder); - if (isset($finder->dependency)) { - $this->assertEquals('it works!', $finder->dependency); - } else { - $this->fail('Dependency property not set in Finder'); - } + $this->assertTrue(isset($finder->dependency)); + $this->assertEquals('it works!', $finder->dependency); } } diff --git a/test/src/ContainerPropagatesToObjectTest.php b/test/src/ContainerPropagatesToObjectTest.php index e3807cb..06e494e 100644 --- a/test/src/ContainerPropagatesToObjectTest.php +++ b/test/src/ContainerPropagatesToObjectTest.php @@ -10,30 +10,30 @@ use ActiveCollab\DatabaseConnection\Result\ResultInterface; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; -use ActiveCollab\DatabaseObject\Test\Fixtures\Container; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; +use Psr\Container\ContainerInterface; /** * @package ActiveCollab\DatabaseObject\Test */ class ContainerPropagatesToObjectTest extends WritersTypeTestCase { - /** - * Set up test environment. - */ public function setUp(): void { parent::setUp(); - $container = new Container(['is_special' => true]); + $container = $this->createMock(ContainerInterface::class); + $container + ->expects($this->once()) + ->method('get') + ->with('is_special') + ->willReturn(true); $this->pool->setContainer($container); - $this->assertTrue($this->pool->hasContainer()); - $this->assertInstanceOf(Container::class, $this->pool->getContainer()); } /** - * Test instantination via getById() method. + * Test instantiation via getById() method. */ public function testGetByIdInstantination() { diff --git a/test/src/Fixtures/Container.php b/test/src/Fixtures/Container.php deleted file mode 100644 index c44e22b..0000000 --- a/test/src/Fixtures/Container.php +++ /dev/null @@ -1,46 +0,0 @@ -. All rights reserved. - */ - -namespace ActiveCollab\DatabaseObject\Test\Fixtures; - -use Psr\Container\ContainerInterface; -use InvalidArgumentException; - -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures - */ -class Container extends \Pimple\Container implements ContainerInterface -{ - /** - * Finds an entry of the container by its identifier and returns it. - * - * @param string $id Identifier of the entry to look for - * @return mixed Entry - */ - public function get($id) - { - if (!$this->offsetExists($id)) { - throw new InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); - } - - return $this->offsetGet($id); - } - - /** - * Returns true if the container can return an entry for the given identifier. - * Returns false otherwise. - * - * @param string $id Identifier of the entry to look for - * - * @return bool - */ - public function has($id) - { - return $this->offsetExists($id); - } -} From f27bbdb455974fcf3af044d92f61fe2787b145fc Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Thu, 3 Mar 2022 10:05:56 +0100 Subject: [PATCH 26/61] Update dependencies --- composer.json | 10 +- composer.lock | 448 ++++++++++++++++++++++++++------------------------ 2 files changed, 233 insertions(+), 225 deletions(-) diff --git a/composer.json b/composer.json index b95f010..8020b31 100644 --- a/composer.json +++ b/composer.json @@ -15,15 +15,9 @@ "email": "ilija.studen@activecollab.com" } ], - "repositories": [ - { - "type": "vcs", - "url": "/Users/ilijastuden/Projects/Components/databaseconnection" - } - ], "require": { - "php": ">=8.1", - "activecollab/databaseconnection": "dev-master", + "php": ">=8.0", + "activecollab/databaseconnection": "^5.0", "activecollab/etag": "^1.0", "activecollab/object": "^1.0", "doctrine/inflector": "^1.0", diff --git a/composer.lock b/composer.lock index 49ce2d9..f9de493 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": "d20fdf1c17334eb50830d1625cc0839f", + "content-hash": "e1429e7d86962455ad5477d64fd730b6", "packages": [ { "name": "activecollab/containeraccess", @@ -59,18 +59,24 @@ }, { "name": "activecollab/databaseconnection", - "version": "dev-master", + "version": "5.0.0", "source": { "type": "git", - "url": "/Users/ilijastuden/Projects/Components/databaseconnection", - "reference": "fa168fcfc236b0bd6672ff0faca083930322a6d9" + "url": "https://github.com/activecollab/databaseconnection.git", + "reference": "85710eaebca7d0396dcb2db425e40b052e1a6956" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/85710eaebca7d0396dcb2db425e40b052e1a6956", + "reference": "85710eaebca7d0396dcb2db425e40b052e1a6956", + "shasum": "" }, "require": { "activecollab/containeraccess": "^2.0", "activecollab/datevalue": "^2.0", "ext-json": "*", "ext-mysqli": "*", - "php": ">=8.1", + "php": ">=8.0", "psr/log": "^1.0.0" }, "require-dev": { @@ -78,7 +84,6 @@ "phpunit/phpunit": "~9.0", "pimple/pimple": "~3.5.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -86,6 +91,7 @@ "ActiveCollab\\DatabaseConnection\\Test\\": "test/src" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -101,7 +107,11 @@ "activecollab", "mysql" ], - "time": "2021-12-26T12:20:04+00:00" + "support": { + "issues": "https://github.com/activecollab/databaseconnection/issues", + "source": "https://github.com/activecollab/databaseconnection/tree/5.0.0" + }, + "time": "2022-03-03T09:01:59+00:00" }, { "name": "activecollab/datevalue", @@ -286,8 +296,8 @@ }, "autoload": { "psr-4": { - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector", - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector", + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -352,16 +362,16 @@ }, { "name": "nesbot/carbon", - "version": "2.55.2", + "version": "2.57.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2" + "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8c2a18ce3e67c34efc1b29f64fe61304368259a2", - "reference": "8c2a18ce3e67c34efc1b29f64fe61304368259a2", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", + "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", "shasum": "" }, "require": { @@ -378,7 +388,7 @@ "kylekatarnls/multi-tester": "^2.0", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^0.12.54 || ^1.0", "phpunit/phpunit": "^7.5.20 || ^8.5.14", "squizlabs/php_codesniffer": "^3.4" }, @@ -444,7 +454,7 @@ "type": "tidelift" } ], - "time": "2021-12-03T14:59:52+00:00" + "time": "2022-02-13T18:13:33+00:00" }, { "name": "psr/container", @@ -546,21 +556,24 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-mbstring": "*" + }, "suggest": { "ext-mbstring": "For best performance" }, @@ -575,12 +588,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -606,7 +619,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" }, "funding": [ { @@ -622,20 +635,20 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-30T18:21:41+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", "shasum": "" }, "require": { @@ -652,12 +665,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -689,7 +702,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" }, "funding": [ { @@ -705,20 +718,20 @@ "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2021-09-13T13:58:33+00:00" }, { "name": "symfony/translation", - "version": "v6.0.1", + "version": "v6.0.5", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "b7956e00c6e03546f2ba489fc50f7c47933e76b8" + "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/b7956e00c6e03546f2ba489fc50f7c47933e76b8", - "reference": "b7956e00c6e03546f2ba489fc50f7c47933e76b8", + "url": "https://api.github.com/repos/symfony/translation/zipball/e69501c71107cc3146b32aaa45f4edd0c3427875", + "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875", "shasum": "" }, "require": { @@ -784,7 +797,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.0.1" + "source": "https://github.com/symfony/translation/tree/v6.0.5" }, "funding": [ { @@ -800,7 +813,7 @@ "type": "tidelift" } ], - "time": "2021-12-08T15:13:44+00:00" + "time": "2022-02-09T15:52:48+00:00" }, { "name": "symfony/translation-contracts", @@ -884,23 +897,23 @@ "packages-dev": [ { "name": "composer/pcre", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2" + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/3d322d715c43a1ac36c7fe215fa59336265500f2", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2", + "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", + "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1", + "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", "symfony/phpunit-bridge": "^4.2 || ^5" }, @@ -935,7 +948,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.0" + "source": "https://github.com/composer/pcre/tree/1.0.1" }, "funding": [ { @@ -951,27 +964,27 @@ "type": "tidelift" } ], - "time": "2021-12-06T15:17:27+00:00" + "time": "2022-01-21T20:24:37+00:00" }, { "name": "composer/semver", - "version": "3.2.6", + "version": "3.2.9", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "83e511e247de329283478496f7a1e114c9517506" + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/83e511e247de329283478496f7a1e114c9517506", - "reference": "83e511e247de329283478496f7a1e114c9517506", + "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -1016,7 +1029,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.6" + "source": "https://github.com/composer/semver/tree/3.2.9" }, "funding": [ { @@ -1032,20 +1045,20 @@ "type": "tidelift" } ], - "time": "2021-10-25T11:34:17+00:00" + "time": "2022-02-04T13:58:43+00:00" }, { "name": "composer/xdebug-handler", - "version": "2.0.3", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "6555461e76962fd0379c444c46fd558a0fcfb65e" + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6555461e76962fd0379c444c46fd558a0fcfb65e", - "reference": "6555461e76962fd0379c444c46fd558a0fcfb65e", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/9e36aeed4616366d2b690bdce11f71e9178c579a", + "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a", "shasum": "" }, "require": { @@ -1082,7 +1095,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.3" + "source": "https://github.com/composer/xdebug-handler/tree/2.0.5" }, "funding": [ { @@ -1098,7 +1111,7 @@ "type": "tidelift" } ], - "time": "2021-12-08T13:07:32+00:00" + "time": "2022-02-24T20:20:32+00:00" }, { "name": "doctrine/annotations", @@ -1243,32 +1256,28 @@ }, { "name": "doctrine/lexer", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "^1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" @@ -1303,7 +1312,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/1.2.3" }, "funding": [ { @@ -1319,7 +1328,7 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-02-28T11:07:21+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -1518,34 +1527,38 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.10.3", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "c6a951b75d684fd43fbbd69617488e1e2e8924ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/c6a951b75d684fd43fbbd69617488e1e2e8924ba", + "reference": "c6a951b75d684fd43fbbd69617488e1e2e8924ba", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1561,7 +1574,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.3" }, "funding": [ { @@ -1569,7 +1582,7 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2022-03-02T14:16:47+00:00" }, { "name": "nikic/php-parser", @@ -1689,16 +1702,16 @@ }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -1734,9 +1747,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2021-02-23T14:00:09+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "php-cs-fixer/diff", @@ -1905,16 +1918,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -1949,9 +1962,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", @@ -2022,16 +2035,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.10", + "version": "9.2.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" + "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f4d60b6afe5546421462b76cd4e633ebc364ab4", + "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4", "shasum": "" }, "require": { @@ -2087,7 +2100,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.14" }, "funding": [ { @@ -2095,7 +2108,7 @@ "type": "github" } ], - "time": "2021-12-05T09:12:13+00:00" + "time": "2022-02-28T12:38:02+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2340,16 +2353,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.11", + "version": "9.5.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2406855036db1102126125537adb1406f7242fdd" + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd", - "reference": "2406855036db1102126125537adb1406f7242fdd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", "shasum": "" }, "require": { @@ -2365,7 +2378,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", + "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -2400,11 +2413,11 @@ } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2427,7 +2440,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" }, "funding": [ { @@ -2439,7 +2452,7 @@ "type": "github" } ], - "time": "2021-12-25T07:07:57+00:00" + "time": "2022-02-23T17:10:58+00:00" }, { "name": "psr/cache", @@ -3046,16 +3059,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.3", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", "shasum": "" }, "require": { @@ -3098,7 +3111,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" }, "funding": [ { @@ -3106,7 +3119,7 @@ "type": "github" } ], - "time": "2021-06-11T13:31:12+00:00" + "time": "2022-02-14T08:28:10+00:00" }, { "name": "sebastian/lines-of-code", @@ -3506,16 +3519,16 @@ }, { "name": "symfony/console", - "version": "v5.4.1", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4" + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", - "reference": "9130e1a0fc93cb0faadca4ee917171bd2ca9e5f4", + "url": "https://api.github.com/repos/symfony/console/zipball/d8111acc99876953f52fe16d4c50eb60940d49ad", + "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad", "shasum": "" }, "require": { @@ -3585,7 +3598,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.1" + "source": "https://github.com/symfony/console/tree/v5.4.5" }, "funding": [ { @@ -3601,7 +3614,7 @@ "type": "tidelift" } ], - "time": "2021-12-09T11:22:43+00:00" + "time": "2022-02-24T12:45:35+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3672,16 +3685,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", "shasum": "" }, "require": { @@ -3737,7 +3750,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" }, "funding": [ { @@ -3753,7 +3766,7 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -3836,16 +3849,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.0", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01" + "reference": "797680071ea8f71b94eb958680c50d0e002638f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/731f917dc31edcffec2c6a777f3698c33bea8f01", - "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/797680071ea8f71b94eb958680c50d0e002638f5", + "reference": "797680071ea8f71b94eb958680c50d0e002638f5", "shasum": "" }, "require": { @@ -3880,7 +3893,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.0" + "source": "https://github.com/symfony/filesystem/tree/v5.4.5" }, "funding": [ { @@ -3896,20 +3909,20 @@ "type": "tidelift" } ], - "time": "2021-10-28T13:39:27+00:00" + "time": "2022-02-27T10:31:47+00:00" }, { "name": "symfony/finder", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590" + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d2f29dac98e96a98be467627bd49c2efb1bc2590", - "reference": "d2f29dac98e96a98be467627bd49c2efb1bc2590", + "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", "shasum": "" }, "require": { @@ -3943,7 +3956,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.0" + "source": "https://github.com/symfony/finder/tree/v5.4.3" }, "funding": [ { @@ -3959,20 +3972,20 @@ "type": "tidelift" } ], - "time": "2021-11-28T15:25:38+00:00" + "time": "2022-01-26T16:34:36+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "b0fb78576487af19c500aaddb269fd36701d4847" + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b0fb78576487af19c500aaddb269fd36701d4847", - "reference": "b0fb78576487af19c500aaddb269fd36701d4847", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", "shasum": "" }, "require": { @@ -4012,7 +4025,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.0" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" }, "funding": [ { @@ -4028,25 +4041,28 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -4061,12 +4077,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4091,7 +4107,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -4107,20 +4123,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", + "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", "shasum": "" }, "require": { @@ -4140,12 +4156,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4172,7 +4188,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" }, "funding": [ { @@ -4188,11 +4204,11 @@ "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2021-11-23T21:10:46+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -4221,12 +4237,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -4256,7 +4272,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" }, "funding": [ { @@ -4344,7 +4360,7 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", @@ -4370,12 +4386,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4400,7 +4416,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.24.0" }, "funding": [ { @@ -4420,16 +4436,16 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", "shasum": "" }, "require": { @@ -4446,12 +4462,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -4479,7 +4495,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" }, "funding": [ { @@ -4495,20 +4511,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-06-05T21:20:04+00:00" }, { "name": "symfony/process", - "version": "v5.4.0", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "5be20b3830f726e019162b26223110c8f47cf274" + "reference": "95440409896f90a5f85db07a32b517ecec17fa4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/5be20b3830f726e019162b26223110c8f47cf274", - "reference": "5be20b3830f726e019162b26223110c8f47cf274", + "url": "https://api.github.com/repos/symfony/process/zipball/95440409896f90a5f85db07a32b517ecec17fa4c", + "reference": "95440409896f90a5f85db07a32b517ecec17fa4c", "shasum": "" }, "require": { @@ -4541,7 +4557,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.0" + "source": "https://github.com/symfony/process/tree/v5.4.5" }, "funding": [ { @@ -4557,7 +4573,7 @@ "type": "tidelift" } ], - "time": "2021-11-28T15:25:38+00:00" + "time": "2022-01-30T18:16:22+00:00" }, { "name": "symfony/service-contracts", @@ -4643,16 +4659,16 @@ }, { "name": "symfony/stopwatch", - "version": "v5.4.0", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "208ef96122bfed82a8f3a61458a07113a08bdcfe" + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/208ef96122bfed82a8f3a61458a07113a08bdcfe", - "reference": "208ef96122bfed82a8f3a61458a07113a08bdcfe", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", "shasum": "" }, "require": { @@ -4685,7 +4701,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.0" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" }, "funding": [ { @@ -4701,20 +4717,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-02-18T16:06:09+00:00" }, { "name": "symfony/string", - "version": "v6.0.1", + "version": "v6.0.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "0cfed595758ec6e0a25591bdc8ca733c1896af32" + "reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/0cfed595758ec6e0a25591bdc8ca733c1896af32", - "reference": "0cfed595758ec6e0a25591bdc8ca733c1896af32", + "url": "https://api.github.com/repos/symfony/string/zipball/522144f0c4c004c80d56fa47e40e17028e2eefc2", + "reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2", "shasum": "" }, "require": { @@ -4735,12 +4751,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -4770,7 +4786,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.1" + "source": "https://github.com/symfony/string/tree/v6.0.3" }, "funding": [ { @@ -4786,7 +4802,7 @@ "type": "tidelift" } ], - "time": "2021-12-08T15:13:44+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "theseer/tokenizer", @@ -4899,13 +4915,11 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "activecollab/databaseconnection": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.1" + "php": ">=8.0" }, "platform-dev": { "ext-mysqli": "*" From 4a4ba19e82e04aa8ffe5762dc6b454a88a669187 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Thu, 17 Mar 2022 12:13:07 +0100 Subject: [PATCH 27/61] Upgrade inflector --- composer.json | 2 +- composer.lock | 29 ++++++++++------------- src/Collection/Type.php | 14 ++++++++--- src/Entity/Entity.php | 4 ++-- src/Finder.php | 52 ++++++++++++++--------------------------- 5 files changed, 43 insertions(+), 58 deletions(-) diff --git a/composer.json b/composer.json index 8020b31..b4d09d1 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "activecollab/databaseconnection": "^5.0", "activecollab/etag": "^1.0", "activecollab/object": "^1.0", - "doctrine/inflector": "^1.0", + "doctrine/inflector": "^2.0", "psr/log": "^1.0.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index f9de493..0be59c7 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": "e1429e7d86962455ad5477d64fd730b6", + "content-hash": "ec7ee57e6dbbf8b2af7e8d998008ea1c", "packages": [ { "name": "activecollab/containeraccess", @@ -266,38 +266,33 @@ }, { "name": "doctrine/inflector", - "version": "1.4.4", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9" + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", - "reference": "4bd5c1cdfcd00e9e2d8c484f79150f67e5d355d9", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^8.2", "phpstan/phpstan": "^0.12", "phpstan/phpstan-phpunit": "^0.12", "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "vimeo/psalm": "^4.10" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, "autoload": { "psr-4": { - "Doctrine\\Inflector\\": "lib/Doctrine/Inflector", - "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + "Doctrine\\Inflector\\": "lib/Doctrine/Inflector" } }, "notification-url": "https://packagist.org/downloads/", @@ -342,7 +337,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/1.4.4" + "source": "https://github.com/doctrine/inflector/tree/2.0.4" }, "funding": [ { @@ -358,7 +353,7 @@ "type": "tidelift" } ], - "time": "2021-04-16T17:34:40+00:00" + "time": "2021-10-22T20:16:43+00:00" }, { "name": "nesbot/carbon", diff --git a/src/Collection/Type.php b/src/Collection/Type.php index 50c6d5f..120c02f 100644 --- a/src/Collection/Type.php +++ b/src/Collection/Type.php @@ -11,7 +11,7 @@ use ActiveCollab\DatabaseConnection\Result\ResultInterface; use ActiveCollab\DatabaseObject\Collection; use ActiveCollab\DatabaseObject\Entity\EntityInterface; -use Doctrine\Common\Inflector\Inflector; +use Doctrine\Inflector\InflectorFactory; use InvalidArgumentException; use LogicException; @@ -457,10 +457,18 @@ public function &setJoinTable($table_name, $join_field = null) } else { $registered_type = $this->getRegisteredType(); + $inflector = InflectorFactory::create()->build(); + if (($pos = strrpos($registered_type, '\\')) !== false) { - $this->target_join_field = Inflector::singularize(Inflector::tableize(substr($registered_type, $pos + 1))) . '_id'; + $this->target_join_field = sprintf( + '%s_id', + $inflector->singularize($inflector->tableize(substr($registered_type, $pos + 1))) + ); } else { - $this->target_join_field = Inflector::singularize(Inflector::tableize($registered_type)) . '_id'; + $this->target_join_field = sprintf( + '%s_id', + $inflector->singularize($inflector->tableize($registered_type)) + ); } } } diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 0125150..ef95089 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -21,7 +21,7 @@ use ActiveCollab\DateValue\DateValue; use ActiveCollab\DateValue\DateValueInterface; use DateTime; -use Doctrine\Common\Inflector\Inflector; +use Doctrine\Inflector\InflectorFactory; use InvalidArgumentException; use LogicException; use Psr\Log\LoggerInterface; @@ -801,7 +801,7 @@ protected function getAttributes() */ private function getAttributeSetter($attribute) { - return 'set' . Inflector::classify($attribute); + return sprintf('set%s', InflectorFactory::create()->build()->classify($attribute)); } /** diff --git a/src/Finder.php b/src/Finder.php index f1be5f3..f563508 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -14,43 +14,22 @@ use ActiveCollab\ContainerAccess\ContainerAccessInterface\Implementation as ContainerAccessInterfaceImplementation; use ActiveCollab\DatabaseConnection\ConnectionInterface; use ActiveCollab\DatabaseObject\Entity\EntityInterface; -use Doctrine\Common\Inflector\Inflector; -use InvalidArgumentException; +use Doctrine\Inflector\InflectorFactory; use Psr\Log\LoggerInterface; class Finder implements FinderInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - private $connection; - private $pool; - private $logger; - private $type; - - /** - * @var string[] - */ - private $where = []; - - /** - * @var string - */ - private $order_by; - - /** - * @var int|null - */ - private $offset; - - /** - * @var int|null - */ - private $limit; - - /** - * @var string - */ - private $join; + private ConnectionInterface $connection; + private PoolInterface $pool; + private LoggerInterface $logger; + private string $type; + private array $where = []; + private string $order_by; + private ?int $offset = null; + private ?int $limit = null; + private ?string $join = null; public function __construct( ConnectionInterface $connection, @@ -167,7 +146,7 @@ private function getJoinFieldNameFromType(): string $type = substr($this->getType(), $pos + 1); } - return Inflector::tableize($type) . '_id'; + return sprintf('%s_id', InflectorFactory::create()->build()->tableize($type)); } // --------------------------------------------------- @@ -178,7 +157,10 @@ public function count(): int { $table_name = $this->getEscapedTableName(); - $sql = "SELECT COUNT($table_name.`id`) AS 'row_count' FROM $table_name"; + $sql = sprintf("SELECT COUNT(%s.`id`) AS 'row_count' FROM %s", + $table_name, + $table_name + ); if ($this->join) { $sql .= " $this->join"; @@ -286,7 +268,7 @@ public function execute() // Utilities // --------------------------------------------------- - private $load_by_type_field; + private ?bool $load_by_type_field = null; private function loadByTypeField(): bool { @@ -320,7 +302,7 @@ private function getSelectFieldsSql(string $escaped_field_names): string return $result; } - private $escaped_table_name; + private ?string $escaped_table_name = null; private function getEscapedTableName(): string { From f54f94a7a79b9045a5265cfe297a81dcfde9c1d5 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 23 Apr 2022 16:28:14 +0200 Subject: [PATCH 28/61] Update database connection package --- composer.lock | 498 +++----------------------------------------------- 1 file changed, 21 insertions(+), 477 deletions(-) diff --git a/composer.lock b/composer.lock index 0be59c7..15e9d9d 100644 --- a/composer.lock +++ b/composer.lock @@ -59,26 +59,41 @@ }, { "name": "activecollab/databaseconnection", - "version": "5.0.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/activecollab/databaseconnection.git", - "reference": "85710eaebca7d0396dcb2db425e40b052e1a6956" + "reference": "f6dc0f67020beec643ce26b91267be836d317eea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/85710eaebca7d0396dcb2db425e40b052e1a6956", - "reference": "85710eaebca7d0396dcb2db425e40b052e1a6956", + "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/f6dc0f67020beec643ce26b91267be836d317eea", + "reference": "f6dc0f67020beec643ce26b91267be836d317eea", "shasum": "" }, "require": { "activecollab/containeraccess": "^2.0", "activecollab/datevalue": "^2.0", "ext-json": "*", + "ext-mbstring": "*", "ext-mysqli": "*", "php": ">=8.0", "psr/log": "^1.0.0" }, + "replace": { + "symfony/polyfill-ctype": "*", + "symfony/polyfill-mbstring": "*", + "symfony/polyfill-php54": "*", + "symfony/polyfill-php55": "*", + "symfony/polyfill-php56": "*", + "symfony/polyfill-php70": "*", + "symfony/polyfill-php71": "*", + "symfony/polyfill-php72": "*", + "symfony/polyfill-php73": "*", + "symfony/polyfill-php80": "*", + "symfony/polyfill-php81": "*", + "symfony/polyfill-util": "*" + }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", "phpunit/phpunit": "~9.0", @@ -109,9 +124,9 @@ ], "support": { "issues": "https://github.com/activecollab/databaseconnection/issues", - "source": "https://github.com/activecollab/databaseconnection/tree/5.0.0" + "source": "https://github.com/activecollab/databaseconnection/tree/5.1.0" }, - "time": "2022-03-03T09:01:59+00:00" + "time": "2022-04-23T14:23:34+00:00" }, { "name": "activecollab/datevalue", @@ -549,172 +564,6 @@ }, "time": "2021-05-03T11:20:27+00:00" }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-11-30T18:21:41+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-09-13T13:58:33+00:00" - }, { "name": "symfony/translation", "version": "v6.0.5", @@ -4038,88 +3887,6 @@ ], "time": "2022-01-02T09:53:40+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-10-20T20:35:02+00:00" - }, { "name": "symfony/polyfill-intl-grapheme", "version": "v1.24.0", @@ -4285,229 +4052,6 @@ ], "time": "2021-02-19T12:13:01+00:00" }, - { - "name": "symfony/polyfill-php70", - "version": "v1.20.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-main": "1.20-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-23T14:02:19+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T09:17:38+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.24.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", - "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-06-05T21:20:04+00:00" - }, { "name": "symfony/process", "version": "v5.4.5", From 2536eaa2f88554666d92028761031bdd1ab0f848 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 23 Apr 2022 20:46:44 +0200 Subject: [PATCH 29/61] Improve getTableName() method signature --- src/Collection/Type.php | 11 ++--------- src/Entity/Entity.php | 7 ++----- src/Entity/EntityInterface.php | 4 +--- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/Collection/Type.php b/src/Collection/Type.php index 120c02f..8d7f661 100644 --- a/src/Collection/Type.php +++ b/src/Collection/Type.php @@ -276,19 +276,12 @@ public function count() } } - /** - * Return model table name. - * - * @var string - */ - private $table_name; + private ?string $table_name = null; /** * Return model table name. - * - * @return mixed */ - public function getTableName() + public function getTableName(): string { if (empty($this->table_name)) { $this->table_name = $this->pool->getTypeTable($this->getRegisteredType()); diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index ef95089..8ee8cae 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -225,11 +225,8 @@ public function getPrimaryKey() { return $this->primary_key; } - - /** - * {@inheritdoc} - */ - public function getTableName() + + public function getTableName(): string { return $this->table_name; } diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index b0d2a07..162665d 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -75,10 +75,8 @@ public function getPrimaryKey(); /** * Return value of table name. - * - * @return string */ - public function getTableName(); + public function getTableName(): string; // --------------------------------------------------- // Flags From 49042ad83056ff11a73c40a3c48853fa0dedb2a0 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 24 Apr 2022 22:33:54 +0200 Subject: [PATCH 30/61] Prepare type read statement --- src/Entity/Entity.php | 46 +-- src/Entity/EntityInterface.php | 4 +- src/Pool.php | 349 ++++++++++-------- src/PoolInterface.php | 8 +- test/src/Base/TestCase.php | 36 +- test/src/Base/WritersTypeTestCase.php | 9 - test/src/EscapedTypeFieldsTest.php | 40 ++ .../SpatialEntity/Base/SpatialEntity.php | 239 ++++++++++++ .../Fixtures/SpatialEntity/SpatialEntity.php | 15 + .../StatSnapshots/Base/StatsSnapshot.php | 31 +- test/src/Fixtures/Users/Base/User.php | 15 +- test/src/Fixtures/Writers/BaseWriter.php | 17 +- 12 files changed, 547 insertions(+), 262 deletions(-) create mode 100644 test/src/EscapedTypeFieldsTest.php create mode 100644 test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php create mode 100644 test/src/Fixtures/SpatialEntity/SpatialEntity.php diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 8ee8cae..bc144f7 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -12,7 +12,6 @@ use ActiveCollab\ContainerAccess\ContainerAccessInterface\Implementation as ContainerAccessInterfaceImplementation; use ActiveCollab\DatabaseConnection\ConnectionInterface; use ActiveCollab\DatabaseConnection\Record\ValueCasterInterface; -use ActiveCollab\DatabaseObject\Exception\ValidationException; use ActiveCollab\DatabaseObject\PoolInterface; use ActiveCollab\DatabaseObject\Validator; use ActiveCollab\DatabaseObject\ValidatorInterface; @@ -36,48 +35,43 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface /** * Name of the table. - * - * @var string */ - protected $table_name; + protected string $table_name = ''; /** * Primary key fields. - * - * @var array */ - protected $primary_key = 'id'; + protected string $primary_key = 'id'; /** * Name of autoincrement field (if exists). - * - * @var string */ - protected $auto_increment = 'id'; + protected string $auto_increment = 'id'; /** * @var string[] */ - protected $order_by = ['id']; + protected array $order_by = ['id']; /** * Table fields that are managed by this entity. */ - protected $entity_fields = []; + protected array $entity_fields = []; + + /** + * Table fields prepared for SELECT SQL query. + */ + protected array $sql_read_statements = []; /** * Generated fields that are loaded, but not managed by the entity. - * - * @var array */ - protected $generated_entity_fields = []; + protected array $generated_entity_fields = []; /** * List of default field values. - * - * @var array */ - protected $default_entity_field_values = []; + protected array $default_entity_field_values = []; public function __construct( protected ConnectionInterface $connection, @@ -218,14 +212,11 @@ private function areFieldValuesSame($value_1, $value_2) } } - /** - * {@inheritdoc} - */ - public function getPrimaryKey() + public function getPrimaryKey(): string { return $this->primary_key; } - + public function getTableName(): string { return $this->table_name; @@ -240,8 +231,7 @@ public function getTableName(): string * * If $cache_row is set to true row data will be added to cache * - * @param array $row - * @throws InvalidArgumentException + * @param array $row */ public function loadFromRow(array $row) { @@ -284,7 +274,6 @@ public function loadFromRow(array $row) * Save object into database (insert or update). * * @return $this - * @throws ValidationException */ public function &save() { @@ -725,10 +714,9 @@ public function getOldFieldValue($field) * runs fine - modifications are saved, in case of primary key old value * will be remembered in case we need to update the row and so on * - * @param string $field - * @param mixed $value + * @param string $field + * @param mixed $value * @return $this - * @throws InvalidArgumentException */ public function &setFieldValue($field, $value) { diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index 162665d..9c2b051 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -68,10 +68,8 @@ public function &delete($bulk = false); /** * Return primary key columns. - * - * @return string */ - public function getPrimaryKey(); + public function getPrimaryKey(): string; /** * Return value of table name. diff --git a/src/Pool.php b/src/Pool.php index 22e3c88..4f03e21 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -27,13 +27,13 @@ class Pool implements PoolInterface, ProducerInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - protected $connection; - protected $logger; + protected ConnectionInterface $connection; + protected LoggerInterface $logger; /** * @var EntityInterface[] */ - private $objects_pool = []; + private array $objects_pool = []; public function __construct(ConnectionInterface $connection, LoggerInterface $logger) { @@ -45,17 +45,15 @@ public function produce($type, array $attributes = null, $save = true): EntityIn { $registered_type = $this->requireRegisteredType($type); - $object = $this->getProducerForRegisteredType($registered_type)->produce($type, $attributes, $save); + $object = $this + ->getProducerForRegisteredType($registered_type) + ->produce($type, $attributes, $save); - if ($object instanceof EntityInterface) { - if ($object->isLoaded()) { - $this->objects_pool[$registered_type][$object->getId()] = $object; - } - - return $object; - } else { - throw new RuntimeException("Failed to produce an instance of '$type'"); + if ($object->isLoaded()) { + $this->objects_pool[$registered_type][$object->getId()] = $object; } + + return $object; } public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface @@ -66,11 +64,11 @@ public function modify(EntityInterface &$instance, array $attributes = null, $sa $registered_type = $this->requireRegisteredType(get_class($instance)); - $instance = $this->getProducerForRegisteredType($registered_type)->modify($instance, $attributes, $save); + $instance = $this + ->getProducerForRegisteredType($registered_type) + ->modify($instance, $attributes, $save); - if ($instance instanceof EntityInterface) { - $this->objects_pool[$registered_type][$instance->getId()] = $instance; - } + $this->objects_pool[$registered_type][$instance->getId()] = $instance; return $instance; } @@ -93,7 +91,7 @@ public function scrap(EntityInterface &$instance, $force_delete = false): Entity return $instance; } - private $default_producer_class = Producer::class; + private string $default_producer_class = Producer::class; public function getDefaultProducerClass(): string { @@ -116,10 +114,7 @@ public function setDefaultProducerClass(string $default_producer_class): PoolInt return $this; } - /** - * @var ProducerInterface - */ - private $default_producer; + private ?ProducerInterface $default_producer = null; public function getDefaultProducer(): ProducerInterface { @@ -146,15 +141,15 @@ public function setDefaultProducer(ProducerInterface $producer): PoolInterface /** * @var ProducerInterface[] */ - private $producers = []; + private array $producers = []; protected function getProducerForRegisteredType(string $registered_type): ProducerInterface { if (empty($this->producers[$registered_type])) { return $this->getDefaultProducer(); - } else { - return $this->producers[$registered_type]; } + + return $this->producers[$registered_type]; } public function registerProducer(string $type, ProducerInterface $producer): PoolInterface @@ -199,36 +194,36 @@ public function getById(string $type, int $id, bool $use_cache = true): ?EntityI { $registered_type = $this->requireRegisteredType($type); - $id = (int) $id; - if ($id < 1) { throw new InvalidArgumentException('ID is expected to be a number larger than 0'); } if (isset($this->objects_pool[$registered_type][$id]) && $use_cache) { return $this->objects_pool[$registered_type][$id]; - } else { - $type_fields = $this->getTypeFields($registered_type); + } - if ($row = $this->connection->executeFirstRow($this->getSelectOneByType($registered_type), [$id])) { - $object_class = in_array('type', $type_fields) ? $row['type'] : $type; + $type_fields = $this->getTypeFields($registered_type); - /** @var object|EntityInterface $object */ - $object = new $object_class($this->connection, $this, $this->logger); + $row = $this->connection->executeFirstRow($this->getSelectOneByType($registered_type), [$id]); - if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { - $object->setContainer($this->getContainer()); - } + if (empty($row)) { + $object = null; + + return $this->addToObjectPool($registered_type, $id, $object); + } - $object->loadFromRow($row); + $object_class = in_array('type', $type_fields) ? $row['type'] : $type; - return $this->addToObjectPool($registered_type, $id, $object); - } else { - $object = null; + /** @var object|EntityInterface $object */ + $object = new $object_class($this->connection, $this, $this->logger); - return $this->addToObjectPool($registered_type, $id, $object); - } + if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { + $object->setContainer($this->getContainer()); } + + $object->loadFromRow($row); + + return $this->addToObjectPool($registered_type, $id, $object); } public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface @@ -251,8 +246,6 @@ public function isInPool(string $type, int $id): bool { $this->requireRegisteredType($type); - $id = (int) $id; - if ($id < 1) { throw new InvalidArgumentException('ID is expected to be a number larger than 0'); } @@ -260,15 +253,11 @@ public function isInPool(string $type, int $id): bool return isset($this->objects_pool[$type][$id]); } - /** - * Add object to the object pool. - * - * @param string $registered_type - * @param int $id - * @param EntityInterface|null $value_to_store - * @return EntityInterface - */ - private function &addToObjectPool($registered_type, $id, &$value_to_store) + private function &addToObjectPool( + string $registered_type, + int $id, + ?EntityInterface $value_to_store + ): ?EntityInterface { if (empty($this->objects_pool[$registered_type])) { $this->objects_pool[$registered_type] = []; @@ -281,11 +270,15 @@ private function &addToObjectPool($registered_type, $id, &$value_to_store) public function remember(EntityInterface $object): void { - if ($object->isLoaded()) { - $this->addToObjectPool($this->requireRegisteredType(get_class($object)), $object->getId(), $object); - } else { + if (!$object->isLoaded()) { throw new InvalidArgumentException('Object needs to be saved in the database to be remembered'); } + + $this->addToObjectPool( + $this->requireRegisteredType(get_class($object)), + $object->getId(), + $object + ); } public function forget(string $type, int ...$ids_to_forget): void { @@ -305,19 +298,26 @@ public function forget(string $type, int ...$ids_to_forget): void /** * Return number of records of the given type that match the given conditions. * - * @param string $type - * @param array|string|null $conditions - * @return int + * @param array|string|null $conditions */ public function count(string $type, $conditions = null): int { $this->requireRegisteredType($type); - if ($conditions = $this->connection->prepareConditions($conditions)) { - return $this->connection->executeFirstCell('SELECT COUNT(`id`) AS "row_count" FROM ' . $this->getTypeTable($type, true) . " WHERE $conditions"); - } else { - return $this->connection->executeFirstCell('SELECT COUNT(`id`) AS "row_count" FROM ' . $this->getTypeTable($type, true)); + $conditions = $this->connection->prepareConditions($conditions); + + if ($conditions) { + return $this->connection->executeFirstCell( + sprintf('SELECT COUNT(`id`) AS "row_count" FROM %s WHERE %s', + $this->getTypeTable($type, true), + $conditions + ) + ); } + + return $this->connection->executeFirstCell( + sprintf('SELECT COUNT(`id`) AS "row_count" FROM %s', $this->getTypeTable($type, true)) + ); } /** @@ -383,15 +383,35 @@ public function findBySql(string $type, string $sql, ...$arguments) } if ($this->hasContainer()) { - return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->logger], $this->getContainer()); - } else { - return $this->connection->advancedExecute($sql, $arguments, ConnectionInterface::LOAD_ALL_ROWS, $return_by, $return_by_value, [&$this->connection, &$this, &$this->logger]); - } + return $this->connection->advancedExecute( + $sql, + $arguments, + ConnectionInterface::LOAD_ALL_ROWS, + $return_by, + $return_by_value, + [ + &$this->connection, + &$this, + &$this->logger, + ], + $this->getContainer() + ); + } + + return $this->connection->advancedExecute( + $sql, + $arguments, + ConnectionInterface::LOAD_ALL_ROWS, + $return_by, + $return_by_value, + [ + &$this->connection, + &$this, + &$this->logger, + ] + ); } - /** - * {@inheritdoc} - */ public function getTypeTable(string $type, bool $escaped = false): string { $registered_type = $this->requireRegisteredType($type); @@ -417,15 +437,7 @@ public function getGeneratedTypeFields(string $type): array return $this->types[$this->requireRegisteredType($type)]['generated_fields']; } - /** - * Get a particular type property, and make it (using $callback) if it is not set already. - * - * @param string $type - * @param string $property - * @param callable $callback - * @return mixed - */ - public function getTypeProperty(string $type, string $property, callable $callback) + public function getTypeProperty(string $type, string $property, callable $callback): mixed { $registered_type = $this->requireRegisteredType($type); @@ -438,14 +450,15 @@ public function getTypeProperty(string $type, string $property, callable $callba /** * Return select by ID-s query for the given type. - * - * @param string $type - * @return string */ - private function getSelectOneByType($type) + private function getSelectOneByType(string $type): string { if (empty($this->types[$type]['sql_select_by_ids'])) { - $this->types[$type]['sql_select_by_ids'] = 'SELECT ' . $this->getEscapedTypeFields($type) . ' FROM ' . $this->getTypeTable($type, true) . ' WHERE `id` IN ? ORDER BY `id`'; + $this->types[$type]['sql_select_by_ids'] = sprintf( + 'SELECT %s FROM %s WHERE `id` IN ? ORDER BY `id`', + $this->getEscapedTypeFields($type), + $this->getTypeTable($type, true) + ); } return $this->types[$type]['sql_select_by_ids']; @@ -453,21 +466,48 @@ private function getSelectOneByType($type) public function getEscapedTypeFields(string $type): string { - return $this->getTypeProperty($type, 'escaped_fields', function () use ($type) { - $table_name = $this->getTypeTable($type, true); + return $this->getTypeProperty( + $type, + 'escaped_fields', + function () use ($type) { + $table_name = $this->getTypeTable($type, true); - $escaped_field_names = []; + $escaped_field_names = []; - foreach ($this->getTypeFields($type) as $field_name) { - $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); - } + foreach ($this->getTypeFields($type) as $field_name) { + $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + } - foreach ($this->getGeneratedTypeFields($type) as $field_name) { - $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + foreach ($this->getGeneratedTypeFields($type) as $field_name) { + $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + } + + return implode(',', $escaped_field_names); } + ); + } + + public function getTypeFieldsReadStatement(string $type): string + { + return $this->getTypeProperty( + $type, + 'escaped_fields', + function () use ($type) { + $table_name = $this->getTypeTable($type, true); - return implode(',', $escaped_field_names); - }); + $escaped_field_names = []; + + foreach ($this->getTypeFields($type) as $field_name) { + $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + } + + foreach ($this->getGeneratedTypeFields($type) as $field_name) { + $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + } + + return implode(',', $escaped_field_names); + } + ); } public function getTypeOrderBy(string $type): array @@ -477,23 +517,30 @@ public function getTypeOrderBy(string $type): array public function getEscapedTypeOrderBy(string $type): string { - return $this->getTypeProperty($type, 'escaped_order_by', function () use ($type) { - $table_name = $this->getTypeTable($type, true); + return $this->getTypeProperty( + $type, + 'escaped_order_by', + function () use ($type) { + $table_name = $this->getTypeTable($type, true); + + return implode( + ',', + array_map( + function ($field_name) use ($table_name) { + if (str_starts_with($field_name, '!')) { + return $table_name . '.' . $this->connection->escapeFieldName(substr($field_name, 1)) . ' DESC'; + } - return implode(',', array_map(function ($field_name) use ($table_name) { - if (substr($field_name, 0, 1) == '!') { - return $table_name . '.' . $this->connection->escapeFieldName(substr($field_name, 1)) . ' DESC'; - } else { - return $table_name . '.' . $this->connection->escapeFieldName($field_name); - } - }, $this->getTypeOrderBy($type))); - }); + return $table_name . '.' . $this->connection->escapeFieldName($field_name); + }, + $this->getTypeOrderBy($type) + ) + ); + } + ); } - /** - * @var array - */ - private $types = []; + private array $types = []; public function getRegisteredTypes(): array { @@ -502,16 +549,11 @@ public function getRegisteredTypes(): array /** * Cached type to registered type map. - * - * @var array */ - private $known_types = []; + private array $known_types = []; /** * Return registered type for the given $type. This function is subclassing aware. - * - * @param string $type - * @return string|null */ public function getRegisteredType(string $type): ?string { @@ -545,11 +587,13 @@ public function getRegisteredType(string $type): ?string public function requireRegisteredType(string $type): string { - if ($registered_type = $this->getRegisteredType($type)) { - return $registered_type; - } else { + $registered_type = $this->getRegisteredType($type); + + if (empty($registered_type)) { throw new InvalidArgumentException("Type '$type' is not registered"); } + + return $registered_type; } public function isTypeRegistered(string $type): bool @@ -557,19 +601,13 @@ public function isTypeRegistered(string $type): bool return (bool) $this->getRegisteredType($type); } - /** - * @var string|null - */ - private $polymorph_type_interface; + private ?string $polymorph_type_interface = null; public function getPolymorphTypeInterface(): ?string { return $this->polymorph_type_interface; } - /** - * {@inheritdoc} - */ public function &setPolymorphTypeInterface(?string $value): PoolInterface { $this->polymorph_type_interface = $value; @@ -577,16 +615,10 @@ public function &setPolymorphTypeInterface(?string $value): PoolInterface return $this; } - /** - * @var array - */ - private $polymorph_types = []; + private array $polymorph_types = []; /** * Return true if $type is polymorph (has type column that is used to figure out a class of individual record). - * - * @param string $type - * @return bool */ public function isTypePolymorph(string $type): bool { @@ -613,42 +645,42 @@ public function registerType(string ...$types): PoolInterface foreach ($types as $type) { $type = ltrim($type, '\\'); - if (class_exists($type, true)) { - $reflection = new ReflectionClass($type); + if (!class_exists($type, true)) { + throw new InvalidArgumentException(sprintf("Type '%s' is not defined.", $type)); + } - if ($reflection->implementsInterface(EntityInterface::class)) { - $default_properties = $reflection->getDefaultProperties(); + $reflection = new ReflectionClass($type); - if (empty($default_properties['order_by'])) { - $default_properties['order_by'] = ''; - } + if (!$reflection->implementsInterface(EntityInterface::class)) { + throw new InvalidArgumentException( + sprintf( + "Type '%s' does not implement '%s' interface.", + $type, + EntityInterface::class + ) + ); + } - $this->types[$type] = [ - 'table_name' => $default_properties['table_name'], - 'fields' => $default_properties['entity_fields'], - 'generated_fields' => $default_properties['generated_entity_fields'], - 'order_by' => $default_properties['order_by'], - ]; - } else { - throw new InvalidArgumentException("Type '$type' does not implement '" . EntityInterface::class . "' interface"); - } - } else { - throw new InvalidArgumentException("Type '$type' is not defined"); + $default_properties = $reflection->getDefaultProperties(); + + if (empty($default_properties['order_by'])) { + $default_properties['order_by'] = ''; } + + $this->types[$type] = [ + 'table_name' => $default_properties['table_name'], + 'fields' => $default_properties['entity_fields'], + 'generated_fields' => $default_properties['generated_entity_fields'], + 'order_by' => $default_properties['order_by'], + ]; } return $this; } - /** - * @var TraitsResolverInterface - */ - private $traits_resolver; + private ?TraitsResolverInterface $traits_resolver = null; - /** - * @return TraitsResolverInterface - */ - private function &getTraitsResolver() + private function getTraitsResolver(): TraitsResolverInterface { if (empty($this->traits_resolver)) { $this->traits_resolver = new TraitsResolver(); @@ -661,10 +693,7 @@ private function &getTraitsResolver() * Return trait names by object. * * Note: $type does not need to be directly registered, because we need to support subclasses, which call can have - * different traits impelemnted! - * - * @param string $type - * @return array + * different traits implemented! */ public function getTraitNamesByType(string $type): array { diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 03b3c3a..aca6e01 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -82,14 +82,10 @@ public function getGeneratedTypeFields(string $type): array; /** * Get a particular type property, and make it (using $callback) if it is not set already. - * - * @param string $type - * @param string $property - * @param callable $callback - * @return mixed */ - public function getTypeProperty(string $type, string $property, callable $callback); + public function getTypeProperty(string $type, string $property, callable $callback): mixed; public function getEscapedTypeFields(string $type): string; + public function getTypeFieldsReadStatement(string $type): string; public function getTypeOrderBy(string $type): array; public function getEscapedTypeOrderBy(string $type): string; public function getRegisteredTypes(): array; diff --git a/test/src/Base/TestCase.php b/test/src/Base/TestCase.php index 0f616c4..3964682 100644 --- a/test/src/Base/TestCase.php +++ b/test/src/Base/TestCase.php @@ -6,11 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Base; -use ActiveCollab\DatabaseConnection\Connection; use ActiveCollab\DatabaseConnection\Connection\MysqliConnection; +use ActiveCollab\DatabaseConnection\ConnectionInterface; use ActiveCollab\DatabaseObject\Pool; +use ActiveCollab\DatabaseObject\PoolInterface; use Monolog\Handler\TestHandler; use Monolog\Logger; use mysqli; @@ -19,30 +22,12 @@ use PHPUnit\Framework\TestCase as BaseTestCase; use RuntimeException; -/** - * @package ActiveCollab\DatabaseObject\Test\Base - */ abstract class TestCase extends BaseTestCase { - /** - * @var mysqli - */ - protected $link; - - /** - * @var Connection - */ - protected $connection; - - /** - * @var Pool - */ - protected $pool; - - /** - * @var LoggerInterface - */ - protected $logger; + protected mysqli $link; + protected ConnectionInterface $connection; + protected PoolInterface $pool; + protected LoggerInterface $logger; public function setUp(): void { @@ -69,13 +54,8 @@ public function setUp(): void $this->logger->pushHandler(new TestHandler()); } - /** - * Tear down test environment. - */ public function tearDown(): void { - $this->connection = null; - $this->pool = null; $this->link->close(); parent::tearDown(); diff --git a/test/src/Base/WritersTypeTestCase.php b/test/src/Base/WritersTypeTestCase.php index 9a686a5..0d179f8 100644 --- a/test/src/Base/WritersTypeTestCase.php +++ b/test/src/Base/WritersTypeTestCase.php @@ -11,14 +11,8 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DateValue\DateValue; -/** - * @package ActiveCollab\DatabaseObject\Test\Base - */ abstract class WritersTypeTestCase extends TestCase { - /** - * Set up test environment. - */ public function setUp(): void { parent::setUp(); @@ -53,9 +47,6 @@ public function setUp(): void $this->assertTrue($this->pool->isTypeRegistered(Writer::class)); } - /** - * Tear down test environment. - */ public function tearDown(): void { if ($this->connection->tableExists('writers')) { diff --git a/test/src/EscapedTypeFieldsTest.php b/test/src/EscapedTypeFieldsTest.php new file mode 100644 index 0000000..06cb368 --- /dev/null +++ b/test/src/EscapedTypeFieldsTest.php @@ -0,0 +1,40 @@ +. All rights reserved. + */ + +declare(strict_types=1); + +namespace ActiveCollab\DatabaseObject\Test; + +use ActiveCollab\DatabaseObject\Test\Base\TestCase; +use ActiveCollab\DatabaseObject\Test\Fixtures\SpatialEntity\Base\SpatialEntity; + +class EscapedTypeFieldsTest extends TestCase +{ + public function setUp(): void + { + parent::setUp(); + + $this->pool->registerType(SpatialEntity::class); + } + + public function testWillEscapeFieldNames(): void + { + $this->assertSame( + '`spatial_entities`.`id`,`spatial_entities`.`name`,`spatial_entities`.`polygon`', + $this->pool->getEscapedTypeFields(SpatialEntity::class) + ); + } + + public function testWillPrepareTypeSqlReadStatement(): void + { + $this->assertSame( + "`spatial_entities`.`id`,`spatial_entities`.`name`,ST_GEOMFROMTEXT(`spatial_entities`.`polygon`) AS 'polygon'", + $this->pool->getTypeFieldsReadStatement(SpatialEntity::class) + ); + } +} diff --git a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php new file mode 100644 index 0000000..c310c42 --- /dev/null +++ b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php @@ -0,0 +1,239 @@ +. All rights reserved. + */ + +declare(strict_types=1); + +namespace ActiveCollab\DatabaseObject\Test\Fixtures\SpatialEntity\Base; + +use ActiveCollab\DatabaseConnection\Record\ValueCaster; +use ActiveCollab\DatabaseConnection\Record\ValueCasterInterface; +use ActiveCollab\DatabaseObject\Entity\Entity; +use ActiveCollab\DatabaseObject\ValidatorInterface; + +abstract class SpatialEntity extends Entity +{ + /** + * Name of the table where records are stored. + */ + protected string $table_name = 'spatial_entities'; + + /** + * Table fields that are managed by this entity. + */ + protected array $entity_fields = [ + 'id', + 'name', + 'polygon', + ]; + + /** + * Table fields prepared for SELECT SQL query. + */ + protected array $sql_read_statements = [ + '`id`', + '`name`', + 'ST_GEOMFROMTEXT(`polygon`) AS \'polygon\'', + ]; + + /** + * Generated fields that are loaded, but not managed by the entity. + * + * @var array + */ + protected array $generated_entity_fields = []; + + /** + * List of default field values. + */ + protected array $default_entity_field_values = []; + + /** + * Return value of name field. + * + * @return string + */ + public function getName() + { + return $this->getFieldValue('name'); + } + + /** + * Set value of name field. + * + * @param string $value + * @return $this + */ + public function &setName($value) + { + $this->setFieldValue('name', $value); + + return $this; + } + + /** + * Return value of day field. + * + * @return \ActiveCollab\DateValue\DateValueInterface|null + */ + public function getDay() + { + return $this->getFieldValue('day'); + } + + /** + * Set value of day field. + * + * @param \ActiveCollab\DateValue\DateValueInterface|null $value + * @return $this + */ + public function &setDay($value) + { + $this->setFieldValue('day', $value); + + return $this; + } + + /** + * Return value of is_used_on_day field. + * + * @return bool + */ + public function isUsedOnDay() + { + return $this->getFieldValue('is_used_on_day'); + } + + /** + * Return value of is_used_on_day field. + * + * @return bool + * @deprecated use isUsedOnDay() + */ + public function getIsUsedOnDay() + { + return $this->getFieldValue('is_used_on_day'); + } + + /** + * Return value of plan_name field. + * + * @return string + */ + public function getPlanName() + { + return $this->getFieldValue('plan_name'); + } + + /** + * Return value of number_of_users field. + * + * @return int + */ + public function getNumberOfUsers() + { + return $this->getFieldValue('number_of_users'); + } + + /** + * Return value of stats field. + * + * @return mixed + */ + public function getStats() + { + return $this->getFieldValue('stats'); + } + + /** + * Set value of stats field. + * + * @param mixed $value + * @return $this + */ + public function &setStats($value) + { + $this->setFieldValue('stats', $value); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function getFieldValue($field, $default = null) + { + $value = parent::getFieldValue($field, $default); + + if ($value === null) { + return null; + } else { + switch ($field) { + case 'stats': + return json_decode($value, true); + } + + return $value; + } + } + + /** + * {@inheritdoc} + */ + public function &setFieldValue($name, $value) + { + if ($value === null) { + parent::setFieldValue($name, null); + } else { + switch ($name) { + case 'id': + case 'name': + return parent::setFieldValue($name, (string) $value); + case 'day': + return parent::setFieldValue($name, $this->getDateTimeValueInstanceFrom($value)); + case 'stats': + return parent::setFieldValue($name, $this->isLoading() ? $value : json_encode($value)); + default: + if ($this->isLoading()) { + return parent::setFieldValue($name, $value); + } else { + if ($this->isGeneratedField($name)) { + throw new \LogicException("Generated field $name cannot be set by directly assigning a value"); + } else { + throw new \InvalidArgumentException("Field $name does not exist in this table"); + } + } + } + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function jsonSerialize() + { + return array_merge(parent::jsonSerialize(), [ + 'account_id' => $this->getAccountId(), + 'day' => $this->getDay(), + 'is_used_on_day' => $this->getIsUsedOnDay(), + 'stats' => $this->getStats(), + ]); + } + + /** + * {@inheritdoc} + */ + public function validate(ValidatorInterface &$validator) + { + $validator->present('day'); + $validator->present('account_id'); + + parent::validate($validator); + } +} diff --git a/test/src/Fixtures/SpatialEntity/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/SpatialEntity.php new file mode 100644 index 0000000..4f6628f --- /dev/null +++ b/test/src/Fixtures/SpatialEntity/SpatialEntity.php @@ -0,0 +1,15 @@ +. All rights reserved. + */ + +declare(strict_types=1); + +namespace ActiveCollab\DatabaseObject\Test\Fixtures\SpatialEntity; + +class SpatialEntity extends Base\SpatialEntity +{ +} diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index d77a285..d32eeaf 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -20,42 +20,47 @@ abstract class StatsSnapshot extends Entity { /** * Name of the table where records are stored. - * - * @var string */ - protected $table_name = 'stats_snapshots'; + protected string $table_name = 'stats_snapshots'; /** * Table fields that are managed by this entity. * * @var array */ - protected $entity_fields = ['id', 'account_id', 'day', 'stats']; + protected array $entity_fields = ['id', 'account_id', 'day', 'stats']; + + /** + * Table fields prepared for SELECT SQL query. + */ + protected array $sql_read_statements = ['`id`', '`account_id`', '`day`', '`stats`']; /** * Generated fields that are loaded, but not managed by the entity. * * @var array */ - protected $generated_entity_fields = ['is_used_on_day', 'plan_name', 'number_of_users']; + protected array $generated_entity_fields = ['is_used_on_day', 'plan_name', 'number_of_users']; /** * List of default field values. - * - * @var array */ - protected $default_entity_field_values = []; + protected array $default_entity_field_values = []; /** * {@inheritdoc} */ protected function configure() { - $this->setGeneratedFieldsValueCaster(new ValueCaster([ - 'is_used_on_day' => ValueCasterInterface::CAST_BOOL, - 'plan_name' => ValueCasterInterface::CAST_STRING, - 'number_of_users' => ValueCasterInterface::CAST_INT, - ])); + $this->setGeneratedFieldsValueCaster( + new ValueCaster( + [ + 'is_used_on_day' => ValueCasterInterface::CAST_BOOL, + 'plan_name' => ValueCasterInterface::CAST_STRING, + 'number_of_users' => ValueCasterInterface::CAST_INT, + ] + ) + ); } /** diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index d7a4904..c073487 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -18,24 +18,25 @@ abstract class User extends Entity { /** * Name of the table where records are stored. - * - * @var string */ - protected $table_name = 'users'; + protected string $table_name = 'users'; /** * All table fields. * * @var array */ - protected $entity_fields = ['id', 'type', 'first_name', 'last_name', 'email', 'homepage_url', 'password']; + protected array $entity_fields = ['id', 'type', 'first_name', 'last_name', 'email', 'homepage_url', 'password']; + + /** + * Table fields prepared for SELECT SQL query. + */ + protected array $sql_read_statements = ['`id`', '`type`', '`first_name`', '`last_name`', '`email`', '`homepage_url`', '`password`']; /** * List of default field values. - * - * @var array */ - protected $default_entity_field_values = [ + protected array $default_entity_field_values = [ 'type' => 'ActiveCollab\DatabaseObject\Test\Fixtures\Users\User', 'first_name' => '', 'last_name' => '', diff --git a/test/src/Fixtures/Writers/BaseWriter.php b/test/src/Fixtures/Writers/BaseWriter.php index 52809e5..7f7d7cd 100644 --- a/test/src/Fixtures/Writers/BaseWriter.php +++ b/test/src/Fixtures/Writers/BaseWriter.php @@ -20,36 +20,39 @@ abstract class BaseWriter extends Entity implements EntityInterface { /** * Name of the table where records are stored. - * - * @var string */ - protected $table_name = 'writers'; + protected string $table_name = 'writers'; /** * All table fields. * * @var array */ - protected $entity_fields = ['id', 'name', 'birthday', 'created_at', 'updated_at']; + protected array $entity_fields = ['id', 'name', 'birthday', 'created_at', 'updated_at']; + + /** + * Table fields prepared for SELECT SQL query. + */ + protected array $sql_read_statements = ['`id`', '`name`', '`birthday`', '`created_at`', '`updated_at`']; /** * List of default field values. * * @var array */ - protected $default_entity_field_values = ['name' => 'Unknown Writer']; + protected array $default_entity_field_values = ['name' => 'Unknown Writer']; /** * Name of AI field (if any). * * @var string */ - protected $auto_increment = 'id'; + protected string $auto_increment = 'id'; /** * @var string[] */ - protected $order_by = ['!id']; + protected array $order_by = ['!id']; /** * Return value of name field. From 07aa3809f014d8853f7c1ef21661dfbd38344a8f Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 24 Apr 2022 22:46:27 +0200 Subject: [PATCH 31/61] Fix SQL read statements in fixtures --- test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php | 6 +++--- test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php | 7 ++++++- test/src/Fixtures/Users/Base/User.php | 10 +++++++++- test/src/Fixtures/Writers/BaseWriter.php | 8 +++++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php index c310c42..ac3c3d6 100644 --- a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php +++ b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php @@ -35,9 +35,9 @@ abstract class SpatialEntity extends Entity * Table fields prepared for SELECT SQL query. */ protected array $sql_read_statements = [ - '`id`', - '`name`', - 'ST_GEOMFROMTEXT(`polygon`) AS \'polygon\'', + '`spatial_entities`.`id`', + '`spatial_entities`.`name`', + 'ST_GEOMFROMTEXT(`spatial_entities`.`polygon`) AS \'polygon\'', ]; /** diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index d32eeaf..5fa4e8e 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -33,7 +33,12 @@ abstract class StatsSnapshot extends Entity /** * Table fields prepared for SELECT SQL query. */ - protected array $sql_read_statements = ['`id`', '`account_id`', '`day`', '`stats`']; + protected array $sql_read_statements = [ + '`stats_snapshots`.`id`', + '`stats_snapshots`.`account_id`', + '`stats_snapshots`.`day`', + '`stats_snapshots`.`stats`', + ]; /** * Generated fields that are loaded, but not managed by the entity. diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index c073487..bc2f5d9 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -31,7 +31,15 @@ abstract class User extends Entity /** * Table fields prepared for SELECT SQL query. */ - protected array $sql_read_statements = ['`id`', '`type`', '`first_name`', '`last_name`', '`email`', '`homepage_url`', '`password`']; + protected array $sql_read_statements = [ + '`users`.`id`', + '`users`.`type`', + '`users`.`first_name`', + '`users`.`last_name`', + '`users`.`email`', + '`users`.`homepage_url`', + '`users`.`password`', + ]; /** * List of default field values. diff --git a/test/src/Fixtures/Writers/BaseWriter.php b/test/src/Fixtures/Writers/BaseWriter.php index 7f7d7cd..51209a1 100644 --- a/test/src/Fixtures/Writers/BaseWriter.php +++ b/test/src/Fixtures/Writers/BaseWriter.php @@ -33,7 +33,13 @@ abstract class BaseWriter extends Entity implements EntityInterface /** * Table fields prepared for SELECT SQL query. */ - protected array $sql_read_statements = ['`id`', '`name`', '`birthday`', '`created_at`', '`updated_at`']; + protected array $sql_read_statements = [ + '`writers`.`id`', + '`writers`.`name`', + '`writers`.`birthday`', + '`writers`.`created_at`', + '`writers`.`updated_at`', + ]; /** * List of default field values. From 21043abe2c0743d866699935e0839e1f0f0c3253 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 24 Apr 2022 22:54:13 +0200 Subject: [PATCH 32/61] Use SQL read statement instead of simple list of escaped field names --- src/Pool.php | 19 ++++++++++++------- test/src/GeneratedFieldsTest.php | 4 ++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index 4f03e21..d671fed 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -437,6 +437,10 @@ public function getGeneratedTypeFields(string $type): array return $this->types[$this->requireRegisteredType($type)]['generated_fields']; } + public function getTypeSqlReadStatements(string $type): array + { + return $this->types[$this->requireRegisteredType($type)]['sql_read_statements']; + } public function getTypeProperty(string $type, string $property, callable $callback): mixed { $registered_type = $this->requireRegisteredType($type); @@ -456,7 +460,7 @@ private function getSelectOneByType(string $type): string if (empty($this->types[$type]['sql_select_by_ids'])) { $this->types[$type]['sql_select_by_ids'] = sprintf( 'SELECT %s FROM %s WHERE `id` IN ? ORDER BY `id`', - $this->getEscapedTypeFields($type), + $this->getTypeFieldsReadStatement($type), $this->getTypeTable($type, true) ); } @@ -491,21 +495,21 @@ public function getTypeFieldsReadStatement(string $type): string { return $this->getTypeProperty( $type, - 'escaped_fields', + 'field_read_statements', function () use ($type) { $table_name = $this->getTypeTable($type, true); - $escaped_field_names = []; + $field_read_statements = []; - foreach ($this->getTypeFields($type) as $field_name) { - $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + foreach ($this->getTypeSqlReadStatements($type) as $sql_read_statement) { + $field_read_statements[] = $sql_read_statement; } foreach ($this->getGeneratedTypeFields($type) as $field_name) { - $escaped_field_names[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); + $field_read_statements[] = $table_name . '.' . $this->connection->escapeFieldName($field_name); } - return implode(',', $escaped_field_names); + return implode(',', $field_read_statements); } ); } @@ -671,6 +675,7 @@ public function registerType(string ...$types): PoolInterface 'table_name' => $default_properties['table_name'], 'fields' => $default_properties['entity_fields'], 'generated_fields' => $default_properties['generated_entity_fields'], + 'sql_read_statements' => $default_properties['sql_read_statements'], 'order_by' => $default_properties['order_by'], ]; } diff --git a/test/src/GeneratedFieldsTest.php b/test/src/GeneratedFieldsTest.php index 43384a3..2e1fdaa 100644 --- a/test/src/GeneratedFieldsTest.php +++ b/test/src/GeneratedFieldsTest.php @@ -117,6 +117,10 @@ public function testPoolIncludesGeneratedFieldsInTypeFieldsList() $escaped_type_fields = $this->pool->getEscapedTypeFields(StatsSnapshot::class); $this->assertIsString($escaped_type_fields); $this->assertStringContainsString('is_used_on_day', $escaped_type_fields); + + $type_fields_read_statement = $this->pool->getTypeFieldsReadStatement(StatsSnapshot::class); + $this->assertIsString($type_fields_read_statement); + $this->assertStringContainsString('is_used_on_day', $type_fields_read_statement); } public function testGeneratedFieldsAreHydrated() From ec70acb3971eb9f9fcc87faeceaefacf3e17f358 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 24 Apr 2022 22:58:34 +0200 Subject: [PATCH 33/61] Improve types in pool interface --- src/Finder.php | 10 +++++++--- src/Pool.php | 7 ++----- src/PoolInterface.php | 10 ++-------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Finder.php b/src/Finder.php index f563508..7f51eee 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -52,7 +52,7 @@ public function getType(): string public function getSelectSql(): string { - return $this->getSelectFieldsSql($this->pool->getEscapedTypeFields($this->type)); + return $this->getSelectFieldsSql($this->pool->getTypeFieldsReadStatement($this->type)); } public function getSelectIdsSql(): string @@ -279,9 +279,13 @@ private function loadByTypeField(): bool return $this->load_by_type_field; } - private function getSelectFieldsSql(string $escaped_field_names): string + private function getSelectFieldsSql(string $fields_read_statement): string { - $result = "SELECT $escaped_field_names FROM " . $this->getEscapedTableName(); + $result = sprintf( + 'SELECT %s FROM %s', + $fields_read_statement, + $this->getEscapedTableName() + ); if ($this->join) { $result .= " $this->join"; diff --git a/src/Pool.php b/src/Pool.php index d671fed..e851a45 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -300,7 +300,7 @@ public function forget(string $type, int ...$ids_to_forget): void * * @param array|string|null $conditions */ - public function count(string $type, $conditions = null): int + public function count(string $type, mixed $conditions = null): int { $this->requireRegisteredType($type); @@ -359,10 +359,7 @@ public function getDefaultFinderClass(): string return Finder::class; } - /** - * {@inheritdoc} - */ - public function findBySql(string $type, string $sql, ...$arguments) + public function findBySql(string $type, string $sql, mixed ...$arguments): mixed { if (empty($type)) { throw new InvalidArgumentException('Type is required'); diff --git a/src/PoolInterface.php b/src/PoolInterface.php index aca6e01..930e944 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -36,11 +36,9 @@ public function forget(string $type, int ...$ids_to_forget): void; /** * Return number of records of the given type that match the given conditions. * - * @param string $type * @param array|string|null $conditions - * @return int */ - public function count(string $type, $conditions = null): int; + public function count(string $type, mixed $conditions = null): int; /** * Return true if object of the given type with the given ID exists. @@ -62,13 +60,9 @@ public function find(string $type): FinderInterface; /** * Return result by a prepared SQL statement. * - * @param string $type - * @param string $sql - * @param mixed $arguments * @return ResultInterface|EntityInterface[]|null */ - public function findBySql(string $type, string $sql, ...$arguments); - + public function findBySql(string $type, string $sql, mixed ...$arguments): mixed; public function getTypeTable(string $type, bool $escaped = false): string; /** From 4ba3bd4d9a19253c635463beb49f8c1d632f5a65 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Mon, 25 Apr 2022 21:06:26 +0200 Subject: [PATCH 34/61] Improve methods in fixtures --- test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php | 3 --- test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php | 3 --- test/src/Fixtures/Users/Base/User.php | 5 ++--- test/src/Fixtures/Writers/BaseWriter.php | 5 ++--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php index ac3c3d6..ecba375 100644 --- a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php +++ b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php @@ -181,9 +181,6 @@ public function getFieldValue($field, $default = null) } } - /** - * {@inheritdoc} - */ public function &setFieldValue($name, $value) { if ($value === null) { diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index 5fa4e8e..eb1d92b 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -197,9 +197,6 @@ public function getFieldValue($field, $default = null) } } - /** - * {@inheritdoc} - */ public function &setFieldValue($name, $value) { if ($value === null) { diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index bc2f5d9..60dd403 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -191,10 +191,9 @@ public function &setPassword($value) /** * Set value of specific field. * - * @param string $name - * @param mixed $value + * @param string $name + * @param mixed $value * @return $this - * @throws \InvalidArgumentException */ public function &setFieldValue($name, $value) { diff --git a/test/src/Fixtures/Writers/BaseWriter.php b/test/src/Fixtures/Writers/BaseWriter.php index 51209a1..63d4e45 100644 --- a/test/src/Fixtures/Writers/BaseWriter.php +++ b/test/src/Fixtures/Writers/BaseWriter.php @@ -155,10 +155,9 @@ public function &setUpdatedAt($value) /** * Set value of specific field. * - * @param string $name - * @param mixed $value + * @param string $name + * @param mixed $value * @return mixed - * @throws InvalidArgumentException */ public function &setFieldValue($name, $value) { From 6c2ad28eebd8252ecb0ca02c54c60d1f9e70ce4f Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Mon, 25 Apr 2022 21:11:43 +0200 Subject: [PATCH 35/61] Improve signature of setFieldValue() method --- src/Entity/Entity.php | 6 +----- src/Entity/EntityInterface.php | 7 +------ .../SpatialEntity/Base/SpatialEntity.php | 20 +++++++++---------- .../StatSnapshots/Base/StatsSnapshot.php | 20 +++++++++---------- test/src/Fixtures/Users/Base/User.php | 16 ++++++--------- test/src/Fixtures/Writers/BaseWriter.php | 20 ++++++++----------- 6 files changed, 36 insertions(+), 53 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index bc144f7..66088ff 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -713,12 +713,8 @@ public function getOldFieldValue($field) * Set value of the $field. This function will make sure that everything * runs fine - modifications are saved, in case of primary key old value * will be remembered in case we need to update the row and so on - * - * @param string $field - * @param mixed $value - * @return $this */ - public function &setFieldValue($field, $value) + public function setFieldValue(string $field, mixed $value): static { if ($this->entityFieldExists($field)) { if ($field === 'id') { diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index 9c2b051..a71c2ff 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -245,13 +245,8 @@ public function revertField($field); * Set value of the $field. This function will make sure that everything * runs fine - modifications are saved, in case of primary key old value * will be remembered in case we need to update the row and so on - * - * @param string $field - * @param mixed $value - * @return mixed - * @throws InvalidArgumentException */ - public function &setFieldValue($field, $value); + public function setFieldValue(string $field, mixed $value): static; /** * Set non-field value during DataManager::create() and DataManager::update() calls. diff --git a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php index ecba375..a5e8c98 100644 --- a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php +++ b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php @@ -181,27 +181,27 @@ public function getFieldValue($field, $default = null) } } - public function &setFieldValue($name, $value) + public function setFieldValue(string $field, mixed $value): static { if ($value === null) { - parent::setFieldValue($name, null); + parent::setFieldValue($field, null); } else { - switch ($name) { + switch ($field) { case 'id': case 'name': - return parent::setFieldValue($name, (string) $value); + return parent::setFieldValue($field, (string) $value); case 'day': - return parent::setFieldValue($name, $this->getDateTimeValueInstanceFrom($value)); + return parent::setFieldValue($field, $this->getDateTimeValueInstanceFrom($value)); case 'stats': - return parent::setFieldValue($name, $this->isLoading() ? $value : json_encode($value)); + return parent::setFieldValue($field, $this->isLoading() ? $value : json_encode($value)); default: if ($this->isLoading()) { - return parent::setFieldValue($name, $value); + return parent::setFieldValue($field, $value); } else { - if ($this->isGeneratedField($name)) { - throw new \LogicException("Generated field $name cannot be set by directly assigning a value"); + if ($this->isGeneratedField($field)) { + throw new \LogicException("Generated field $field cannot be set by directly assigning a value"); } else { - throw new \InvalidArgumentException("Field $name does not exist in this table"); + throw new \InvalidArgumentException("Field $field does not exist in this table"); } } } diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index eb1d92b..05f8cba 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -197,27 +197,27 @@ public function getFieldValue($field, $default = null) } } - public function &setFieldValue($name, $value) + public function setFieldValue(string $field, mixed $value): static { if ($value === null) { - parent::setFieldValue($name, null); + parent::setFieldValue($field, null); } else { - switch ($name) { + switch ($field) { case 'id': case 'account_id': - return parent::setFieldValue($name, (int) $value); + return parent::setFieldValue($field, (int) $value); case 'day': - return parent::setFieldValue($name, $this->getDateTimeValueInstanceFrom($value)); + return parent::setFieldValue($field, $this->getDateTimeValueInstanceFrom($value)); case 'stats': - return parent::setFieldValue($name, $this->isLoading() ? $value : json_encode($value)); + return parent::setFieldValue($field, $this->isLoading() ? $value : json_encode($value)); default: if ($this->isLoading()) { - return parent::setFieldValue($name, $value); + return parent::setFieldValue($field, $value); } else { - if ($this->isGeneratedField($name)) { - throw new \LogicException("Generated field $name cannot be set by directly assigning a value"); + if ($this->isGeneratedField($field)) { + throw new \LogicException("Generated field $field cannot be set by directly assigning a value"); } else { - throw new \InvalidArgumentException("Field $name does not exist in this table"); + throw new \InvalidArgumentException("Field $field does not exist in this table"); } } } diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index 60dd403..3c3a763 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -190,28 +190,24 @@ public function &setPassword($value) /** * Set value of specific field. - * - * @param string $name - * @param mixed $value - * @return $this */ - public function &setFieldValue($name, $value) + public function setFieldValue(string $field, mixed $value): static { if ($value === null) { - parent::setFieldValue($name, null); + parent::setFieldValue($field, null); } else { - switch ($name) { + switch ($field) { case 'id': - return parent::setFieldValue($name, (int) $value); + return parent::setFieldValue($field, (int) $value); case 'type': case 'first_name': case 'last_name': case 'email': case 'homepage_url': case 'password': - return parent::setFieldValue($name, (string) $value); + return parent::setFieldValue($field, (string) $value); default: - throw new \InvalidArgumentException("Field $name does not exist in this table"); + throw new \InvalidArgumentException("Field $field does not exist in this table"); } } diff --git a/test/src/Fixtures/Writers/BaseWriter.php b/test/src/Fixtures/Writers/BaseWriter.php index 63d4e45..9dc973f 100644 --- a/test/src/Fixtures/Writers/BaseWriter.php +++ b/test/src/Fixtures/Writers/BaseWriter.php @@ -154,31 +154,27 @@ public function &setUpdatedAt($value) /** * Set value of specific field. - * - * @param string $name - * @param mixed $value - * @return mixed */ - public function &setFieldValue($name, $value) + public function setFieldValue(string $field, mixed $value): static { if ($value === null) { - parent::setFieldValue($name, null); + parent::setFieldValue($field, null); } else { - switch ($name) { + switch ($field) { case 'id': - parent::setFieldValue($name, (int) $value); + parent::setFieldValue($field, (int) $value); break; case 'name': - parent::setFieldValue($name, (string) $value); + parent::setFieldValue($field, (string) $value); break; case 'birthday': - parent::setFieldValue($name, $this->getDateValueInstanceFrom($value)); + parent::setFieldValue($field, $this->getDateValueInstanceFrom($value)); break; case 'created_at': case 'updated_at': - return parent::setFieldValue($name, $this->getDateTimeValueInstanceFrom($value)); + return parent::setFieldValue($field, $this->getDateTimeValueInstanceFrom($value)); default: - throw new InvalidArgumentException("'$name' is not a known field"); + throw new InvalidArgumentException("'$field' is not a known field"); } } From 21e05708006980f5a40975f27c9a1da115d15130 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 22 Sep 2023 14:09:28 +0200 Subject: [PATCH 36/61] Add missing type --- composer.lock | 1605 +++++++++++++++----------- src/Pool.php | 2 +- src/PoolInterface.php | 2 +- src/Producer.php | 2 +- src/ProducerInterface.php | 2 +- test/src/Fixtures/CustomProducer.php | 2 +- 6 files changed, 950 insertions(+), 665 deletions(-) diff --git a/composer.lock b/composer.lock index 15e9d9d..60c4cd9 100644 --- a/composer.lock +++ b/composer.lock @@ -59,16 +59,16 @@ }, { "name": "activecollab/databaseconnection", - "version": "5.1.0", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/activecollab/databaseconnection.git", - "reference": "f6dc0f67020beec643ce26b91267be836d317eea" + "reference": "9249db981e2998a571b03f5663cdca9e4517bb22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/f6dc0f67020beec643ce26b91267be836d317eea", - "reference": "f6dc0f67020beec643ce26b91267be836d317eea", + "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/9249db981e2998a571b03f5663cdca9e4517bb22", + "reference": "9249db981e2998a571b03f5663cdca9e4517bb22", "shasum": "" }, "require": { @@ -80,20 +80,6 @@ "php": ">=8.0", "psr/log": "^1.0.0" }, - "replace": { - "symfony/polyfill-ctype": "*", - "symfony/polyfill-mbstring": "*", - "symfony/polyfill-php54": "*", - "symfony/polyfill-php55": "*", - "symfony/polyfill-php56": "*", - "symfony/polyfill-php70": "*", - "symfony/polyfill-php71": "*", - "symfony/polyfill-php72": "*", - "symfony/polyfill-php73": "*", - "symfony/polyfill-php80": "*", - "symfony/polyfill-php81": "*", - "symfony/polyfill-util": "*" - }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", "phpunit/phpunit": "~9.0", @@ -124,32 +110,32 @@ ], "support": { "issues": "https://github.com/activecollab/databaseconnection/issues", - "source": "https://github.com/activecollab/databaseconnection/tree/5.1.0" + "source": "https://github.com/activecollab/databaseconnection/tree/5.1.5" }, - "time": "2022-04-23T14:23:34+00:00" + "time": "2023-01-22T21:37:18+00:00" }, { "name": "activecollab/datevalue", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/activecollab/datevalue.git", - "reference": "a69670b4938d44a27e2baa0e66cf335a3ad5d511" + "reference": "075bea63dc3cbaab9505459b7d5844eeaaad78ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/datevalue/zipball/a69670b4938d44a27e2baa0e66cf335a3ad5d511", - "reference": "a69670b4938d44a27e2baa0e66cf335a3ad5d511", + "url": "https://api.github.com/repos/activecollab/datevalue/zipball/075bea63dc3cbaab9505459b7d5844eeaaad78ae", + "reference": "075bea63dc3cbaab9505459b7d5844eeaaad78ae", "shasum": "" }, "require": { "ext-json": "*", "nesbot/carbon": "~2.0", - "php": ">=7.1" + "php": ">=8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.0", - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "autoload": { @@ -177,9 +163,9 @@ ], "support": { "issues": "https://github.com/activecollab/datevalue/issues", - "source": "https://github.com/activecollab/datevalue/tree/2.0.0" + "source": "https://github.com/activecollab/datevalue/tree/2.1.0" }, - "time": "2019-06-23T16:19:52+00:00" + "time": "2022-08-10T07:26:18+00:00" }, { "name": "activecollab/etag", @@ -281,28 +267,28 @@ }, { "name": "doctrine/inflector", - "version": "2.0.4", + "version": "2.0.8", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89" + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", - "reference": "8b7ff3e4b7de6b2c84da85637b59fd2880ecaa89", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff", + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^8.2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "vimeo/psalm": "^4.10" + "doctrine/coding-standard": "^11.0", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^8.5 || ^9.5", + "vimeo/psalm": "^4.25 || ^5.4" }, "type": "library", "autoload": { @@ -352,7 +338,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.4" + "source": "https://github.com/doctrine/inflector/tree/2.0.8" }, "funding": [ { @@ -368,38 +354,44 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:16:43+00:00" + "time": "2023-06-16T13:40:37+00:00" }, { "name": "nesbot/carbon", - "version": "2.57.0", + "version": "2.70.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" + "reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3298b38ea8612e5f77d38d1a99438e42f70341d", + "reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.0", + "doctrine/dbal": "^2.0 || ^3.1.4", "doctrine/orm": "^2.7", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54 || ^1.0", - "phpunit/phpunit": "^7.5.20 || ^8.5.14", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", "squizlabs/php_codesniffer": "^3.4" }, "bin": [ @@ -456,15 +448,67 @@ }, "funding": [ { - "url": "https://opencollective.com/Carbon", - "type": "open_collective" + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" }, { - "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", "type": "tidelift" } ], - "time": "2022-02-13T18:13:33+00:00" + "time": "2023-09-07T16:43:50+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" }, { "name": "psr/container", @@ -564,30 +608,266 @@ }, "time": "2021-05-03T11:20:27+00:00" }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-05-23T14:45:45+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "42292d99c55abe617799667f454222c54c60e229" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-07-28T09:04:16+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, { "name": "symfony/translation", - "version": "v6.0.5", + "version": "v6.3.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875" + "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e69501c71107cc3146b32aaa45f4edd0c3427875", - "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875", + "url": "https://api.github.com/repos/symfony/translation/zipball/3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", + "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" + "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { "symfony/config": "<5.4", "symfony/console": "<5.4", "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4" }, @@ -595,23 +875,20 @@ "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { + "nikic/php-parser": "^4.13", "psr/log": "^1|^2|^3", "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-client-contracts": "^2.5|^3.0", "symfony/http-kernel": "^5.4|^6.0", "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/routing": "^5.4|^6.0", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, "type": "library", "autoload": { "files": [ @@ -641,7 +918,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.0.5" + "source": "https://github.com/symfony/translation/tree/v6.3.3" }, "funding": [ { @@ -657,32 +934,29 @@ "type": "tidelift" } ], - "time": "2022-02-09T15:52:48+00:00" + "time": "2023-07-31T07:08:24+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.0.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77" + "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86", + "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86", "shasum": "" }, "require": { - "php": ">=8.0.2" - }, - "suggest": { - "symfony/translation-implementation": "" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -692,7 +966,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -719,7 +996,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.0.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.3.0" }, "funding": [ { @@ -735,7 +1012,7 @@ "type": "tidelift" } ], - "time": "2021-09-07T12:43:40+00:00" + "time": "2023-05-30T17:17:10+00:00" } ], "packages-dev": [ @@ -812,16 +1089,16 @@ }, { "name": "composer/semver", - "version": "3.2.9", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649" + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649", - "reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649", + "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", "shasum": "" }, "require": { @@ -871,9 +1148,9 @@ "versioning" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.9" + "source": "https://github.com/composer/semver/tree/3.4.0" }, "funding": [ { @@ -889,7 +1166,7 @@ "type": "tidelift" } ], - "time": "2022-02-04T13:58:43+00:00" + "time": "2023-08-31T09:50:34+00:00" }, { "name": "composer/xdebug-handler", @@ -959,30 +1236,34 @@ }, { "name": "doctrine/annotations", - "version": "1.13.2", + "version": "1.14.3", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08" + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", - "reference": "5b668aef16090008790395c02c893b1ba13f7e08", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", + "reference": "fb0d71a7393298a7b232cbf4c8b1f73f3ec3d5af", "shasum": "" }, "require": { - "doctrine/lexer": "1.*", + "doctrine/lexer": "^1 || ^2", "ext-tokenizer": "*", "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { "doctrine/cache": "^1.11 || ^2.0", - "doctrine/coding-standard": "^6.0 || ^8.1", - "phpstan/phpstan": "^0.12.20", - "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", - "symfony/cache": "^4.4 || ^5.2" + "doctrine/coding-standard": "^9 || ^10", + "phpstan/phpstan": "~1.4.10 || ^1.8.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "symfony/cache": "^4.4 || ^5.4 || ^6", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" }, "type": "library", "autoload": { @@ -1025,35 +1306,83 @@ ], "support": { "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/1.13.2" + "source": "https://github.com/doctrine/annotations/tree/1.14.3" }, - "time": "2021-08-05T19:00:23+00:00" + "time": "2023-02-01T09:20:38+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "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", + "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" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" + }, + "time": "2023-06-03T09:27:29+00:00" }, { "name": "doctrine/instantiator", - "version": "1.4.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -1080,7 +1409,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -1096,35 +1425,37 @@ "type": "tidelift" } ], - "time": "2020-11-10T18:47:58+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "doctrine/lexer", - "version": "1.2.3", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", - "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9.0", + "doctrine/coding-standard": "^9 || ^10", "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.11" + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^4.11 || ^5.0" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + "Doctrine\\Common\\Lexer\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -1156,7 +1487,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.3" + "source": "https://github.com/doctrine/lexer/tree/2.1.0" }, "funding": [ { @@ -1172,7 +1503,7 @@ "type": "tidelift" } ], - "time": "2022-02-28T11:07:21+00:00" + "time": "2022-12-14T08:49:07+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -1285,16 +1616,16 @@ }, { "name": "monolog/monolog", - "version": "1.26.1", + "version": "1.27.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5" + "reference": "904713c5929655dc9b97288b69cfeedad610c9a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c6b00f05152ae2c9b04a448f99c7590beb6042f5", - "reference": "c6b00f05152ae2c9b04a448f99c7590beb6042f5", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/904713c5929655dc9b97288b69cfeedad610c9a1", + "reference": "904713c5929655dc9b97288b69cfeedad610c9a1", "shasum": "" }, "require": { @@ -1355,7 +1686,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/1.26.1" + "source": "https://github.com/Seldaek/monolog/tree/1.27.1" }, "funding": [ { @@ -1367,20 +1698,20 @@ "type": "tidelift" } ], - "time": "2021-05-28T08:32:12+00:00" + "time": "2022-06-09T08:53:42+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.10.3", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "c6a951b75d684fd43fbbd69617488e1e2e8924ba" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/c6a951b75d684fd43fbbd69617488e1e2e8924ba", - "reference": "c6a951b75d684fd43fbbd69617488e1e2e8924ba", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -1418,7 +1749,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.3" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -1426,20 +1757,20 @@ "type": "tidelift" } ], - "time": "2022-03-02T14:16:47+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -1480,9 +1811,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phar-io/manifest", @@ -1648,254 +1979,28 @@ "issues": "https://github.com/PHP-CS-Fixer/diff/issues", "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" }, + "abandoned": true, "time": "2020-10-14T08:39:05+00:00" }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "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" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "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/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" - }, - "time": "2022-01-04T19:58:01+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "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 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, { "name": "phpunit/php-code-coverage", - "version": "9.2.14", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f4d60b6afe5546421462b76cd4e633ebc364ab4", - "reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1910,8 +2015,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -1944,7 +2049,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.14" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -1952,7 +2058,7 @@ "type": "github" } ], - "time": "2022-02-28T12:38:02+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2197,20 +2303,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.16", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc", - "reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2221,31 +2327,26 @@ "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.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -2253,7 +2354,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -2284,7 +2385,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, "funding": [ { @@ -2294,9 +2396,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-02-23T17:10:58+00:00" + "time": "2023-09-19T05:39:22+00:00" }, { "name": "psr/cache", @@ -2566,16 +2672,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -2628,7 +2734,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -2636,7 +2742,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -2697,16 +2803,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -2751,7 +2857,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -2759,20 +2865,20 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -2814,7 +2920,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -2822,20 +2928,20 @@ "type": "github" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -2891,7 +2997,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -2899,20 +3005,20 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -2955,7 +3061,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, "funding": [ { @@ -2963,7 +3069,7 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", @@ -3136,16 +3242,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -3184,10 +3290,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://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" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -3195,7 +3301,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -3254,28 +3360,28 @@ }, { "name": "sebastian/type", - "version": "2.3.4", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { "php": ">=7.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -3298,7 +3404,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -3306,7 +3412,7 @@ "type": "github" } ], - "time": "2021-06-15T12:49:02+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", @@ -3363,16 +3469,16 @@ }, { "name": "symfony/console", - "version": "v5.4.5", + "version": "v5.4.28", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad" + "reference": "f4f71842f24c2023b91237c72a365306f3c58827" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d8111acc99876953f52fe16d4c50eb60940d49ad", - "reference": "d8111acc99876953f52fe16d4c50eb60940d49ad", + "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", + "reference": "f4f71842f24c2023b91237c72a365306f3c58827", "shasum": "" }, "require": { @@ -3437,79 +3543,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.5" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-02-24T12:45:35+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", - "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", - "shasum": "" - }, - "require": { - "php": ">=8.0.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" + "source": "https://github.com/symfony/console/tree/v5.4.28" }, "funding": [ { @@ -3525,20 +3564,20 @@ "type": "tidelift" } ], - "time": "2021-11-01T23:48:49+00:00" + "time": "2023-08-07T06:12:30+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.3", + "version": "v5.4.26", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d" + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dec8a9f58d20df252b9cd89f1c6c1530f747685d", - "reference": "dec8a9f58d20df252b9cd89f1c6c1530f747685d", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5dcc00e03413f05c1e7900090927bb7247cb0aac", + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac", "shasum": "" }, "require": { @@ -3594,7 +3633,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.3" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.26" }, "funding": [ { @@ -3610,33 +3649,30 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-07-06T06:34:20+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.0.0", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "aa5422287b75594b90ee9cd807caf8f0df491385" + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/aa5422287b75594b90ee9cd807caf8f0df491385", - "reference": "aa5422287b75594b90ee9cd807caf8f0df491385", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3673,7 +3709,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" }, "funding": [ { @@ -3689,20 +3725,20 @@ "type": "tidelift" } ], - "time": "2021-07-15T12:33:35+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.5", + "version": "v5.4.25", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "797680071ea8f71b94eb958680c50d0e002638f5" + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/797680071ea8f71b94eb958680c50d0e002638f5", - "reference": "797680071ea8f71b94eb958680c50d0e002638f5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", "shasum": "" }, "require": { @@ -3737,7 +3773,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.5" + "source": "https://github.com/symfony/filesystem/tree/v5.4.25" }, "funding": [ { @@ -3753,20 +3789,20 @@ "type": "tidelift" } ], - "time": "2022-02-27T10:31:47+00:00" + "time": "2023-05-31T13:04:02+00:00" }, { "name": "symfony/finder", - "version": "v5.4.3", + "version": "v5.4.27", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d" + "reference": "ff4bce3c33451e7ec778070e45bd23f74214cd5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d", - "reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d", + "url": "https://api.github.com/repos/symfony/finder/zipball/ff4bce3c33451e7ec778070e45bd23f74214cd5d", + "reference": "ff4bce3c33451e7ec778070e45bd23f74214cd5d", "shasum": "" }, "require": { @@ -3800,7 +3836,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.3" + "source": "https://github.com/symfony/finder/tree/v5.4.27" }, "funding": [ { @@ -3816,20 +3852,20 @@ "type": "tidelift" } ], - "time": "2022-01-26T16:34:36+00:00" + "time": "2023-07-31T08:02:31+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.4.3", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", - "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", "shasum": "" }, "require": { @@ -3869,7 +3905,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" }, "funding": [ { @@ -3885,32 +3921,35 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.24.0", + "name": "symfony/polyfill-ctype", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { - "ext-intl": "For best performance" + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3922,7 +3961,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + "Symfony\\Polyfill\\Ctype\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -3931,26 +3970,24 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's grapheme_* functions", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "grapheme", - "intl", + "ctype", "polyfill", - "portable", - "shim" + "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -3966,20 +4003,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T21:10:46+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.24.0", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.28.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -3991,7 +4028,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4003,7 +4040,88 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" }, "classmap": [ "Resources/stubs" @@ -4034,7 +4152,75 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.20.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "metapackage", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" }, "funding": [ { @@ -4050,20 +4236,175 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", + "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/process", - "version": "v5.4.5", + "version": "v5.4.28", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "95440409896f90a5f85db07a32b517ecec17fa4c" + "reference": "45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/95440409896f90a5f85db07a32b517ecec17fa4c", - "reference": "95440409896f90a5f85db07a32b517ecec17fa4c", + "url": "https://api.github.com/repos/symfony/process/zipball/45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b", + "reference": "45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b", "shasum": "" }, "require": { @@ -4096,7 +4437,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.5" + "source": "https://github.com/symfony/process/tree/v5.4.28" }, "funding": [ { @@ -4112,25 +4453,26 @@ "type": "tidelift" } ], - "time": "2022-01-30T18:16:22+00:00" + "time": "2023-08-07T10:36:04+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d664541b99d6fb0247ec5ff32e87238582236204" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d664541b99d6fb0247ec5ff32e87238582236204", - "reference": "d664541b99d6fb0247ec5ff32e87238582236204", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.1" + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -4141,7 +4483,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.4-dev" + "dev-main": "2.5-dev" }, "thanks": { "name": "symfony/contracts", @@ -4178,7 +4520,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.1" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -4194,20 +4536,20 @@ "type": "tidelift" } ], - "time": "2021-11-04T16:37:19+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.4.5", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", - "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f83692cd869a6f2391691d40a01e8acb89e76fee", + "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee", "shasum": "" }, "require": { @@ -4240,7 +4582,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.21" }, "funding": [ { @@ -4256,36 +4598,37 @@ "type": "tidelift" } ], - "time": "2022-02-18T16:06:09+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/string", - "version": "v6.0.3", + "version": "v6.3.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2" + "reference": "53d1a83225002635bca3482fcbf963001313fb68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/522144f0c4c004c80d56fa47e40e17028e2eefc2", - "reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2", + "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", + "reference": "53d1a83225002635bca3482fcbf963001313fb68", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -4325,7 +4668,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.0.3" + "source": "https://github.com/symfony/string/tree/v6.3.2" }, "funding": [ { @@ -4341,7 +4684,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:55:41+00:00" + "time": "2023-07-05T08:41:27+00:00" }, { "name": "theseer/tokenizer", @@ -4392,64 +4735,6 @@ } ], "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "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" } ], "aliases": [], @@ -4463,5 +4748,5 @@ "platform-dev": { "ext-mysqli": "*" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/src/Pool.php b/src/Pool.php index e851a45..e759e1d 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -41,7 +41,7 @@ public function __construct(ConnectionInterface $connection, LoggerInterface $lo $this->logger = $logger; } - public function produce($type, array $attributes = null, $save = true): EntityInterface + public function produce(string $type, array $attributes = null, $save = true): EntityInterface { $registered_type = $this->requireRegisteredType($type); diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 930e944..0a59205 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -15,7 +15,7 @@ interface PoolInterface { - public function produce($type, array $attributes = null, $save = true): EntityInterface; + public function produce(string $type, array $attributes = null, $save = true): EntityInterface; public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; diff --git a/src/Producer.php b/src/Producer.php index 57ec75c..b21f0a8 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -29,7 +29,7 @@ public function __construct(ConnectionInterface $connection, PoolInterface $pool $this->logger = $logger; } - public function produce($type, array $attributes = null, $save = true): EntityInterface + public function produce(string $type, array $attributes = null, $save = true): EntityInterface { /** @var EntityInterface $object */ $object = new $type($this->connection, $this->pool, $this->logger); diff --git a/src/ProducerInterface.php b/src/ProducerInterface.php index df9ea9d..5c69e39 100644 --- a/src/ProducerInterface.php +++ b/src/ProducerInterface.php @@ -14,7 +14,7 @@ interface ProducerInterface { - public function produce($type, array $attributes = null, $save = true): EntityInterface; + public function produce(string $type, array $attributes = null, $save = true): EntityInterface; public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; } diff --git a/test/src/Fixtures/CustomProducer.php b/test/src/Fixtures/CustomProducer.php index 551db41..e6cf822 100644 --- a/test/src/Fixtures/CustomProducer.php +++ b/test/src/Fixtures/CustomProducer.php @@ -16,7 +16,7 @@ class CustomProducer extends Producer { - public function produce($type, array $attributes = null, $save = true): EntityInterface + public function produce(string $type, array $attributes = null, $save = true): EntityInterface { $object = parent::produce($type, $attributes, $save); From 179941ac54388ece93d651ee42f0ec1d2d32c52a Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 22 Sep 2023 14:11:50 +0200 Subject: [PATCH 37/61] Help IDEs figure out which instances are being returned --- src/PoolInterface.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 0a59205..12a2113 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -15,6 +15,11 @@ interface PoolInterface { + /** + * @template TClassName + * @param class-string $type + * @return TClassName + */ public function produce(string $type, array $attributes = null, $save = true): EntityInterface; public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; @@ -26,8 +31,25 @@ public function setDefaultProducerClass(string $default_producer_class): PoolInt public function registerProducer(string $type, ProducerInterface $producer): PoolInterface; public function registerProducerByClass(string $type, string $producer_class): PoolInterface; + /** + * @template TClassName + * @param class-string $type + * @return ?TClassName + */ public function getById(string $type, int $id, bool $use_cache = true): ?EntityInterface; + + /** + * @template TClassName + * @param class-string $type + * @return TClassName + */ public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface; + + /** + * @template TClassName + * @param class-string $type + * @return ?TClassName + */ public function reload(string $type, int $id): ?EntityInterface; public function isInPool(string $type, int $id): bool; public function remember(EntityInterface $object): void; @@ -42,10 +64,6 @@ public function count(string $type, mixed $conditions = null): int; /** * Return true if object of the given type with the given ID exists. - * - * @param string $type - * @param int $id - * @return bool */ public function exists(string $type, int $id): bool; From 8890641d9c5aae73edf0ecd41e0639161d474a7e Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 22 Sep 2023 14:47:16 +0200 Subject: [PATCH 38/61] Add an easy way to query records without the need for a finder --- src/Pool.php | 70 ++++++++++++++++---- src/PoolInterface.php | 7 ++ test/src/ContainerPropagatesToObjectTest.php | 11 ++- 3 files changed, 73 insertions(+), 15 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index e759e1d..7f38e75 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -202,8 +202,6 @@ public function getById(string $type, int $id, bool $use_cache = true): ?EntityI return $this->objects_pool[$registered_type][$id]; } - $type_fields = $this->getTypeFields($registered_type); - $row = $this->connection->executeFirstRow($this->getSelectOneByType($registered_type), [$id]); if (empty($row)) { @@ -212,18 +210,11 @@ public function getById(string $type, int $id, bool $use_cache = true): ?EntityI return $this->addToObjectPool($registered_type, $id, $object); } - $object_class = in_array('type', $type_fields) ? $row['type'] : $type; - - /** @var object|EntityInterface $object */ - $object = new $object_class($this->connection, $this, $this->logger); - - if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { - $object->setContainer($this->getContainer()); - } - - $object->loadFromRow($row); - - return $this->addToObjectPool($registered_type, $id, $object); + return $this->getObjectFromRow( + $type, + $registered_type, + $row, + ); } public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface @@ -237,6 +228,56 @@ public function mustGetById(string $type, int $id, bool $use_cache = true): Enti return $result; } + public function getFirstBy(string $type, string $where, mixed ...$arguments): ?EntityInterface + { + if (empty($where)) { + throw new LogicException('Conditions are required'); + } + + $registered_type = $this->requireRegisteredType($type); + + $row = $this->connection->executeFirstRow( + sprintf( + 'SELECT %s FROM %s WHERE %s LIMIT 0, 1', + $this->getTypeFieldsReadStatement($type), + $this->getTypeTable($type, true), + $this->connection->prepare($where, $arguments), + ) + ); + + if (empty($row)) { + return null; + } + + return $this->getObjectFromRow( + $type, + $registered_type, + $row, + ); + } + + private function getObjectFromRow( + string $type, + string $registered_type, + array $row, + ): EntityInterface + { + $object_class = in_array('type', $this->getTypeFields($registered_type)) + ? $row['type'] + : $type; + + /** @var object|EntityInterface $object */ + $object = new $object_class($this->connection, $this, $this->logger); + + if ($object instanceof ContainerAccessInterface && $this->hasContainer()) { + $object->setContainer($this->getContainer()); + } + + $object->loadFromRow($row); + + return $this->addToObjectPool($registered_type, $object->getId(), $object); + } + public function reload(string $type, int $id): ?EntityInterface { return $this->getById($type, $id, false); @@ -438,6 +479,7 @@ public function getTypeSqlReadStatements(string $type): array { return $this->types[$this->requireRegisteredType($type)]['sql_read_statements']; } + public function getTypeProperty(string $type, string $property, callable $callback): mixed { $registered_type = $this->requireRegisteredType($type); diff --git a/src/PoolInterface.php b/src/PoolInterface.php index 12a2113..e28656f 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -45,6 +45,13 @@ public function getById(string $type, int $id, bool $use_cache = true): ?EntityI */ public function mustGetById(string $type, int $id, bool $use_cache = true): EntityInterface; + /** + * @template TClassName + * @param class-string $type + * @return ?TClassName + */ + public function getFirstBy(string $type, string $where, mixed ...$arguments): ?EntityInterface; + /** * @template TClassName * @param class-string $type diff --git a/test/src/ContainerPropagatesToObjectTest.php b/test/src/ContainerPropagatesToObjectTest.php index 06e494e..032c0fc 100644 --- a/test/src/ContainerPropagatesToObjectTest.php +++ b/test/src/ContainerPropagatesToObjectTest.php @@ -37,7 +37,6 @@ public function setUp(): void */ public function testGetByIdInstantination() { - /** @var Writer $special_writer */ $special_writer = $this->pool->getById(Writer::class, 1); $this->assertInstanceOf(Writer::class, $special_writer); @@ -45,6 +44,16 @@ public function testGetByIdInstantination() $this->assertTrue($special_writer->is_special); } + public function testGetFirstByInstantination() + { + /** @var Writer $special_writer */ + $special_writer = $this->pool->getFirstBy(Writer::class, '`name` = ?', 'Leo Tolstoy'); + + $this->assertInstanceOf(Writer::class, $special_writer); + $this->assertTrue($special_writer->hasContainer()); + $this->assertTrue($special_writer->is_special); + } + /** * Test instantination via finder. */ From 4b10203f9a553b7280e75eb0021be0173657b23b Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Mon, 9 Oct 2023 13:57:55 +0200 Subject: [PATCH 39/61] Fix issue where ? can leak in via conditions --- src/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Validator.php b/src/Validator.php index 808bd73..3f90cb5 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -374,7 +374,7 @@ private function prepareUniquenessValidatorSql(array $field_names, mixed $where) return $this->connection->prepare( sprintf( - "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE (%s) AND (`id` != ?)", + "SELECT COUNT(`id`) AS 'row_count' FROM %s WHERE `id` != ? AND (%s)", $this->connection->escapeTableName($this->table_name), implode(' AND ', $conditions) ), From 8b97000b78654733d3adb5ba443c2a0c2efc8aae Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 28 Jan 2024 10:25:15 +0100 Subject: [PATCH 40/61] Remofe use of validators by reference --- src/Entity/Entity.php | 8 ++++---- src/Entity/EntityInterface.php | 4 +--- test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php | 7 ++----- test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php | 7 ++----- test/src/Fixtures/Users/Base/User.php | 6 ++---- test/src/Fixtures/Writers/Writer.php | 4 ++-- 6 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 66088ff..6abdc17 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -161,12 +161,12 @@ protected function configure() * errors in data before we really save it database. $errors is instance of * ValidationErrors class that is used for error collection. If collection * is empty object is considered valid and save process will continue - * - * @param ValidatorInterface $validator */ - public function validate(ValidatorInterface &$validator) + public function validate(ValidatorInterface $validator): ValidatorInterface { $this->triggerEvent('on_validate', [&$validator]); + + return $validator; } /** @@ -318,7 +318,7 @@ public function &save() $values_to_validate ); - $this->validate($validator); + $validator = $this->validate($validator); if ($validator->hasErrors()) { throw $validator->createException(); diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index a71c2ff..bf7ace3 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -37,10 +37,8 @@ public function loadFromRow(array $row); * errors in data before we really save it database. $errors is instance of * ValidationErrors class that is used for error collection. If collection * is empty object is considered valid and save process will continue - * - * @param ValidatorInterface $validator */ - public function validate(ValidatorInterface &$validator); + public function validate(ValidatorInterface $validator): ValidatorInterface; /** * Save object into database (insert or update). diff --git a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php index a5e8c98..8bd9b10 100644 --- a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php +++ b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php @@ -223,14 +223,11 @@ public function jsonSerialize() ]); } - /** - * {@inheritdoc} - */ - public function validate(ValidatorInterface &$validator) + public function validate(ValidatorInterface $validator): ValidatorInterface { $validator->present('day'); $validator->present('account_id'); - parent::validate($validator); + return parent::validate($validator); } } diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index 05f8cba..9b35fdd 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -239,14 +239,11 @@ public function jsonSerialize() ]); } - /** - * {@inheritdoc} - */ - public function validate(ValidatorInterface &$validator) + public function validate(ValidatorInterface $validator): ValidatorInterface { $validator->present('day'); $validator->present('account_id'); - parent::validate($validator); + return parent::validate($validator); } } diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index 3c3a763..143aeae 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -216,14 +216,12 @@ public function setFieldValue(string $field, mixed $value): static /** * Validate object properties before object is saved. - * - * @param ValidatorInterface $validator */ - public function validate(ValidatorInterface &$validator) + public function validate(ValidatorInterface $validator): ValidatorInterface { $validator->presentAndUnique('email'); $validator->present('password'); - parent::validate($validator); + return parent::validate($validator); } } diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index 502791a..c3b7a9d 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -129,12 +129,12 @@ public function &setProtectedCustomFieldValue($value) /** * @param ValidatorInterface $validator */ - public function validate(ValidatorInterface &$validator) + public function validate(ValidatorInterface $validator): ValidatorInterface { $validator->present('name'); $validator->present('birthday'); - parent::validate($validator); + return parent::validate($validator); } public function scrap($bulk = false): EntityInterface From 51f3ea8bdf49c1c74c775a4eee8ea6b91ae23366 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 28 Jan 2024 10:44:20 +0100 Subject: [PATCH 41/61] Set PHP 8.2 as the baseline for future development --- composer.json | 7 +- composer.lock | 346 ++++++++++++++++++++------------- src/Entity/Entity.php | 4 +- src/Entity/EntityInterface.php | 5 +- 4 files changed, 218 insertions(+), 144 deletions(-) diff --git a/composer.json b/composer.json index b4d09d1..c729779 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,13 @@ "email": "ilija.studen@activecollab.com" } ], + "config": { + "platform": { + "php": "8.2.0" + } + }, "require": { - "php": ">=8.0", + "php": ">=8.2", "activecollab/databaseconnection": "^5.0", "activecollab/etag": "^1.0", "activecollab/object": "^1.0", diff --git a/composer.lock b/composer.lock index 60c4cd9..f175ccb 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": "ec7ee57e6dbbf8b2af7e8d998008ea1c", + "content-hash": "97d1e40746333c86ca923e02d5b13efe", "packages": [ { "name": "activecollab/containeraccess", @@ -59,16 +59,16 @@ }, { "name": "activecollab/databaseconnection", - "version": "5.1.5", + "version": "5.1.6", "source": { "type": "git", "url": "https://github.com/activecollab/databaseconnection.git", - "reference": "9249db981e2998a571b03f5663cdca9e4517bb22" + "reference": "5f5ff2ce8fbe7b94b64027d446735499de71c040" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/9249db981e2998a571b03f5663cdca9e4517bb22", - "reference": "9249db981e2998a571b03f5663cdca9e4517bb22", + "url": "https://api.github.com/repos/activecollab/databaseconnection/zipball/5f5ff2ce8fbe7b94b64027d446735499de71c040", + "reference": "5f5ff2ce8fbe7b94b64027d446735499de71c040", "shasum": "" }, "require": { @@ -110,9 +110,9 @@ ], "support": { "issues": "https://github.com/activecollab/databaseconnection/issues", - "source": "https://github.com/activecollab/databaseconnection/tree/5.1.5" + "source": "https://github.com/activecollab/databaseconnection/tree/5.1.6" }, - "time": "2023-01-22T21:37:18+00:00" + "time": "2023-09-24T06:25:56+00:00" }, { "name": "activecollab/datevalue", @@ -265,18 +265,87 @@ }, "time": "2016-07-14T19:59:07+00:00" }, + { + "name": "carbonphp/carbon-doctrine-types", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", + "reference": "a31d3358a2a5d6ae947df1691d1f321418a5f3d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/a31d3358a2a5d6ae947df1691d1f321418a5f3d5", + "reference": "a31d3358a2a5d6ae947df1691d1f321418a5f3d5", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/dbal": "<4.0.0 || >=5.0.0" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.1.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2023-12-10T15:33:53+00:00" + }, { "name": "doctrine/inflector", - "version": "2.0.8", + "version": "2.0.9", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff" + "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff", - "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", "shasum": "" }, "require": { @@ -338,7 +407,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.8" + "source": "https://github.com/doctrine/inflector/tree/2.0.9" }, "funding": [ { @@ -354,23 +423,24 @@ "type": "tidelift" } ], - "time": "2023-06-16T13:40:37+00:00" + "time": "2024-01-15T18:05:13+00:00" }, { "name": "nesbot/carbon", - "version": "2.70.0", + "version": "2.72.2", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d" + "reference": "3e7edc41b58d65509baeb0d4a14c8fa41d627130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d3298b38ea8612e5f77d38d1a99438e42f70341d", - "reference": "d3298b38ea8612e5f77d38d1a99438e42f70341d", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/3e7edc41b58d65509baeb0d4a14c8fa41d627130", + "reference": "3e7edc41b58d65509baeb0d4a14c8fa41d627130", "shasum": "" }, "require": { + "carbonphp/carbon-doctrine-types": "*", "ext-json": "*", "php": "^7.1.8 || ^8.0", "psr/clock": "^1.0", @@ -382,8 +452,8 @@ "psr/clock-implementation": "1.0" }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.1.4", - "doctrine/orm": "^2.7", + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", "ondrejmirtes/better-reflection": "*", @@ -460,7 +530,7 @@ "type": "tidelift" } ], - "time": "2023-09-07T16:43:50+00:00" + "time": "2024-01-19T00:21:53+00:00" }, { "name": "psr/clock", @@ -610,7 +680,7 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -657,7 +727,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -843,16 +913,16 @@ }, { "name": "symfony/translation", - "version": "v6.3.3", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd" + "reference": "a2ab2ec1a462e53016de8e8d5e8912bfd62ea681" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", - "reference": "3ed078c54bc98bbe4414e1e9b2d5e85ed5a5c8bd", + "url": "https://api.github.com/repos/symfony/translation/zipball/a2ab2ec1a462e53016de8e8d5e8912bfd62ea681", + "reference": "a2ab2ec1a462e53016de8e8d5e8912bfd62ea681", "shasum": "" }, "require": { @@ -877,17 +947,17 @@ "require-dev": { "nikic/php-parser": "^4.13", "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", "symfony/http-client-contracts": "^2.5|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0|^7.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0" + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -918,7 +988,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.3.3" + "source": "https://github.com/symfony/translation/tree/v6.4.2" }, "funding": [ { @@ -934,20 +1004,20 @@ "type": "tidelift" } ], - "time": "2023-07-31T07:08:24+00:00" + "time": "2023-12-18T09:25:29+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.3.0", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86" + "reference": "06450585bf65e978026bda220cdebca3f867fde7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86", - "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/06450585bf65e978026bda220cdebca3f867fde7", + "reference": "06450585bf65e978026bda220cdebca3f867fde7", "shasum": "" }, "require": { @@ -996,7 +1066,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.4.1" }, "funding": [ { @@ -1012,7 +1082,7 @@ "type": "tidelift" } ], - "time": "2023-05-30T17:17:10+00:00" + "time": "2023-12-26T14:02:43+00:00" } ], "packages-dev": [ @@ -1312,16 +1382,16 @@ }, { "name": "doctrine/deprecations", - "version": "v1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", "shasum": "" }, "require": { @@ -1353,9 +1423,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" + "source": "https://github.com/doctrine/deprecations/tree/1.1.2" }, - "time": "2023-06-03T09:27:29+00:00" + "time": "2023-09-27T20:04:15+00:00" }, { "name": "doctrine/instantiator", @@ -1761,25 +1831,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -1787,7 +1859,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1811,9 +1883,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2024-01-07T17:17:35+00:00" }, { "name": "phar-io/manifest", @@ -1984,23 +2056,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "9.2.30", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -2050,7 +2122,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" }, "funding": [ { @@ -2058,7 +2130,7 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2023-12-22T06:47:57+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2303,16 +2375,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.13", + "version": "9.6.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" + "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f", + "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f", "shasum": "" }, "require": { @@ -2386,7 +2458,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16" }, "funding": [ { @@ -2402,7 +2474,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:39:22+00:00" + "time": "2024-01-19T07:03:14+00:00" }, { "name": "psr/cache", @@ -2746,20 +2818,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2791,7 +2863,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -2799,7 +2871,7 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", @@ -3073,20 +3145,20 @@ }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -3118,7 +3190,7 @@ "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" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -3126,7 +3198,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -3469,16 +3541,16 @@ }, { "name": "symfony/console", - "version": "v5.4.28", + "version": "v5.4.34", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827" + "reference": "4b4d8cd118484aa604ec519062113dd87abde18c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827", + "url": "https://api.github.com/repos/symfony/console/zipball/4b4d8cd118484aa604ec519062113dd87abde18c", + "reference": "4b4d8cd118484aa604ec519062113dd87abde18c", "shasum": "" }, "require": { @@ -3548,7 +3620,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.28" + "source": "https://github.com/symfony/console/tree/v5.4.34" }, "funding": [ { @@ -3564,20 +3636,20 @@ "type": "tidelift" } ], - "time": "2023-08-07T06:12:30+00:00" + "time": "2023-12-08T13:33:03+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.26", + "version": "v5.4.34", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac" + "reference": "e3bca343efeb613f843c254e7718ef17c9bdf7a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5dcc00e03413f05c1e7900090927bb7247cb0aac", - "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/e3bca343efeb613f843c254e7718ef17c9bdf7a3", + "reference": "e3bca343efeb613f843c254e7718ef17c9bdf7a3", "shasum": "" }, "require": { @@ -3633,7 +3705,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.26" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.34" }, "funding": [ { @@ -3649,11 +3721,11 @@ "type": "tidelift" } ], - "time": "2023-07-06T06:34:20+00:00" + "time": "2023-12-27T21:12:56+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.3.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", @@ -3709,7 +3781,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.4.0" }, "funding": [ { @@ -4395,16 +4467,16 @@ }, { "name": "symfony/process", - "version": "v5.4.28", + "version": "v5.4.34", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b" + "reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b", - "reference": "45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b", + "url": "https://api.github.com/repos/symfony/process/zipball/8fa22178dfc368911dbd513b431cd9b06f9afe7a", + "reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a", "shasum": "" }, "require": { @@ -4437,7 +4509,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.28" + "source": "https://github.com/symfony/process/tree/v5.4.34" }, "funding": [ { @@ -4453,37 +4525,33 @@ "type": "tidelift" } ], - "time": "2023-08-07T10:36:04+00:00" + "time": "2023-12-02T08:41:43+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0", + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^1.1|^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -4493,7 +4561,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4520,7 +4591,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.1" }, "funding": [ { @@ -4536,7 +4607,7 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2023-12-26T14:02:43+00:00" }, { "name": "symfony/stopwatch", @@ -4602,16 +4673,16 @@ }, { "name": "symfony/string", - "version": "v6.3.2", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "53d1a83225002635bca3482fcbf963001313fb68" + "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/53d1a83225002635bca3482fcbf963001313fb68", - "reference": "53d1a83225002635bca3482fcbf963001313fb68", + "url": "https://api.github.com/repos/symfony/string/zipball/7cb80bc10bfcdf6b5492741c0b9357dac66940bc", + "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc", "shasum": "" }, "require": { @@ -4625,11 +4696,11 @@ "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^5.4|^6.0", - "symfony/http-client": "^5.4|^6.0", - "symfony/intl": "^6.2", + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0" + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -4668,7 +4739,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.3.2" + "source": "https://github.com/symfony/string/tree/v6.4.2" }, "funding": [ { @@ -4684,20 +4755,20 @@ "type": "tidelift" } ], - "time": "2023-07-05T08:41:27+00:00" + "time": "2023-12-10T16:15:48+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -4726,7 +4797,7 @@ "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" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -4734,7 +4805,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" } ], "aliases": [], @@ -4743,10 +4814,13 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.0" + "php": ">=8.2" }, "platform-dev": { "ext-mysqli": "*" }, - "plugin-api-version": "2.3.0" + "platform-overrides": { + "php": "8.2.0" + }, + "plugin-api-version": "2.6.0" } diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 6abdc17..134de45 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -272,10 +272,8 @@ public function loadFromRow(array $row) /** * Save object into database (insert or update). - * - * @return $this */ - public function &save() + public function save(): static { // --------------------------------------------------- // Populate defaults diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index bf7ace3..ea3cedf 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -42,11 +42,8 @@ public function validate(ValidatorInterface $validator): ValidatorInterface; /** * Save object into database (insert or update). - * - * @return $this - * @throws ValidationException */ - public function &save(); + public function save(): static; /** * Create a copy of this object and optionally save it. From e25ea7d772c2c8d43c8d4fa4ae210f734e602ef3 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 28 Jan 2024 11:01:06 +0100 Subject: [PATCH 42/61] Add types and remove deprecations --- src/Entity/Entity.php | 197 ++++++------------ src/Entity/EntityInterface.php | 105 +++------- .../SpatialEntity/Base/SpatialEntity.php | 5 +- .../StatSnapshots/Base/StatsSnapshot.php | 5 +- test/src/Fixtures/Writers/Writer.php | 1 + 5 files changed, 96 insertions(+), 217 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 134de45..aa26364 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -105,24 +105,18 @@ protected function configure() /** * Indicates if this is new object (not saved). - * - * @var bool */ - private $is_new = true; + private bool $is_new = true; /** * This flag is set to true when data from row are inserted into fields. - * - * @var bool */ - private $is_loading = false; + private bool $is_loading = false; /** * Field values. - * - * @var array */ - private $values = []; + private array $values = []; /** * Array of modified field values. @@ -130,36 +124,26 @@ protected function configure() * Elements of this array are populated on setter call. Real name is * resolved, old value is saved here (if exists) and new one is set. Keys * used in this array are real field names only! - * - * @var array - */ - private $old_values = []; - - /** - * Array of modified fiels. - * - * @var array */ - private $modified_fields = []; + private array $old_values = []; /** - * @var array + * Array of modified fields. */ - private $modified_attributes = []; + private array $modified_fields = []; + private array $modified_attributes = []; /** * Primary key is updated. - * - * @var bool */ - private $primary_key_modified = false; + private bool $primary_key_modified = false; /** * Validate object properties before object is saved. * * This method is called before the item is saved and can be used to fetch - * errors in data before we really save it database. $errors is instance of - * ValidationErrors class that is used for error collection. If collection + * errors in data before we really save it to the database. $errors is instance + * of ValidationErrors class that is used for error collection. If collection * is empty object is considered valid and save process will continue */ public function validate(ValidatorInterface $validator): ValidatorInterface @@ -169,47 +153,41 @@ public function validate(ValidatorInterface $validator): ValidatorInterface return $validator; } - /** - * {@inheritdoc} - */ - public function is($object) + public function is(mixed $object): bool { - if ($object instanceof EntityInterface) { - if ($this->isLoaded()) { - return $object->isLoaded() && get_class($this) == get_class($object) && $this->getId() == $object->getId(); - } else { - foreach ($this->getEntityFields() as $field_name) { - if (!$object->entityFieldExists($field_name) || - !$this->areFieldValuesSame( - $this->getFieldValue($field_name), - $object->getFieldValue($field_name) - )) { - return false; - } - } + if (!$object instanceof EntityInterface) { + return false; + } - return true; + if ($this->isLoaded()) { + return $object->isLoaded() && get_class($this) == get_class($object) && $this->getId() == $object->getId(); + } + + foreach ($this->getEntityFields() as $field_name) { + if (!$object->entityFieldExists($field_name) || + !$this->areFieldValuesSame( + $this->getFieldValue($field_name), + $object->getFieldValue($field_name) + )) { + return false; } } - return false; + return true; } /** * Return true if field values match. - * - * @param mixed $value_1 - * @param mixed $value_2 - * @return bool */ - private function areFieldValuesSame($value_1, $value_2) + private function areFieldValuesSame(mixed $value_1, mixed $value_2): bool { if (($value_1 instanceof DateValueInterface && $value_2 instanceof DateValueInterface) - || ($value_1 instanceof DateTimeValueInterface && $value_2 instanceof DateTimeValueInterface)) { + || ($value_1 instanceof DateTimeValueInterface && $value_2 instanceof DateTimeValueInterface) + ) { return $value_1->getTimestamp() == $value_2->getTimestamp(); - } else { - return $value_1 === $value_2; } + + return $value_1 === $value_2; } public function getPrimaryKey(): string @@ -229,11 +207,9 @@ public function getTableName(): string /** * Load data from database row. * - * If $cache_row is set to true row data will be added to cache - * - * @param array $row + * If $cache_row is set to true row data will be added to cache. */ - public function loadFromRow(array $row) + public function loadFromRow(array $row): static { if (empty($row)) { throw new InvalidArgumentException('Database row expected'); @@ -268,6 +244,8 @@ public function loadFromRow(array $row) } $this->doneLoading(); + + return $this; } /** @@ -340,12 +318,9 @@ public function save(): static } /** - * Delete specific object (and related objects if neccecery). - * - * @param bool $bulk - * @return $this + * Delete specific object (and related objects if necessary). */ - public function &delete($bulk = false) + public function delete(bool $bulk = false): static { if ($this->isLoaded()) { $this->connection->transact(function () use ($bulk) { @@ -363,15 +338,11 @@ public function &delete($bulk = false) /** * Create a copy of this object and optionally save it. - * - * @param bool $save - * @return object */ - public function copy($save = false) + public function copy(bool $save = false): static { $object_class = get_class($this); - /** @var EntityInterface $copy */ $copy = new $object_class($this->connection, $this->pool, $this->logger); foreach ($this->getEntityFields() as $field) { @@ -395,20 +366,16 @@ public function copy($save = false) /** * Return value of $is_new variable. - * - * @return bool */ - public function isNew() + public function isNew(): bool { - return (bool) $this->is_new; + return $this->is_new; } /** * Returns true if this object have row in database. - * - * @return bool */ - public function isLoaded() + public function isLoaded(): bool { return !$this->is_new; } @@ -416,7 +383,7 @@ public function isLoaded() /** * Mark start of loading from row. */ - private function startLoading() + private function startLoading(): void { $this->is_loading = true; } @@ -424,7 +391,7 @@ private function startLoading() /** * Done loading from row. */ - private function doneLoading() + private function doneLoading(): void { if ($this->is_loading) { $this->is_loading = false; @@ -436,7 +403,7 @@ private function doneLoading() /** * Set loaded stamp value. */ - private function setAsLoaded() + private function setAsLoaded(): void { $this->is_new = false; $this->resetModifiedFlags(); @@ -445,10 +412,8 @@ private function setAsLoaded() /** * Returns true if this object is in the middle of hydration process * (loading values from database row). - * - * @return bool */ - protected function isLoading() + protected function isLoading(): bool { return $this->is_loading; } @@ -459,21 +424,16 @@ protected function isLoading() /** * Return object ID. - * - * @return int */ - public function getId() + public function getId(): ?int { return $this->getFieldValue('id'); } /** * Set value of id field. - * - * @param int $value - * @return $this */ - public function &setId($value) + public function setId(?int $value): static { $this->setFieldValue('id', $value); @@ -482,26 +442,18 @@ public function &setId($value) /** * Check if this object has modified columns. - * - * @return bool */ - public function isModified() + public function isModified(): bool { return !empty($this->modified_fields) || !empty($this->modified_attributes); } - /** - * {@inheritdoc} - */ - public function getModifiedFields() + public function getModifiedFields(): array { return $this->modified_fields; } - /** - * {@inheritdoc} - */ - public function getModifications() + public function getModifications(): array { $result = []; @@ -521,40 +473,29 @@ public function getModifications() /** * Returns true if specific field is modified. - * - * @param string $field - * @return bool */ - public function isModifiedField($field) + public function isModifiedField(string $field): bool { return in_array($field, $this->modified_fields); } /** * Return true if primary key is modified. - * - * @return bool */ - public function isPrimaryKeyModified() + public function isPrimaryKeyModified(): bool { return $this->primary_key_modified; } - /** - * @return array - */ - public function getModifiedAttributes() + public function getModifiedAttributes(): array { return $this->modified_attributes; } /** * Return true if $attribute is modified. - * - * @param string $attribute - * @return bool */ - public function isModifiedAttribute($attribute) + public function isModifiedAttribute(string $attribute): bool { return in_array($attribute, $this->modified_attributes); } @@ -568,39 +509,26 @@ protected function recordModifiedAttribute($attribute) /** * Revert field to old value. - * - * @param $field */ - public function revertField($field) + public function revertField(string $field): void { if ($this->isModifiedField($field)) { $this->setFieldValue($field, $this->getOldFieldValue($field)); // revert field value - if (($key = array_search($field, $this->modified_fields)) !== false) { - unset($this->modified_fields[$field]); // remove modified flag + if (array_key_exists($field, $this->modified_fields)) { + unset($this->modified_fields[$field]); } } } /** * Check if selected field is primary key. - * - * @param string $field Field that need to be checked - * @return bool */ - public function isPrimaryKey($field) + public function isPrimaryKey(string $field): bool { return $field === 'id'; } - /** - * @deprecated Use getEntityFields() instead. - */ - public function getFields() - { - return $this->getEntityFields(); - } - public function getEntityFields(): array { return $this->entity_fields; @@ -669,10 +597,7 @@ protected function &setGeneratedFieldsValueCaster(ValueCasterInterface $value_ca return $this; } - /** - * {@inheritdoc} - */ - public function getFieldValue($field, $default = null) + public function getFieldValue(string $field, mixed $default = null): mixed { if (empty($this->values[$field]) && !array_key_exists($field, $this->values)) { return empty($this->default_entity_field_values[$field]) @@ -934,9 +859,9 @@ private function getWherePartById($id) } /** - * Reset modification idicators. + * Reset modification indicators. * - * Useful when you use setXXX functions but you dont want to modify + * Useful when you use setXXX functions, but you don't want to modify * anything (just loading data from database in fresh object using * setFieldValue function) */ diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index ea3cedf..4eefad5 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -6,40 +6,40 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Entity; use ActiveCollab\DatabaseConnection\Record\LoadFromRow; -use ActiveCollab\DatabaseObject\Exception\ValidationException; use ActiveCollab\DatabaseObject\ValidatorInterface; use ActiveCollab\Object\ObjectInterface; -use InvalidArgumentException; use JsonSerializable; -/** - * @package ActiveCollab\DatabaseObject - */ interface EntityInterface extends ObjectInterface, LoadFromRow, JsonSerializable { /** * Load data from database row. * - * If $cache_row is set to true row data will be added to cache - * - * @param array $row - * @throws InvalidArgumentException + * If $cache_row is set to true row data will be added to cache. */ - public function loadFromRow(array $row); + public function loadFromRow(array $row): static; /** * Validate object properties before object is saved. * * This method is called before the item is saved and can be used to fetch - * errors in data before we really save it database. $errors is instance of - * ValidationErrors class that is used for error collection. If collection + * errors in data before we really save it to the database. $errors is instance + * of ValidationErrors class that is used for error collection. If collection * is empty object is considered valid and save process will continue */ public function validate(ValidatorInterface $validator): ValidatorInterface; + /** + * Return true if $object is the same as this object (of same type, and + * with the same ID). + */ + public function is(mixed $object): bool; + /** * Save object into database (insert or update). */ @@ -47,19 +47,13 @@ public function save(): static; /** * Create a copy of this object and optionally save it. - * - * @param bool $save - * @return EntityInterface */ - public function copy($save = false); + public function copy(bool $save = false): static; /** - * Delete specific object (and related objects if neccecery). - * - * @param bool $bulk - * @return $this + * Delete specific object (and related objects if necessary). */ - public function &delete($bulk = false); + public function delete(bool $bulk = false): static; /** * Return primary key columns. @@ -77,78 +71,54 @@ public function getTableName(): string; /** * Return value of $is_new variable. - * - * @return bool */ - public function isNew(); + public function isNew(): bool; /** * Returns true if this object have row in database. - * - * @return bool */ - public function isLoaded(); + public function isLoaded(): bool; // --------------------------------------------------- // Fields // --------------------------------------------------- + public function getId(): ?int; + /** * Set value of id field. - * - * @param int $value - * @return $this */ - public function &setId($value); + public function setId(?int $value): static; /** * Check if this object has modified columns. - * - * @return bool */ - public function isModified(); + public function isModified(): bool; /** - * Return modificications indexed by field name, with value composed of an old and new value. - * - * @return array + * Return modifications indexed by field name, with value composed of an old and new value. */ - public function getModifications(); + public function getModifications(): array; /** * Return array of modified fields. - * - * @return array */ - public function getModifiedFields(); + public function getModifiedFields(): array; /** * Returns true if specific field is modified. - * - * @param string $field - * @return bool */ - public function isModifiedField($field); + public function isModifiedField(string $field): bool; /** * Return a list of modified attributes. - * - * @return array */ - public function getModifiedAttributes(); + public function getModifiedAttributes(): array; /** * Return true if $attribute is modified. - * - * @param string $attribute - * @return bool */ - public function isModifiedAttribute($attribute); - - /** - * @deprecated Use getEntityFields() instead. - */ - public function getFields(); + public function isModifiedAttribute(string $attribute): bool; /** * Return a list of fields that are managed by this entity. @@ -190,27 +160,18 @@ public function isGeneratedField($field); /** * Check if selected field is primary key. - * - * @param string $field Field that need to be checked - * @return bool */ - public function isPrimaryKey($field); + public function isPrimaryKey(string $field): bool; /** * Return true if primary key is modified. - * - * @return bool */ - public function isPrimaryKeyModified(); + public function isPrimaryKeyModified(): bool; /** - * Return value of specific field and typecast it... - * - * @param string $field Field value - * @param mixed $default Default value that is returned in case of any error - * @return mixed + * Return value of specific field and typecast it. */ - public function getFieldValue($field, $default = null); + public function getFieldValue(string $field, mixed $default = null): mixed; /** * Return old field values, before fields were updated. @@ -229,10 +190,8 @@ public function getOldFieldValue($field); /** * Revert field to old value. - * - * @param string $field */ - public function revertField($field); + public function revertField(string $field): void; /** * Set specific field value. diff --git a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php index 8bd9b10..08d8879 100644 --- a/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php +++ b/test/src/Fixtures/SpatialEntity/Base/SpatialEntity.php @@ -162,10 +162,7 @@ public function &setStats($value) return $this; } - /** - * {@inheritdoc} - */ - public function getFieldValue($field, $default = null) + public function getFieldValue(string $field, mixed $default = null): mixed { $value = parent::getFieldValue($field, $default); diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index 9b35fdd..3b94582 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -178,10 +178,7 @@ public function &setStats($value) return $this; } - /** - * {@inheritdoc} - */ - public function getFieldValue($field, $default = null) + public function getFieldValue(string $field, mixed $default = null): mixed { $value = parent::getFieldValue($field, $default); diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index c3b7a9d..8e0eb3d 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -26,6 +26,7 @@ class Writer extends BaseWriter implements ScrapInterface { use Russian, ClassicWriter; + /** * @var mixed */ From 0b67ae7340e62a3786315bb6eb4e23123a41a408 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 28 Jan 2024 11:30:15 +0100 Subject: [PATCH 43/61] Add missing types to Entity class --- README.md | 5 +- src/Collection.php | 2 +- src/Entity/Entity.php | 185 +++++++----------- src/Entity/EntityInterface.php | 38 +--- .../StatSnapshots/Base/StatsSnapshot.php | 5 +- .../Writers/PreconfiguredCollection.php | 2 +- test/src/Fixtures/Writers/Writer.php | 50 ++--- 7 files changed, 97 insertions(+), 190 deletions(-) diff --git a/README.md b/README.md index 8b26258..fed39c5 100644 --- a/README.md +++ b/README.md @@ -163,10 +163,7 @@ use ActiveCollab\DatabaseObject\Entity\Entity; class StatsSnapshot extends Entity { - /** - * {@inheritdoc} - */ - protected function configure() + protected function configure(): void { $this->setGeneratedFieldsValueCaster(new ValueCaster([ 'is_used_on_day' => ValueCasterInterface::CAST_BOOL, diff --git a/src/Collection.php b/src/Collection.php index 52e9a72..6864888 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -33,7 +33,7 @@ public function __construct(ConnectionInterface $connection, PoolInterface $pool $this->configure(); } - protected function configure() + protected function configure(): void { } diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index aa26364..4da676d 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -95,7 +95,7 @@ public function __construct( /** * Execute post-construction configuration. */ - protected function configure() + protected function configure(): void { } @@ -500,7 +500,7 @@ public function isModifiedAttribute(string $attribute): bool return in_array($attribute, $this->modified_attributes); } - protected function recordModifiedAttribute($attribute) + protected function recordModifiedAttribute(string $attribute): void { if (!in_array($attribute, $this->modified_attributes)) { $this->modified_attributes[] = $attribute; @@ -534,63 +534,37 @@ public function getEntityFields(): array return $this->entity_fields; } - /** - * @deprecated Use entityFieldExists() instead. - */ - public function fieldExists($field) - { - return $this->entityFieldExists($field); - } - public function entityFieldExists(string $entity_field): bool { return in_array($entity_field, $this->entity_fields) || in_array($entity_field, $this->generated_entity_fields); } - /** - * {@inheritdoc} - */ - public function getGeneratedFields() + public function getGeneratedFields(): array { return $this->generated_entity_fields; } - /** - * {@inheritdoc} - */ - public function generatedFieldExists($field) + public function generatedFieldExists(string $field): bool { return in_array($field, $this->generated_entity_fields); } - /** - * {@inheritdoc} - */ - public function isGeneratedField($field) + public function isGeneratedField(string $field): bool { return $this->generatedFieldExists($field); } - /** - * @var ValueCasterInterface - */ - private $generated_fields_value_caster; + private ?ValueCasterInterface $generated_fields_value_caster = null; - /** - * @return ValueCasterInterface - */ - private function getGeneratedFieldsValueCaster() + private function getGeneratedFieldsValueCaster(): ?ValueCasterInterface { return $this->generated_fields_value_caster; } /** * Set generated fields value caster. - * - * @param ValueCasterInterface|null $value_caster - * @return $this */ - protected function &setGeneratedFieldsValueCaster(ValueCasterInterface $value_caster = null) + protected function setGeneratedFieldsValueCaster(ValueCasterInterface $value_caster = null): static { $this->generated_fields_value_caster = $value_caster; @@ -611,23 +585,22 @@ public function getFieldValue(string $field, mixed $default = null): mixed /** * Return old field values, before fields were updated. - * - * @return array */ - public function getOldValues() + public function getOldValues(): array { return $this->old_values; } /** - * Return all field value. - * - * @param string $field - * @return mixed + * Return old field value. */ - public function getOldFieldValue($field) + public function getOldFieldValue(string $field): mixed { - return isset($this->old_values[$field]) ? $this->old_values[$field] : null; + if (array_key_exists($field, $this->old_values)) { + return $this->old_values[$field]; + } + + return null; } /** @@ -689,33 +662,24 @@ public function setFieldValue(string $field, mixed $value): static /** * Return a list of attributes that this object supports. - * - * @return array */ - protected function getAttributes() + protected function getAttributes(): array { return []; } /** * Return setter method name for the given attribute. - * - * @param string $attribute - * @return string */ - private function getAttributeSetter($attribute) + private function getAttributeSetter(string $attribute): string { return sprintf('set%s', InflectorFactory::create()->build()->classify($attribute)); } /** * Set non-field value during DataManager::create() and DataManager::update() calls. - * - * @param string $attribute - * @param mixed $value - * @return $this */ - public function &setAttribute($attribute, $value) + public function setAttribute(string $attribute, mixed $value): static { if (in_array($attribute, $this->getAttributes())) { $setter = $this->getAttributeSetter($attribute); @@ -732,36 +696,34 @@ public function &setAttribute($attribute, $value) /** * Use input $value and return a valid DateValue instance. - * - * @param mixed $value - * @return DateValue|null */ - protected function getDateValueInstanceFrom($value) + protected function getDateValueInstanceFrom(mixed $value): ?DateValueInterface { if ($value === null) { return null; - } elseif ($value instanceof DateTime) { + } + + if ($value instanceof DateTime) { return new DateValue($value->format('Y-m-d')); - } else { - return new DateValue($value); } + + return new DateValue($value); } /** * Use input $value and return a valid DateTimeValue instance. - * - * @param mixed $value - * @return DateTimeValue|null */ - protected function getDateTimeValueInstanceFrom($value) + protected function getDateTimeValueInstanceFrom(mixed $value): ?DateTimeValueInterface { if ($value === null) { return null; - } elseif ($value instanceof DateTime) { + } + + if ($value instanceof DateTime) { return new DateTimeValue($value->format('Y-m-d H:i:s'), 'UTC'); - } else { - return new DateTimeValue($value, 'UTC'); } + + return new DateTimeValue($value, 'UTC'); } // --------------------------------------------------- @@ -771,7 +733,7 @@ protected function getDateTimeValueInstanceFrom($value) /** * Insert record in the database. */ - private function insert() + private function insert(): void { $last_insert_id = $this->connection->insert($this->table_name, $this->values); @@ -786,39 +748,38 @@ private function insert() /** * Update database record. */ - private function update() + private function update(): void { - if (count($this->modified_fields)) { - $updates = []; + if (empty($this->modified_fields)) { + return; + } - foreach ($this->modified_fields as $modified_field) { - $updates[$modified_field] = $this->values[$modified_field]; - } + $updates = []; - if ($this->primary_key_modified) { - $old_id = isset($this->old_values['id']) ? $this->old_values['id'] : $this->getId(); + foreach ($this->modified_fields as $modified_field) { + $updates[$modified_field] = $this->values[$modified_field]; + } - if ($this->pool->exists(get_class($this), $this->getId())) { - throw new LogicException('Object #' . $this->getId() . " can't be overwritten"); - } else { - $this->connection->update($this->table_name, $updates, $this->getWherePartById($old_id)); - } + if ($this->primary_key_modified) { + $old_id = $this->old_values['id'] ?? $this->getId(); + + if ($this->pool->exists(get_class($this), $this->getId())) { + throw new LogicException('Object #' . $this->getId() . " can't be overwritten"); } else { - $this->connection->update($this->table_name, $updates, $this->getWherePartById($this->getId())); + $this->connection->update($this->table_name, $updates, $this->getWherePartById($old_id)); } - - $this->values = array_merge($this->values, $this->refreshGeneratedFieldValues($this->getId())); - $this->setAsLoaded(); + } else { + $this->connection->update($this->table_name, $updates, $this->getWherePartById($this->getId())); } + + $this->values = array_merge($this->values, $this->refreshGeneratedFieldValues($this->getId())); + $this->setAsLoaded(); } /** * Return an array with potentially refreshed values of generated fields. - * - * @param int $id - * @return array */ - private function refreshGeneratedFieldValues($id) + private function refreshGeneratedFieldValues(int $id): array { $result = []; @@ -845,13 +806,10 @@ private function refreshGeneratedFieldValues($id) /** * Return where part of query. - * - * @param int $id - * @return string */ - private function getWherePartById($id) + private function getWherePartById(int $id): string { - if (empty($id)) { + if ($id < 1) { throw new InvalidArgumentException("Value '$id' is not a valid ID"); } @@ -865,7 +823,7 @@ private function getWherePartById($id) * anything (just loading data from database in fresh object using * setFieldValue function) */ - private function resetModifiedFlags() + private function resetModifiedFlags(): void { $this->modified_fields = []; $this->modified_attributes = []; @@ -879,41 +837,33 @@ private function resetModifiedFlags() /** * Registered event handlers. - * - * @var array */ - private $event_handlers = []; + private array $event_handlers = []; /** * Register an internal event handler. - * - * @param string $event - * @param callable $handler */ - protected function registerEventHandler($event, callable $handler) + protected function registerEventHandler(string $event, callable $handler): void { if (empty($event)) { throw new InvalidArgumentException('Event name is required'); } - if (is_callable($handler)) { - if (empty($this->event_handlers[$event])) { - $this->event_handlers[$event] = []; - } - - $this->event_handlers[$event][] = $handler; - } else { + if (!is_callable($handler)) { throw new InvalidArgumentException('Handler not callable'); } + + if (empty($this->event_handlers[$event])) { + $this->event_handlers[$event] = []; + } + + $this->event_handlers[$event][] = $handler; } /** * Trigger an internal event. - * - * @param string $event - * @param array $event_parameters */ - protected function triggerEvent($event, array $event_parameters = []) + protected function triggerEvent(string $event, array $event_parameters = []): void { if (isset($this->event_handlers[$event])) { foreach ($this->event_handlers[$event] as $handler) { @@ -935,10 +885,7 @@ public function jsonSerialize() return $result; } - /** - * {@inheritdoc} - */ - public function jsonSerializeDetails() + public function jsonSerializeDetails(): array { return []; } diff --git a/src/Entity/EntityInterface.php b/src/Entity/EntityInterface.php index 4eefad5..b0f6e2a 100644 --- a/src/Entity/EntityInterface.php +++ b/src/Entity/EntityInterface.php @@ -125,11 +125,6 @@ public function isModifiedAttribute(string $attribute): bool; */ public function getEntityFields(): array; - /** - * @deprecated Use entityFieldExists() instead. - */ - public function fieldExists($field); - /** * Return true if $field exists (both generated and non-generated fields are checked). */ @@ -137,26 +132,18 @@ public function entityFieldExists(string $entity_field): bool; /** * Return a list of fields that this entity is aware of, but does not manage. - * - * @return array */ - public function getGeneratedFields(); + public function getGeneratedFields(): array; /** * Check if generated field exists. - * - * @param string $field Field name - * @return bool */ - public function generatedFieldExists($field); + public function generatedFieldExists(string $field): bool; /** * Return true if $field is generated field. - * - * @param string $field - * @return bool */ - public function isGeneratedField($field); + public function isGeneratedField(string $field): bool; /** * Check if selected field is primary key. @@ -175,18 +162,13 @@ public function getFieldValue(string $field, mixed $default = null): mixed; /** * Return old field values, before fields were updated. - * - * @return array */ - public function getOldValues(); + public function getOldValues(): array; /** * Return all field value. - * - * @param string $field - * @return mixed */ - public function getOldFieldValue($field); + public function getOldFieldValue(string $field): mixed; /** * Revert field to old value. @@ -204,17 +186,11 @@ public function setFieldValue(string $field, mixed $value): static; /** * Set non-field value during DataManager::create() and DataManager::update() calls. - * - * @param string $attribute - * @param mixed $value - * @return $this */ - public function &setAttribute($attribute, $value); + public function setAttribute(string $attribute, mixed $value): static; /** * Return an array of object properties that are needed to fully display this object on a page. - * - * @return array */ - public function jsonSerializeDetails(); + public function jsonSerializeDetails(): array; } diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index 3b94582..0083182 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -52,10 +52,7 @@ abstract class StatsSnapshot extends Entity */ protected array $default_entity_field_values = []; - /** - * {@inheritdoc} - */ - protected function configure() + protected function configure(): void { $this->setGeneratedFieldsValueCaster( new ValueCaster( diff --git a/test/src/Fixtures/Writers/PreconfiguredCollection.php b/test/src/Fixtures/Writers/PreconfiguredCollection.php index 0e00ec0..f6759c8 100644 --- a/test/src/Fixtures/Writers/PreconfiguredCollection.php +++ b/test/src/Fixtures/Writers/PreconfiguredCollection.php @@ -28,7 +28,7 @@ public function getType() /** * Configure the collection when it is created. */ - protected function configure() + protected function configure(): void { $this->where('`name` LIKE ?', 'A%')->orderBy('`name`'); } diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index 8e0eb3d..2bb0770 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -26,47 +26,37 @@ class Writer extends BaseWriter implements ScrapInterface { use Russian, ClassicWriter; - /** * @var mixed */ public $custom_attribute_value; - - /** - * @var bool - */ - public $modified_using_custom_producer = false; - - /** - * @var bool - */ - public $is_scrapped = false; - - /** - * @var bool - */ - public $scrapped_using_custom_producer = false; + public bool $modified_using_custom_producer = false; + public bool $is_scrapped = false; + public bool $scrapped_using_custom_producer = false; public function __construct(ConnectionInterface &$connection, PoolInterface &$pool, LoggerInterface $logger) { parent::__construct($connection, $pool, $logger); - $this->registerEventHandler('on_set_attribute', function ($attribute, $value) { - if ($attribute == 'custom_attribute') { - $this->custom_attribute_value = $value; - } - }); - - $this->registerEventHandler('on_json_serialize', function (array &$result) { - $result['name'] = $this->getName(); - $result['birthday'] = $this->getBirthday(); - }); + $this->registerEventHandler( + 'on_set_attribute', + function ($attribute, $value) { + if ($attribute == 'custom_attribute') { + $this->custom_attribute_value = $value; + } + }, + ); + + $this->registerEventHandler( + 'on_json_serialize', + function (array &$result) { + $result['name'] = $this->getName(); + $result['birthday'] = $this->getBirthday(); + }, + ); } - /** - * {@inheritdoc} - */ - protected function getAttributes() + protected function getAttributes(): array { return array_merge(parent::getAttributes(), ['custom_field_value']); } From a5aae84271f172ecacf8c9359e02bdb8874ed633 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Tue, 30 Jan 2024 12:10:04 +0100 Subject: [PATCH 44/61] Update code style --- README.md | 2 +- src/Entity/Manager.php | 13 +- src/Exception/ObjectNotFoundException.php | 22 ++-- src/Exception/ValidationException.php | 150 ++++++++-------------- 4 files changed, 69 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index fed39c5..d109f98 100644 --- a/README.md +++ b/README.md @@ -179,4 +179,4 @@ Entity class also refreshes the values of these fields on object save so fresh v ## To Do 1. Caching, -1. Remove deprecated `ObjectInterface` and `Object` class. +2. Remove deprecated `ObjectInterface` and `Object` class. diff --git a/src/Entity/Manager.php b/src/Entity/Manager.php index 9cd9c34..0c09a14 100644 --- a/src/Entity/Manager.php +++ b/src/Entity/Manager.php @@ -16,14 +16,11 @@ abstract class Manager implements ManagerInterface { - protected $connection; - protected $pool; - protected $logger; - - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) + public function __construct( + protected ConnectionInterface $connection, + protected PoolInterface $pool, + protected LoggerInterface $logger, + ) { - $this->connection = $connection; - $this->pool = $pool; - $this->logger = $logger; } } diff --git a/src/Exception/ObjectNotFoundException.php b/src/Exception/ObjectNotFoundException.php index 52ce385..bf96299 100644 --- a/src/Exception/ObjectNotFoundException.php +++ b/src/Exception/ObjectNotFoundException.php @@ -6,23 +6,25 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Exception; use Exception; use RuntimeException; -/** - * @package ActiveCollab\DatabaseObject\Exception - */ class ObjectNotFoundException extends RuntimeException { - /** - * @param string $type - * @param int $id - * @param Exception|null $previous - */ - public function __construct($type, $id, Exception $previous = null) + public function __construct( + string $type, + int $id, + Exception $previous = null, + ) { - parent::__construct("{$type} #{$id} not found", 0, $previous); + parent::__construct( + sprintf("%s #%d not found", $type, $id), + 0, + $previous, + ); } } diff --git a/src/Exception/ValidationException.php b/src/Exception/ValidationException.php index ea591c9..9b90fe8 100644 --- a/src/Exception/ValidationException.php +++ b/src/Exception/ValidationException.php @@ -6,154 +6,81 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Exception; use ActiveCollab\DatabaseObject\Entity\EntityInterface; use Exception; -/** - * @package ActiveCollab\DatabaseObject\Exception - */ class ValidationException extends Exception { const ANY_FIELD = '-- any --'; - /** - * Object instance. - * - * @var EntityInterface - */ - private $object; + private ?EntityInterface $object = null; + private array $errors = []; - /** - * Errors array. - * - * @var array - */ - private $errors = []; - - public function __construct($message = 'Validation failed', int $code = 0, Exception $previous = null) + public function __construct( + string $message = 'Validation failed', + int $code = 0, + Exception $previous = null, + ) { parent::__construct($message, $code, $previous); } - /** - * Return parent object instance. - * - * @return object - */ - public function getObject() + public function getObject(): ?EntityInterface { return $this->object; } - /** - * @param EntityInterface $object - */ - public function setObject(EntityInterface $object) + public function setObject(EntityInterface $object): static { $this->object = $object; + + return $this; } - /** - * Return array or property => value pairs that describes this object. - * - * @return array - */ - public function jsonSerialize() + public function getErrors(): ?array { - $result = [ - 'message' => $this->getMessage(), - 'type' => get_class($this), - 'field_errors' => [] - ]; - - foreach ($this->getErrors() as $field => $messages) { - foreach ($messages as $message) { - if (empty($result['field_errors'][$field])) { - $result['field_errors'][$field] = []; - } - - $result['field_errors'][$field][] = $message; - } - } - - if ($this->object instanceof EntityInterface) { - $result['object_class'] = get_class($this->object); + if (empty($this->errors)) { + return null; } - return $result; - } - - // --------------------------------------------------- - // Utility methods - // --------------------------------------------------- - - /** - * Return number of errors from specific form. - * - * @return array - */ - public function getErrors() - { - return count($this->errors) ? $this->errors : null; + return $this->errors; } /** * Set errors. * * Key is field name, value is array of error messages for the given field - * - * @param array $errors - * @return $this */ - public function &setErrors(array $errors) + public function setErrors(array $errors): static { $this->errors = $errors; return $this; } - /** - * Return field errors. - * - * @param string $field - * @return array - */ - public function getFieldErrors($field) + public function getFieldErrors(string $field): ?array { - return isset($this->errors[$field]) ? $this->errors[$field] : null; + return $this->errors[$field] ?? null; } - /** - * Returns true if there are error messages reported. - * - * @return bool - */ - public function hasErrors() + public function hasErrors(): bool { return (bool) count($this->errors); } - /** - * Check if a specific field has reported errors. - * - * @param string $field - * @return bool - */ - public function hasError($field) + public function hasError(string $field): bool { return !empty($this->errors[$field]); } - /** - * Add error to array. - * - * @param string $error - * @param string $field - * @return $this - */ - public function &addError(string $error, string $field = self::ANY_FIELD) + public function addError( + string $error, + string $field = self::ANY_FIELD, + ): static { if (empty($field)) { $field = self::ANY_FIELD; @@ -167,4 +94,29 @@ public function &addError(string $error, string $field = self::ANY_FIELD) return $this; } + + public function jsonSerialize(): array + { + $result = [ + 'message' => $this->getMessage(), + 'type' => get_class($this), + 'field_errors' => [] + ]; + + foreach ($this->getErrors() as $field => $messages) { + foreach ($messages as $message) { + if (empty($result['field_errors'][$field])) { + $result['field_errors'][$field] = []; + } + + $result['field_errors'][$field][] = $message; + } + } + + if ($this->object instanceof EntityInterface) { + $result['object_class'] = get_class($this->object); + } + + return $result; + } } From 6558b81b386a3bd8d7c5bd3099558a9b46ec1fe6 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Tue, 30 Jan 2024 12:12:40 +0100 Subject: [PATCH 45/61] Add missing types --- src/FinderFactory/FinderFactory.php | 19 ++++++++----------- src/FinderFactory/FinderFactoryInterface.php | 6 +++++- src/TraitsResolver/TraitsResolver.php | 16 ++++++---------- .../TraitsResolverInterface.php | 7 +++---- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/FinderFactory/FinderFactory.php b/src/FinderFactory/FinderFactory.php index 4517e5d..e271647 100644 --- a/src/FinderFactory/FinderFactory.php +++ b/src/FinderFactory/FinderFactory.php @@ -18,22 +18,19 @@ class FinderFactory implements FinderFactoryInterface { - private $connection; - private $pool; - private $logger; - public function __construct( - ConnectionInterface $connection, - PoolInterface $pool, - LoggerInterface $logger + private ConnectionInterface $connection, + private PoolInterface $pool, + private LoggerInterface $logger, ) { - $this->connection = $connection; - $this->pool = $pool; - $this->logger = $logger; } - public function produceFinder(string $type, string $where_pattern = null, ...$where_arguments): FinderInterface + public function produceFinder( + string $type, + string $where_pattern = null, + mixed ...$where_arguments, + ): FinderInterface { $finder = new Finder( $this->connection, diff --git a/src/FinderFactory/FinderFactoryInterface.php b/src/FinderFactory/FinderFactoryInterface.php index 9027743..0f00dc7 100644 --- a/src/FinderFactory/FinderFactoryInterface.php +++ b/src/FinderFactory/FinderFactoryInterface.php @@ -14,5 +14,9 @@ interface FinderFactoryInterface { - public function produceFinder(string $type, string $where_pattern = null, ...$where_arguments): FinderInterface; + public function produceFinder( + string $type, + string $where_pattern = null, + mixed ...$where_arguments, + ): FinderInterface; } diff --git a/src/TraitsResolver/TraitsResolver.php b/src/TraitsResolver/TraitsResolver.php index 85be552..14d185b 100644 --- a/src/TraitsResolver/TraitsResolver.php +++ b/src/TraitsResolver/TraitsResolver.php @@ -6,25 +6,24 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\TraitsResolver; use ReflectionClass; class TraitsResolver implements TraitsResolverInterface { - private $type_traits = []; + private array $type_traits = []; - /** - * {@inheritdoc} - */ - public function getClassTraits($class_name) + public function getClassTraits(string $class_name): array { if (empty($this->type_traits[$class_name])) { $this->type_traits[$class_name] = []; $this->recursiveGetClassTraits( new ReflectionClass($class_name), - $this->type_traits[$class_name] + $this->type_traits[$class_name], ); } @@ -33,11 +32,8 @@ public function getClassTraits($class_name) /** * Recursively get trait names for the given class name. - * - * @param ReflectionClass $class - * @param array $trait_names */ - private function recursiveGetClassTraits(ReflectionClass $class, array &$trait_names) + private function recursiveGetClassTraits(ReflectionClass $class, array &$trait_names): void { $trait_names = array_merge($trait_names, $class->getTraitNames()); diff --git a/src/TraitsResolver/TraitsResolverInterface.php b/src/TraitsResolver/TraitsResolverInterface.php index 68596bb..129e8ab 100644 --- a/src/TraitsResolver/TraitsResolverInterface.php +++ b/src/TraitsResolver/TraitsResolverInterface.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\TraitsResolver; interface TraitsResolverInterface { /** * Return trait names for the given class. - * - * @param string $class_name - * @return array */ - public function getClassTraits($class_name); + public function getClassTraits(string $class_name): array; } From c88bdd12954afcc6295fbda15adcf2db371ce771 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Tue, 30 Jan 2024 12:17:25 +0100 Subject: [PATCH 46/61] Update code style --- src/Collection.php | 27 +++++++++++++++------------ src/Finder.php | 17 +++++------------ src/FinderInterface.php | 10 +++++----- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 6864888..184e47a 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -20,11 +20,15 @@ abstract class Collection implements CollectionInterface { use EtagInterfaceImplementation; - protected $connection; - protected $pool; - protected $logger; - - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) + protected ConnectionInterface $connection; + protected PoolInterface $pool; + protected LoggerInterface $logger; + + public function __construct( + ConnectionInterface $connection, + PoolInterface $pool, + LoggerInterface $logger, + ) { $this->connection = $connection; $this->pool = $pool; @@ -49,10 +53,7 @@ protected function isReady(): bool return true; } - /** - * @var string - */ - private $application_identifier = 'APPv1.0'; + private string $application_identifier = 'APPv1.0'; /** * Return application identifier. @@ -206,10 +207,12 @@ public function jsonSerialize(): mixed if ($result instanceof ResultInterface) { return $result->jsonSerialize(); - } elseif ($result === null) { + } + + if ($result === null) { return []; - } else { - return $result; } + + return $result; } } diff --git a/src/Finder.php b/src/Finder.php index 7f51eee..6e8a1da 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -69,14 +69,7 @@ public function __toString(): string // Configuration // --------------------------------------------------- - /** - * Set finder . - * - * @param string|array $pattern - * @param mixed ...$arguments - * @return FinderInterface|$this - */ - public function where(string $pattern, ...$arguments): FinderInterface + public function where(string $pattern, mixed ...$arguments): static { $conditions_to_prepare = [$pattern]; @@ -106,14 +99,14 @@ private function getWhere(): string } } - public function orderBy(string $order_by): FinderInterface + public function orderBy(string $order_by): static { $this->order_by = $order_by; return $this; } - public function limit(int $offset, int $limit): FinderInterface + public function limit(int $offset, int $limit): static { $this->offset = $offset; $this->limit = $limit; @@ -121,12 +114,12 @@ public function limit(int $offset, int $limit): FinderInterface return $this; } - public function join(string $type, string $field_name = null): FinderInterface + public function join(string $type, string $field_name = null): static { return $this->joinTable($this->pool->getTypeTable($type), $field_name); } - public function joinTable(string $table_name, string $field_name = null): FinderInterface + public function joinTable(string $table_name, string $field_name = null): static { $join_table = $this->connection->escapeTableName($table_name); $join_field = $this->connection->escapeFieldName( diff --git a/src/FinderInterface.php b/src/FinderInterface.php index 2b8acd1..561c47a 100644 --- a/src/FinderInterface.php +++ b/src/FinderInterface.php @@ -24,11 +24,11 @@ public function __toString(): string; // Configuration // --------------------------------------------------- - public function where(string $pattern, ...$arguments): FinderInterface; - public function orderBy(string $order_by): FinderInterface; - public function limit(int $offset, int $limit): FinderInterface; - public function join(string $type, string $field_name = null): FinderInterface; - public function joinTable(string $table_name, string $field_name = null): FinderInterface; + public function where(string $pattern, mixed ...$arguments): static; + public function orderBy(string $order_by): static; + public function limit(int $offset, int $limit): static; + public function join(string $type, string $field_name = null): static; + public function joinTable(string $table_name, string $field_name = null): static; // --------------------------------------------------- // Execution From fce97d559ba960a7e0adf1d1e3c47f135db0edbb Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 3 Feb 2024 20:07:49 +0100 Subject: [PATCH 47/61] Add missing types --- src/Finder.php | 33 +++++++++++++++++---------------- src/FinderInterface.php | 4 +--- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Finder.php b/src/Finder.php index 6e8a1da..f455fad 100644 --- a/src/Finder.php +++ b/src/Finder.php @@ -87,16 +87,17 @@ public function where(string $pattern, mixed ...$arguments): static */ private function getWhere(): string { - switch (count($this->where)) { - case 0: - return ''; - case 1: - return $this->where[0]; - default: - return implode(' AND ', array_map(function ($condition) { - return "($condition)"; - }, $this->where)); - } + return match (count($this->where)) { + 0 => '', + 1 => $this->where[0], + default => implode( + ' AND ', + array_map( + fn ($condition) => sprintf("(%s)", $condition), + $this->where, + ), + ), + }; } public function orderBy(string $order_by): static @@ -119,11 +120,14 @@ public function join(string $type, string $field_name = null): static return $this->joinTable($this->pool->getTypeTable($type), $field_name); } - public function joinTable(string $table_name, string $field_name = null): static + public function joinTable( + string $table_name, + string $field_name = null, + ): static { $join_table = $this->connection->escapeTableName($table_name); $join_field = $this->connection->escapeFieldName( - $field_name ? $field_name : $this->getJoinFieldNameFromType() + $field_name ?: $this->getJoinFieldNameFromType() ); $this->join = "LEFT JOIN $join_table ON {$this->getEscapedTableName()}.`id` = $join_table.$join_field"; @@ -212,10 +216,7 @@ public function ids(): ?iterable return empty($ids) ? [] : $ids; } - /** - * {@inheritdoc} - */ - public function execute() + public function execute(): mixed { $select_sql = $this->getSelectSql(); diff --git a/src/FinderInterface.php b/src/FinderInterface.php index 561c47a..dd2c7ab 100644 --- a/src/FinderInterface.php +++ b/src/FinderInterface.php @@ -67,8 +67,6 @@ public function ids(): ?iterable; /** * Prepare SQL and load one or more records. - * - * @return mixed */ - public function execute(); + public function execute(): mixed; } From 42fc40aa1c030d6771990f59a3282f2c96e3bcd0 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 3 Feb 2024 20:08:34 +0100 Subject: [PATCH 48/61] Remove argument values that are argument defaults --- src/Pool.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index 7f38e75..70599c2 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -100,7 +100,7 @@ public function getDefaultProducerClass(): string public function setDefaultProducerClass(string $default_producer_class): PoolInterface { - if (!class_exists($default_producer_class, true)) { + if (!class_exists($default_producer_class)) { throw new InvalidArgumentException('Producer class not found.'); } @@ -606,7 +606,7 @@ public function getRegisteredType(string $type): ?string if (isset($this->types[$type])) { $this->known_types[$type] = $type; } else { - if (class_exists($type, true)) { + if (class_exists($type)) { $reflection_class = new ReflectionClass($type); if ($reflection_class->implementsInterface(EntityInterface::class)) { @@ -688,7 +688,7 @@ public function registerType(string ...$types): PoolInterface foreach ($types as $type) { $type = ltrim($type, '\\'); - if (!class_exists($type, true)) { + if (!class_exists($type)) { throw new InvalidArgumentException(sprintf("Type '%s' is not defined.", $type)); } From 2e77b50eac62d21f50b45eab9af276e427fc9e06 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 3 Feb 2024 20:11:07 +0100 Subject: [PATCH 49/61] Add missing types --- src/Producer.php | 30 ++++++++++++++++++------------ src/ProducerInterface.php | 17 ++++++++++++++--- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/Producer.php b/src/Producer.php index b21f0a8..3932e1d 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject; use ActiveCollab\ContainerAccess\ContainerAccessInterface; @@ -18,15 +20,12 @@ class Producer implements ProducerInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; - protected $connection; - protected $pool; - protected $logger; - - public function __construct(ConnectionInterface $connection, PoolInterface $pool, LoggerInterface $logger) + public function __construct( + protected ConnectionInterface $connection, + protected PoolInterface $pool, + protected LoggerInterface $logger + ) { - $this->connection = $connection; - $this->pool = $pool; - $this->logger = $logger; } public function produce(string $type, array $attributes = null, $save = true): EntityInterface @@ -55,7 +54,11 @@ public function produce(string $type, array $attributes = null, $save = true): E return $object; } - public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface + public function modify( + EntityInterface $instance, + array $attributes = null, + bool $save = true, + ): EntityInterface { if ($attributes) { foreach ($attributes as $k => $v) { @@ -74,12 +77,15 @@ public function modify(EntityInterface &$instance, array $attributes = null, $sa return $instance; } - public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface + public function scrap( + EntityInterface $instance, + bool $force_delete = false, + ): EntityInterface { if (!$force_delete && $instance instanceof ScrapInterface) { return $instance->scrap(); - } else { - return $instance->delete(); } + + return $instance->delete(); } } diff --git a/src/ProducerInterface.php b/src/ProducerInterface.php index 5c69e39..495ea66 100644 --- a/src/ProducerInterface.php +++ b/src/ProducerInterface.php @@ -14,7 +14,18 @@ interface ProducerInterface { - public function produce(string $type, array $attributes = null, $save = true): EntityInterface; - public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; - public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; + public function produce( + string $type, + array $attributes = null, + $save = true, + ): EntityInterface; + public function modify( + EntityInterface $instance, + array $attributes = null, + bool $save = true, + ): EntityInterface; + public function scrap( + EntityInterface $instance, + bool $force_delete = false, + ): EntityInterface; } From ebfd040c795a8483f02b001065c76d2d43faee60 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 3 Feb 2024 20:14:52 +0100 Subject: [PATCH 50/61] Add types to producer interface --- src/Pool.php | 17 ++++++++++++++--- src/PoolInterface.php | 8 ++++---- src/Producer.php | 6 +++++- src/ProducerInterface.php | 4 +++- test/src/Fixtures/CustomProducer.php | 17 ++++++++++++++--- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/Pool.php b/src/Pool.php index 70599c2..9384517 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -41,7 +41,11 @@ public function __construct(ConnectionInterface $connection, LoggerInterface $lo $this->logger = $logger; } - public function produce(string $type, array $attributes = null, $save = true): EntityInterface + public function produce( + string $type, + array $attributes = null, + bool $save = true, + ): EntityInterface { $registered_type = $this->requireRegisteredType($type); @@ -56,7 +60,11 @@ public function produce(string $type, array $attributes = null, $save = true): E return $object; } - public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface + public function modify( + EntityInterface $instance, + array $attributes = null, + bool $save = true, + ): EntityInterface { if ($instance->isNew()) { throw new RuntimeException('Only objects that are saved to database can be modified'); @@ -73,7 +81,10 @@ public function modify(EntityInterface &$instance, array $attributes = null, $sa return $instance; } - public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface + public function scrap( + EntityInterface $instance, + bool $force_delete = false, + ): EntityInterface { if ($instance->isNew()) { throw new RuntimeException('Only objects that are saved to database can be modified'); diff --git a/src/PoolInterface.php b/src/PoolInterface.php index e28656f..443c94e 100644 --- a/src/PoolInterface.php +++ b/src/PoolInterface.php @@ -17,12 +17,12 @@ interface PoolInterface { /** * @template TClassName - * @param class-string $type + * @param class-string $type * @return TClassName */ - public function produce(string $type, array $attributes = null, $save = true): EntityInterface; - public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface; - public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface; + public function produce(string $type, array $attributes = null, bool $save = true): EntityInterface; + public function modify(EntityInterface $instance, array $attributes = null, bool $save = true): EntityInterface; + public function scrap(EntityInterface $instance, bool $force_delete = false): EntityInterface; public function getDefaultProducerClass(): string; public function getDefaultProducer(): ProducerInterface; diff --git a/src/Producer.php b/src/Producer.php index 3932e1d..d46d273 100644 --- a/src/Producer.php +++ b/src/Producer.php @@ -28,7 +28,11 @@ public function __construct( { } - public function produce(string $type, array $attributes = null, $save = true): EntityInterface + public function produce( + string $type, + array $attributes = null, + bool $save = true, + ): EntityInterface { /** @var EntityInterface $object */ $object = new $type($this->connection, $this->pool, $this->logger); diff --git a/src/ProducerInterface.php b/src/ProducerInterface.php index 495ea66..fee5828 100644 --- a/src/ProducerInterface.php +++ b/src/ProducerInterface.php @@ -17,13 +17,15 @@ interface ProducerInterface public function produce( string $type, array $attributes = null, - $save = true, + bool $save = true, ): EntityInterface; + public function modify( EntityInterface $instance, array $attributes = null, bool $save = true, ): EntityInterface; + public function scrap( EntityInterface $instance, bool $force_delete = false, diff --git a/test/src/Fixtures/CustomProducer.php b/test/src/Fixtures/CustomProducer.php index e6cf822..48a9cdd 100644 --- a/test/src/Fixtures/CustomProducer.php +++ b/test/src/Fixtures/CustomProducer.php @@ -16,7 +16,11 @@ class CustomProducer extends Producer { - public function produce(string $type, array $attributes = null, $save = true): EntityInterface + public function produce( + string $type, + array $attributes = null, + bool $save = true, + ): EntityInterface { $object = parent::produce($type, $attributes, $save); @@ -27,7 +31,11 @@ public function produce(string $type, array $attributes = null, $save = true): E return $object; } - public function modify(EntityInterface &$instance, array $attributes = null, $save = true): EntityInterface + public function modify( + EntityInterface $instance, + array $attributes = null, + bool $save = true, + ): EntityInterface { $instance = parent::modify($instance, $attributes, $save); @@ -38,7 +46,10 @@ public function modify(EntityInterface &$instance, array $attributes = null, $sa return $instance; } - public function scrap(EntityInterface &$instance, $force_delete = false): EntityInterface + public function scrap( + EntityInterface $instance, + bool $force_delete = false, + ): EntityInterface { $instance = parent::scrap($instance, $force_delete); From b45c61eeeead251e821db3295af77a9ecc56a6b5 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 3 Feb 2024 20:18:43 +0100 Subject: [PATCH 51/61] Improve code style --- src/ScrapInterface.php | 2 +- src/Validator.php | 30 ++++++++++------------------ test/src/Fixtures/Writers/Writer.php | 2 +- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/ScrapInterface.php b/src/ScrapInterface.php index b1ba2bc..3b8d6b8 100644 --- a/src/ScrapInterface.php +++ b/src/ScrapInterface.php @@ -14,5 +14,5 @@ interface ScrapInterface { - public function scrap($bulk = false): EntityInterface; + public function scrap(bool $bulk = false): EntityInterface; } diff --git a/src/Validator.php b/src/Validator.php index 3f90cb5..b537362 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -17,32 +17,22 @@ class Validator implements ValidatorInterface { private array $errors = []; - private ConnectionInterface $connection; - private string $table_name; - private ?int $object_id; - private ?int $old_object_id; - private array $field_values; public function __construct( - ConnectionInterface $connection, - string $table_name, - ?int $object_id, - ?int $old_object_id, - array $field_values + private ConnectionInterface $connection, + private string $table_name, + private ?int $object_id, + private ?int $old_object_id, + private array $field_values, ) { - $this->connection = $connection; - $this->table_name = $table_name; - $this->object_id = $object_id; - $this->old_object_id = $old_object_id; - $this->field_values = $field_values; } /** * Check if value of $field_name is present. * - * Note: strings are trimmed prior to check, and values that empty() would return true for (like '0') are consdiered - * to be present (because we check strlen(trim($value)). + * Note: strings are trimmed prior to check, and values that empty() would return true for (like '0') are considered + * to be present (because we check strlen(trim($value))). */ public function present(string $field_name): bool { @@ -77,9 +67,9 @@ public function present(string $field_name): bool * @param string $field_name * @return bool */ - private function failPresenceValidation($field_name) + private function failPresenceValidation(string $field_name): bool { - $this->addFieldError($field_name, "Value of '$field_name' is required."); + $this->addFieldError($field_name, sprintf("Value of '%s' is required.", $field_name)); return false; } @@ -465,7 +455,7 @@ public function createException(): ValidationException $first_messages = []; $counter = 0; - foreach ($this->errors as $field => $error_messages) { + foreach ($this->errors as $error_messages) { foreach ($error_messages as $error_message) { $first_messages[] = $error_message; ++$counter; diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index 2bb0770..d09962f 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -128,7 +128,7 @@ public function validate(ValidatorInterface $validator): ValidatorInterface return parent::validate($validator); } - public function scrap($bulk = false): EntityInterface + public function scrap(bool $bulk = false): EntityInterface { $this->is_scrapped = true; From 5a91e99dd163abdadd33426eea7d0fcc69c87bf4 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 3 Feb 2024 20:38:36 +0100 Subject: [PATCH 52/61] Add writer interface --- src/Pool.php | 2 +- test/src/Fixtures/Writers/BaseWriter.php | 6 +- test/src/Fixtures/Writers/WriterInterface.php | 17 +++++ test/src/ProducerTest.php | 64 +++++++++++-------- 4 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 test/src/Fixtures/Writers/WriterInterface.php diff --git a/src/Pool.php b/src/Pool.php index 9384517..d86cb96 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -623,7 +623,7 @@ public function getRegisteredType(string $type): ?string if ($reflection_class->implementsInterface(EntityInterface::class)) { foreach ($this->types as $registered_type => $registered_type_properties) { if ($reflection_class->isSubclassOf($registered_type)) { - $this->known_types[ $type ] = $registered_type; + $this->known_types[$type] = $registered_type; break; } } diff --git a/test/src/Fixtures/Writers/BaseWriter.php b/test/src/Fixtures/Writers/BaseWriter.php index 9dc973f..d0c27d8 100644 --- a/test/src/Fixtures/Writers/BaseWriter.php +++ b/test/src/Fixtures/Writers/BaseWriter.php @@ -9,14 +9,10 @@ namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; use ActiveCollab\DatabaseObject\Entity\Entity; -use ActiveCollab\DatabaseObject\Entity\EntityInterface; use ActiveCollab\DateValue\DateValueInterface; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers - */ -abstract class BaseWriter extends Entity implements EntityInterface +abstract class BaseWriter extends Entity implements WriterInterface { /** * Name of the table where records are stored. diff --git a/test/src/Fixtures/Writers/WriterInterface.php b/test/src/Fixtures/Writers/WriterInterface.php new file mode 100644 index 0000000..9ae25d8 --- /dev/null +++ b/test/src/Fixtures/Writers/WriterInterface.php @@ -0,0 +1,17 @@ +. All rights reserved. + */ + +declare(strict_types=1); + +namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; + +use ActiveCollab\DatabaseObject\Entity\EntityInterface; + +interface WriterInterface extends EntityInterface +{ +} diff --git a/test/src/ProducerTest.php b/test/src/ProducerTest.php index f063bb8..a5f46f6 100644 --- a/test/src/ProducerTest.php +++ b/test/src/ProducerTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; @@ -17,22 +19,22 @@ use InvalidArgumentException; use LogicException; use RuntimeException; +use stdClass; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class ProducerTest extends WritersTypeTestCase { /** * Test if default producer is used by default. */ - public function testDefaultProducerIsUsedByDefault() + public function testDefaultProducerIsUsedByDefault(): void { - /** @var Writer $object */ - $object = $this->pool->produce(Writer::class, [ - 'name' => 'Anton Chekhov', - 'birthday' => new DateValue('1860-01-29'), - ]); + $object = $this->pool->produce( + Writer::class, + [ + 'name' => 'Anton Chekhov', + 'birthday' => new DateValue('1860-01-29'), + ], + ); $this->assertInstanceOf(Writer::class, $object); $this->assertNull($object->custom_attribute_value); @@ -45,12 +47,14 @@ public function testCustomProducerCanBeSetForType() { $this->pool->registerProducer(Writer::class, new CustomProducer($this->connection, $this->pool, $this->logger)); - /** @var Writer $object */ - $object = $this->pool->produce(Writer::class, [ - 'name' => 'Anton Chekhov', - 'birthday' => new DateValue('1860-01-29'), - 'custom_producer_set_custom_attribute_to' => 1234, - ]); + $object = $this->pool->produce( + Writer::class, + [ + 'name' => 'Anton Chekhov', + 'birthday' => new DateValue('1860-01-29'), + 'custom_producer_set_custom_attribute_to' => 1234, + ], + ); $this->assertInstanceOf(Writer::class, $object); $this->assertSame(1234, $object->custom_attribute_value); @@ -63,12 +67,14 @@ public function testCustomProducerCanBeSetForSubtype() { $this->pool->registerProducer(AwesomeWriter::class, new CustomProducer($this->connection, $this->pool, $this->logger)); - /** @var Writer $object */ - $object = $this->pool->produce(AwesomeWriter::class, [ - 'name' => 'Anton Chekhov', - 'birthday' => new DateValue('1860-01-29'), - 'custom_producer_set_custom_attribute_to' => 1234, - ]); + $object = $this->pool->produce( + AwesomeWriter::class, + [ + 'name' => 'Anton Chekhov', + 'birthday' => new DateValue('1860-01-29'), + 'custom_producer_set_custom_attribute_to' => 1234, + ], + ); $this->assertInstanceOf(AwesomeWriter::class, $object); $this->assertSame(1234, $object->custom_attribute_value); @@ -81,12 +87,14 @@ public function testCustomProducerCanBeSetByClassName() { $this->pool->registerProducerByClass(Writer::class, CustomProducer::class); - /** @var Writer $object */ - $object = $this->pool->produce(Writer::class, [ - 'name' => 'Anton Chekhov', - 'birthday' => new DateValue('1860-01-29'), - 'custom_producer_set_custom_attribute_to' => 1234, - ]); + $object = $this->pool->produce( + Writer::class, + [ + 'name' => 'Anton Chekhov', + 'birthday' => new DateValue('1860-01-29'), + 'custom_producer_set_custom_attribute_to' => 1234, + ], + ); $this->assertInstanceOf(Writer::class, $object); $this->assertSame(1234, $object->custom_attribute_value); @@ -110,7 +118,7 @@ public function testCustomProducerRequiresProducerInterface() { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("Class 'stdClass' does not implement 'ActiveCollab\DatabaseObject\ProducerInterface' interface"); - $this->pool->registerProducerByClass(Writer::class, \stdClass::class); + $this->pool->registerProducerByClass(Writer::class, stdClass::class); } public function testUnsavedObjectsCantBeModified() From e92e17c23e5fc1d388249d17bd10a40cea608ece Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 8 Mar 2024 09:57:28 +0100 Subject: [PATCH 53/61] Add types to collections --- src/Collection.php | 105 ++++-------------- src/Collection/Composite.php | 5 +- src/Collection/Type.php | 93 +++++++--------- src/CollectionInterface.php | 51 ++------- test/src/Fixtures/Writers/Collection.php | 37 ++---- .../Writers/PreconfiguredCollection.php | 15 +-- test/src/TypeCollectionTest.php | 2 +- 7 files changed, 87 insertions(+), 221 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 184e47a..163598b 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -20,20 +20,12 @@ abstract class Collection implements CollectionInterface { use EtagInterfaceImplementation; - protected ConnectionInterface $connection; - protected PoolInterface $pool; - protected LoggerInterface $logger; - public function __construct( - ConnectionInterface $connection, - PoolInterface $pool, - LoggerInterface $logger, + protected ConnectionInterface $connection, + protected PoolInterface $pool, + protected LoggerInterface $logger, ) { - $this->connection = $connection; - $this->pool = $pool; - $this->logger = $logger; - $this->configure(); } @@ -45,8 +37,6 @@ protected function configure(): void * Return true if ready. * * If collection declares that it is not ready, but execute methods get called, we should throw an exception - * - * @return bool */ protected function isReady(): bool { @@ -55,23 +45,12 @@ protected function isReady(): bool private string $application_identifier = 'APPv1.0'; - /** - * Return application identifier. - * - * @return string - */ - public function getApplicationIdentifier() + public function getApplicationIdentifier(): string { return $this->application_identifier; } - /** - * Set application identifier. - * - * @param string $value - * @return $this - */ - public function &setApplicationIdentifier($value) + public function setApplicationIdentifier(string $value): static { $this->application_identifier = $value; @@ -80,13 +59,12 @@ public function &setApplicationIdentifier($value) /** * Prepare collection tag from bits of information. - * - * @param string $additional_identifier - * @param string $visitor_identifier - * @param string $hash - * @return string */ - protected function prepareTagFromBits($additional_identifier, $visitor_identifier, $hash) + protected function prepareTagFromBits( + string $additional_identifier, + string $visitor_identifier, + string $hash + ): string { return implode( ',', @@ -106,24 +84,16 @@ public function canBeTagged(): bool return true; } - // --------------------------------------------------- - // Pagination - // --------------------------------------------------- - - /** - * Set pagination configuration. - * - * @param int $current_page - * @param int $items_per_page - * @return $this - */ - public function &pagination($current_page = 1, $items_per_page = 100) + public function pagination( + int $current_page = 1, + int $items_per_page = 100, + ): static { $this->is_paginated = true; $this->currentPage($current_page); - $this->items_per_page = (int) $items_per_page; + $this->items_per_page = $items_per_page; if ($this->items_per_page < 1) { $this->items_per_page = 100; @@ -132,38 +102,17 @@ public function &pagination($current_page = 1, $items_per_page = 100) return $this; } - /** - * @var bool - */ - private $is_paginated = false; + private bool $is_paginated = false; - /** - * Return true if collection is paginated. - * - * @return bool - */ - public function isPaginated() + public function isPaginated(): bool { return $this->is_paginated; } - /** - * @var int|null - */ - private $current_page = null; - - /** - * @var int|null - */ - private $items_per_page = null; + private ?int $current_page = null; + private ?int $items_per_page = null; - /** - * Set current page. - * - * @param int $value - * @return $this - */ - public function ¤tPage($value) + public function currentPage(?int $value): static { if (!$this->is_paginated) { throw new LogicException('Page can be set only for paginated collections'); @@ -178,22 +127,12 @@ public function ¤tPage($value) return $this; } - /** - * Return current page #. - * - * @return int|null - */ - public function getCurrentPage() + public function getCurrentPage(): ?int { return $this->current_page; } - /** - * Return number of items that are displayed per page. - * - * @return int|null - */ - public function getItemsPerPage() + public function getItemsPerPage(): ?int { return $this->items_per_page; } diff --git a/src/Collection/Composite.php b/src/Collection/Composite.php index 649c863..7e8f2cb 100644 --- a/src/Collection/Composite.php +++ b/src/Collection/Composite.php @@ -6,13 +6,12 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Collection; use ActiveCollab\DatabaseObject\Collection; -/** - * @package ActiveCollab\DatabaseObject\Collection - */ abstract class Composite extends Collection { } diff --git a/src/Collection/Type.php b/src/Collection/Type.php index 8d7f661..392db73 100644 --- a/src/Collection/Type.php +++ b/src/Collection/Type.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Collection; use ActiveCollab\DatabaseConnection\Result\ResultInterface; @@ -15,35 +17,27 @@ use InvalidArgumentException; use LogicException; -/** - * @package ActiveCollab\DatabaseObject\Collection - */ abstract class Type extends Collection { - /** - * @var string - */ - private $registered_type; + private ?string $registered_type = null; /** * Return type that this collection works with. - * - * @return string */ - abstract public function getType(); + abstract public function getType(): string; /** * Return registered type. - * - * @return string */ - protected function getRegisteredType() + protected function getRegisteredType(): string { - if (empty($this->registered_type)) { + if ($this->registered_type === null) { $this->registered_type = $this->pool->getRegisteredType($this->getType()); if (empty($this->registered_type)) { - throw new InvalidArgumentException("Type '" . $this->getType() . "' is not registered"); + throw new InvalidArgumentException( + sprintf("Type '%s' is not registered", $this->getType()) + ); } } @@ -56,20 +50,16 @@ protected function getRegisteredType() /** * Return true if this object can be tagged and cached on client side. - * - * @return bool|null */ - public function canBeEtagged() + public function canBeEtagged(): bool { return (bool) $this->getTimestampField(); } /** * Cached tag value. - * - * @var string */ - private $tag = false; + private ?string $tag = null; /** * Return collection etag. @@ -82,36 +72,30 @@ public function getEtag($visitor_identifier, $use_cache = true) { $timestamp_field = $this->getTimestampField(); - if ($timestamp_field && ($this->tag === false || !$use_cache)) { - $this->tag = $this->prepareTagFromBits($this->getAdditionalIdentifier(), $visitor_identifier, $this->getTimestampHash($timestamp_field)); + if ($timestamp_field && ($this->tag === null || !$use_cache)) { + $this->tag = $this->prepareTagFromBits( + $this->getAdditionalIdentifier(), + $visitor_identifier, + $this->getTimestampHash($timestamp_field), + ); } return $this->tag; } - /** - * @return string - */ - protected function getAdditionalIdentifier() + protected function getAdditionalIdentifier(): string { return 'na'; } /** * Cached time stamp field name. - * - * @var string|bool */ - private $timestamp_field = null; + private string|false $timestamp_field = ''; - /** - * Return timestamp field name. - * - * @return string|bool - */ - public function getTimestampField() + public function getTimestampField(): string|false { - if ($this->timestamp_field === null) { + if ($this->timestamp_field === '') { $fields = $this->pool->getTypeFields($this->getRegisteredType()); if (in_array('updated_at', $fields)) { @@ -128,11 +112,8 @@ public function getTimestampField() /** * Return timestamp hash. - * - * @param string $timestamp_field - * @return string */ - public function getTimestampHash($timestamp_field) + public function getTimestampHash(string $timestamp_field): string { if (!$this->isReady()) { throw new LogicException('Collection is not ready'); @@ -143,13 +124,21 @@ public function getTimestampHash($timestamp_field) if ($this->count() > 0) { if ($join_expression = $this->getJoinExpression()) { - return sha1($this->connection->executeFirstCell("SELECT GROUP_CONCAT($table_name.$timestamp_field ORDER BY $table_name.id SEPARATOR ',') AS 'timestamp_hash' FROM $table_name $join_expression $conditions")); - } else { - return sha1($this->connection->executeFirstCell("SELECT GROUP_CONCAT($table_name.$timestamp_field ORDER BY id SEPARATOR ',') AS 'timestamp_hash' FROM $table_name $conditions")); + return sha1( + $this->connection->executeFirstCell( + "SELECT GROUP_CONCAT($table_name.$timestamp_field ORDER BY $table_name.id SEPARATOR ',') AS 'timestamp_hash' FROM $table_name $join_expression $conditions", + ), + ); } + + return sha1( + $this->connection->executeFirstCell( + "SELECT GROUP_CONCAT($table_name.$timestamp_field ORDER BY id SEPARATOR ',') AS 'timestamp_hash' FROM $table_name $conditions" + ), + ); } - return sha1(get_class($this)); + return sha1($this::class); } // --------------------------------------------------- @@ -185,9 +174,9 @@ public function execute() } return null; - } else { - return $this->pool->findBySql($this->getType(), $this->getSelectSql()); } + + return $this->pool->findBySql($this->getType(), $this->getSelectSql()); } /** @@ -197,10 +186,8 @@ public function execute() /** * Return ID-s of matching records. - * - * @return array */ - public function executeIds() + public function executeIds(): array { if (!$this->isReady()) { throw new LogicException('Collection is not ready'); @@ -257,10 +244,8 @@ private function getSelectSql($all_fields = true) /** * Return number of records that match conditions set by the collection. - * - * @return int */ - public function count() + public function count(): int { if (!$this->isReady()) { throw new LogicException('Collection is not ready'); @@ -426,7 +411,7 @@ public function getJoinTable() * * If $join_field is null, join field will be based on model name. There are two ways to specify it: * - * 1. As string, where value is for target field and it will map with ID column of the source table, + * 1. As string, where value is for target field, and it will map with ID column of the source table, * 2. As array, where first element is ID in the source table and second element is field in target table * * @param string $table_name diff --git a/src/CollectionInterface.php b/src/CollectionInterface.php index 017b058..938ad59 100644 --- a/src/CollectionInterface.php +++ b/src/CollectionInterface.php @@ -17,21 +17,8 @@ interface CollectionInterface extends EtagInterface, JsonSerializable { - /** - * Return application identifier. - * - * @return string - */ - public function getApplicationIdentifier(); - - /** - * Set application identifier. - * - * @param string $value - * @return $this - */ - public function &setApplicationIdentifier($value); - + public function getApplicationIdentifier(): string; + public function setApplicationIdentifier(string $value): static; public function canBeTagged(): bool; /** @@ -43,53 +30,39 @@ public function execute(); /** * Return ID-s of matching records. - * - * @return array */ - public function executeIds(); + public function executeIds(): array; /** * Return number of records that match conditions set by the collection. - * - * @return int */ - public function count(); + public function count(): int; /** * Set pagination configuration. - * - * @param int $current_page - * @param int $items_per_page - * @return $this */ - public function &pagination($current_page = 1, $items_per_page = 100); + public function pagination( + int $current_page = 1, + int $items_per_page = 100, + ): static; /** * Return true if collection is paginated. - * - * @return bool */ - public function isPaginated(); + public function isPaginated(): bool; /** * Set current page. - * - * @param int $value - * @return $this */ - public function ¤tPage($value); + public function currentPage(?int $value): static; /** * Return current page #. - * - * @return int|null */ - public function getCurrentPage(); + public function getCurrentPage(): ?int; /** * Return number of items that are displayed per page. - * - * @return int|null */ - public function getItemsPerPage(); + public function getItemsPerPage(): ?int; } diff --git a/test/src/Fixtures/Writers/Collection.php b/test/src/Fixtures/Writers/Collection.php index 119f1ac..2073636 100644 --- a/test/src/Fixtures/Writers/Collection.php +++ b/test/src/Fixtures/Writers/Collection.php @@ -6,30 +6,21 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; use ActiveCollab\DatabaseObject\Collection\Type; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers - */ class Collection extends Type { - /** - * Return type that this collection manages. - * - * @return string - */ - public function getType() + public function getType(): string { return Writer::class; } - private $is_ready = true; + private bool $is_ready = true; - /** - * {@inheritdoc} - */ protected function isReady(): bool { return $this->is_ready; @@ -37,34 +28,22 @@ protected function isReady(): bool /** * Set collection as not ready. - * - * @return $this */ - public function &setAsNotReady() + public function setAsNotReady(): static { $this->is_ready = false; return $this; } - /** - * @var string - */ - private $additional_identifier = 'na'; + private string $additional_identifier = 'na'; - /** - * @return string - */ - protected function getAdditionalIdentifier() + protected function getAdditionalIdentifier(): string { return $this->additional_identifier; } - /** - * @param string $value - * @return $this - */ - public function &setAdditionalIdenfitifier($value) + public function setAdditionalIdentifier(string $value): static { $this->additional_identifier = $value; diff --git a/test/src/Fixtures/Writers/PreconfiguredCollection.php b/test/src/Fixtures/Writers/PreconfiguredCollection.php index f6759c8..4303fdf 100644 --- a/test/src/Fixtures/Writers/PreconfiguredCollection.php +++ b/test/src/Fixtures/Writers/PreconfiguredCollection.php @@ -6,28 +6,19 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; use ActiveCollab\DatabaseObject\Collection\Type; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers - */ class PreconfiguredCollection extends Type { - /** - * Return type that this collection manages. - * - * @return string - */ - public function getType() + public function getType(): string { return Writer::class; } - /** - * Configure the collection when it is created. - */ protected function configure(): void { $this->where('`name` LIKE ?', 'A%')->orderBy('`name`'); diff --git a/test/src/TypeCollectionTest.php b/test/src/TypeCollectionTest.php index 6e19ae5..bbc9851 100644 --- a/test/src/TypeCollectionTest.php +++ b/test/src/TypeCollectionTest.php @@ -488,7 +488,7 @@ public function testEtagCanIncludeAdditionalIdenfitier() { $collection = (new WritersCollection($this->connection, $this->pool, $this->logger)) ->setApplicationIdentifier('MyApp v1.0') - ->setAdditionalIdenfitifier('addidf'); + ->setAdditionalIdentifier('addidf'); $etag = $collection->getEtag('ilija.studen@activecollab.com'); From 9926ceedc7b010b76cd4a5b87a42e9478c4288fa Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 8 Mar 2024 10:02:54 +0100 Subject: [PATCH 54/61] Use strict types --- src/Entity/Entity.php | 5 ++--- test/src/AutoloaderTest.php | 8 ++------ test/src/ContainerPropagatesToFinderTest.php | 18 ++++-------------- test/src/ContainerPropagatesToObjectTest.php | 5 ++--- test/src/CrudTest.php | 5 ++--- test/src/EntityCopyTest.php | 5 ++--- test/src/EntityIsTest.php | 5 ++--- test/src/EntityModifyFieldsTest.php | 5 ++--- test/src/FindJoinTest.php | 5 ++--- .../StatSnapshots/Base/StatsSnapshot.php | 5 ++--- .../Fixtures/StatSnapshots/StatsSnapshot.php | 5 ++--- test/src/Fixtures/Users/Base/User.php | 5 ++--- test/src/Fixtures/Users/User.php | 5 ++--- test/src/Fixtures/Writers/AwesomeWriter.php | 5 ++--- .../Fixtures/Writers/Traits/ClassicWriter.php | 13 +++---------- test/src/Fixtures/Writers/Traits/Russian.php | 10 +++------- test/src/Fixtures/Writers/Writer.php | 4 ++-- test/src/GeneratedFieldsTest.php | 5 ++--- test/src/GreaterThanOrEqualsValidatorTest.php | 5 ++--- test/src/GreaterThanValidatorTest.php | 5 ++--- test/src/InArrayValidatorTest.php | 18 +++++++++++------- test/src/LowerThanOrEqualsValidatorTest.php | 10 +++------- test/src/LowerThanValidatorTest.php | 5 ++--- test/src/PoolProduceTest.php | 5 ++--- test/src/PresenceValidatorTest.php | 5 ++--- test/src/SerializeTest.php | 5 ++--- test/src/TraitTest.php | 5 ++--- test/src/TypeCollectionTest.php | 7 ++----- test/src/TypePreconfiguredCollectionTest.php | 5 ++--- test/src/TypeRegistrationTest.php | 5 ++--- test/src/UniqueValidatorTest.php | 5 ++--- test/src/UrlValidatorTest.php | 5 ++--- test/src/ValidatorTest.php | 5 ++--- 33 files changed, 80 insertions(+), 133 deletions(-) diff --git a/src/Entity/Entity.php b/src/Entity/Entity.php index 4da676d..55b4cc1 100644 --- a/src/Entity/Entity.php +++ b/src/Entity/Entity.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Entity; use ActiveCollab\ContainerAccess\ContainerAccessInterface; @@ -26,9 +28,6 @@ use Psr\Log\LoggerInterface; use ReturnTypeWillChange; -/** - * @package ActiveCollab\DatabaseObject - */ abstract class Entity implements EntityInterface, ContainerAccessInterface { use ContainerAccessInterfaceImplementation; diff --git a/test/src/AutoloaderTest.php b/test/src/AutoloaderTest.php index 6cc45a1..01077b3 100644 --- a/test/src/AutoloaderTest.php +++ b/test/src/AutoloaderTest.php @@ -6,18 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class AutoloaderTest extends TestCase { - /** - * Test if classes are properly loaded. - */ public function testAutoloader() { $this->assertTrue(class_exists('\ActiveCollab\DatabaseObject\Entity\Entity')); diff --git a/test/src/ContainerPropagatesToFinderTest.php b/test/src/ContainerPropagatesToFinderTest.php index fe693a9..b0036c0 100644 --- a/test/src/ContainerPropagatesToFinderTest.php +++ b/test/src/ContainerPropagatesToFinderTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Finder; @@ -13,31 +15,19 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use Psr\Container\ContainerInterface; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class ContainerPropagatesToFinderTest extends TestCase { - /** - * Set up test environment. - */ public function setUp(): void { parent::setUp(); -// $container = new Container(['dependency' => 'it works!']); -// -// $this->pool->setContainer($container); -// $this->assertTrue($this->pool->hasContainer()); -// $this->assertInstanceOf(Container::class, $this->pool->getContainer()); - $this->pool->registerType(Writer::class); } /** - * Test if container propages to finder. + * Test if container propagates to finder. */ - public function testCustomFinderRecivesContainer() + public function testCustomFinderReceivesContainer() { $container = $this->createMock(ContainerInterface::class); $container diff --git a/test/src/ContainerPropagatesToObjectTest.php b/test/src/ContainerPropagatesToObjectTest.php index 032c0fc..cc6e3e9 100644 --- a/test/src/ContainerPropagatesToObjectTest.php +++ b/test/src/ContainerPropagatesToObjectTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseConnection\Result\ResultInterface; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use Psr\Container\ContainerInterface; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class ContainerPropagatesToObjectTest extends WritersTypeTestCase { public function setUp(): void diff --git a/test/src/CrudTest.php b/test/src/CrudTest.php index 0761fbd..bfe5fd2 100644 --- a/test/src/CrudTest.php +++ b/test/src/CrudTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Exception\ObjectNotFoundException; @@ -17,9 +19,6 @@ use InvalidArgumentException; use LogicException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class CrudTest extends WritersTypeTestCase { /** diff --git a/test/src/EntityCopyTest.php b/test/src/EntityCopyTest.php index 33016a5..5f8d424 100644 --- a/test/src/EntityCopyTest.php +++ b/test/src/EntityCopyTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Entity\EntityInterface; @@ -14,9 +16,6 @@ use ActiveCollab\DateValue\DateTimeValueInterface; use ActiveCollab\DateValue\DateValueInterface; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class EntityCopyTest extends WritersTypeTestCase { /** diff --git a/test/src/EntityIsTest.php b/test/src/EntityIsTest.php index a65f98b..6b63e0a 100644 --- a/test/src/EntityIsTest.php +++ b/test/src/EntityIsTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Entity\EntityInterface; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class EntityIsTest extends WritersTypeTestCase { /** diff --git a/test/src/EntityModifyFieldsTest.php b/test/src/EntityModifyFieldsTest.php index 554ab23..1639583 100644 --- a/test/src/EntityModifyFieldsTest.php +++ b/test/src/EntityModifyFieldsTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Entity\EntityInterface; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class EntityModifyFieldsTest extends WritersTypeTestCase { /** diff --git a/test/src/FindJoinTest.php b/test/src/FindJoinTest.php index 38bcdcb..e65b05b 100644 --- a/test/src/FindJoinTest.php +++ b/test/src/FindJoinTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseConnection\Result\Result; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class FindJoinTest extends WritersTypeTestCase { /** diff --git a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php index 0083182..a117cc7 100644 --- a/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/Base/StatsSnapshot.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\StatSnapshots\Base; use ActiveCollab\DatabaseConnection\Record\ValueCaster; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Entity\Entity; use ActiveCollab\DatabaseObject\ValidatorInterface; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\StatSnapshots\Base - */ abstract class StatsSnapshot extends Entity { /** diff --git a/test/src/Fixtures/StatSnapshots/StatsSnapshot.php b/test/src/Fixtures/StatSnapshots/StatsSnapshot.php index 7a5eeea..04c6ab0 100644 --- a/test/src/Fixtures/StatSnapshots/StatsSnapshot.php +++ b/test/src/Fixtures/StatSnapshots/StatsSnapshot.php @@ -6,11 +6,10 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\StatSnapshots; -/** - * @package ActiveCollab\Shepherd\Model - */ class StatsSnapshot extends Base\StatsSnapshot { /** diff --git a/test/src/Fixtures/Users/Base/User.php b/test/src/Fixtures/Users/Base/User.php index 143aeae..b239c34 100644 --- a/test/src/Fixtures/Users/Base/User.php +++ b/test/src/Fixtures/Users/Base/User.php @@ -6,14 +6,13 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Users\Base; use ActiveCollab\DatabaseObject\Entity\Entity; use ActiveCollab\DatabaseObject\ValidatorInterface; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Users\Base - */ abstract class User extends Entity { /** diff --git a/test/src/Fixtures/Users/User.php b/test/src/Fixtures/Users/User.php index a22889b..de3f962 100644 --- a/test/src/Fixtures/Users/User.php +++ b/test/src/Fixtures/Users/User.php @@ -6,13 +6,12 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Users; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\Base\User as BaseUser; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Users - */ class User extends BaseUser { } diff --git a/test/src/Fixtures/Writers/AwesomeWriter.php b/test/src/Fixtures/Writers/AwesomeWriter.php index 29c0a9c..4bb671e 100644 --- a/test/src/Fixtures/Writers/AwesomeWriter.php +++ b/test/src/Fixtures/Writers/AwesomeWriter.php @@ -6,11 +6,10 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers - */ class AwesomeWriter extends Writer { } diff --git a/test/src/Fixtures/Writers/Traits/ClassicWriter.php b/test/src/Fixtures/Writers/Traits/ClassicWriter.php index cd1d64d..b3a1b46 100644 --- a/test/src/Fixtures/Writers/Traits/ClassicWriter.php +++ b/test/src/Fixtures/Writers/Traits/ClassicWriter.php @@ -6,21 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Traits; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Traits - */ trait ClassicWriter { - /** - * @var bool - */ - public $is_classic_writer = false; + public bool $is_classic_writer = false; - /** - * Call when object is created. - */ public function ActiveCollabDatabaseObjectTestFixturesWritersTraitsClassicWriter() { $this->is_classic_writer = true; diff --git a/test/src/Fixtures/Writers/Traits/Russian.php b/test/src/Fixtures/Writers/Traits/Russian.php index 6651ff1..43b964c 100644 --- a/test/src/Fixtures/Writers/Traits/Russian.php +++ b/test/src/Fixtures/Writers/Traits/Russian.php @@ -6,17 +6,13 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Traits; -/** - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Traits - */ trait Russian { - /** - * @var bool - */ - public $is_russian = false; + public bool $is_russian = false; /** * Call when object is created. diff --git a/test/src/Fixtures/Writers/Writer.php b/test/src/Fixtures/Writers/Writer.php index d09962f..fed1eec 100644 --- a/test/src/Fixtures/Writers/Writer.php +++ b/test/src/Fixtures/Writers/Writer.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test\Fixtures\Writers; use ActiveCollab\DatabaseConnection\ConnectionInterface; @@ -19,8 +21,6 @@ /** * @property string $is_special - * - * @package ActiveCollab\DatabaseObject\Test\Fixtures\Writers */ class Writer extends BaseWriter implements ScrapInterface { diff --git a/test/src/GeneratedFieldsTest.php b/test/src/GeneratedFieldsTest.php index 2e1fdaa..427bdb0 100644 --- a/test/src/GeneratedFieldsTest.php +++ b/test/src/GeneratedFieldsTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Entity\EntityInterface; @@ -16,9 +18,6 @@ use ActiveCollab\DateValue\DateValueInterface; use LogicException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class GeneratedFieldsTest extends TestCase { /** diff --git a/test/src/GreaterThanOrEqualsValidatorTest.php b/test/src/GreaterThanOrEqualsValidatorTest.php index 22364f7..cbeb2c8 100644 --- a/test/src/GreaterThanOrEqualsValidatorTest.php +++ b/test/src/GreaterThanOrEqualsValidatorTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Validator; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class GreaterThanOrEqualsValidatorTest extends TestCase { /** diff --git a/test/src/GreaterThanValidatorTest.php b/test/src/GreaterThanValidatorTest.php index 22f1bea..16e2277 100644 --- a/test/src/GreaterThanValidatorTest.php +++ b/test/src/GreaterThanValidatorTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Validator; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class GreaterThanValidatorTest extends TestCase { /** diff --git a/test/src/InArrayValidatorTest.php b/test/src/InArrayValidatorTest.php index f704e83..3a62391 100644 --- a/test/src/InArrayValidatorTest.php +++ b/test/src/InArrayValidatorTest.php @@ -6,21 +6,25 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\User; use ActiveCollab\DatabaseObject\Validator; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class InArrayValidatorTest extends TestCase { - /** - * @var array - */ - private $continents = ['Asia', 'Africa', 'North America', 'South America', 'Antarctica', 'Europe', 'Australia']; + private array $continents = [ + 'Asia', + 'Africa', + 'North America', + 'South America', + 'Antarctica', + 'Europe', + 'Australia', + ]; /** * Set up test environment. diff --git a/test/src/LowerThanOrEqualsValidatorTest.php b/test/src/LowerThanOrEqualsValidatorTest.php index 714cd38..507fdd5 100644 --- a/test/src/LowerThanOrEqualsValidatorTest.php +++ b/test/src/LowerThanOrEqualsValidatorTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; @@ -13,15 +15,9 @@ use ActiveCollab\DatabaseObject\Validator; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class LowerThanOrEqualsValidatorTest extends TestCase { - /** - * @var int - */ - private $max_age = 125; + private int $max_age = 125; /** * Set up test environment. diff --git a/test/src/LowerThanValidatorTest.php b/test/src/LowerThanValidatorTest.php index 44ed80d..356658f 100644 --- a/test/src/LowerThanValidatorTest.php +++ b/test/src/LowerThanValidatorTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Validator; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class LowerThanValidatorTest extends TestCase { /** diff --git a/test/src/PoolProduceTest.php b/test/src/PoolProduceTest.php index 35885f1..dab4a37 100644 --- a/test/src/PoolProduceTest.php +++ b/test/src/PoolProduceTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; @@ -15,9 +17,6 @@ use ActiveCollab\DateValue\DateValue; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class PoolProduceTest extends WritersTypeTestCase { /** diff --git a/test/src/PresenceValidatorTest.php b/test/src/PresenceValidatorTest.php index 444f06a..d72cfbc 100644 --- a/test/src/PresenceValidatorTest.php +++ b/test/src/PresenceValidatorTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Validator; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class PresenceValidatorTest extends WritersTypeTestCase { public function testFieldNameIsRequired() diff --git a/test/src/SerializeTest.php b/test/src/SerializeTest.php index 571dc10..dbf4e6b 100644 --- a/test/src/SerializeTest.php +++ b/test/src/SerializeTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Entity\EntityInterface; @@ -13,9 +15,6 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use JsonSerializable; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class SerializeTest extends WritersTypeTestCase { /** diff --git a/test/src/TraitTest.php b/test/src/TraitTest.php index aa4b701..cf1c28a 100644 --- a/test/src/TraitTest.php +++ b/test/src/TraitTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\ContainerAccess\ContainerAccessInterface\Implementation; @@ -15,9 +17,6 @@ use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\Writer; use ActiveCollab\DatabaseObject\TraitsResolver\TraitsResolver; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class TraitTest extends TestCase { /** diff --git a/test/src/TypeCollectionTest.php b/test/src/TypeCollectionTest.php index bbc9851..ec50397 100644 --- a/test/src/TypeCollectionTest.php +++ b/test/src/TypeCollectionTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseConnection\Result\ResultInterface; @@ -15,11 +17,6 @@ use InvalidArgumentException; use LogicException; -/** - * Test data object collection. - * - * @package angie.tests - */ class TypeCollectionTest extends WritersTypeTestCase { /** diff --git a/test/src/TypePreconfiguredCollectionTest.php b/test/src/TypePreconfiguredCollectionTest.php index 091563c..e46846f 100644 --- a/test/src/TypePreconfiguredCollectionTest.php +++ b/test/src/TypePreconfiguredCollectionTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseConnection\Result\ResultInterface; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Writers\PreconfiguredCollection; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class TypePreconfiguredCollectionTest extends WritersTypeTestCase { /** diff --git a/test/src/TypeRegistrationTest.php b/test/src/TypeRegistrationTest.php index ebf79ca..fb67588 100644 --- a/test/src/TypeRegistrationTest.php +++ b/test/src/TypeRegistrationTest.php @@ -6,6 +6,8 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\ContainerAccess\ContainerAccessInterface\Implementation; @@ -19,9 +21,6 @@ use ActiveCollab\DateValue\DateValue; use InvalidArgumentException; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class TypeRegistrationTest extends TestCase { /** diff --git a/test/src/UniqueValidatorTest.php b/test/src/UniqueValidatorTest.php index 38a287a..f8bed3f 100644 --- a/test/src/UniqueValidatorTest.php +++ b/test/src/UniqueValidatorTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Validator; use ActiveCollab\DateValue\DateValue; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class UniqueValidatorTest extends WritersTypeTestCase { /** diff --git a/test/src/UrlValidatorTest.php b/test/src/UrlValidatorTest.php index b3d9fd7..c034dfa 100644 --- a/test/src/UrlValidatorTest.php +++ b/test/src/UrlValidatorTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Test\Base\TestCase; use ActiveCollab\DatabaseObject\Test\Fixtures\Users\User; use ActiveCollab\DatabaseObject\Validator; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class UrlValidatorTest extends TestCase { public function setUp(): void diff --git a/test/src/ValidatorTest.php b/test/src/ValidatorTest.php index b11b19d..1068560 100644 --- a/test/src/ValidatorTest.php +++ b/test/src/ValidatorTest.php @@ -6,15 +6,14 @@ * (c) A51 doo . All rights reserved. */ +declare(strict_types=1); + namespace ActiveCollab\DatabaseObject\Test; use ActiveCollab\DatabaseObject\Exception\ValidationException; use ActiveCollab\DatabaseObject\Test\Base\WritersTypeTestCase; use ActiveCollab\DatabaseObject\Validator; -/** - * @package ActiveCollab\DatabaseObject\Test - */ class ValidatorTest extends WritersTypeTestCase { /** From 2ee0333a6294e5d0b13326c76f714164208f9e7e Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 8 Mar 2024 10:05:08 +0100 Subject: [PATCH 55/61] Improve code style --- src/Validator.php | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index b537362..541aad3 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -37,28 +37,32 @@ public function __construct( public function present(string $field_name): bool { if (empty($field_name)) { - throw new InvalidArgumentException("Value '$field_name' is not a valid field name"); + throw new InvalidArgumentException( + sprintf("Value '%s' is not a valid field name", $field_name), + ); } - if (array_key_exists($field_name, $this->field_values)) { - if (is_string($this->field_values[$field_name])) { - if (mb_strlen(trim($this->field_values[$field_name])) > 0) { - return true; - } else { - return $this->failPresenceValidation($field_name); - } - } elseif (is_bool($this->field_values[$field_name])) { + if (!array_key_exists($field_name, $this->field_values)) { + return $this->failPresenceValidation($field_name); + } + + if (is_string($this->field_values[$field_name])) { + if (mb_strlen(trim($this->field_values[$field_name])) > 0) { return true; - } else { - if (empty($this->field_values[$field_name])) { - return $this->failPresenceValidation($field_name); - } else { - return true; - } } - } else { + + return $this->failPresenceValidation($field_name); + } + + if (is_bool($this->field_values[$field_name])) { + return true; + } + + if (empty($this->field_values[$field_name])) { return $this->failPresenceValidation($field_name); } + + return true; } /** From 8a94aa16b6967b88b06c7d287b1e78767d99686f Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 8 Mar 2024 10:10:36 +0100 Subject: [PATCH 56/61] Add type to collection's execute() method --- src/Collection/Type.php | 39 +++++++++++++++++++------------------ src/CollectionInterface.php | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/Collection/Type.php b/src/Collection/Type.php index 392db73..edd4550 100644 --- a/src/Collection/Type.php +++ b/src/Collection/Type.php @@ -150,7 +150,7 @@ public function getTimestampHash(string $timestamp_field): string * * @return ResultInterface|EntityInterface[] */ - public function execute() + public function execute(): ?iterable { if (!$this->isReady()) { throw new LogicException('Collection is not ready'); @@ -158,31 +158,34 @@ public function execute() if (is_callable($this->pre_execute_callback)) { $ids = $this->executeIds(); + $ids_count = count($ids); - if ($ids_count = count($ids)) { - call_user_func($this->pre_execute_callback, $ids); + if ($ids_count === 0) { + return null; + } - if ($ids_count > 1000) { - $sql = $this->getSelectSql(); // Don't escape more than 1000 ID-s using DB::escape(), let MySQL do the dirty work instead of PHP - } else { - $escaped_ids = $this->connection->escapeValue($ids); + call_user_func($this->pre_execute_callback, $ids); - $sql = "SELECT * FROM {$this->getTableName()} WHERE id IN ($escaped_ids) ORDER BY FIELD (id, $escaped_ids)"; - } + if ($ids_count > 1000) { + $sql = $this->getSelectSql(); // Don't escape more than 1000 ID-s using DB::escape(), let MySQL do the dirty work instead of PHP + } else { + $escaped_ids = $this->connection->escapeValue($ids); - return $this->pool->findBySql($this->getType(), $sql); + $sql = sprintf( + "SELECT * FROM %s WHERE `id` IN (%s) ORDER BY FIELD (`id`, %s)", + $this->getTableName(), + $escaped_ids, + $escaped_ids, + ); } - return null; + return $this->pool->findBySql($this->getType(), $sql); } return $this->pool->findBySql($this->getType(), $this->getSelectSql()); } - /** - * @var int[] - */ - private $ids = false; + private ?array $ids = null; /** * Return ID-s of matching records. @@ -193,7 +196,7 @@ public function executeIds(): array throw new LogicException('Collection is not ready'); } - if ($this->ids === false) { + if ($this->ids === null) { $this->ids = $this->connection->executeFirstColumn($this->getSelectSql(false)); if (empty($this->ids)) { @@ -206,10 +209,8 @@ public function executeIds(): array /** * Return number of items that will be displayed on the current page of paginated collection (or total, if collection is not paginated). - * - * @return int */ - public function countIds() + public function countIds(): int { return count($this->executeIds()); } diff --git a/src/CollectionInterface.php b/src/CollectionInterface.php index 938ad59..126cc83 100644 --- a/src/CollectionInterface.php +++ b/src/CollectionInterface.php @@ -26,7 +26,7 @@ public function canBeTagged(): bool; * * @return ResultInterface|EntityInterface[] */ - public function execute(); + public function execute(): ?iterable; /** * Return ID-s of matching records. From 7b802fed97a4490a8274a22a0ce02bc3cf715b7a Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sat, 9 Mar 2024 09:31:50 +0100 Subject: [PATCH 57/61] Switch to updated etag package --- composer.json | 2 +- composer.lock | 400 +++++++++++++++++++--------------------- src/Collection/Type.php | 9 +- 3 files changed, 198 insertions(+), 213 deletions(-) diff --git a/composer.json b/composer.json index c729779..ea22462 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "php": ">=8.2", "activecollab/databaseconnection": "^5.0", - "activecollab/etag": "^1.0", + "activecollab/etag": "^2.0", "activecollab/object": "^1.0", "doctrine/inflector": "^2.0", "psr/log": "^1.0.0" diff --git a/composer.lock b/composer.lock index f175ccb..fc61ec4 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": "97d1e40746333c86ca923e02d5b13efe", + "content-hash": "7906381b6b26f85f5202623fcf7805e2", "packages": [ { "name": "activecollab/containeraccess", @@ -169,23 +169,23 @@ }, { "name": "activecollab/etag", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/activecollab/etag.git", - "reference": "98d8ef105d00c722afa7424cfea80ae7d25a2984" + "reference": "b1d8882fb889a2854e23fc4397e7c2191a56809b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/activecollab/etag/zipball/98d8ef105d00c722afa7424cfea80ae7d25a2984", - "reference": "98d8ef105d00c722afa7424cfea80ae7d25a2984", + "url": "https://api.github.com/repos/activecollab/etag/zipball/b1d8882fb889a2854e23fc4397e7c2191a56809b", + "reference": "b1d8882fb889a2854e23fc4397e7c2191a56809b", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~10.0" }, "type": "library", "autoload": { @@ -212,9 +212,9 @@ ], "support": { "issues": "https://github.com/activecollab/etag/issues", - "source": "https://github.com/activecollab/etag/tree/master" + "source": "https://github.com/activecollab/etag/tree/2.0.0" }, - "time": "2015-11-09T09:18:16+00:00" + "time": "2024-03-09T08:26:40+00:00" }, { "name": "activecollab/object", @@ -267,16 +267,16 @@ }, { "name": "carbonphp/carbon-doctrine-types", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", - "reference": "a31d3358a2a5d6ae947df1691d1f321418a5f3d5" + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/a31d3358a2a5d6ae947df1691d1f321418a5f3d5", - "reference": "a31d3358a2a5d6ae947df1691d1f321418a5f3d5", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", "shasum": "" }, "require": { @@ -316,7 +316,7 @@ ], "support": { "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", - "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.1.0" + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" }, "funding": [ { @@ -332,20 +332,20 @@ "type": "tidelift" } ], - "time": "2023-12-10T15:33:53+00:00" + "time": "2024-02-09T16:56:22+00:00" }, { "name": "doctrine/inflector", - "version": "2.0.9", + "version": "2.0.10", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65" + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/2930cd5ef353871c821d5c43ed030d39ac8cfe65", - "reference": "2930cd5ef353871c821d5c43ed030d39ac8cfe65", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc", + "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc", "shasum": "" }, "require": { @@ -407,7 +407,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.9" + "source": "https://github.com/doctrine/inflector/tree/2.0.10" }, "funding": [ { @@ -423,20 +423,20 @@ "type": "tidelift" } ], - "time": "2024-01-15T18:05:13+00:00" + "time": "2024-02-18T20:23:39+00:00" }, { "name": "nesbot/carbon", - "version": "2.72.2", + "version": "2.72.3", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "3e7edc41b58d65509baeb0d4a14c8fa41d627130" + "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/3e7edc41b58d65509baeb0d4a14c8fa41d627130", - "reference": "3e7edc41b58d65509baeb0d4a14c8fa41d627130", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/0c6fd108360c562f6e4fd1dedb8233b423e91c83", + "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83", "shasum": "" }, "require": { @@ -530,7 +530,7 @@ "type": "tidelift" } ], - "time": "2024-01-19T00:21:53+00:00" + "time": "2024-01-25T10:35:09+00:00" }, { "name": "psr/clock", @@ -747,16 +747,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -770,9 +770,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -810,7 +807,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -826,20 +823,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -847,9 +844,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -893,7 +887,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -909,20 +903,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/translation", - "version": "v6.4.2", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "a2ab2ec1a462e53016de8e8d5e8912bfd62ea681" + "reference": "bce6a5a78e94566641b2594d17e48b0da3184a8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/a2ab2ec1a462e53016de8e8d5e8912bfd62ea681", - "reference": "a2ab2ec1a462e53016de8e8d5e8912bfd62ea681", + "url": "https://api.github.com/repos/symfony/translation/zipball/bce6a5a78e94566641b2594d17e48b0da3184a8e", + "reference": "bce6a5a78e94566641b2594d17e48b0da3184a8e", "shasum": "" }, "require": { @@ -945,7 +939,7 @@ "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { - "nikic/php-parser": "^4.13", + "nikic/php-parser": "^4.18|^5.0", "psr/log": "^1|^2|^3", "symfony/config": "^5.4|^6.0|^7.0", "symfony/console": "^5.4|^6.0|^7.0", @@ -988,7 +982,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.4.2" + "source": "https://github.com/symfony/translation/tree/v6.4.4" }, "funding": [ { @@ -1004,7 +998,7 @@ "type": "tidelift" } ], - "time": "2023-12-18T09:25:29+00:00" + "time": "2024-02-20T13:16:58+00:00" }, { "name": "symfony/translation-contracts", @@ -1382,16 +1376,16 @@ }, { "name": "doctrine/deprecations", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", - "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", "shasum": "" }, "require": { @@ -1423,9 +1417,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.2" + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" }, - "time": "2023-09-27T20:04:15+00:00" + "time": "2024-01-30T19:34:25+00:00" }, { "name": "doctrine/instantiator", @@ -1499,16 +1493,16 @@ }, { "name": "doctrine/lexer", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124" + "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", - "reference": "39ab8fcf5a51ce4b85ca97c7a7d033eb12831124", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", + "reference": "861c870e8b75f7c8f69c146c7f89cc1c0f1b49b6", "shasum": "" }, "require": { @@ -1516,11 +1510,11 @@ "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", + "doctrine/coding-standard": "^9 || ^12", "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psalm/plugin-phpunit": "^0.18.3", - "vimeo/psalm": "^4.11 || ^5.0" + "vimeo/psalm": "^4.11 || ^5.21" }, "type": "library", "autoload": { @@ -1557,7 +1551,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/2.1.0" + "source": "https://github.com/doctrine/lexer/tree/2.1.1" }, "funding": [ { @@ -1573,7 +1567,7 @@ "type": "tidelift" } ], - "time": "2022-12-14T08:49:07+00:00" + "time": "2024-02-05T11:35:39+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -1831,16 +1825,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.0", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4a21235f7e56e713259a6f76bf4b5ea08502b9dc", - "reference": "4a21235f7e56e713259a6f76bf4b5ea08502b9dc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { @@ -1883,26 +1877,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2024-01-07T17:17:35+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -1943,9 +1938,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -2056,16 +2057,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.30", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { @@ -2122,7 +2123,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -2130,7 +2131,7 @@ "type": "github" } ], - "time": "2023-12-22T06:47:57+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2375,16 +2376,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.16", + "version": "9.6.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f" + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f", - "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", "shasum": "" }, "require": { @@ -2458,7 +2459,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" }, "funding": [ { @@ -2474,7 +2475,7 @@ "type": "tidelift" } ], - "time": "2024-01-19T07:03:14+00:00" + "time": "2024-02-23T13:14:51+00:00" }, { "name": "psr/cache", @@ -2577,16 +2578,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -2621,7 +2622,7 @@ "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" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -2629,7 +2630,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -2875,16 +2876,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -2929,7 +2930,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -2937,7 +2938,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -3004,16 +3005,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -3069,7 +3070,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -3077,20 +3078,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -3133,7 +3134,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -3141,7 +3142,7 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -3541,16 +3542,16 @@ }, { "name": "symfony/console", - "version": "v5.4.34", + "version": "v5.4.36", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "4b4d8cd118484aa604ec519062113dd87abde18c" + "reference": "39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/4b4d8cd118484aa604ec519062113dd87abde18c", - "reference": "4b4d8cd118484aa604ec519062113dd87abde18c", + "url": "https://api.github.com/repos/symfony/console/zipball/39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e", + "reference": "39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e", "shasum": "" }, "require": { @@ -3620,7 +3621,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.34" + "source": "https://github.com/symfony/console/tree/v5.4.36" }, "funding": [ { @@ -3636,20 +3637,20 @@ "type": "tidelift" } ], - "time": "2023-12-08T13:33:03+00:00" + "time": "2024-02-20T16:33:57+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.34", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "e3bca343efeb613f843c254e7718ef17c9bdf7a3" + "reference": "7a69a85c7ea5bdd1e875806a99c51a87d3a74b38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/e3bca343efeb613f843c254e7718ef17c9bdf7a3", - "reference": "e3bca343efeb613f843c254e7718ef17c9bdf7a3", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7a69a85c7ea5bdd1e875806a99c51a87d3a74b38", + "reference": "7a69a85c7ea5bdd1e875806a99c51a87d3a74b38", "shasum": "" }, "require": { @@ -3705,7 +3706,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.34" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.35" }, "funding": [ { @@ -3721,7 +3722,7 @@ "type": "tidelift" } ], - "time": "2023-12-27T21:12:56+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -3801,16 +3802,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.25", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364" + "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", - "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5a553607d4ffbfa9c0ab62facadea296c9db7086", + "reference": "5a553607d4ffbfa9c0ab62facadea296c9db7086", "shasum": "" }, "require": { @@ -3845,7 +3846,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.25" + "source": "https://github.com/symfony/filesystem/tree/v5.4.35" }, "funding": [ { @@ -3861,20 +3862,20 @@ "type": "tidelift" } ], - "time": "2023-05-31T13:04:02+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/finder", - "version": "v5.4.27", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "ff4bce3c33451e7ec778070e45bd23f74214cd5d" + "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ff4bce3c33451e7ec778070e45bd23f74214cd5d", - "reference": "ff4bce3c33451e7ec778070e45bd23f74214cd5d", + "url": "https://api.github.com/repos/symfony/finder/zipball/abe6d6f77d9465fed3cd2d029b29d03b56b56435", + "reference": "abe6d6f77d9465fed3cd2d029b29d03b56b56435", "shasum": "" }, "require": { @@ -3908,7 +3909,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.27" + "source": "https://github.com/symfony/finder/tree/v5.4.35" }, "funding": [ { @@ -3924,7 +3925,7 @@ "type": "tidelift" } ], - "time": "2023-07-31T08:02:31+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/options-resolver", @@ -3997,16 +3998,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -4020,9 +4021,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4059,7 +4057,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -4075,20 +4073,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "875e90aeea2777b6f135677f618529449334a612" + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", - "reference": "875e90aeea2777b6f135677f618529449334a612", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", "shasum": "" }, "require": { @@ -4099,9 +4097,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4140,7 +4135,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" }, "funding": [ { @@ -4156,20 +4151,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -4180,9 +4175,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4224,7 +4216,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -4240,7 +4232,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php70", @@ -4312,16 +4304,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179" + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/70f4aebd92afca2f865444d30a4d2151c13c3179", - "reference": "70f4aebd92afca2f865444d30a4d2151c13c3179", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/861391a8da9a04cbad2d232ddd9e4893220d6e25", + "reference": "861391a8da9a04cbad2d232ddd9e4893220d6e25", "shasum": "" }, "require": { @@ -4329,9 +4321,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4368,7 +4357,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.29.0" }, "funding": [ { @@ -4384,20 +4373,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -4405,9 +4394,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4447,7 +4433,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -4463,20 +4449,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/process", - "version": "v5.4.34", + "version": "v5.4.36", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a" + "reference": "4fdf34004f149cc20b2f51d7d119aa500caad975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/8fa22178dfc368911dbd513b431cd9b06f9afe7a", - "reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a", + "url": "https://api.github.com/repos/symfony/process/zipball/4fdf34004f149cc20b2f51d7d119aa500caad975", + "reference": "4fdf34004f149cc20b2f51d7d119aa500caad975", "shasum": "" }, "require": { @@ -4509,7 +4495,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.34" + "source": "https://github.com/symfony/process/tree/v5.4.36" }, "funding": [ { @@ -4525,7 +4511,7 @@ "type": "tidelift" } ], - "time": "2023-12-02T08:41:43+00:00" + "time": "2024-02-12T15:49:53+00:00" }, { "name": "symfony/service-contracts", @@ -4611,16 +4597,16 @@ }, { "name": "symfony/stopwatch", - "version": "v5.4.21", + "version": "v5.4.35", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee" + "reference": "887762aa99ff16f65dc8b48aafead415f942d407" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f83692cd869a6f2391691d40a01e8acb89e76fee", - "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/887762aa99ff16f65dc8b48aafead415f942d407", + "reference": "887762aa99ff16f65dc8b48aafead415f942d407", "shasum": "" }, "require": { @@ -4653,7 +4639,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.21" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.35" }, "funding": [ { @@ -4669,20 +4655,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2024-01-23T13:51:25+00:00" }, { "name": "symfony/string", - "version": "v6.4.2", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc" + "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7cb80bc10bfcdf6b5492741c0b9357dac66940bc", - "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc", + "url": "https://api.github.com/repos/symfony/string/zipball/4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", + "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", "shasum": "" }, "require": { @@ -4739,7 +4725,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.2" + "source": "https://github.com/symfony/string/tree/v6.4.4" }, "funding": [ { @@ -4755,20 +4741,20 @@ "type": "tidelift" } ], - "time": "2023-12-10T16:15:48+00:00" + "time": "2024-02-01T13:16:41+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -4797,7 +4783,7 @@ "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.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -4805,7 +4791,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], diff --git a/src/Collection/Type.php b/src/Collection/Type.php index edd4550..13772ba 100644 --- a/src/Collection/Type.php +++ b/src/Collection/Type.php @@ -63,12 +63,11 @@ public function canBeEtagged(): bool /** * Return collection etag. - * - * @param string $visitor_identifier - * @param bool $use_cache - * @return string */ - public function getEtag($visitor_identifier, $use_cache = true) + public function getEtag( + string $visitor_identifier, + bool $use_cache = true + ): string { $timestamp_field = $this->getTimestampField(); From f271f2008337ce7a46ada10563e16a74d5a9c0e5 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 18 Jul 2025 08:13:07 +0200 Subject: [PATCH 58/61] Add option to check for value presence, while allowing empty values --- src/Validator.php | 9 ++++++++- test/src/PresenceValidatorTest.php | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Validator.php b/src/Validator.php index 541aad3..9d74b5a 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -34,7 +34,10 @@ public function __construct( * Note: strings are trimmed prior to check, and values that empty() would return true for (like '0') are considered * to be present (because we check strlen(trim($value))). */ - public function present(string $field_name): bool + public function present( + string $field_name, + bool $allow_empty = false, + ): bool { if (empty($field_name)) { throw new InvalidArgumentException( @@ -46,6 +49,10 @@ public function present(string $field_name): bool return $this->failPresenceValidation($field_name); } + if ($allow_empty && empty($this->field_values[$field_name])) { + return true; + } + if (is_string($this->field_values[$field_name])) { if (mb_strlen(trim($this->field_values[$field_name])) > 0) { return true; diff --git a/test/src/PresenceValidatorTest.php b/test/src/PresenceValidatorTest.php index d72cfbc..4525811 100644 --- a/test/src/PresenceValidatorTest.php +++ b/test/src/PresenceValidatorTest.php @@ -42,6 +42,21 @@ public function testPass() $this->assertCount(0, $name_errors); } + public function testPassAllowEmpty() + { + $validator = new Validator($this->connection, 'writers', null, null, ['name' => '']); + + $is_present = $validator->present('name', true); + + $this->assertTrue($is_present); + $this->assertFalse($validator->hasErrors()); + + $name_errors = $validator->getFieldErrors('name'); + + $this->assertIsArray($name_errors); + $this->assertCount(0, $name_errors); + } + /** * Test validation failure. */ From 1c62b451ba146d00d5f3a7e4de6681679bba1dcb Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 18 Jul 2025 08:19:46 +0200 Subject: [PATCH 59/61] Revert "Add option to check for value presence, while allowing empty values" This reverts commit f271f2008337ce7a46ada10563e16a74d5a9c0e5. --- src/Validator.php | 9 +-------- test/src/PresenceValidatorTest.php | 15 --------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/Validator.php b/src/Validator.php index 9d74b5a..541aad3 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -34,10 +34,7 @@ public function __construct( * Note: strings are trimmed prior to check, and values that empty() would return true for (like '0') are considered * to be present (because we check strlen(trim($value))). */ - public function present( - string $field_name, - bool $allow_empty = false, - ): bool + public function present(string $field_name): bool { if (empty($field_name)) { throw new InvalidArgumentException( @@ -49,10 +46,6 @@ public function present( return $this->failPresenceValidation($field_name); } - if ($allow_empty && empty($this->field_values[$field_name])) { - return true; - } - if (is_string($this->field_values[$field_name])) { if (mb_strlen(trim($this->field_values[$field_name])) > 0) { return true; diff --git a/test/src/PresenceValidatorTest.php b/test/src/PresenceValidatorTest.php index 4525811..d72cfbc 100644 --- a/test/src/PresenceValidatorTest.php +++ b/test/src/PresenceValidatorTest.php @@ -42,21 +42,6 @@ public function testPass() $this->assertCount(0, $name_errors); } - public function testPassAllowEmpty() - { - $validator = new Validator($this->connection, 'writers', null, null, ['name' => '']); - - $is_present = $validator->present('name', true); - - $this->assertTrue($is_present); - $this->assertFalse($validator->hasErrors()); - - $name_errors = $validator->getFieldErrors('name'); - - $this->assertIsArray($name_errors); - $this->assertCount(0, $name_errors); - } - /** * Test validation failure. */ From 1f784f40eba0c7856b795350e8ed97e79cf663eb Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Fri, 18 Jul 2025 08:50:33 +0200 Subject: [PATCH 60/61] Revert "Revert "Add option to check for value presence, while allowing empty values"" This reverts commit 1c62b451ba146d00d5f3a7e4de6681679bba1dcb. --- src/Validator.php | 9 ++++++++- test/src/PresenceValidatorTest.php | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Validator.php b/src/Validator.php index 541aad3..9d74b5a 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -34,7 +34,10 @@ public function __construct( * Note: strings are trimmed prior to check, and values that empty() would return true for (like '0') are considered * to be present (because we check strlen(trim($value))). */ - public function present(string $field_name): bool + public function present( + string $field_name, + bool $allow_empty = false, + ): bool { if (empty($field_name)) { throw new InvalidArgumentException( @@ -46,6 +49,10 @@ public function present(string $field_name): bool return $this->failPresenceValidation($field_name); } + if ($allow_empty && empty($this->field_values[$field_name])) { + return true; + } + if (is_string($this->field_values[$field_name])) { if (mb_strlen(trim($this->field_values[$field_name])) > 0) { return true; diff --git a/test/src/PresenceValidatorTest.php b/test/src/PresenceValidatorTest.php index d72cfbc..4525811 100644 --- a/test/src/PresenceValidatorTest.php +++ b/test/src/PresenceValidatorTest.php @@ -42,6 +42,21 @@ public function testPass() $this->assertCount(0, $name_errors); } + public function testPassAllowEmpty() + { + $validator = new Validator($this->connection, 'writers', null, null, ['name' => '']); + + $is_present = $validator->present('name', true); + + $this->assertTrue($is_present); + $this->assertFalse($validator->hasErrors()); + + $name_errors = $validator->getFieldErrors('name'); + + $this->assertIsArray($name_errors); + $this->assertCount(0, $name_errors); + } + /** * Test validation failure. */ From 0aab0e2b87e5e224e4b4016e3727491f1afe8891 Mon Sep 17 00:00:00 2001 From: Ilija Studen Date: Sun, 3 Aug 2025 20:11:46 +0200 Subject: [PATCH 61/61] Update to do list --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d109f98..4607bb9 100644 --- a/README.md +++ b/README.md @@ -179,4 +179,5 @@ Entity class also refreshes the values of these fields on object save so fresh v ## To Do 1. Caching, -2. Remove deprecated `ObjectInterface` and `Object` class. +2. Add support for PHP enums +3. Remove deprecated `ObjectInterface` and `Object` class.