From 4e9d93957ecf3bf7f221cd8cee6e58aa74663a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:06:44 +0200 Subject: [PATCH 01/91] Removed tests for PHP 7.4 and PHP 8.0 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f12c4f06..76137f02 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - php-versions: [ '7.4', '8.0', '8.1', '8.2' ] + php-versions: [ '8.1', '8.2' ] db-type: [ 'mysql', 'sqlite' ] env: From cd1413a74e82c67dbdf06c09b53b7a5cbdc7b963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:07:03 +0200 Subject: [PATCH 02/91] CheckRequirementsCommand now recommends PHP 8.2 --- src/Command/CheckRequirementsCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 4d9f9d96..60883f81 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -70,7 +70,8 @@ class CheckRequirementsCommand extends Command { //Check PHP versions $io->isVerbose() && $io->comment('Checking PHP version...'); - if (PHP_VERSION_ID < 80100) { + //We recommend PHP 8.2, but 8.1 is the minimum + if (PHP_VERSION_ID < 80200) { $io->warning('You are using PHP '. PHP_VERSION .'. This will work, but a newer version is recommended.'); } else { !$only_issues && $io->success('PHP version is sufficient.'); From ef9b2aefe5bb5e907ab44691b96b60da873a8610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:10:18 +0200 Subject: [PATCH 03/91] Set platform in composer.json to PHP 8.1.0 and updated dependencies --- composer.json | 2 +- composer.lock | 732 +++++++++++++++++++++++++++++--------------------- 2 files changed, 431 insertions(+), 303 deletions(-) diff --git a/composer.json b/composer.json index 0f5c6450..ccb53e85 100644 --- a/composer.json +++ b/composer.json @@ -111,7 +111,7 @@ "*": "dist" }, "platform": { - "php": "7.4.0" + "php": "8.1.0" }, "sort-packages": true, "allow-plugins": { diff --git a/composer.lock b/composer.lock index 8ec67ba6..6d63eb9a 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": "51206f9aa7e372b40ef62a105c4a3f13", + "content-hash": "c64a13c94017e1a9e155b92400d8389d", "packages": [ { "name": "beberlei/assert", @@ -506,32 +506,34 @@ }, { "name": "doctrine/collections", - "version": "1.8.0", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "2b44dd4cbca8b5744327de78bafef5945c7e7b5e" + "reference": "db8cda536a034337f7dd63febecc713d4957f9ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/2b44dd4cbca8b5744327de78bafef5945c7e7b5e", - "reference": "2b44dd4cbca8b5744327de78bafef5945c7e7b5e", + "url": "https://api.github.com/repos/doctrine/collections/zipball/db8cda536a034337f7dd63febecc713d4957f9ee", + "reference": "db8cda536a034337f7dd63febecc713d4957f9ee", "shasum": "" }, "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1.3 || ^8.0" + "doctrine/deprecations": "^1", + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9.0 || ^10.0", - "phpstan/phpstan": "^1.4.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.1.5", + "doctrine/coding-standard": "^10.0", + "ext-json": "*", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^9.5", "vimeo/psalm": "^4.22" }, "type": "library", "autoload": { "psr-4": { - "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" + "Doctrine\\Common\\Collections\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -570,9 +572,23 @@ ], "support": { "issues": "https://github.com/doctrine/collections/issues", - "source": "https://github.com/doctrine/collections/tree/1.8.0" + "source": "https://github.com/doctrine/collections/tree/2.1.2" }, - "time": "2022-09-01T20:12:10+00:00" + "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%2Fcollections", + "type": "tidelift" + } + ], + "time": "2022-12-27T23:41:38+00:00" }, { "name": "doctrine/common", @@ -1288,30 +1304,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "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": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "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": { @@ -1338,7 +1354,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -1354,7 +1370,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "doctrine/lexer", @@ -1436,16 +1452,16 @@ }, { "name": "doctrine/migrations", - "version": "3.5.5", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/migrations.git", - "reference": "4b1e2b6ba71d21d0c5be22ed03b6fc954d20b204" + "reference": "e542ad8bcd606d7a18d0875babb8a6d963c9c059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/4b1e2b6ba71d21d0c5be22ed03b6fc954d20b204", - "reference": "4b1e2b6ba71d21d0c5be22ed03b6fc954d20b204", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/e542ad8bcd606d7a18d0875babb8a6d963c9c059", + "reference": "e542ad8bcd606d7a18d0875babb8a6d963c9c059", "shasum": "" }, "require": { @@ -1453,11 +1469,11 @@ "doctrine/dbal": "^3.5.1", "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.2 || ^2.0", - "friendsofphp/proxy-manager-lts": "^1.0", - "php": "^7.4 || ^8.0", + "php": "^8.1", "psr/log": "^1.1.3 || ^2 || ^3", "symfony/console": "^4.4.16 || ^5.4 || ^6.0", - "symfony/stopwatch": "^4.4 || ^5.4 || ^6.0" + "symfony/stopwatch": "^4.4 || ^5.4 || ^6.0", + "symfony/var-exporter": "^6.2" }, "conflict": { "doctrine/orm": "<2.12" @@ -1473,7 +1489,7 @@ "phpstan/phpstan-phpunit": "^1.1", "phpstan/phpstan-strict-rules": "^1.1", "phpstan/phpstan-symfony": "^1.1", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.5.24", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/process": "^4.4 || ^5.4 || ^6.0", "symfony/yaml": "^4.4 || ^5.4 || ^6.0" @@ -1518,7 +1534,7 @@ ], "support": { "issues": "https://github.com/doctrine/migrations/issues", - "source": "https://github.com/doctrine/migrations/tree/3.5.5" + "source": "https://github.com/doctrine/migrations/tree/3.6.0" }, "funding": [ { @@ -1534,7 +1550,7 @@ "type": "tidelift" } ], - "time": "2023-01-18T12:44:30+00:00" + "time": "2023-02-15T18:49:46+00:00" }, { "name": "doctrine/orm", @@ -1851,26 +1867,26 @@ }, { "name": "egulias/email-validator", - "version": "3.2.5", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "b531a2311709443320c786feb4519cfaf94af796" + "reference": "3a85486b709bc384dae8eb78fb2eec649bdb64ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b531a2311709443320c786feb4519cfaf94af796", - "reference": "b531a2311709443320c786feb4519cfaf94af796", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/3a85486b709bc384dae8eb78fb2eec649bdb64ff", + "reference": "3a85486b709bc384dae8eb78fb2eec649bdb64ff", "shasum": "" }, "require": { - "doctrine/lexer": "^1.2|^2", - "php": ">=7.2", - "symfony/polyfill-intl-idn": "^1.15" + "doctrine/lexer": "^2.0 || ^3.0", + "php": ">=8.1", + "symfony/polyfill-intl-idn": "^1.26" }, "require-dev": { - "phpunit/phpunit": "^8.5.8|^9.3.3", - "vimeo/psalm": "^4" + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^4.30" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -1878,7 +1894,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -1906,7 +1922,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/3.2.5" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.1" }, "funding": [ { @@ -1914,7 +1930,7 @@ "type": "github" } ], - "time": "2023-01-02T17:26:14+00:00" + "time": "2023-01-14T14:17:03+00:00" }, { "name": "erusev/parsedown", @@ -2755,25 +2771,26 @@ }, { "name": "jfcherng/php-mb-string", - "version": "1.4.8", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/jfcherng/php-mb-string.git", - "reference": "ef8926ff849863bfea234e99ee827947bedd86b0" + "reference": "8407bfefde47849c9e7c9594e6de2ac85a0f845d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jfcherng/php-mb-string/zipball/ef8926ff849863bfea234e99ee827947bedd86b0", - "reference": "ef8926ff849863bfea234e99ee827947bedd86b0", + "url": "https://api.github.com/repos/jfcherng/php-mb-string/zipball/8407bfefde47849c9e7c9594e6de2ac85a0f845d", + "reference": "8407bfefde47849c9e7c9594e6de2ac85a0f845d", "shasum": "" }, "require": { - "php": ">=7.1.3" + "ext-iconv": "*", + "php": ">=8.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.18", - "phan/phan": "^2 || ^3 || ^4", - "phpunit/phpunit": "^7.2 || ^8 || ^9" + "friendsofphp/php-cs-fixer": "^3", + "phan/phan": "^5", + "phpunit/phpunit": "^9 || ^10" }, "suggest": { "ext-iconv": "Either \"ext-iconv\" or \"ext-mbstring\" is requried.", @@ -2798,7 +2815,7 @@ "description": "A high performance multibytes sting implementation for frequently reading/writing operations.", "support": { "issues": "https://github.com/jfcherng/php-mb-string/issues", - "source": "https://github.com/jfcherng/php-mb-string/tree/1.4.8" + "source": "https://github.com/jfcherng/php-mb-string/tree/2.0.1" }, "funding": [ { @@ -2806,30 +2823,30 @@ "type": "custom" } ], - "time": "2023-04-17T14:22:37+00:00" + "time": "2023-04-17T14:23:16+00:00" }, { "name": "jfcherng/php-sequence-matcher", - "version": "3.2.10", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/jfcherng/php-sequence-matcher.git", - "reference": "650164598be2c6ad6891dbd41de4cb5cc21cc91b" + "reference": "d2038ac29627340a7458609072a8ba355e80ec5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jfcherng/php-sequence-matcher/zipball/650164598be2c6ad6891dbd41de4cb5cc21cc91b", - "reference": "650164598be2c6ad6891dbd41de4cb5cc21cc91b", + "url": "https://api.github.com/repos/jfcherng/php-sequence-matcher/zipball/d2038ac29627340a7458609072a8ba355e80ec5b", + "reference": "d2038ac29627340a7458609072a8ba355e80ec5b", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=8.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phan/phan": "^2.5 || ^3 || ^4 || ^5", - "phpunit/phpunit": ">=7 <10", - "squizlabs/php_codesniffer": "^3.5" + "friendsofphp/php-cs-fixer": "^3", + "phan/phan": "^5", + "phpunit/phpunit": "^9 || ^10", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -2854,7 +2871,7 @@ "description": "A longest sequence matcher. The logic is primarily based on the Python difflib package.", "support": { "issues": "https://github.com/jfcherng/php-sequence-matcher/issues", - "source": "https://github.com/jfcherng/php-sequence-matcher/tree/3.2.10" + "source": "https://github.com/jfcherng/php-sequence-matcher/tree/4.0.3" }, "funding": [ { @@ -2862,33 +2879,33 @@ "type": "custom" } ], - "time": "2023-05-21T07:53:38+00:00" + "time": "2023-05-21T07:57:08+00:00" }, { "name": "laminas/laminas-code", - "version": "4.7.1", + "version": "4.11.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-code.git", - "reference": "91aabc066d5620428120800c0eafc0411e441a62" + "reference": "169123b3ede20a9193480c53de2a8194f8c073ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-code/zipball/91aabc066d5620428120800c0eafc0411e441a62", - "reference": "91aabc066d5620428120800c0eafc0411e441a62", + "url": "https://api.github.com/repos/laminas/laminas-code/zipball/169123b3ede20a9193480c53de2a8194f8c073ec", + "reference": "169123b3ede20a9193480c53de2a8194f8c073ec", "shasum": "" }, "require": { - "php": ">=7.4, <8.2" + "php": "~8.1.0 || ~8.2.0" }, "require-dev": { - "doctrine/annotations": "^1.13.2", + "doctrine/annotations": "^2.0.0", "ext-phar": "*", "laminas/laminas-coding-standard": "^2.3.0", "laminas/laminas-stdlib": "^3.6.1", - "phpunit/phpunit": "^9.5.10", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.13.1" + "phpunit/phpunit": "^10.0.9", + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.7.1" }, "suggest": { "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", @@ -2896,9 +2913,6 @@ }, "type": "library", "autoload": { - "files": [ - "polyfill/ReflectionEnumPolyfill.php" - ], "psr-4": { "Laminas\\Code\\": "src/" } @@ -2928,35 +2942,38 @@ "type": "community_bridge" } ], - "time": "2022-11-21T01:32:31+00:00" + "time": "2023-05-14T12:05:38+00:00" }, { "name": "lcobucci/clock", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/lcobucci/clock.git", - "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3" + "reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/clock/zipball/353d83fe2e6ae95745b16b3d911813df6a05bfb3", - "reference": "353d83fe2e6ae95745b16b3d911813df6a05bfb3", + "url": "https://api.github.com/repos/lcobucci/clock/zipball/039ef98c6b57b101d10bd11d8fdfda12cbd996dc", + "reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0" + "php": "~8.1.0 || ~8.2.0", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" }, "require-dev": { - "infection/infection": "^0.17", - "lcobucci/coding-standard": "^6.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/php-code-coverage": "9.1.4", - "phpunit/phpunit": "9.3.7" + "infection/infection": "^0.26", + "lcobucci/coding-standard": "^9.0", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-deprecation-rules": "^1.1.1", + "phpstan/phpstan-phpunit": "^1.3.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^9.5.27" }, "type": "library", "autoload": { @@ -2977,7 +2994,7 @@ "description": "Yet another clock abstraction", "support": { "issues": "https://github.com/lcobucci/clock/issues", - "source": "https://github.com/lcobucci/clock/tree/2.0.x" + "source": "https://github.com/lcobucci/clock/tree/3.0.0" }, "funding": [ { @@ -2989,7 +3006,7 @@ "type": "patreon" } ], - "time": "2020-08-27T18:56:02+00:00" + "time": "2022-12-19T15:00:24+00:00" }, { "name": "lcobucci/jwt", @@ -3240,37 +3257,38 @@ }, { "name": "league/uri", - "version": "6.7.2", + "version": "6.8.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06" + "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/a700b4656e4c54371b799ac61e300ab25a2d1d39", + "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39", "shasum": "" }, "require": { "ext-json": "*", "league/uri-interfaces": "^2.3", - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.0" + "php": "^8.1", + "psr/http-message": "^1.0.1" }, "conflict": { "league/uri-schemes": "^1.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.3.2", - "nyholm/psr7": "^1.5", - "php-http/psr7-integration-tests": "^1.1", - "phpstan/phpstan": "^1.2.0", + "friendsofphp/php-cs-fixer": "^v3.9.5", + "nyholm/psr7": "^1.5.1", + "php-http/psr7-integration-tests": "^1.1.1", + "phpbench/phpbench": "^1.2.6", + "phpstan/phpstan": "^1.8.5", "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0.0", - "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.10", - "psr/http-factory": "^1.0" + "phpstan/phpstan-phpunit": "^1.1.1", + "phpstan/phpstan-strict-rules": "^1.4.3", + "phpunit/phpunit": "^9.5.24", + "psr/http-factory": "^1.0.1" }, "suggest": { "ext-fileinfo": "Needed to create Data URI from a filepath", @@ -3327,7 +3345,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.7.2" + "source": "https://github.com/thephpleague/uri/tree/6.8.0" }, "funding": [ { @@ -3335,7 +3353,7 @@ "type": "github" } ], - "time": "2022-09-13T19:50:42+00:00" + "time": "2022-09-13T19:58:47+00:00" }, { "name": "league/uri-interfaces", @@ -5134,20 +5152,20 @@ }, { "name": "psr/cache", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -5167,7 +5185,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -5177,9 +5195,57 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/2.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:23:37+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", @@ -5441,20 +5507,20 @@ }, { "name": "psr/link", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/php-fig/link.git", - "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562" + "reference": "846c25f58a1f02b93a00f2404e3626b6bf9b7807" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562", - "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562", + "url": "https://api.github.com/repos/php-fig/link/zipball/846c25f58a1f02b93a00f2404e3626b6bf9b7807", + "reference": "846c25f58a1f02b93a00f2404e3626b6bf9b7807", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -5478,6 +5544,7 @@ } ], "description": "Common interfaces for HTTP links", + "homepage": "https://github.com/php-fig/link", "keywords": [ "http", "http-link", @@ -5487,9 +5554,9 @@ "rest" ], "support": { - "source": "https://github.com/php-fig/link/tree/master" + "source": "https://github.com/php-fig/link/tree/1.1.1" }, - "time": "2016-10-28T16:06:13+00:00" + "time": "2021-03-11T22:59:13+00:00" }, { "name": "psr/log", @@ -5543,25 +5610,25 @@ }, { "name": "psr/simple-cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -5576,7 +5643,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interfaces for simple caching", @@ -5588,27 +5655,26 @@ "simple-cache" ], "support": { - "source": "https://github.com/php-fig/simple-cache/tree/master" + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2017-10-23T01:57:42+00:00" + "time": "2021-10-29T13:26:27+00:00" }, { "name": "ramsey/collection", - "version": "1.3.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4" + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/ad7475d1c9e70b190ecffc58f2d989416af339b4", - "reference": "ad7475d1c9e70b190ecffc58f2d989416af339b4", + "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", "shasum": "" }, "require": { - "php": "^7.4 || ^8.0", - "symfony/polyfill-php81": "^1.23" + "php": "^8.1" }, "require-dev": { "captainhook/plugin-composer": "^5.3", @@ -5668,7 +5734,7 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/1.3.0" + "source": "https://github.com/ramsey/collection/tree/2.0.0" }, "funding": [ { @@ -5680,29 +5746,27 @@ "type": "tidelift" } ], - "time": "2022-12-27T19:12:24+00:00" + "time": "2022-12-31T21:50:55+00:00" }, { "name": "ramsey/uuid", - "version": "4.2.3", + "version": "4.7.4", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df" + "reference": "60a4c63ab724854332900504274f6150ff26d286" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", - "reference": "fc9bb7fb5388691fd7373cd44dcb4d63bbcf24df", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", + "reference": "60a4c63ab724854332900504274f6150ff26d286", "shasum": "" }, "require": { - "brick/math": "^0.8 || ^0.9", + "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11", "ext-json": "*", - "php": "^7.2 || ^8.0", - "ramsey/collection": "^1.0", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php80": "^1.14" + "php": "^8.0", + "ramsey/collection": "^1.2 || ^2.0" }, "replace": { "rhumsaa/uuid": "self.version" @@ -5714,24 +5778,23 @@ "doctrine/annotations": "^1.8", "ergebnis/composer-normalize": "^2.15", "mockery/mockery": "^1.3", - "moontoast/math": "^1.1", "paragonie/random-lib": "^2", "php-mock/php-mock": "^2.2", "php-mock/php-mock-mockery": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.1", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.1", "phpunit/phpunit": "^8.5 || ^9", - "slevomat/coding-standard": "^7.0", + "ramsey/composer-repl": "^1.4", + "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.9" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", - "ext-ctype": "Enables faster processing of character classification using ctype functions.", "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", @@ -5739,9 +5802,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "4.x-dev" - }, "captainhook": { "force-install": true } @@ -5766,7 +5826,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.2.3" + "source": "https://github.com/ramsey/uuid/tree/4.7.4" }, "funding": [ { @@ -5778,7 +5838,7 @@ "type": "tidelift" } ], - "time": "2021-09-25T23:10:38+00:00" + "time": "2023-04-15T23:01:58+00:00" }, { "name": "robrichards/xmlseclibs", @@ -7093,16 +7153,16 @@ }, { "name": "symfony/console", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c" + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/90f21e27d0d88ce38720556dd164d4a1e4c3934c", - "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c", + "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", "shasum": "" }, "require": { @@ -7172,7 +7232,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.23" + "source": "https://github.com/symfony/console/tree/v5.4.24" }, "funding": [ { @@ -7188,7 +7248,7 @@ "type": "tidelift" } ], - "time": "2023-04-24T18:47:29+00:00" + "time": "2023-05-26T05:13:16+00:00" }, { "name": "symfony/css-selector", @@ -7347,25 +7407,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -7394,7 +7454,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" }, "funding": [ { @@ -7410,20 +7470,20 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-03-01T10:25:55+00:00" }, { "name": "symfony/doctrine-bridge", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "32cddf41cf6abfc4c3db68568c785e48eebf3d71" + "reference": "1eeb02bcad51cb99ab3b73bc83adf80f9b1a75cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/32cddf41cf6abfc4c3db68568c785e48eebf3d71", - "reference": "32cddf41cf6abfc4c3db68568c785e48eebf3d71", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/1eeb02bcad51cb99ab3b73bc83adf80f9b1a75cf", + "reference": "1eeb02bcad51cb99ab3b73bc83adf80f9b1a75cf", "shasum": "" }, "require": { @@ -7440,7 +7500,6 @@ "doctrine/dbal": "<2.13.1", "doctrine/lexer": "<1.1", "doctrine/orm": "<2.7.4", - "phpunit/phpunit": "<5.4.3", "symfony/cache": "<5.4", "symfony/dependency-injection": "<4.4", "symfony/form": "<5.4.21|>=6,<6.2.7", @@ -7511,7 +7570,7 @@ "description": "Provides integration for Doctrine with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/doctrine-bridge/tree/v5.4.23" + "source": "https://github.com/symfony/doctrine-bridge/tree/v5.4.24" }, "funding": [ { @@ -7527,7 +7586,7 @@ "type": "tidelift" } ], - "time": "2023-04-05T05:19:44+00:00" + "time": "2023-05-25T13:05:00+00:00" }, { "name": "symfony/dotenv", @@ -7602,16 +7661,16 @@ }, { "name": "symfony/error-handler", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "218206b4772d9f412d7d277980c020d06e9d8a4e" + "reference": "c1b9be3b8a6f60f720bec28c4ffb6fb5b00a8946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/218206b4772d9f412d7d277980c020d06e9d8a4e", - "reference": "218206b4772d9f412d7d277980c020d06e9d8a4e", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c1b9be3b8a6f60f720bec28c4ffb6fb5b00a8946", + "reference": "c1b9be3b8a6f60f720bec28c4ffb6fb5b00a8946", "shasum": "" }, "require": { @@ -7653,7 +7712,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.4.23" + "source": "https://github.com/symfony/error-handler/tree/v5.4.24" }, "funding": [ { @@ -7669,7 +7728,7 @@ "type": "tidelift" } ], - "time": "2023-04-17T10:03:27+00:00" + "time": "2023-05-02T16:13:31+00:00" }, { "name": "symfony/event-dispatcher", @@ -8194,16 +8253,16 @@ }, { "name": "symfony/framework-bundle", - "version": "v5.4.22", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "6cb4f6aed4bd7fbf7b2ee74c231184a07f3d00c1" + "reference": "c06a56a47817d29318aaace1c655cbde16c998e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/6cb4f6aed4bd7fbf7b2ee74c231184a07f3d00c1", - "reference": "6cb4f6aed4bd7fbf7b2ee74c231184a07f3d00c1", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/c06a56a47817d29318aaace1c655cbde16c998e8", + "reference": "c06a56a47817d29318aaace1c655cbde16c998e8", "shasum": "" }, "require": { @@ -8217,7 +8276,7 @@ "symfony/event-dispatcher": "^5.1|^6.0", "symfony/filesystem": "^4.4|^5.0|^6.0", "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^5.3|^6.0", + "symfony/http-foundation": "^5.4.24|^6.2.11", "symfony/http-kernel": "^5.4|^6.0", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php80": "^1.16", @@ -8230,7 +8289,6 @@ "doctrine/persistence": "<1.3", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "phpunit/phpunit": "<5.4.3", "symfony/asset": "<5.3", "symfony/console": "<5.2.5", "symfony/dom-crawler": "<4.4", @@ -8325,7 +8383,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.4.22" + "source": "https://github.com/symfony/framework-bundle/tree/v5.4.24" }, "funding": [ { @@ -8341,7 +8399,7 @@ "type": "tidelift" } ], - "time": "2023-03-31T08:25:44+00:00" + "time": "2023-05-25T13:05:00+00:00" }, { "name": "symfony/http-client", @@ -8514,16 +8572,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "af9fbb378f5f956c8f29d4886644c84c193780ac" + "reference": "3c59f97f6249ce552a44f01b93bfcbd786a954f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/af9fbb378f5f956c8f29d4886644c84c193780ac", - "reference": "af9fbb378f5f956c8f29d4886644c84c193780ac", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3c59f97f6249ce552a44f01b93bfcbd786a954f5", + "reference": "3c59f97f6249ce552a44f01b93bfcbd786a954f5", "shasum": "" }, "require": { @@ -8570,7 +8628,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.23" + "source": "https://github.com/symfony/http-foundation/tree/v5.4.24" }, "funding": [ { @@ -8586,20 +8644,20 @@ "type": "tidelift" } ], - "time": "2023-04-18T06:30:11+00:00" + "time": "2023-05-19T07:21:23+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "48ea17a7c65ef1ede0c3b2dbc35adace99071810" + "reference": "f38b722e1557eb3f487d351b48f5a1279b50e9d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/48ea17a7c65ef1ede0c3b2dbc35adace99071810", - "reference": "48ea17a7c65ef1ede0c3b2dbc35adace99071810", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f38b722e1557eb3f487d351b48f5a1279b50e9d1", + "reference": "f38b722e1557eb3f487d351b48f5a1279b50e9d1", "shasum": "" }, "require": { @@ -8682,7 +8740,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.23" + "source": "https://github.com/symfony/http-kernel/tree/v5.4.24" }, "funding": [ { @@ -8698,7 +8756,7 @@ "type": "tidelift" } ], - "time": "2023-04-28T13:29:52+00:00" + "time": "2023-05-27T08:06:30+00:00" }, { "name": "symfony/intl", @@ -10157,16 +10215,16 @@ }, { "name": "symfony/process", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "4b842fc4b61609e0a155a114082bd94e31e98287" + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/4b842fc4b61609e0a155a114082bd94e31e98287", - "reference": "4b842fc4b61609e0a155a114082bd94e31e98287", + "url": "https://api.github.com/repos/symfony/process/zipball/e3c46cc5689c8782944274bb30702106ecbe3b64", + "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64", "shasum": "" }, "require": { @@ -10199,7 +10257,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.23" + "source": "https://github.com/symfony/process/tree/v5.4.24" }, "funding": [ { @@ -10215,7 +10273,7 @@ "type": "tidelift" } ], - "time": "2023-04-18T13:50:24+00:00" + "time": "2023-05-17T11:26:05+00:00" }, { "name": "symfony/property-access", @@ -11389,6 +11447,74 @@ ], "time": "2022-05-30T19:17:29+00:00" }, + { + "name": "symfony/stimulus-bundle", + "version": "v2.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/stimulus-bundle.git", + "reference": "af27f718ceff2a6d5ac53187465ba21075895c53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stimulus-bundle/zipball/af27f718ceff2a6d5ac53187465ba21075895c53", + "reference": "af27f718ceff2a6d5ac53187465ba21075895c53", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "twig/twig": "^2.15.3|^3.4.3" + }, + "require-dev": { + "symfony/asset-mapper": "6.3.x-dev", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/phpunit-bridge": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", + "zenstruck/browser": "^1.4" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Symfony\\UX\\StimulusBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Integration with your Symfony app & Stimulus!", + "keywords": [ + "symfony-ux" + ], + "support": { + "source": "https://github.com/symfony/stimulus-bundle/tree/v2.9.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-26T15:00:40+00:00" + }, { "name": "symfony/stopwatch", "version": "v5.4.21", @@ -11539,16 +11665,16 @@ }, { "name": "symfony/translation", - "version": "v5.4.22", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "9a401392f01bc385aa42760eff481d213a0cc2ba" + "reference": "de237e59c5833422342be67402d487fbf50334ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/9a401392f01bc385aa42760eff481d213a0cc2ba", - "reference": "9a401392f01bc385aa42760eff481d213a0cc2ba", + "url": "https://api.github.com/repos/symfony/translation/zipball/de237e59c5833422342be67402d487fbf50334ff", + "reference": "de237e59c5833422342be67402d487fbf50334ff", "shasum": "" }, "require": { @@ -11616,7 +11742,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.22" + "source": "https://github.com/symfony/translation/tree/v5.4.24" }, "funding": [ { @@ -11632,7 +11758,7 @@ "type": "tidelift" } ], - "time": "2023-03-27T16:07:23+00:00" + "time": "2023-05-19T12:34:17+00:00" }, { "name": "symfony/translation-contracts", @@ -11924,43 +12050,44 @@ }, { "name": "symfony/ux-turbo", - "version": "v2.8.1", + "version": "v2.9.0", "source": { "type": "git", "url": "https://github.com/symfony/ux-turbo.git", - "reference": "3b2716284ba3153d911e53f87db03aef40ff0efd" + "reference": "fe9b0068db1cb97349e435695ed9bd671e72dd44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/ux-turbo/zipball/3b2716284ba3153d911e53f87db03aef40ff0efd", - "reference": "3b2716284ba3153d911e53f87db03aef40ff0efd", + "url": "https://api.github.com/repos/symfony/ux-turbo/zipball/fe9b0068db1cb97349e435695ed9bd671e72dd44", + "reference": "fe9b0068db1cb97349e435695ed9bd671e72dd44", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/webpack-encore-bundle": "^1.11" + "php": ">=8.1", + "symfony/stimulus-bundle": "^2.9" }, "conflict": { "symfony/flex": "<1.13" }, "require-dev": { "doctrine/annotations": "^1.12", - "doctrine/doctrine-bundle": "^2.2", + "doctrine/doctrine-bundle": "^2.4.3", "doctrine/orm": "^2.8 | 3.0", - "phpstan/phpstan": "^0.12", - "symfony/debug-bundle": "^5.2|^6.0", + "phpstan/phpstan": "^1.10", + "symfony/debug-bundle": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", - "symfony/form": "^5.2|^6.0", - "symfony/framework-bundle": "^5.2|^6.0", - "symfony/mercure-bundle": "^0.3", - "symfony/messenger": "^5.2|^6.0", + "symfony/form": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/mercure-bundle": "^0.3.4", + "symfony/messenger": "^5.4|^6.0", "symfony/panther": "^1.0|^2.0", - "symfony/phpunit-bridge": "^5.2.1|^6.0", - "symfony/property-access": "^5.2|^6.0", - "symfony/security-core": "^5.2|^6.0", - "symfony/stopwatch": "^5.2|^6.0", - "symfony/twig-bundle": "^5.2|^6.0", - "symfony/web-profiler-bundle": "^5.2|^6.0" + "symfony/phpunit-bridge": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/security-core": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", + "symfony/web-profiler-bundle": "^5.4|^6.0", + "symfony/webpack-encore-bundle": "^1.11" }, "type": "symfony-bundle", "extra": { @@ -11999,7 +12126,7 @@ "turbo-stream" ], "support": { - "source": "https://github.com/symfony/ux-turbo/tree/v2.8.1" + "source": "https://github.com/symfony/ux-turbo/tree/v2.9.0" }, "funding": [ { @@ -12015,20 +12142,20 @@ "type": "tidelift" } ], - "time": "2023-04-11T18:15:46+00:00" + "time": "2023-05-26T10:08:55+00:00" }, { "name": "symfony/validator", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "ca71f5562a3876a153250f638124b6b95452985f" + "reference": "47794a3cb530e01593ecad9856ba80f5c011e36b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/ca71f5562a3876a153250f638124b6b95452985f", - "reference": "ca71f5562a3876a153250f638124b6b95452985f", + "url": "https://api.github.com/repos/symfony/validator/zipball/47794a3cb530e01593ecad9856ba80f5c011e36b", + "reference": "47794a3cb530e01593ecad9856ba80f5c011e36b", "shasum": "" }, "require": { @@ -12045,7 +12172,6 @@ "doctrine/annotations": "<1.13", "doctrine/cache": "<1.11", "doctrine/lexer": "<1.1", - "phpunit/phpunit": "<5.4.3", "symfony/dependency-injection": "<4.4", "symfony/expression-language": "<5.1", "symfony/http-kernel": "<4.4", @@ -12112,7 +12238,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v5.4.23" + "source": "https://github.com/symfony/validator/tree/v5.4.24" }, "funding": [ { @@ -12128,20 +12254,20 @@ "type": "tidelift" } ], - "time": "2023-04-19T07:52:21+00:00" + "time": "2023-05-25T13:05:00+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "9a8a5b6d6508928174ded2109e29328a55342a42" + "reference": "8e12706bf9c68a2da633f23bfdc15b4dce5970b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/9a8a5b6d6508928174ded2109e29328a55342a42", - "reference": "9a8a5b6d6508928174ded2109e29328a55342a42", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/8e12706bf9c68a2da633f23bfdc15b4dce5970b3", + "reference": "8e12706bf9c68a2da633f23bfdc15b4dce5970b3", "shasum": "" }, "require": { @@ -12150,7 +12276,6 @@ "symfony/polyfill-php80": "^1.16" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<4.4" }, "require-dev": { @@ -12201,7 +12326,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.23" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.24" }, "funding": [ { @@ -12217,28 +12342,27 @@ "type": "tidelift" } ], - "time": "2023-04-18T09:26:27+00:00" + "time": "2023-05-25T13:05:00+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.4.21", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "be74908a6942fdd331554b3cec27ff41b45ccad4" + "reference": "9a07920c2058bafee921ce4d90aeef2193837d63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/be74908a6942fdd331554b3cec27ff41b45ccad4", - "reference": "be74908a6942fdd331554b3cec27ff41b45ccad4", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/9a07920c2058bafee921ce4d90aeef2193837d63", + "reference": "9a07920c2058bafee921ce4d90aeef2193837d63", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "require-dev": { - "symfony/var-dumper": "^4.4.9|^5.0.9|^6.0" + "symfony/var-dumper": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -12271,10 +12395,12 @@ "export", "hydrate", "instantiate", + "lazy-loading", + "proxy", "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.4.21" + "source": "https://github.com/symfony/var-exporter/tree/v6.2.10" }, "funding": [ { @@ -12290,7 +12416,7 @@ "type": "tidelift" } ], - "time": "2023-02-21T19:46:44+00:00" + "time": "2023-04-21T08:33:05+00:00" }, { "name": "symfony/web-link", @@ -15684,29 +15810,29 @@ }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^10.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -15738,7 +15864,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" }, "funding": [ { @@ -15746,30 +15873,29 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2023-05-01T07:48:21+00:00" }, { "name": "spatie/array-to-xml", - "version": "2.17.1", + "version": "3.1.6", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" + "reference": "e210b98957987c755372465be105d32113f339a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/e210b98957987c755372465be105d32113f339a4", + "reference": "e210b98957987c755372465be105d32113f339a4", "shasum": "" }, "require": { "ext-dom": "*", - "php": "^7.4|^8.0" + "php": "^8.0" }, "require-dev": { "mockery/mockery": "^1.2", "pestphp/pest": "^1.21", - "phpunit/phpunit": "^9.0", "spatie/pest-plugin-snapshots": "^1.1" }, "type": "library", @@ -15798,7 +15924,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" + "source": "https://github.com/spatie/array-to-xml/tree/3.1.6" }, "funding": [ { @@ -15810,7 +15936,7 @@ "type": "github" } ], - "time": "2022-12-26T08:22:07+00:00" + "time": "2023-05-11T14:04:07+00:00" }, { "name": "symfony/browser-kit", @@ -16040,22 +16166,22 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.43.0", + "version": "v1.48.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "e3f9a1d9e0f4968f68454403e820dffc7db38a59" + "reference": "2e428e8432e9879187672fe08f1cc335e2a31dd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/e3f9a1d9e0f4968f68454403e820dffc7db38a59", - "reference": "e3f9a1d9e0f4968f68454403e820dffc7db38a59", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/2e428e8432e9879187672fe08f1cc335e2a31dd6", + "reference": "2e428e8432e9879187672fe08f1cc335e2a31dd6", "shasum": "" }, "require": { "doctrine/inflector": "^2.0", "nikic/php-parser": "^4.11", - "php": ">=7.2.5", + "php": ">=8.0", "symfony/config": "^5.4.7|^6.0", "symfony/console": "^5.4.7|^6.0", "symfony/dependency-injection": "^5.4.7|^6.0", @@ -16066,7 +16192,9 @@ "symfony/http-kernel": "^5.4.7|^6.0" }, "conflict": { - "doctrine/orm": "<2.10" + "doctrine/doctrine-bundle": "<2.4", + "doctrine/orm": "<2.10", + "symfony/doctrine-bridge": "<5.4" }, "require-dev": { "composer/semver": "^3.0", @@ -16111,7 +16239,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.43.0" + "source": "https://github.com/symfony/maker-bundle/tree/v1.48.0" }, "funding": [ { @@ -16127,7 +16255,7 @@ "type": "tidelift" } ], - "time": "2022-05-17T15:46:50+00:00" + "time": "2022-11-14T10:48:46+00:00" }, { "name": "symfony/phpunit-bridge", @@ -16214,16 +16342,16 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v5.4.21", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "a83337a813d1398789bf4190a56dc3c4d8cc4d93" + "reference": "42dbb751c0363d75a3697775e662d6f21f3d8b83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/a83337a813d1398789bf4190a56dc3c4d8cc4d93", - "reference": "a83337a813d1398789bf4190a56dc3c4d8cc4d93", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/42dbb751c0363d75a3697775e662d6f21f3d8b83", + "reference": "42dbb751c0363d75a3697775e662d6f21f3d8b83", "shasum": "" }, "require": { @@ -16274,7 +16402,7 @@ "description": "Provides a development tool that gives detailed information about the execution of any request", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.4.21" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.4.24" }, "funding": [ { @@ -16290,7 +16418,7 @@ "type": "tidelift" } ], - "time": "2023-02-17T16:59:45+00:00" + "time": "2023-05-02T16:38:36+00:00" }, { "name": "symplify/easy-coding-standard", @@ -16477,7 +16605,7 @@ }, "platform-dev": [], "platform-overrides": { - "php": "7.4.0" + "php": "8.1.0" }, "plugin-api-version": "2.3.0" } From b8a7f81f55ada4a6b5d246487a79cb922792782f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:25:51 +0200 Subject: [PATCH 04/91] Bumped dependencies (dont work yet) --- composer.json | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index ccb53e85..36e6aab8 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "ext-json": "*", "ext-mbstring": "*", "beberlei/doctrineextensions": "^1.2", - "brick/math": "^0.8.15", + "brick/math": "^0.11.0", "composer/package-versions-deprecated": "1.11.99.4", "doctrine/annotations": "^1.6", "doctrine/data-fixtures": "^1.6.6", @@ -25,7 +25,7 @@ "florianv/swap-bundle": "dev-master", "gregwar/captcha-bundle": "^2.1.0", "hslavich/oneloginsaml-bundle": "^2.10", - "jbtronics/2fa-webauthn": "^1.0.0", + "jbtronics/2fa-webauthn": "dev-master", "jfcherng/php-diff": "^6.14", "league/csv": "^9.8.0", "league/html-to-markdown": "^5.0.1", @@ -34,7 +34,7 @@ "nelmio/security-bundle": "^3.0", "nyholm/psr7": "^1.1", "ocramius/proxy-manager": "2.2.*", - "omines/datatables-bundle": "^0.5.0", + "omines/datatables-bundle": "^0.7.2", "php-translation/symfony-bundle": "^0.13.0", "phpdocumentor/reflection-docblock": "^5.2", "s9e/text-formatter": "^2.1", @@ -44,7 +44,7 @@ "scheb/2fa-trusted-device": "^5.13", "sensio/framework-extra-bundle": "^6.1.1", "shivas/versioning-bundle": "^4.0", - "spatie/db-dumper": "^2.21", + "spatie/db-dumper": "^3.3.1", "symfony/apache-pack": "^1.0", "symfony/asset": "5.4.*", "symfony/console": "5.4.*", @@ -79,7 +79,7 @@ "twig/inky-extra": "^3.0", "twig/intl-extra": "^3.0", "twig/markdown-extra": "^3.0", - "web-auth/webauthn-symfony-bundle": "^3.3", + "web-auth/webauthn-symfony-bundle": "^4.0.0", "webmozart/assert": "^1.4" }, "require-dev": { @@ -155,5 +155,9 @@ } }, "repositories": [ + { + "type": "git", + "url": "https://github.com/jbtronics/2fa-webauthn.git" + } ] } From edce70bc12b126a511a77163462a8725ccdd06fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:35:36 +0200 Subject: [PATCH 05/91] Updated symfony to 6.2, updated scheb/2fa bundle and removed obsolete hslavich/oneloginsaml-bundle --- composer.json | 57 +- composer.lock | 3677 +++++++++++++++---------------------- config/bundles.php | 1 - config/packages/lock.yaml | 2 - config/packages/uid.yaml | 4 + symfony.lock | 36 +- 6 files changed, 1484 insertions(+), 2293 deletions(-) delete mode 100644 config/packages/lock.yaml create mode 100644 config/packages/uid.yaml diff --git a/composer.json b/composer.json index 36e6aab8..8aa27bc9 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,6 @@ "florianv/swap": "^4.0", "florianv/swap-bundle": "dev-master", "gregwar/captcha-bundle": "^2.1.0", - "hslavich/oneloginsaml-bundle": "^2.10", "jbtronics/2fa-webauthn": "dev-master", "jfcherng/php-diff": "^6.14", "league/csv": "^9.8.0", @@ -38,40 +37,40 @@ "php-translation/symfony-bundle": "^0.13.0", "phpdocumentor/reflection-docblock": "^5.2", "s9e/text-formatter": "^2.1", - "scheb/2fa-backup-code": "^5.13", - "scheb/2fa-bundle": "^5.13", - "scheb/2fa-google-authenticator": "^5.13", - "scheb/2fa-trusted-device": "^5.13", + "scheb/2fa-backup-code": "^6.8.0", + "scheb/2fa-bundle": "^6.8.0", + "scheb/2fa-google-authenticator": "^6.8.0", + "scheb/2fa-trusted-device": "^6.8.0", "sensio/framework-extra-bundle": "^6.1.1", "shivas/versioning-bundle": "^4.0", "spatie/db-dumper": "^3.3.1", "symfony/apache-pack": "^1.0", - "symfony/asset": "5.4.*", - "symfony/console": "5.4.*", - "symfony/dotenv": "5.4.*", - "symfony/expression-language": "5.4.*", + "symfony/asset": "6.2.*", + "symfony/console": "6.2.*", + "symfony/dotenv": "6.2.*", + "symfony/expression-language": "6.2.*", "symfony/flex": "^1.1", - "symfony/form": "5.4.*", - "symfony/framework-bundle": "5.4.*", - "symfony/http-client": "5.4.*", - "symfony/http-kernel": "5.4.*", - "symfony/mailer": "5.4.*", + "symfony/form": "6.2.*", + "symfony/framework-bundle": "6.2.*", + "symfony/http-client": "6.2.*", + "symfony/http-kernel": "6.2.*", + "symfony/mailer": "6.2.*", "symfony/monolog-bundle": "^3.1", - "symfony/process": "5.4.*", - "symfony/property-access": "5.4.*", - "symfony/property-info": "5.4.*", - "symfony/proxy-manager-bridge": "5.4.*", - "symfony/rate-limiter": "5.4.*", - "symfony/runtime": "5.4.*", - "symfony/security-bundle": "5.4.*", - "symfony/serializer": "5.4.*", - "symfony/translation": "5.4.*", - "symfony/twig-bundle": "5.4.*", + "symfony/process": "6.2.*", + "symfony/property-access": "6.2.*", + "symfony/property-info": "6.2.*", + "symfony/proxy-manager-bridge": "6.2.*", + "symfony/rate-limiter": "6.2.*", + "symfony/runtime": "6.2.*", + "symfony/security-bundle": "6.2.*", + "symfony/serializer": "6.2.*", + "symfony/translation": "6.2.*", + "symfony/twig-bundle": "6.2.*", "symfony/ux-turbo": "^2.0", - "symfony/validator": "5.4.*", - "symfony/web-link": "5.4.*", + "symfony/validator": "6.2.*", + "symfony/web-link": "6.2.*", "symfony/webpack-encore-bundle": "^1.1", - "symfony/yaml": "5.4.*", + "symfony/yaml": "6.2.*", "tecnickcom/tc-lib-barcode": "^1.15", "twig/cssinliner-extra": "^3.0", "twig/extra-bundle": "^3.0", @@ -95,7 +94,7 @@ "symfony/css-selector": "^5.2", "symfony/debug-bundle": "^5.2", "symfony/maker-bundle": "^1.13", - "symfony/phpunit-bridge": "5.4.*", + "symfony/phpunit-bridge": "6.2.*", "symfony/stopwatch": "^5.2", "symfony/web-profiler-bundle": "^5.2", "symplify/easy-coding-standard": "^11.0", @@ -151,7 +150,7 @@ "extra": { "symfony": { "allow-contrib": false, - "require": "5.4.*" + "require": "6.2.*" } }, "repositories": [ diff --git a/composer.lock b/composer.lock index 6d63eb9a..687fcbf6 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": "c64a13c94017e1a9e155b92400d8389d", + "content-hash": "ef71583adf031fff76718bf97c9ca69c", "packages": [ { "name": "beberlei/assert", @@ -132,26 +132,25 @@ }, { "name": "brick/math", - "version": "0.8.17", + "version": "0.11.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "e6f8e7d04346a95be89580f8c2c22d6c3fa65556" + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/e6f8e7d04346a95be89580f8c2c22d6c3fa65556", - "reference": "e6f8e7d04346a95be89580f8c2c22d6c3fa65556", + "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478", + "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478", "shasum": "" }, "require": { - "ext-json": "*", - "php": "^7.1|^8.0" + "php": "^8.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^7.5.15|^8.5", - "vimeo/psalm": "^3.5" + "phpunit/phpunit": "^9.0", + "vimeo/psalm": "5.0.0" }, "type": "library", "autoload": { @@ -176,15 +175,15 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/v0.8" + "source": "https://github.com/brick/math/tree/0.11.0" }, "funding": [ { - "url": "https://tidelift.com/funding/github/packagist/brick/math", - "type": "tidelift" + "url": "https://github.com/BenMorel", + "type": "github" } ], - "time": "2020-08-18T23:41:20+00:00" + "time": "2023-01-15T23:15:59+00:00" }, { "name": "composer/ca-bundle", @@ -1121,30 +1120,29 @@ }, { "name": "doctrine/event-manager", - "version": "1.2.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520" + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/95aa4cb529f1e96576f3fda9f5705ada4056a520", - "reference": "95aa4cb529f1e96576f3fda9f5705ada4056a520", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/750671534e0241a7c50ea5b43f67e23eb5c96f32", + "reference": "750671534e0241a7c50ea5b43f67e23eb5c96f32", "shasum": "" }, "require": { - "doctrine/deprecations": "^0.5.3 || ^1", - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "conflict": { "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^10", - "phpstan/phpstan": "~1.4.10 || ^1.8.8", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.24" + "doctrine/coding-standard": "^10", + "phpstan/phpstan": "^1.8.8", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.28" }, "type": "library", "autoload": { @@ -1193,7 +1191,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.2.0" + "source": "https://github.com/doctrine/event-manager/tree/2.0.0" }, "funding": [ { @@ -1209,7 +1207,7 @@ "type": "tidelift" } ], - "time": "2022-10-12T20:51:15+00:00" + "time": "2022-10-12T20:59:15+00:00" }, { "name": "doctrine/inflector", @@ -1982,82 +1980,6 @@ }, "time": "2019-12-30T22:54:17+00:00" }, - { - "name": "fgrosse/phpasn1", - "version": "v2.5.0", - "source": { - "type": "git", - "url": "https://github.com/fgrosse/PHPASN1.git", - "reference": "42060ed45344789fb9f21f9f1864fc47b9e3507b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fgrosse/PHPASN1/zipball/42060ed45344789fb9f21f9f1864fc47b9e3507b", - "reference": "42060ed45344789fb9f21f9f1864fc47b9e3507b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "php-coveralls/php-coveralls": "~2.0", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "suggest": { - "ext-bcmath": "BCmath is the fallback extension for big integer calculations", - "ext-curl": "For loading OID information from the web if they have not bee defined statically", - "ext-gmp": "GMP is the preferred extension for big integer calculations", - "phpseclib/bcmath_compat": "BCmath polyfill for servers where neither GMP nor BCmath is available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "FG\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Friedrich Große", - "email": "friedrich.grosse@gmail.com", - "homepage": "https://github.com/FGrosse", - "role": "Author" - }, - { - "name": "All contributors", - "homepage": "https://github.com/FGrosse/PHPASN1/contributors" - } - ], - "description": "A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.", - "homepage": "https://github.com/FGrosse/PHPASN1", - "keywords": [ - "DER", - "asn.1", - "asn1", - "ber", - "binary", - "decoding", - "encoding", - "x.509", - "x.690", - "x509", - "x690" - ], - "support": { - "issues": "https://github.com/fgrosse/PHPASN1/issues", - "source": "https://github.com/fgrosse/PHPASN1/tree/v2.5.0" - }, - "abandoned": true, - "time": "2022-12-19T11:08:26+00:00" - }, { "name": "florianv/exchanger", "version": "2.8.0", @@ -2464,67 +2386,6 @@ }, "time": "2022-01-11T08:28:06+00:00" }, - { - "name": "hslavich/oneloginsaml-bundle", - "version": "v2.10.0", - "source": { - "type": "git", - "url": "https://github.com/hslavich/OneloginSamlBundle.git", - "reference": "aee3450bd36b750a2e61b4a0ca19a09ecab7a086" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hslavich/OneloginSamlBundle/zipball/aee3450bd36b750a2e61b4a0ca19a09ecab7a086", - "reference": "aee3450bd36b750a2e61b4a0ca19a09ecab7a086", - "shasum": "" - }, - "require": { - "onelogin/php-saml": "^3.0", - "symfony/dependency-injection": "^5.4", - "symfony/deprecation-contracts": "^2.1 | ^3", - "symfony/event-dispatcher-contracts": "^2.4", - "symfony/framework-bundle": "^5.4", - "symfony/security-bundle": "^5.4" - }, - "require-dev": { - "dms/phpunit-arraysubset-asserts": "^0.2.0", - "doctrine/orm": "~2.3", - "php-coveralls/php-coveralls": "^2.2", - "phpunit/phpunit": "^9.0", - "symfony/event-dispatcher": "^5.4", - "symfony/phpunit-bridge": "^5.4" - }, - "type": "symfony-bundle", - "autoload": { - "psr-4": { - "Hslavich\\OneloginSamlBundle\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "hslavich", - "email": "hernan.slavich@gmail.com" - } - ], - "description": "OneLogin SAML Bundle for Symfony", - "keywords": [ - "SSO", - "onelogin", - "saml" - ], - "support": { - "issues": "https://github.com/hslavich/OneloginSamlBundle/issues", - "source": "https://github.com/hslavich/OneloginSamlBundle/tree/v2.10.0" - }, - "time": "2022-11-23T17:12:47+00:00" - }, { "name": "imagine/imagine", "version": "1.3.4", @@ -2589,17 +2450,11 @@ }, { "name": "jbtronics/2fa-webauthn", - "version": "v1.0.0", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/jbtronics/2fa-webauthn.git", - "reference": "c4108d16ba7a3061d977fc92f577c69067e1d003" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jbtronics/2fa-webauthn/zipball/c4108d16ba7a3061d977fc92f577c69067e1d003", - "reference": "c4108d16ba7a3061d977fc92f577c69067e1d003", - "shasum": "" + "reference": "ef886b0654766a6adb1e027ed1b3b57a3cbb9c5a" }, "require": { "ext-json": "*", @@ -2608,18 +2463,18 @@ "scheb/2fa-bundle": "^5.0.0|^6.0.0", "symfony/framework-bundle": "^5.0|^6.0", "symfony/psr-http-message-bridge": "^2.1", - "web-auth/webauthn-lib": "^3.3" + "web-auth/webauthn-lib": "^3.3|^4.0" }, "require-dev": { "phpunit/phpunit": "^9.5" }, + "default-branch": true, "type": "symfony-bundle", "autoload": { "psr-4": { "Jbtronics\\TFAWebauthn\\": "src/" } }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2638,11 +2493,7 @@ "two-factor-authentication", "webauthn" ], - "support": { - "issues": "https://github.com/jbtronics/2fa-webauthn/issues", - "source": "https://github.com/jbtronics/2fa-webauthn/tree/v1.0.0" - }, - "time": "2022-10-03T22:29:32+00:00" + "time": "2023-05-27T18:21:46+00:00" }, { "name": "jfcherng/php-color-output", @@ -3010,39 +2861,40 @@ }, { "name": "lcobucci/jwt", - "version": "4.3.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4" + "reference": "47bdb0e0b5d00c2f89ebe33e7e384c77e84e7c34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/4d7de2fe0d51a96418c0d04004986e410e87f6b4", - "reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/47bdb0e0b5d00c2f89ebe33e7e384c77e84e7c34", + "reference": "47bdb0e0b5d00c2f89ebe33e7e384c77e84e7c34", "shasum": "" }, "require": { "ext-hash": "*", "ext-json": "*", - "ext-mbstring": "*", "ext-openssl": "*", "ext-sodium": "*", - "lcobucci/clock": "^2.0 || ^3.0", - "php": "^7.4 || ^8.0" + "php": "~8.1.0 || ~8.2.0", + "psr/clock": "^1.0" }, "require-dev": { - "infection/infection": "^0.21", - "lcobucci/coding-standard": "^6.0", - "mikey179/vfsstream": "^1.6.7", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/php-invoker": "^3.1", - "phpunit/phpunit": "^9.5" + "infection/infection": "^0.26.19", + "lcobucci/clock": "^3.0", + "lcobucci/coding-standard": "^9.0", + "phpbench/phpbench": "^1.2.8", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.10.3", + "phpstan/phpstan-deprecation-rules": "^1.1.2", + "phpstan/phpstan-phpunit": "^1.3.8", + "phpstan/phpstan-strict-rules": "^1.5.0", + "phpunit/phpunit": "^10.0.12" + }, + "suggest": { + "lcobucci/clock": ">= 3.0" }, "type": "library", "autoload": { @@ -3068,7 +2920,7 @@ ], "support": { "issues": "https://github.com/lcobucci/jwt/issues", - "source": "https://github.com/lcobucci/jwt/tree/4.3.0" + "source": "https://github.com/lcobucci/jwt/tree/5.0.0" }, "funding": [ { @@ -3080,7 +2932,7 @@ "type": "patreon" } ], - "time": "2023-01-02T13:28:00+00:00" + "time": "2023-02-25T21:35:16+00:00" }, { "name": "league/csv", @@ -3255,177 +3107,6 @@ ], "time": "2022-03-02T17:24:08+00:00" }, - { - "name": "league/uri", - "version": "6.8.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/uri.git", - "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/a700b4656e4c54371b799ac61e300ab25a2d1d39", - "reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39", - "shasum": "" - }, - "require": { - "ext-json": "*", - "league/uri-interfaces": "^2.3", - "php": "^8.1", - "psr/http-message": "^1.0.1" - }, - "conflict": { - "league/uri-schemes": "^1.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.9.5", - "nyholm/psr7": "^1.5.1", - "php-http/psr7-integration-tests": "^1.1.1", - "phpbench/phpbench": "^1.2.6", - "phpstan/phpstan": "^1.8.5", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.1.1", - "phpstan/phpstan-strict-rules": "^1.4.3", - "phpunit/phpunit": "^9.5.24", - "psr/http-factory": "^1.0.1" - }, - "suggest": { - "ext-fileinfo": "Needed to create Data URI from a filepath", - "ext-intl": "Needed to improve host validation", - "league/uri-components": "Needed to easily manipulate URI objects", - "psr/http-factory": "Needed to use the URI factory" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.x-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Uri\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ignace Nyamagana Butera", - "email": "nyamsprod@gmail.com", - "homepage": "https://nyamsprod.com" - } - ], - "description": "URI manipulation library", - "homepage": "https://uri.thephpleague.com", - "keywords": [ - "data-uri", - "file-uri", - "ftp", - "hostname", - "http", - "https", - "middleware", - "parse_str", - "parse_url", - "psr-7", - "query-string", - "querystring", - "rfc3986", - "rfc3987", - "rfc6570", - "uri", - "uri-template", - "url", - "ws" - ], - "support": { - "docs": "https://uri.thephpleague.com", - "forum": "https://thephpleague.slack.com", - "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.8.0" - }, - "funding": [ - { - "url": "https://github.com/sponsors/nyamsprod", - "type": "github" - } - ], - "time": "2022-09-13T19:58:47+00:00" - }, - { - "name": "league/uri-interfaces", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "shasum": "" - }, - "require": { - "ext-json": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phpstan/phpstan": "^0.12.90", - "phpstan/phpstan-phpunit": "^0.12.19", - "phpstan/phpstan-strict-rules": "^0.12.9", - "phpunit/phpunit": "^8.5.15 || ^9.5" - }, - "suggest": { - "ext-intl": "to use the IDNA feature", - "symfony/intl": "to use the IDNA feature via Symfony Polyfill" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Uri\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ignace Nyamagana Butera", - "email": "nyamsprod@gmail.com", - "homepage": "https://nyamsprod.com" - } - ], - "description": "Common interface for URI representation", - "homepage": "http://github.com/thephpleague/uri-interfaces", - "keywords": [ - "rfc3986", - "rfc3987", - "uri", - "url" - ], - "support": { - "issues": "https://github.com/thephpleague/uri-interfaces/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" - }, - "funding": [ - { - "url": "https://github.com/sponsors/nyamsprod", - "type": "github" - } - ], - "time": "2021-06-28T04:27:21+00:00" - }, { "name": "liip/imagine-bundle", "version": "2.11.0", @@ -3651,42 +3332,41 @@ }, { "name": "monolog/monolog", - "version": "2.9.1", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1" + "reference": "9b5daeaffce5b926cac47923798bba91059e60e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f259e2b15fb95494c83f52d3caad003bbf5ffaa1", - "reference": "f259e2b15fb95494c83f52d3caad003bbf5ffaa1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/9b5daeaffce5b926cac47923798bba91059e60e2", + "reference": "9b5daeaffce5b926cac47923798bba91059e60e2", "shasum": "" }, "require": { - "php": ">=7.2", - "psr/log": "^1.0.1 || ^2.0 || ^3.0" + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" + "psr/log-implementation": "3.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "aws/aws-sdk-php": "^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", "ext-json": "*", "graylog2/gelf-php": "^1.4.2 || ^2@dev", - "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpspec/prophecy": "^1.15", - "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5.14", - "predis/predis": "^1.1 || ^2.0", - "rollbar/rollbar": "^1.3 || ^2 || ^3", + "phpstan/phpstan": "^1.9", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-strict-rules": "^1.4", + "phpunit/phpunit": "^9.5.26", + "predis/predis": "^1.1 || ^2", "ruflin/elastica": "^7", - "swiftmailer/swiftmailer": "^5.3|^6.0", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -3709,7 +3389,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -3737,7 +3417,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.9.1" + "source": "https://github.com/Seldaek/monolog/tree/3.3.1" }, "funding": [ { @@ -3749,7 +3429,7 @@ "type": "tidelift" } ], - "time": "2023-02-06T13:44:46+00:00" + "time": "2023-02-06T13:46:10+00:00" }, { "name": "nelexa/zip", @@ -4151,49 +3831,54 @@ }, { "name": "omines/datatables-bundle", - "version": "0.5.5", + "version": "0.7.2", "source": { "type": "git", "url": "https://github.com/omines/datatables-bundle.git", - "reference": "b8a16c365f9d8e97d1e890e8783249f979f0d7ca" + "reference": "8e0dce49a271e0cfdf128d42bf81a336f8f02232" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/omines/datatables-bundle/zipball/b8a16c365f9d8e97d1e890e8783249f979f0d7ca", - "reference": "b8a16c365f9d8e97d1e890e8783249f979f0d7ca", + "url": "https://api.github.com/repos/omines/datatables-bundle/zipball/8e0dce49a271e0cfdf128d42bf81a336f8f02232", + "reference": "8e0dce49a271e0cfdf128d42bf81a336f8f02232", "shasum": "" }, "require": { - "php": ">=7.2", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/options-resolver": "^4.4|^5.0", - "symfony/property-access": "^4.4|^5.0", - "symfony/translation": "^4.4|^5.0" + "php": ">=8.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/options-resolver": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0" }, "require-dev": { - "doctrine/common": "^2.6|^3.0", - "doctrine/doctrine-bundle": "^2.3|^3.0", - "doctrine/orm": "^2.6.3", - "doctrine/persistence": "^1.3.4|^2.0", + "doctrine/common": "^2.6|^3.3", + "doctrine/doctrine-bundle": "^2.7|^3.0", + "doctrine/orm": "^2.13.1", + "doctrine/persistence": "^2.0|^3.0.3", "ext-curl": "*", "ext-json": "*", "ext-pdo_sqlite": "*", "ext-zip": "*", - "friendsofphp/php-cs-fixer": "^2.7", - "mongodb/mongodb": "^1.2", - "ocramius/package-versions": "^1.4", - "phpoffice/phpspreadsheet": "^1.6", - "ruflin/elastica": "^6.0", - "symfony/browser-kit": "^4.4|^5.0", - "symfony/css-selector": "^4.4|^5.0", - "symfony/dom-crawler": "^4.4|^5.0", - "symfony/intl": "^4.4|^5.0", - "symfony/mime": "^4.4|^5.0", - "symfony/phpunit-bridge": "^4.4|^5.0", - "symfony/twig-bundle": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0", - "symfony/yaml": "^4.4|^5.0" + "friendsofphp/php-cs-fixer": "^3.9.5", + "mongodb/mongodb": "^1.12", + "ocramius/package-versions": "^2.5", + "phpoffice/phpspreadsheet": "^1.24.1", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8.2", + "phpstan/phpstan-doctrine": "^1.3.12", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-symfony": "^1.2.9", + "ruflin/elastica": "^6.0|^7.2", + "symfony/browser-kit": "^5.4|^6.1.3", + "symfony/css-selector": "^5.4|^6.1.3", + "symfony/dom-crawler": "^5.4|^6.1.3", + "symfony/intl": "^5.4|^6.1", + "symfony/mime": "^5.4|^6.1.3", + "symfony/phpunit-bridge": "^5.4|^6.1.3", + "symfony/twig-bundle": "^5.4|^6.1.1", + "symfony/var-dumper": "^5.4|^6.1.3", + "symfony/yaml": "^5.4|^6.1.3" }, "suggest": { "doctrine/doctrine-bundle": "For integrated access to Doctrine object managers", @@ -4206,7 +3891,7 @@ "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "0.5-dev" + "dev-master": "0.7-dev" } }, "autoload": { @@ -4244,64 +3929,9 @@ ], "support": { "issues": "https://github.com/omines/datatables-bundle/issues", - "source": "https://github.com/omines/datatables-bundle/tree/0.5.5" + "source": "https://github.com/omines/datatables-bundle/tree/0.7.2" }, - "time": "2021-06-29T08:12:37+00:00" - }, - { - "name": "onelogin/php-saml", - "version": "3.6.1", - "source": { - "type": "git", - "url": "https://github.com/onelogin/php-saml.git", - "reference": "a7328b11887660ad248ea10952dd67a5aa73ba3b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/onelogin/php-saml/zipball/a7328b11887660ad248ea10952dd67a5aa73ba3b", - "reference": "a7328b11887660ad248ea10952dd67a5aa73ba3b", - "shasum": "" - }, - "require": { - "php": ">=5.4", - "robrichards/xmlseclibs": ">=3.1.1" - }, - "require-dev": { - "pdepend/pdepend": "^2.5.0", - "php-coveralls/php-coveralls": "^1.0.2 || ^2.0", - "phploc/phploc": "^2.1 || ^3.0 || ^4.0", - "phpunit/phpunit": "<7.5.18", - "sebastian/phpcpd": "^2.0 || ^3.0 || ^4.0", - "squizlabs/php_codesniffer": "^3.1.1" - }, - "suggest": { - "ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs", - "ext-gettext": "Install gettext and php5-gettext libs to handle translations", - "ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)" - }, - "type": "library", - "autoload": { - "psr-4": { - "OneLogin\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "OneLogin PHP SAML Toolkit", - "homepage": "https://developers.onelogin.com/saml/php", - "keywords": [ - "SAML2", - "onelogin", - "saml" - ], - "support": { - "email": "sixto.garcia@onelogin.com", - "issues": "https://github.com/onelogin/php-saml/issues", - "source": "https://github.com/onelogin/php-saml/" - }, - "time": "2021-03-02T10:13:07+00:00" + "time": "2023-04-24T09:09:02+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -5152,16 +4782,16 @@ }, { "name": "psr/cache", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", - "reference": "213f9dbc5b9bfbc4f8db86d2838dc968752ce13b", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { @@ -5195,9 +4825,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/2.0.0" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2021-02-03T23:23:37+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/clock", @@ -5249,22 +4879,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -5291,9 +4926,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/event-dispatcher", @@ -5454,16 +5089,16 @@ }, { "name": "psr/http-message", - "version": "1.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { @@ -5472,7 +5107,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -5487,7 +5122,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -5501,31 +5136,34 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "psr/link", - "version": "1.1.1", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/link.git", - "reference": "846c25f58a1f02b93a00f2404e3626b6bf9b7807" + "reference": "84b159194ecfd7eaa472280213976e96415433f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/link/zipball/846c25f58a1f02b93a00f2404e3626b6bf9b7807", - "reference": "846c25f58a1f02b93a00f2404e3626b6bf9b7807", + "url": "https://api.github.com/repos/php-fig/link/zipball/84b159194ecfd7eaa472280213976e96415433f7", + "reference": "84b159194ecfd7eaa472280213976e96415433f7", "shasum": "" }, "require": { "php": ">=8.0.0" }, + "suggest": { + "fig/link-util": "Provides some useful PSR-13 utilities" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -5554,36 +5192,36 @@ "rest" ], "support": { - "source": "https://github.com/php-fig/link/tree/1.1.1" + "source": "https://github.com/php-fig/link/tree/2.0.1" }, - "time": "2021-03-11T22:59:13+00:00" + "time": "2021-03-11T23:00:27+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -5604,9 +5242,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "psr/simple-cache", @@ -5659,229 +5297,6 @@ }, "time": "2021-10-29T13:26:27+00:00" }, - { - "name": "ramsey/collection", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/ramsey/collection.git", - "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", - "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", - "shasum": "" - }, - "require": { - "php": "^8.1" - }, - "require-dev": { - "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.28.3", - "fakerphp/faker": "^1.21", - "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^1.0", - "mockery/mockery": "^1.5", - "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcsstandards/phpcsutils": "^1.0.0-rc1", - "phpspec/prophecy-phpunit": "^2.0", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18.4", - "ramsey/coding-standard": "^2.0.3", - "ramsey/conventional-commits": "^1.3", - "vimeo/psalm": "^5.4" - }, - "type": "library", - "extra": { - "captainhook": { - "force-install": true - }, - "ramsey/conventional-commits": { - "configFile": "conventional-commits.json" - } - }, - "autoload": { - "psr-4": { - "Ramsey\\Collection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ben Ramsey", - "email": "ben@benramsey.com", - "homepage": "https://benramsey.com" - } - ], - "description": "A PHP library for representing and manipulating collections.", - "keywords": [ - "array", - "collection", - "hash", - "map", - "queue", - "set" - ], - "support": { - "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.0.0" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", - "type": "tidelift" - } - ], - "time": "2022-12-31T21:50:55+00:00" - }, - { - "name": "ramsey/uuid", - "version": "4.7.4", - "source": { - "type": "git", - "url": "https://github.com/ramsey/uuid.git", - "reference": "60a4c63ab724854332900504274f6150ff26d286" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", - "reference": "60a4c63ab724854332900504274f6150ff26d286", - "shasum": "" - }, - "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11", - "ext-json": "*", - "php": "^8.0", - "ramsey/collection": "^1.2 || ^2.0" - }, - "replace": { - "rhumsaa/uuid": "self.version" - }, - "require-dev": { - "captainhook/captainhook": "^5.10", - "captainhook/plugin-composer": "^5.3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.8", - "ergebnis/composer-normalize": "^2.15", - "mockery/mockery": "^1.3", - "paragonie/random-lib": "^2", - "php-mock/php-mock": "^2.2", - "php-mock/php-mock-mockery": "^1.3", - "php-parallel-lint/php-parallel-lint": "^1.1", - "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.1", - "phpunit/phpunit": "^8.5 || ^9", - "ramsey/composer-repl": "^1.4", - "slevomat/coding-standard": "^8.4", - "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "^4.9" - }, - "suggest": { - "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", - "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", - "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." - }, - "type": "library", - "extra": { - "captainhook": { - "force-install": true - } - }, - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Ramsey\\Uuid\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", - "keywords": [ - "guid", - "identifier", - "uuid" - ], - "support": { - "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.7.4" - }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/uuid", - "type": "tidelift" - } - ], - "time": "2023-04-15T23:01:58+00:00" - }, - { - "name": "robrichards/xmlseclibs", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/robrichards/xmlseclibs.git", - "reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/f8f19e58f26cdb42c54b214ff8a820760292f8df", - "reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df", - "shasum": "" - }, - "require": { - "ext-openssl": "*", - "php": ">= 5.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "RobRichards\\XMLSecLibs\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "A PHP library for XML Security", - "homepage": "https://github.com/robrichards/xmlseclibs", - "keywords": [ - "security", - "signature", - "xml", - "xmldsig" - ], - "support": { - "issues": "https://github.com/robrichards/xmlseclibs/issues", - "source": "https://github.com/robrichards/xmlseclibs/tree/3.1.1" - }, - "time": "2020-09-05T13:00:25+00:00" - }, { "name": "s9e/regexp-builder", "version": "1.4.6", @@ -6097,19 +5512,20 @@ }, { "name": "scheb/2fa-backup-code", - "version": "v5.13.2", + "version": "v6.8.0", "source": { "type": "git", "url": "https://github.com/scheb/2fa-backup-code.git", - "reference": "5584eb7a2c3deb80635c7173ad77858e51129c35" + "reference": "b01965cd221cda280526e48e7f56966154b9ba2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scheb/2fa-backup-code/zipball/5584eb7a2c3deb80635c7173ad77858e51129c35", - "reference": "5584eb7a2c3deb80635c7173ad77858e51129c35", + "url": "https://api.github.com/repos/scheb/2fa-backup-code/zipball/b01965cd221cda280526e48e7f56966154b9ba2f", + "reference": "b01965cd221cda280526e48e7f56966154b9ba2f", "shasum": "" }, "require": { + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "scheb/2fa-bundle": "self.version" }, "type": "library", @@ -6139,36 +5555,36 @@ "two-step" ], "support": { - "source": "https://github.com/scheb/2fa-backup-code/tree/v5.13.2" + "source": "https://github.com/scheb/2fa-backup-code/tree/v6.8.0" }, - "time": "2022-01-03T10:21:24+00:00" + "time": "2022-12-10T15:20:09+00:00" }, { "name": "scheb/2fa-bundle", - "version": "v5.13.2", + "version": "v6.8.0", "source": { "type": "git", "url": "https://github.com/scheb/2fa-bundle.git", - "reference": "dc575cc7bc94fa3a52b547698086f2ef015d2e81" + "reference": "4f8e9e87f90cf50c72b0857ea2b88453cf1d2446" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scheb/2fa-bundle/zipball/dc575cc7bc94fa3a52b547698086f2ef015d2e81", - "reference": "dc575cc7bc94fa3a52b547698086f2ef015d2e81", + "url": "https://api.github.com/repos/scheb/2fa-bundle/zipball/4f8e9e87f90cf50c72b0857ea2b88453cf1d2446", + "reference": "4f8e9e87f90cf50c72b0857ea2b88453cf1d2446", "shasum": "" }, "require": { "ext-json": "*", - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/http-foundation": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0", - "symfony/property-access": "^4.4|^5.0", - "symfony/security-bundle": "^4.4.1|^5.0", - "symfony/twig-bundle": "^4.4|^5.0" + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", + "symfony/config": "^5.4 || ^6.0", + "symfony/dependency-injection": "^5.4 || ^6.0", + "symfony/event-dispatcher": "^5.4 || ^6.0", + "symfony/framework-bundle": "^5.4 || ^6.0", + "symfony/http-foundation": "^5.4 || ^6.0", + "symfony/http-kernel": "^5.4 || ^6.0", + "symfony/property-access": "^5.4 || ^6.0", + "symfony/security-bundle": "^5.4 || ^6.0", + "symfony/twig-bundle": "^5.4 || ^6.0" }, "conflict": { "scheb/two-factor-bundle": "*" @@ -6177,7 +5593,6 @@ "scheb/2fa-backup-code": "Emergency codes when you have no access to other methods", "scheb/2fa-email": "Send codes by email", "scheb/2fa-google-authenticator": "Google Authenticator support", - "scheb/2fa-qr-code": "Generate QR codes for Google Authenticator / TOTP", "scheb/2fa-totp": "Temporary one-time password (TOTP) support (Google Authenticator compatible)", "scheb/2fa-trusted-device": "Trusted devices support" }, @@ -6207,28 +5622,29 @@ "two-step" ], "support": { - "source": "https://github.com/scheb/2fa-bundle/tree/v5.13.2" + "source": "https://github.com/scheb/2fa-bundle/tree/v6.8.0" }, - "time": "2022-04-16T10:18:34+00:00" + "time": "2023-01-26T18:47:22+00:00" }, { "name": "scheb/2fa-google-authenticator", - "version": "v5.13.2", + "version": "v6.8.0", "source": { "type": "git", "url": "https://github.com/scheb/2fa-google-authenticator.git", - "reference": "9477bfc47b5927fb165022dd75700aefdd45a8cc" + "reference": "20eab4c1814b587cac71c4516a06b192ca838294" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scheb/2fa-google-authenticator/zipball/9477bfc47b5927fb165022dd75700aefdd45a8cc", - "reference": "9477bfc47b5927fb165022dd75700aefdd45a8cc", + "url": "https://api.github.com/repos/scheb/2fa-google-authenticator/zipball/20eab4c1814b587cac71c4516a06b192ca838294", + "reference": "20eab4c1814b587cac71c4516a06b192ca838294", "shasum": "" }, "require": { - "paragonie/constant_time_encoding": "^2.2", + "paragonie/constant_time_encoding": "^2.4", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "scheb/2fa-bundle": "self.version", - "spomky-labs/otphp": "^9.1|^10.0" + "spomky-labs/otphp": "^10.0 || ^11.0" }, "type": "library", "autoload": { @@ -6257,26 +5673,28 @@ "two-step" ], "support": { - "source": "https://github.com/scheb/2fa-google-authenticator/tree/v5.13.2" + "source": "https://github.com/scheb/2fa-google-authenticator/tree/v6.8.0" }, - "time": "2022-01-03T10:21:24+00:00" + "time": "2022-12-10T15:20:09+00:00" }, { "name": "scheb/2fa-trusted-device", - "version": "v5.13.2", + "version": "v6.8.0", "source": { "type": "git", "url": "https://github.com/scheb/2fa-trusted-device.git", - "reference": "acf5a1526eb2111fb7a82b9b52eb34b1ddfdc526" + "reference": "cac6feaf9f2c7d3a1aade86942f7b7b234fcd151" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/scheb/2fa-trusted-device/zipball/acf5a1526eb2111fb7a82b9b52eb34b1ddfdc526", - "reference": "acf5a1526eb2111fb7a82b9b52eb34b1ddfdc526", + "url": "https://api.github.com/repos/scheb/2fa-trusted-device/zipball/cac6feaf9f2c7d3a1aade86942f7b7b234fcd151", + "reference": "cac6feaf9f2c7d3a1aade86942f7b7b234fcd151", "shasum": "" }, "require": { - "lcobucci/jwt": "^3.4|^4.0", + "lcobucci/clock": "^2.0 || ^3.0", + "lcobucci/jwt": "^4.1 || ^5.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0", "scheb/2fa-bundle": "self.version" }, "type": "library", @@ -6306,9 +5724,9 @@ "two-step" ], "support": { - "source": "https://github.com/scheb/2fa-trusted-device/tree/v5.13.2" + "source": "https://github.com/scheb/2fa-trusted-device/tree/v6.8.0" }, - "time": "2022-01-03T10:21:24+00:00" + "time": "2023-04-01T11:20:00+00:00" }, { "name": "sensio/framework-extra-bundle", @@ -6450,24 +5868,24 @@ }, { "name": "spatie/db-dumper", - "version": "2.21.1", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/spatie/db-dumper.git", - "reference": "05e5955fb882008a8947c5a45146d86cfafa10d1" + "reference": "3b9fd47899bf6a59d3452392121c9ce675d55d34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/db-dumper/zipball/05e5955fb882008a8947c5a45146d86cfafa10d1", - "reference": "05e5955fb882008a8947c5a45146d86cfafa10d1", + "url": "https://api.github.com/repos/spatie/db-dumper/zipball/3b9fd47899bf6a59d3452392121c9ce675d55d34", + "reference": "3b9fd47899bf6a59d3452392121c9ce675d55d34", "shasum": "" }, "require": { - "php": "^7.2|^8.0", - "symfony/process": "^4.2|^5.0" + "php": "^8.0", + "symfony/process": "^5.0|^6.0" }, "require-dev": { - "phpunit/phpunit": "^7.0|^8.0|^9.0" + "pestphp/pest": "^1.22" }, "type": "library", "autoload": { @@ -6497,114 +5915,54 @@ "spatie" ], "support": { - "issues": "https://github.com/spatie/db-dumper/issues", - "source": "https://github.com/spatie/db-dumper/tree/2.21.1" + "source": "https://github.com/spatie/db-dumper/tree/3.3.1" }, "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, { "url": "https://github.com/spatie", "type": "github" } ], - "time": "2021-02-24T14:56:42+00:00" - }, - { - "name": "spomky-labs/base64url", - "version": "v2.0.4", - "source": { - "type": "git", - "url": "https://github.com/Spomky-Labs/base64url.git", - "reference": "7752ce931ec285da4ed1f4c5aa27e45e097be61d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/base64url/zipball/7752ce931ec285da4ed1f4c5aa27e45e097be61d", - "reference": "7752ce931ec285da4ed1f4c5aa27e45e097be61d", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.11|^0.12", - "phpstan/phpstan-beberlei-assert": "^0.11|^0.12", - "phpstan/phpstan-deprecation-rules": "^0.11|^0.12", - "phpstan/phpstan-phpunit": "^0.11|^0.12", - "phpstan/phpstan-strict-rules": "^0.11|^0.12" - }, - "type": "library", - "autoload": { - "psr-4": { - "Base64Url\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky-Labs/base64url/contributors" - } - ], - "description": "Base 64 URL Safe Encoding/Decoding PHP Library", - "homepage": "https://github.com/Spomky-Labs/base64url", - "keywords": [ - "base64", - "rfc4648", - "safe", - "url" - ], - "support": { - "issues": "https://github.com/Spomky-Labs/base64url/issues", - "source": "https://github.com/Spomky-Labs/base64url/tree/v2.0.4" - }, - "funding": [ - { - "url": "https://github.com/Spomky", - "type": "github" - }, - { - "url": "https://www.patreon.com/FlorentMorselli", - "type": "patreon" - } - ], - "time": "2020-11-03T09:10:25+00:00" + "time": "2023-05-02T11:05:31+00:00" }, { "name": "spomky-labs/cbor-bundle", - "version": "v2.0.3", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/Spomky-Labs/cbor-bundle.git", - "reference": "65a5a65e7fc20eca383a0be8f3ed287a4fe80b1f" + "reference": "157ca6ed2f6e957f9e95d71ca86bc67bf42ee79c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/cbor-bundle/zipball/65a5a65e7fc20eca383a0be8f3ed287a4fe80b1f", - "reference": "65a5a65e7fc20eca383a0be8f3ed287a4fe80b1f", + "url": "https://api.github.com/repos/Spomky-Labs/cbor-bundle/zipball/157ca6ed2f6e957f9e95d71ca86bc67bf42ee79c", + "reference": "157ca6ed2f6e957f9e95d71ca86bc67bf42ee79c", "shasum": "" }, "require": { - "php": ">=7.1", - "spomky-labs/cbor-php": "^1.0|^2.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/http-kernel": "^4.4|^5.0" + "php": ">=8.0", + "spomky-labs/cbor-php": "^3.0", + "symfony/config": "^5.3|^6.0", + "symfony/dependency-injection": "^5.3|^6.0", + "symfony/http-kernel": "^5.3|^6.0" }, "require-dev": { - "php-coveralls/php-coveralls": "^2.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-beberlei-assert": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", + "infection/infection": "^0.25.3", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-beberlei-assert": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.0", - "symfony/framework-bundle": "^4.4|^5.0", - "symfony/phpunit-bridge": "^4.4|^5.0", - "thecodingmachine/phpstan-safe-rule": "^1.0@beta" + "rector/rector": "^0.12.5", + "symfony/framework-bundle": "^5.3|^6.0", + "symfony/phpunit-bridge": "^5.3|^6.0", + "symplify/easy-coding-standard": "^9.4" }, "type": "symfony-bundle", "autoload": { @@ -6637,43 +5995,56 @@ ], "support": { "issues": "https://github.com/Spomky-Labs/cbor-bundle/issues", - "source": "https://github.com/Spomky-Labs/cbor-bundle/tree/v2.0.3" + "source": "https://github.com/Spomky-Labs/cbor-bundle/tree/v3.0.0" }, - "time": "2020-07-12T22:47:45+00:00" + "funding": [ + { + "url": "https://github.com/Spomky", + "type": "github" + }, + { + "url": "https://www.patreon.com/FlorentMorselli", + "type": "patreon" + } + ], + "time": "2021-11-23T21:41:00+00:00" }, { "name": "spomky-labs/cbor-php", - "version": "v2.1.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/Spomky-Labs/cbor-php.git", - "reference": "28e2712cfc0b48fae661a48ffc6896d7abe83684" + "reference": "81d5dff7a1101d680729b5789f4359d01b15e6c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/cbor-php/zipball/28e2712cfc0b48fae661a48ffc6896d7abe83684", - "reference": "28e2712cfc0b48fae661a48ffc6896d7abe83684", + "url": "https://api.github.com/repos/Spomky-Labs/cbor-php/zipball/81d5dff7a1101d680729b5789f4359d01b15e6c5", + "reference": "81d5dff7a1101d680729b5789f4359d01b15e6c5", "shasum": "" }, "require": { - "brick/math": "^0.8.15|^0.9.0", + "brick/math": "^0.9|^0.10|^0.11", "ext-mbstring": "*", - "php": ">=7.3" + "php": ">=8.0" }, "require-dev": { "ekino/phpstan-banned-code": "^1.0", "ext-json": "*", - "infection/infection": "^0.18|^0.25", + "infection/infection": "^0.26", + "php-parallel-lint/php-parallel-lint": "^1.3", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.0", "phpstan/phpstan-beberlei-assert": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.12", + "phpunit/phpunit": "^10.0", + "qossmic/deptrac-shim": "^1.0", + "rector/rector": "^0.15", "roave/security-advisories": "dev-latest", - "symplify/easy-coding-standard": "^10.0" + "symfony/var-dumper": "^6.0", + "symplify/easy-coding-standard": "^11.1" }, "suggest": { "ext-bcmath": "GMP or BCMath extensions will drastically improve the library performance. BCMath extension needed to handle the Big Float and Decimal Fraction Tags", @@ -6707,7 +6078,7 @@ ], "support": { "issues": "https://github.com/Spomky-Labs/cbor-php/issues", - "source": "https://github.com/Spomky-Labs/cbor-php/tree/v2.1.0" + "source": "https://github.com/Spomky-Labs/cbor-php/tree/3.0.2" }, "funding": [ { @@ -6719,47 +6090,42 @@ "type": "patreon" } ], - "time": "2021-12-13T12:46:26+00:00" + "time": "2023-02-28T21:37:12+00:00" }, { "name": "spomky-labs/otphp", - "version": "v10.0.3", + "version": "11.2.0", "source": { "type": "git", "url": "https://github.com/Spomky-Labs/otphp.git", - "reference": "9784d9f7c790eed26e102d6c78f12c754036c366" + "reference": "9a1569038bb1c8e98040b14b8bcbba54f25e7795" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Spomky-Labs/otphp/zipball/9784d9f7c790eed26e102d6c78f12c754036c366", - "reference": "9784d9f7c790eed26e102d6c78f12c754036c366", + "url": "https://api.github.com/repos/Spomky-Labs/otphp/zipball/9a1569038bb1c8e98040b14b8bcbba54f25e7795", + "reference": "9a1569038bb1c8e98040b14b8bcbba54f25e7795", "shasum": "" }, "require": { - "beberlei/assert": "^3.0", "ext-mbstring": "*", "paragonie/constant_time_encoding": "^2.0", - "php": "^7.2|^8.0", - "thecodingmachine/safe": "^0.1.14|^1.0|^2.0" + "php": "^8.1" }, "require-dev": { - "php-coveralls/php-coveralls": "^2.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-beberlei-assert": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-strict-rules": "^0.12", - "phpunit/phpunit": "^8.0", - "thecodingmachine/phpstan-safe-rule": "^1.0 || ^2.0" + "ekino/phpstan-banned-code": "^1.0", + "infection/infection": "^0.26", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5.26", + "qossmic/deptrac-shim": "^1.0", + "rector/rector": "^0.15", + "symfony/phpunit-bridge": "^6.1", + "symplify/easy-coding-standard": "^11.0" }, "type": "library", - "extra": { - "branch-alias": { - "v10.0": "10.0.x-dev", - "v9.0": "9.0.x-dev", - "v8.3": "8.3.x-dev" - } - }, "autoload": { "psr-4": { "OTPHP\\": "src/" @@ -6792,9 +6158,129 @@ ], "support": { "issues": "https://github.com/Spomky-Labs/otphp/issues", - "source": "https://github.com/Spomky-Labs/otphp/tree/v10.0.3" + "source": "https://github.com/Spomky-Labs/otphp/tree/11.2.0" }, - "time": "2022-03-17T08:00:35+00:00" + "funding": [ + { + "url": "https://github.com/Spomky", + "type": "github" + }, + { + "url": "https://www.patreon.com/FlorentMorselli", + "type": "patreon" + } + ], + "time": "2023-03-16T19:16:25+00:00" + }, + { + "name": "spomky-labs/pki-framework", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/Spomky-Labs/pki-framework.git", + "reference": "d3ba688bf40e7c6e0dabf065ee18fc210734e760" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Spomky-Labs/pki-framework/zipball/d3ba688bf40e7c6e0dabf065ee18fc210734e760", + "reference": "d3ba688bf40e7c6e0dabf065ee18fc210734e760", + "shasum": "" + }, + "require": { + "brick/math": "^0.10 || ^0.11", + "ext-mbstring": "*", + "php": ">=8.1" + }, + "require-dev": { + "ekino/phpstan-banned-code": "^1.0", + "ext-gmp": "*", + "ext-openssl": "*", + "infection/infection": "^0.26", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-beberlei-assert": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.3", + "phpunit/phpunit": "^10.0", + "rector/rector": "^0.15", + "roave/security-advisories": "dev-latest", + "symfony/phpunit-bridge": "^6.1", + "symfony/var-dumper": "^6.1", + "symplify/easy-coding-standard": "^11.1", + "thecodingmachine/phpstan-safe-rule": "^1.2" + }, + "suggest": { + "ext-bcmath": "For better performance (or GMP)", + "ext-gmp": "For better performance (or BCMath)", + "ext-openssl": "For OpenSSL based cyphering" + }, + "type": "library", + "autoload": { + "psr-4": { + "SpomkyLabs\\Pki\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joni Eskelinen", + "email": "jonieske@gmail.com", + "role": "Original developer" + }, + { + "name": "Florent Morselli", + "email": "florent.morselli@spomky-labs.com", + "role": "Spomky-Labs PKI Framework developer" + } + ], + "description": "A PHP framework for managing Public Key Infrastructures. It comprises X.509 public key certificates, attribute certificates, certification requests and certification path validation.", + "homepage": "https://github.com/spomky-labs/pki-framework", + "keywords": [ + "DER", + "Private Key", + "ac", + "algorithm identifier", + "asn.1", + "asn1", + "attribute certificate", + "certificate", + "certification request", + "cryptography", + "csr", + "decrypt", + "ec", + "encrypt", + "pem", + "pkcs", + "public key", + "rsa", + "sign", + "signature", + "verify", + "x.509", + "x.690", + "x509", + "x690" + ], + "support": { + "issues": "https://github.com/Spomky-Labs/pki-framework/issues", + "source": "https://github.com/Spomky-Labs/pki-framework/tree/1.1.0" + }, + "funding": [ + { + "url": "https://github.com/Spomky", + "type": "github" + }, + { + "url": "https://www.patreon.com/FlorentMorselli", + "type": "patreon" + } + ], + "time": "2023-02-13T17:21:24+00:00" }, { "name": "symfony/apache-pack", @@ -6824,30 +6310,28 @@ }, { "name": "symfony/asset", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "1504b6773c6b90118f9871e90a67833b5d1dca3c" + "reference": "223df790e684ecc7bc37323c2d1e265129ca02de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/1504b6773c6b90118f9871e90a67833b5d1dca3c", - "reference": "1504b6773c6b90118f9871e90a67833b5d1dca3c", + "url": "https://api.github.com/repos/symfony/asset/zipball/223df790e684ecc7bc37323c2d1e265129ca02de", + "reference": "223df790e684ecc7bc37323c2d1e265129ca02de", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "conflict": { - "symfony/http-foundation": "<5.3" + "symfony/http-foundation": "<5.4" }, "require-dev": { - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^5.3|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0" + "symfony/http-client": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0" }, "suggest": { "symfony/http-foundation": "" @@ -6878,7 +6362,7 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v5.4.21" + "source": "https://github.com/symfony/asset/tree/v6.2.7" }, "funding": [ { @@ -6894,62 +6378,61 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/cache", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "983c79ff28612cdfd66d8e44e1a06e5afc87e107" + "reference": "1ce7ed8e7ca6948892b6a3a52bb60cf2b04f7c94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/983c79ff28612cdfd66d8e44e1a06e5afc87e107", - "reference": "983c79ff28612cdfd66d8e44e1a06e5afc87e107", + "url": "https://api.github.com/repos/symfony/cache/zipball/1ce7ed8e7ca6948892b6a3a52bb60cf2b04f7c94", + "reference": "1ce7ed8e7ca6948892b6a3a52bb60cf2b04f7c94", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0", + "php": ">=8.1", + "psr/cache": "^2.0|^3.0", "psr/log": "^1.1|^2|^3", - "symfony/cache-contracts": "^1.1.7|^2", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", + "symfony/cache-contracts": "^1.1.7|^2|^3", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/var-exporter": "^6.2.10" }, "conflict": { "doctrine/dbal": "<2.13.1", - "symfony/dependency-injection": "<4.4", - "symfony/http-kernel": "<4.4", - "symfony/var-dumper": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/var-dumper": "<5.4" }, "provide": { - "psr/cache-implementation": "1.0|2.0", - "psr/simple-cache-implementation": "1.0|2.0", - "symfony/cache-implementation": "1.0|2.0" + "psr/cache-implementation": "2.0|3.0", + "psr/simple-cache-implementation": "1.0|2.0|3.0", + "symfony/cache-implementation": "1.1|2.0|3.0" }, "require-dev": { "cache/integration-tests": "dev-master", - "doctrine/cache": "^1.6|^2.0", "doctrine/dbal": "^2.13.1|^3.0", "predis/predis": "^1.1", - "psr/simple-cache": "^1.0|^2.0", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/messenger": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "psr/simple-cache": "^1.0|^2.0|^3.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/filesystem": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/messenger": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\Cache\\": "" }, + "classmap": [ + "Traits/ValueWrapper.php" + ], "exclude-from-classmap": [ "/Tests/" ] @@ -6975,7 +6458,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.4.23" + "source": "https://github.com/symfony/cache/tree/v6.2.10" }, "funding": [ { @@ -6991,25 +6474,25 @@ "type": "tidelift" } ], - "time": "2023-04-21T15:38:51+00:00" + "time": "2023-04-21T15:42:15+00:00" }, { "name": "symfony/cache-contracts", - "version": "v2.5.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/cache-contracts.git", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" + "reference": "eeb71f04b6f7f34ca6d15633df82e014528b1632" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", - "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/eeb71f04b6f7f34ca6d15633df82e014528b1632", + "reference": "eeb71f04b6f7f34ca6d15633df82e014528b1632", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/cache": "^1.0|^2.0|^3.0" + "php": ">=8.1", + "psr/cache": "^3.0" }, "suggest": { "symfony/cache-implementation": "" @@ -7017,7 +6500,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -7054,7 +6537,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/cache-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/cache-contracts/tree/v3.2.1" }, "funding": [ { @@ -7070,39 +6553,37 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/config", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "2a6b1111d038adfa15d52c0871e540f3b352d1e4" + "reference": "249271da6f545d6579e0663374f8249a80be2893" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/2a6b1111d038adfa15d52c0871e540f3b352d1e4", - "reference": "2a6b1111d038adfa15d52c0871e540f3b352d1e4", + "url": "https://api.github.com/repos/symfony/config/zipball/249271da6f545d6579e0663374f8249a80be2893", + "reference": "249271da6f545d6579e0663374f8249a80be2893", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22" + "symfony/filesystem": "^5.4|^6.0", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<4.4" + "symfony/finder": "<5.4" }, "require-dev": { - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/messenger": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/messenger": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" @@ -7133,7 +6614,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.4.21" + "source": "https://github.com/symfony/config/tree/v6.2.7" }, "funding": [ { @@ -7149,50 +6630,47 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/console", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" + "reference": "12288d9f4500f84a4d02254d4aa968b15488476f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "url": "https://api.github.com/repos/symfony/console/zipball/12288d9f4500f84a4d02254d4aa968b15488476f", + "reference": "12288d9f4500f84a4d02254d4aa968b15488476f", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/string": "^5.4|^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" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "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" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "psr/log": "For using the console logger", @@ -7232,7 +6710,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.24" + "source": "https://github.com/symfony/console/tree/v6.2.10" }, "funding": [ { @@ -7248,7 +6726,7 @@ "type": "tidelift" } ], - "time": "2023-05-26T05:13:16+00:00" + "time": "2023-04-28T13:37:43+00:00" }, { "name": "symfony/css-selector", @@ -7318,47 +6796,45 @@ }, { "name": "symfony/dependency-injection", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "4645e032d0963fb614969398ca28e47605b1a7da" + "reference": "d732a66a2672669232c0b4536c8c96724a679780" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/4645e032d0963fb614969398ca28e47605b1a7da", - "reference": "4645e032d0963fb614969398ca28e47605b1a7da", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d732a66a2672669232c0b4536c8c96724a679780", + "reference": "d732a66a2672669232c0b4536c8c96724a679780", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1.1", + "php": ">=8.1", + "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22", - "symfony/service-contracts": "^1.1.6|^2" + "symfony/service-contracts": "^1.1.6|^2.0|^3.0", + "symfony/var-exporter": "^6.2.7" }, "conflict": { "ext-psr": "<1.1|>=2", - "symfony/config": "<5.3", - "symfony/finder": "<4.4", - "symfony/proxy-manager-bridge": "<4.4", - "symfony/yaml": "<4.4.26" + "symfony/config": "<6.1", + "symfony/finder": "<5.4", + "symfony/proxy-manager-bridge": "<6.2", + "symfony/yaml": "<5.4" }, "provide": { - "psr/container-implementation": "1.0", - "symfony/service-implementation": "1.0|2.0" + "psr/container-implementation": "1.1|2.0", + "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^5.3|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4.26|^5.0|^6.0" + "symfony/config": "^6.1", + "symfony/expression-language": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "symfony/config": "", "symfony/expression-language": "For using expressions in service container configuration", "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, "type": "library", @@ -7387,7 +6863,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v5.4.24" + "source": "https://github.com/symfony/dependency-injection/tree/v6.2.10" }, "funding": [ { @@ -7403,7 +6879,7 @@ "type": "tidelift" } ], - "time": "2023-05-05T14:42:55+00:00" + "time": "2023-04-21T15:42:15+00:00" }, { "name": "symfony/deprecation-contracts", @@ -7474,42 +6950,41 @@ }, { "name": "symfony/doctrine-bridge", - "version": "v5.4.24", + "version": "v6.2.9", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "1eeb02bcad51cb99ab3b73bc83adf80f9b1a75cf" + "reference": "4b3aeaa90d41c5527d7ba211d12102cedf06936e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/1eeb02bcad51cb99ab3b73bc83adf80f9b1a75cf", - "reference": "1eeb02bcad51cb99ab3b73bc83adf80f9b1a75cf", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/4b3aeaa90d41c5527d7ba211d12102cedf06936e", + "reference": "4b3aeaa90d41c5527d7ba211d12102cedf06936e", "shasum": "" }, "require": { - "doctrine/event-manager": "~1.0", + "doctrine/event-manager": "^1.2|^2", "doctrine/persistence": "^2|^3", - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.1|^2|^3" }, "conflict": { "doctrine/dbal": "<2.13.1", "doctrine/lexer": "<1.1", "doctrine/orm": "<2.7.4", + "phpunit/phpunit": "<5.4.3", "symfony/cache": "<5.4", - "symfony/dependency-injection": "<4.4", + "symfony/dependency-injection": "<5.4", "symfony/form": "<5.4.21|>=6,<6.2.7", - "symfony/http-kernel": "<5", - "symfony/messenger": "<4.4", - "symfony/property-info": "<5", - "symfony/proxy-manager-bridge": "<4.4.19", - "symfony/security-bundle": "<5", - "symfony/security-core": "<5.3", - "symfony/validator": "<5.2" + "symfony/http-kernel": "<6.2", + "symfony/messenger": "<5.4", + "symfony/property-info": "<5.4", + "symfony/security-bundle": "<5.4", + "symfony/security-core": "<6.0", + "symfony/validator": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.10.4|^2", @@ -7519,22 +6994,22 @@ "doctrine/orm": "^2.7.4", "psr/log": "^1|^2|^3", "symfony/cache": "^5.4|^6.0", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/doctrine-messenger": "^5.1|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/doctrine-messenger": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", "symfony/form": "^5.4.21|^6.2.7", - "symfony/http-kernel": "^5.0|^6.0", - "symfony/messenger": "^4.4|^5.0|^6.0", - "symfony/property-access": "^4.4|^5.0|^6.0", - "symfony/property-info": "^5.0|^6.0", - "symfony/proxy-manager-bridge": "^4.4|^5.0|^6.0", - "symfony/security-core": "^5.3|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", - "symfony/uid": "^5.1|^6.0", - "symfony/validator": "^5.2|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "symfony/http-kernel": "^6.2", + "symfony/messenger": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/property-info": "^5.4|^6.0", + "symfony/proxy-manager-bridge": "^5.4|^6.0", + "symfony/security-core": "^6.0", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "doctrine/data-fixtures": "", @@ -7570,7 +7045,7 @@ "description": "Provides integration for Doctrine with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/doctrine-bridge/tree/v5.4.24" + "source": "https://github.com/symfony/doctrine-bridge/tree/v6.2.9" }, "funding": [ { @@ -7586,29 +7061,32 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:05:00+00:00" + "time": "2023-04-11T16:08:35+00:00" }, { "name": "symfony/dotenv", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "77b7660bfcb85e8f28287d557d7af0046bcd2ca3" + "reference": "4481aa45be7a11d2335c1d5b5bbe2f0c6199b105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/77b7660bfcb85e8f28287d557d7af0046bcd2ca3", - "reference": "77b7660bfcb85e8f28287d557d7af0046bcd2ca3", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/4481aa45be7a11d2335c1d5b5bbe2f0c6199b105", + "reference": "4481aa45be7a11d2335c1d5b5bbe2f0c6199b105", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1" + }, + "conflict": { + "symfony/console": "<5.4", + "symfony/process": "<5.4" }, "require-dev": { - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0" + "symfony/console": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -7641,7 +7119,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v5.4.22" + "source": "https://github.com/symfony/dotenv/tree/v6.2.8" }, "funding": [ { @@ -7657,31 +7135,31 @@ "type": "tidelift" } ], - "time": "2023-03-09T20:36:58+00:00" + "time": "2023-03-10T10:06:03+00:00" }, { "name": "symfony/error-handler", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "c1b9be3b8a6f60f720bec28c4ffb6fb5b00a8946" + "reference": "8b7e9f124640cb0611624a9383176c3e5f7d8cfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/c1b9be3b8a6f60f720bec28c4ffb6fb5b00a8946", - "reference": "c1b9be3b8a6f60f720bec28c4ffb6fb5b00a8946", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/8b7e9f124640cb0611624a9383176c3e5f7d8cfb", + "reference": "8b7e9f124640cb0611624a9383176c3e5f7d8cfb", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "symfony/var-dumper": "^5.4|^6.0" }, "require-dev": { "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/serializer": "^4.4|^5.0|^6.0" + "symfony/http-kernel": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" }, "bin": [ "Resources/bin/patch-type-declarations" @@ -7712,7 +7190,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v5.4.24" + "source": "https://github.com/symfony/error-handler/tree/v6.2.10" }, "funding": [ { @@ -7728,44 +7206,42 @@ "type": "tidelift" } ], - "time": "2023-05-02T16:13:31+00:00" + "time": "2023-04-18T13:46:08+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "1df20e45d56da29a4b1d8259dd6e950acbf1b13f" + "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1df20e45d56da29a4b1d8259dd6e950acbf1b13f", - "reference": "1df20e45d56da29a4b1d8259dd6e950acbf1b13f", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher-contracts": "^2|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/event-dispatcher-contracts": "^2|^3" }, "conflict": { - "symfony/dependency-injection": "<4.4" + "symfony/dependency-injection": "<5.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "2.0" + "symfony/event-dispatcher-implementation": "2.0|3.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/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3", - "symfony/stopwatch": "^4.4|^5.0|^6.0" + "symfony/stopwatch": "^5.4|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -7797,7 +7273,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.22" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.8" }, "funding": [ { @@ -7813,24 +7289,24 @@ "type": "tidelift" } ], - "time": "2023-03-17T11:31:58+00:00" + "time": "2023-03-20T16:06:02+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", - "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "psr/event-dispatcher": "^1" }, "suggest": { @@ -7839,7 +7315,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -7876,7 +7352,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.1" }, "funding": [ { @@ -7892,25 +7368,25 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/expression-language", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "501589522b844b8eecf012c133f0404f0eef77ac" + "reference": "83e1fee4c018aa60bcbbecd585a2c54af6aca905" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/501589522b844b8eecf012c133f0404f0eef77ac", - "reference": "501589522b844b8eecf012c133f0404f0eef77ac", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/83e1fee4c018aa60bcbbecd585a2c54af6aca905", + "reference": "83e1fee4c018aa60bcbbecd585a2c54af6aca905", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/cache": "^4.4|^5.0|^6.0", + "php": ">=8.1", + "symfony/cache": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3" }, "type": "library", @@ -7939,7 +7415,7 @@ "description": "Provides an engine that can compile and evaluate expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/expression-language/tree/v5.4.21" + "source": "https://github.com/symfony/expression-language/tree/v6.2.7" }, "funding": [ { @@ -7955,27 +7431,26 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5" + "reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", - "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd588debf7d1bc16a2c84b4b3b71145d9946b894", + "reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -8003,7 +7478,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.23" + "source": "https://github.com/symfony/filesystem/tree/v6.2.10" }, "funding": [ { @@ -8019,26 +7494,27 @@ "type": "tidelift" } ], - "time": "2023-03-02T11:38:35+00:00" + "time": "2023-04-18T13:46:08+00:00" }, { "name": "symfony/finder", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19" + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/078e9a5e1871fcfe6a5ce421b539344c21afef19", - "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19", + "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", + "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" + }, + "require-dev": { + "symfony/filesystem": "^6.0" }, "type": "library", "autoload": { @@ -8066,7 +7542,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.21" + "source": "https://github.com/symfony/finder/tree/v6.2.7" }, "funding": [ { @@ -8082,7 +7558,7 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:33:00+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { "name": "symfony/flex", @@ -8151,58 +7627,60 @@ }, { "name": "symfony/form", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "813b79a34ab9843b5a01a6f809f1e4a009aaea2e" + "reference": "a123512b46caea497ab8d96d9dbdbdaaf416a606" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/813b79a34ab9843b5a01a6f809f1e4a009aaea2e", - "reference": "813b79a34ab9843b5a01a6f809f1e4a009aaea2e", + "url": "https://api.github.com/repos/symfony/form/zipball/a123512b46caea497ab8d96d9dbdbdaaf416a606", + "reference": "a123512b46caea497ab8d96d9dbdbdaaf416a606", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/options-resolver": "^5.1|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/options-resolver": "^5.4|^6.0", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-icu": "^1.21", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.23", - "symfony/property-access": "^5.0.8|^6.0", + "symfony/property-access": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3" }, "conflict": { - "symfony/console": "<4.4", - "symfony/dependency-injection": "<4.4", + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<5.4", "symfony/doctrine-bridge": "<5.4.21|>=6,<6.2.7", - "symfony/error-handler": "<4.4.5", - "symfony/framework-bundle": "<4.4", - "symfony/http-kernel": "<4.4", - "symfony/translation": "<4.4", + "symfony/error-handler": "<5.4", + "symfony/framework-bundle": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/translation": "<5.4", "symfony/translation-contracts": "<1.1.7", "symfony/twig-bridge": "<5.4.21|>=6,<6.2.7" }, "require-dev": { "doctrine/collections": "^1.0|^2.0", - "symfony/config": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^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/http-kernel": "^4.4|^5.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", - "symfony/security-csrf": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", - "symfony/uid": "^5.1|^6.0", - "symfony/validator": "^4.4.17|^5.1.9|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/html-sanitizer": "^6.1", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", + "symfony/security-core": "^6.2", + "symfony/security-csrf": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { + "symfony/security-core": "For hashing users passwords.", "symfony/security-csrf": "For protecting forms against CSRF attacks.", "symfony/twig-bridge": "For templating with Twig.", "symfony/validator": "For form validation." @@ -8233,7 +7711,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v5.4.24" + "source": "https://github.com/symfony/form/tree/v6.2.10" }, "funding": [ { @@ -8249,102 +7727,103 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:05:00+00:00" + "time": "2023-04-19T08:03:37+00:00" }, { "name": "symfony/framework-bundle", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "c06a56a47817d29318aaace1c655cbde16c998e8" + "reference": "823f285befde4e97bb70d97cae57997c38e4d6fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/c06a56a47817d29318aaace1c655cbde16c998e8", - "reference": "c06a56a47817d29318aaace1c655cbde16c998e8", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/823f285befde4e97bb70d97cae57997c38e4d6fd", + "reference": "823f285befde4e97bb70d97cae57997c38e4d6fd", "shasum": "" }, "require": { + "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=7.2.5", - "symfony/cache": "^5.2|^6.0", - "symfony/config": "^5.3|^6.0", - "symfony/dependency-injection": "^5.4.5|^6.0.5", + "php": ">=8.1", + "symfony/cache": "^5.4|^6.0", + "symfony/config": "^6.1", + "symfony/dependency-injection": "^6.2.8", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/error-handler": "^4.4.1|^5.0.1|^6.0", - "symfony/event-dispatcher": "^5.1|^6.0", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^5.4.24|^6.2.11", - "symfony/http-kernel": "^5.4|^6.0", + "symfony/error-handler": "^6.1", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/filesystem": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/http-foundation": "^6.2", + "symfony/http-kernel": "^6.2.1", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22", - "symfony/routing": "^5.3|^6.0" + "symfony/routing": "^5.4|^6.0" }, "conflict": { "doctrine/annotations": "<1.13.1", - "doctrine/cache": "<1.11", "doctrine/persistence": "<1.3", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/asset": "<5.3", - "symfony/console": "<5.2.5", - "symfony/dom-crawler": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/form": "<5.2", - "symfony/http-client": "<4.4", - "symfony/lock": "<4.4", - "symfony/mailer": "<5.2", - "symfony/messenger": "<5.4", - "symfony/mime": "<4.4", - "symfony/property-access": "<5.3", - "symfony/property-info": "<4.4", - "symfony/security-csrf": "<5.3", - "symfony/serializer": "<5.2", - "symfony/service-contracts": ">=3.0", - "symfony/stopwatch": "<4.4", - "symfony/translation": "<5.3", - "symfony/twig-bridge": "<4.4", - "symfony/twig-bundle": "<4.4", - "symfony/validator": "<5.2", - "symfony/web-profiler-bundle": "<4.4", - "symfony/workflow": "<5.2" + "phpunit/phpunit": "<5.4.3", + "symfony/asset": "<5.4", + "symfony/console": "<5.4", + "symfony/dom-crawler": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/form": "<5.4", + "symfony/http-client": "<5.4", + "symfony/lock": "<5.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<6.2", + "symfony/mime": "<6.2", + "symfony/property-access": "<5.4", + "symfony/property-info": "<5.4", + "symfony/security-core": "<5.4", + "symfony/security-csrf": "<5.4", + "symfony/serializer": "<6.1", + "symfony/stopwatch": "<5.4", + "symfony/translation": "<6.2.8", + "symfony/twig-bridge": "<5.4", + "symfony/twig-bundle": "<5.4", + "symfony/validator": "<5.4", + "symfony/web-profiler-bundle": "<5.4", + "symfony/workflow": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.13.1|^2", - "doctrine/cache": "^1.11|^2.0", "doctrine/persistence": "^1.3|^2|^3", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/asset": "^5.3|^6.0", + "symfony/asset": "^5.4|^6.0", "symfony/browser-kit": "^5.4|^6.0", "symfony/console": "^5.4.9|^6.0.9", - "symfony/css-selector": "^4.4|^5.0|^6.0", - "symfony/dom-crawler": "^4.4.30|^5.3.7|^6.0", - "symfony/dotenv": "^5.1|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/form": "^5.2|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/mailer": "^5.2|^6.0", - "symfony/messenger": "^5.4|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/dom-crawler": "^5.4|^6.0", + "symfony/dotenv": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/form": "^5.4|^6.0", + "symfony/html-sanitizer": "^6.1", + "symfony/http-client": "^5.4|^6.0", + "symfony/lock": "^5.4|^6.0", + "symfony/mailer": "^5.4|^6.0", + "symfony/messenger": "^6.2", + "symfony/mime": "^6.2", "symfony/notifier": "^5.4|^6.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/property-info": "^4.4|^5.0|^6.0", - "symfony/rate-limiter": "^5.2|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/property-info": "^5.4|^6.0", + "symfony/rate-limiter": "^5.4|^6.0", "symfony/security-bundle": "^5.4|^6.0", - "symfony/serializer": "^5.4|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0", - "symfony/string": "^5.0|^6.0", - "symfony/translation": "^5.3|^6.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0", - "symfony/validator": "^5.2|^6.0", - "symfony/web-link": "^4.4|^5.0|^6.0", - "symfony/workflow": "^5.2|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/semaphore": "^5.4|^6.0", + "symfony/serializer": "^6.1", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/string": "^5.4|^6.0", + "symfony/translation": "^6.2.8", + "symfony/twig-bundle": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0", + "symfony/web-link": "^5.4|^6.0", + "symfony/workflow": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0", "twig/twig": "^2.10|^3.0" }, "suggest": { @@ -8383,7 +7862,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v5.4.24" + "source": "https://github.com/symfony/framework-bundle/tree/v6.2.10" }, "funding": [ { @@ -8399,36 +7878,34 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:05:00+00:00" + "time": "2023-04-23T08:23:35+00:00" }, { "name": "symfony/http-client", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "9e89ac4c9dfe29f4ed2b10a36e62720286632ad6" + "reference": "3f5545a91c8e79dedd1a06c4b04e1682c80c42f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/9e89ac4c9dfe29f4ed2b10a36e62720286632ad6", - "reference": "9e89ac4c9dfe29f4ed2b10a36e62720286632ad6", + "url": "https://api.github.com/repos/symfony/http-client/zipball/3f5545a91c8e79dedd1a06c4b04e1682c80c42f9", + "reference": "3f5545a91c8e79dedd1a06c4b04e1682c80c42f9", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-client-contracts": "^2.4", - "symfony/polyfill-php73": "^1.11", - "symfony/polyfill-php80": "^1.16", + "symfony/http-client-contracts": "^3", "symfony/service-contracts": "^1.0|^2|^3" }, "provide": { "php-http/async-client-implementation": "*", "php-http/client-implementation": "*", "psr/http-client-implementation": "1.0", - "symfony/http-client-implementation": "2.4" + "symfony/http-client-implementation": "3.0" }, "require-dev": { "amphp/amp": "^2.5", @@ -8438,12 +7915,11 @@ "guzzlehttp/promises": "^1.4", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", - "php-http/message-factory": "^1.0", "psr/http-client": "^1.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4.13|^5.1.5|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0" + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -8474,7 +7950,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v5.4.24" + "source": "https://github.com/symfony/http-client/tree/v6.2.10" }, "funding": [ { @@ -8490,24 +7966,24 @@ "type": "tidelift" } ], - "time": "2023-05-07T13:11:28+00:00" + "time": "2023-04-20T13:12:48+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v2.5.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70" + "reference": "df2ecd6cb70e73c1080e6478aea85f5f4da2c48b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/df2ecd6cb70e73c1080e6478aea85f5f4da2c48b", + "reference": "df2ecd6cb70e73c1080e6478aea85f5f4da2c48b", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=8.1" }, "suggest": { "symfony/http-client-implementation": "" @@ -8515,7 +7991,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -8525,7 +8001,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\HttpClient\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -8552,7 +8031,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.2.1" }, "funding": [ { @@ -8568,35 +8047,37 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/http-foundation", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3c59f97f6249ce552a44f01b93bfcbd786a954f5" + "reference": "49adbb92bcb4e3c2943719d2756271e8b9602acc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3c59f97f6249ce552a44f01b93bfcbd786a954f5", - "reference": "3c59f97f6249ce552a44f01b93bfcbd786a954f5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/49adbb92bcb4e3c2943719d2756271e8b9602acc", + "reference": "49adbb92bcb4e3c2943719d2756271e8b9602acc", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.1" + }, + "conflict": { + "symfony/cache": "<6.2" }, "require-dev": { "predis/predis": "~1.0", - "symfony/cache": "^4.4|^5.0|^6.0", + "symfony/cache": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^5.4|^6.0", "symfony/http-kernel": "^5.4.12|^6.0.12|^6.1.4", - "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/mime": "^5.4|^6.0", "symfony/rate-limiter": "^5.2|^6.0" }, "suggest": { @@ -8628,7 +8109,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v5.4.24" + "source": "https://github.com/symfony/http-foundation/tree/v6.2.10" }, "funding": [ { @@ -8644,68 +8125,67 @@ "type": "tidelift" } ], - "time": "2023-05-19T07:21:23+00:00" + "time": "2023-04-18T13:46:08+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "f38b722e1557eb3f487d351b48f5a1279b50e9d1" + "reference": "81064a65a5496f17d2b6984f6519406f98864215" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f38b722e1557eb3f487d351b48f5a1279b50e9d1", - "reference": "f38b722e1557eb3f487d351b48f5a1279b50e9d1", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/81064a65a5496f17d2b6984f6519406f98864215", + "reference": "81064a65a5496f17d2b6984f6519406f98864215", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2", + "php": ">=8.1", + "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^5.0|^6.0", + "symfony/error-handler": "^6.1", + "symfony/event-dispatcher": "^5.4|^6.0", "symfony/http-foundation": "^5.4.21|^6.2.7", - "symfony/polyfill-ctype": "^1.8", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-ctype": "^1.8" }, "conflict": { "symfony/browser-kit": "<5.4", - "symfony/cache": "<5.0", - "symfony/config": "<5.0", - "symfony/console": "<4.4", - "symfony/dependency-injection": "<5.3", - "symfony/doctrine-bridge": "<5.0", - "symfony/form": "<5.0", - "symfony/http-client": "<5.0", - "symfony/mailer": "<5.0", - "symfony/messenger": "<5.0", - "symfony/translation": "<5.0", - "symfony/twig-bridge": "<5.0", - "symfony/validator": "<5.0", + "symfony/cache": "<5.4", + "symfony/config": "<6.1", + "symfony/console": "<5.4", + "symfony/dependency-injection": "<6.2", + "symfony/doctrine-bridge": "<5.4", + "symfony/form": "<5.4", + "symfony/http-client": "<5.4", + "symfony/mailer": "<5.4", + "symfony/messenger": "<5.4", + "symfony/translation": "<5.4", + "symfony/twig-bridge": "<5.4", + "symfony/validator": "<5.4", "twig/twig": "<2.13" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "symfony/browser-kit": "^5.4|^6.0", - "symfony/config": "^5.0|^6.0", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/css-selector": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^5.3|^6.0", - "symfony/dom-crawler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", + "symfony/config": "^6.1", + "symfony/console": "^5.4|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/dependency-injection": "^6.2", + "symfony/dom-crawler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", "symfony/http-client-contracts": "^1.1|^2|^3", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/routing": "^4.4|^5.0|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", "symfony/translation-contracts": "^1.1|^2|^3", + "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, "suggest": { @@ -8740,7 +8220,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v5.4.24" + "source": "https://github.com/symfony/http-kernel/tree/v6.2.10" }, "funding": [ { @@ -8756,41 +8236,34 @@ "type": "tidelift" } ], - "time": "2023-05-27T08:06:30+00:00" + "time": "2023-04-28T13:50:28+00:00" }, { "name": "symfony/intl", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "962789bbc76c82c266623321ffc24416f574b636" + "reference": "860c99e53149d22df1900d3aefdaeb17adb7669d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/962789bbc76c82c266623321ffc24416f574b636", - "reference": "962789bbc76c82c266623321ffc24416f574b636", + "url": "https://api.github.com/repos/symfony/intl/zipball/860c99e53149d22df1900d3aefdaeb17adb7669d", + "reference": "860c99e53149d22df1900d3aefdaeb17adb7669d", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "require-dev": { - "symfony/filesystem": "^4.4|^5.0|^6.0" + "symfony/filesystem": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0" }, "type": "library", "autoload": { - "files": [ - "Resources/functions.php" - ], "psr-4": { "Symfony\\Component\\Intl\\": "" }, - "classmap": [ - "Resources/stubs" - ], "exclude-from-classmap": [ "/Tests/" ] @@ -8817,7 +8290,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library", + "description": "Provides access to the localization data of the ICU library", "homepage": "https://symfony.com", "keywords": [ "i18n", @@ -8828,7 +8301,7 @@ "localization" ], "support": { - "source": "https://github.com/symfony/intl/tree/v5.4.23" + "source": "https://github.com/symfony/intl/tree/v6.2.10" }, "funding": [ { @@ -8844,118 +8317,42 @@ "type": "tidelift" } ], - "time": "2023-04-13T10:36:25+00:00" - }, - { - "name": "symfony/lock", - "version": "v5.4.22", - "source": { - "type": "git", - "url": "https://github.com/symfony/lock.git", - "reference": "cc0565235e16ef403097fbd30eba59690bee6b3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/lock/zipball/cc0565235e16ef403097fbd30eba59690bee6b3c", - "reference": "cc0565235e16ef403097fbd30eba59690bee6b3c", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "doctrine/dbal": "<2.13" - }, - "require-dev": { - "doctrine/dbal": "^2.13|^3.0", - "predis/predis": "~1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Lock\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jérémy Derussé", - "email": "jeremy@derusse.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Creates and manages locks, a mechanism to provide exclusive access to a shared resource", - "homepage": "https://symfony.com", - "keywords": [ - "cas", - "flock", - "locking", - "mutex", - "redlock", - "semaphore" - ], - "support": { - "source": "https://github.com/symfony/lock/tree/v5.4.22" - }, - "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-03-10T16:52:09+00:00" + "time": "2023-04-14T16:23:31+00:00" }, { "name": "symfony/mailer", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "6330cd465dfd8b7a07515757a1c37069075f7b0b" + "reference": "bfcfa015c67e19c6fdb7ca6fe70700af1e740a17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/6330cd465dfd8b7a07515757a1c37069075f7b0b", - "reference": "6330cd465dfd8b7a07515757a1c37069075f7b0b", + "url": "https://api.github.com/repos/symfony/mailer/zipball/bfcfa015c67e19c6fdb7ca6fe70700af1e740a17", + "reference": "bfcfa015c67e19c6fdb7ca6fe70700af1e740a17", "shasum": "" }, "require": { "egulias/email-validator": "^2.1.10|^3|^4", - "php": ">=7.2.5", + "php": ">=8.1", "psr/event-dispatcher": "^1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/mime": "^5.2.6|^6.0", - "symfony/polyfill-php80": "^1.16", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/mime": "^6.2", "symfony/service-contracts": "^1.1|^2|^3" }, "conflict": { - "symfony/http-kernel": "<4.4" + "symfony/http-kernel": "<5.4", + "symfony/messenger": "<6.2", + "symfony/mime": "<6.2", + "symfony/twig-bridge": "<6.2.1" }, "require-dev": { - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/messenger": "^4.4|^5.0|^6.0" + "symfony/console": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/messenger": "^6.2", + "symfony/twig-bridge": "^6.2" }, "type": "library", "autoload": { @@ -8983,7 +8380,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v5.4.22" + "source": "https://github.com/symfony/mailer/tree/v6.2.8" }, "funding": [ { @@ -8999,43 +8396,42 @@ "type": "tidelift" } ], - "time": "2023-03-10T10:15:32+00:00" + "time": "2023-03-14T15:00:05+00:00" }, { "name": "symfony/mime", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "ae0a1032a450a3abf305ee44fc55ed423fbf16e3" + "reference": "b6c137fc53a9f7c4c951cd3f362b3734c7a97723" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/ae0a1032a450a3abf305ee44fc55ed423fbf16e3", - "reference": "ae0a1032a450a3abf305ee44fc55ed423fbf16e3", + "url": "https://api.github.com/repos/symfony/mime/zipball/b6c137fc53a9f7c4c951cd3f362b3734c7a97723", + "reference": "b6c137fc53a9f7c4c951cd3f362b3734c7a97723", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", "symfony/polyfill-intl-idn": "^1.10", - "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/mailer": "<4.4", - "symfony/serializer": "<5.4.14|>=6.0,<6.0.14|>=6.1,<6.1.6" + "symfony/mailer": "<5.4", + "symfony/serializer": "<6.2" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", + "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/property-access": "^4.4|^5.1|^6.0", - "symfony/property-info": "^4.4|^5.1|^6.0", - "symfony/serializer": "^5.4.14|~6.0.14|^6.1.6" + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/property-info": "^5.4|^6.0", + "symfony/serializer": "^6.2" }, "type": "library", "autoload": { @@ -9067,7 +8463,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.23" + "source": "https://github.com/symfony/mime/tree/v6.2.10" }, "funding": [ { @@ -9083,42 +8479,41 @@ "type": "tidelift" } ], - "time": "2023-04-19T09:49:13+00:00" + "time": "2023-04-19T09:54:16+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "34be6f0695e4187dbb832a05905fb4c6581ac39a" + "reference": "34700f2e5c7e9eae78f8e59fc02399dd8f110cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/34be6f0695e4187dbb832a05905fb4c6581ac39a", - "reference": "34be6f0695e4187dbb832a05905fb4c6581ac39a", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/34700f2e5c7e9eae78f8e59fc02399dd8f110cae", + "reference": "34700f2e5c7e9eae78f8e59fc02399dd8f110cae", "shasum": "" }, "require": { - "monolog/monolog": "^1.25.1|^2", - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-kernel": "^5.3|^6.0", - "symfony/polyfill-php80": "^1.16", + "monolog/monolog": "^1.25.1|^2|^3", + "php": ">=8.1", + "symfony/http-kernel": "^5.4|^6.0", "symfony/service-contracts": "^1.1|^2|^3" }, "conflict": { - "symfony/console": "<4.4", - "symfony/http-foundation": "<5.3" + "symfony/console": "<5.4", + "symfony/http-foundation": "<5.4", + "symfony/security-core": "<6.0" }, "require-dev": { - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/mailer": "^4.4|^5.0|^6.0", - "symfony/messenger": "^4.4|^5.0|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0", - "symfony/security-core": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "symfony/console": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/mailer": "^5.4|^6.0", + "symfony/messenger": "^5.4|^6.0", + "symfony/mime": "^5.4|^6.0", + "symfony/security-core": "^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "suggest": { "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings.", @@ -9151,7 +8546,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v5.4.22" + "source": "https://github.com/symfony/monolog-bridge/tree/v6.2.8" }, "funding": [ { @@ -9167,7 +8562,7 @@ "type": "tidelift" } ], - "time": "2023-03-06T21:29:33+00:00" + "time": "2023-03-09T16:20:02+00:00" }, { "name": "symfony/monolog-bundle", @@ -9252,23 +8647,21 @@ }, { "name": "symfony/options-resolver", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9" + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", - "reference": "4fe5cf6ede71096839f0e4b4444d65dd3a7c1eb9", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/aa0e85b53bbb2b4951960efd61d295907eacd629", + "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.1|^3" }, "type": "library", "autoload": { @@ -9301,7 +8694,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.21" + "source": "https://github.com/symfony/options-resolver/tree/v6.2.7" }, "funding": [ { @@ -9317,32 +8710,31 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/password-hasher", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/password-hasher.git", - "reference": "7ce4529b2b2ea7de3b6f344a1a41f58201999180" + "reference": "67820d8570bf1c2c2cd87cb76d9d12a9d52ab808" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/password-hasher/zipball/7ce4529b2b2ea7de3b6f344a1a41f58201999180", - "reference": "7ce4529b2b2ea7de3b6f344a1a41f58201999180", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/67820d8570bf1c2c2cd87cb76d9d12a9d52ab808", + "reference": "67820d8570bf1c2c2cd87cb76d9d12a9d52ab808", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "php": ">=8.1" }, "conflict": { - "symfony/security-core": "<5.3" + "symfony/security-core": "<5.4" }, "require-dev": { - "symfony/console": "^5.3|^6.0", - "symfony/security-core": "^5.3|^6.0" + "symfony/console": "^5.4|^6.0", + "symfony/security-core": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -9374,7 +8766,7 @@ "password" ], "support": { - "source": "https://github.com/symfony/password-hasher/tree/v5.4.21" + "source": "https://github.com/symfony/password-hasher/tree/v6.2.7" }, "funding": [ { @@ -9390,7 +8782,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/polyfill-ctype", @@ -9972,85 +9364,6 @@ ], "time": "2022-11-03T14:55:06+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.27.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.27-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.27.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": "2022-11-03T14:55:06+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.27.0", @@ -10135,22 +9448,28 @@ "time": "2022-11-03T14:55:06+00:00" }, { - "name": "symfony/polyfill-php81", + "name": "symfony/polyfill-uuid", "version": "v1.27.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a" + "url": "https://github.com/symfony/polyfill-uuid.git", + "reference": "f3cf1a645c2734236ed1e2e671e273eeb3586166" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a", - "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/f3cf1a645c2734236ed1e2e671e273eeb3586166", + "reference": "f3cf1a645c2734236ed1e2e671e273eeb3586166", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-uuid": "*" + }, + "suggest": { + "ext-uuid": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -10166,11 +9485,8 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] + "Symfony\\Polyfill\\Uuid\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -10178,24 +9494,24 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "description": "Symfony polyfill for uuid functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", "polyfill", "portable", - "shim" + "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.27.0" }, "funding": [ { @@ -10215,21 +9531,20 @@ }, { "name": "symfony/process", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64" + "reference": "b34cdbc9c5e75d45a3703e63a48ad07aafa8bf2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/e3c46cc5689c8782944274bb30702106ecbe3b64", - "reference": "e3c46cc5689c8782944274bb30702106ecbe3b64", + "url": "https://api.github.com/repos/symfony/process/zipball/b34cdbc9c5e75d45a3703e63a48ad07aafa8bf2e", + "reference": "b34cdbc9c5e75d45a3703e63a48ad07aafa8bf2e", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -10257,7 +9572,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.24" + "source": "https://github.com/symfony/process/tree/v6.2.10" }, "funding": [ { @@ -10273,30 +9588,29 @@ "type": "tidelift" } ], - "time": "2023-05-17T11:26:05+00:00" + "time": "2023-04-18T13:56:57+00:00" }, { "name": "symfony/property-access", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "ffee082889586b5718347b291e04071f4d07b38f" + "reference": "2ad1e0a07b8cab3e09905659d14f3b248e916374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/ffee082889586b5718347b291e04071f4d07b38f", - "reference": "ffee082889586b5718347b291e04071f4d07b38f", + "url": "https://api.github.com/repos/symfony/property-access/zipball/2ad1e0a07b8cab3e09905659d14f3b248e916374", + "reference": "2ad1e0a07b8cab3e09905659d14f3b248e916374", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16", - "symfony/property-info": "^5.2|^6.0" + "symfony/property-info": "^5.4|^6.0" }, "require-dev": { - "symfony/cache": "^4.4|^5.0|^6.0" + "symfony/cache": "^5.4|^6.0" }, "suggest": { "psr/cache-implementation": "To cache access methods." @@ -10338,7 +9652,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v5.4.22" + "source": "https://github.com/symfony/property-access/tree/v6.2.8" }, "funding": [ { @@ -10354,40 +9668,38 @@ "type": "tidelift" } ], - "time": "2023-03-14T14:59:20+00:00" + "time": "2023-03-14T15:00:05+00:00" }, { "name": "symfony/property-info", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "d43b85b00699b4484964c297575b5c6f9dc5f6e1" + "reference": "617177c24e1a92e011851948ba973758429a68b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/d43b85b00699b4484964c297575b5c6f9dc5f6e1", - "reference": "d43b85b00699b4484964c297575b5c6f9dc5f6e1", + "url": "https://api.github.com/repos/symfony/property-info/zipball/617177c24e1a92e011851948ba973758429a68b2", + "reference": "617177c24e1a92e011851948ba973758429a68b2", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16", - "symfony/string": "^5.1|^6.0" + "php": ">=8.1", + "symfony/string": "^5.4|^6.0" }, "conflict": { - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/dependency-injection": "<4.4" + "phpdocumentor/reflection-docblock": "<5.2", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/dependency-injection": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.10.4|^2", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "phpdocumentor/reflection-docblock": "^5.2", "phpstan/phpdoc-parser": "^1.0", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/serializer": "^4.4|^5.0|^6.0" + "symfony/cache": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0" }, "suggest": { "phpdocumentor/reflection-docblock": "To use the PHPDoc", @@ -10429,7 +9741,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v5.4.24" + "source": "https://github.com/symfony/property-info/tree/v6.2.10" }, "funding": [ { @@ -10445,30 +9757,29 @@ "type": "tidelift" } ], - "time": "2023-05-15T20:11:03+00:00" + "time": "2023-04-18T13:46:08+00:00" }, { "name": "symfony/proxy-manager-bridge", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "a4cf96f3acfa252503a216bea877478f9621c7c0" + "reference": "534119513ce1d06faa6d55b6717f237e980b4e91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/a4cf96f3acfa252503a216bea877478f9621c7c0", - "reference": "a4cf96f3acfa252503a216bea877478f9621c7c0", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/534119513ce1d06faa6d55b6717f237e980b4e91", + "reference": "534119513ce1d06faa6d55b6717f237e980b4e91", "shasum": "" }, "require": { "friendsofphp/proxy-manager-lts": "^1.0.2", - "php": ">=7.2.5", - "symfony/dependency-injection": "^5.0|^6.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/dependency-injection": "^6.2" }, "require-dev": { - "symfony/config": "^4.4|^5.0|^6.0" + "symfony/config": "^6.1" }, "type": "symfony-bridge", "autoload": { @@ -10496,7 +9807,7 @@ "description": "Provides integration for ProxyManager with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/proxy-manager-bridge/tree/v5.4.21" + "source": "https://github.com/symfony/proxy-manager-bridge/tree/v6.2.7" }, "funding": [ { @@ -10512,7 +9823,7 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:33:00+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -10604,25 +9915,28 @@ }, { "name": "symfony/rate-limiter", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/rate-limiter.git", - "reference": "342acb2d23f6012f6150e7a8b167bf9cd931c0f8" + "reference": "e82784d6a8d64a33f44a8acfd703327a32831533" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/rate-limiter/zipball/342acb2d23f6012f6150e7a8b167bf9cd931c0f8", - "reference": "342acb2d23f6012f6150e7a8b167bf9cd931c0f8", + "url": "https://api.github.com/repos/symfony/rate-limiter/zipball/e82784d6a8d64a33f44a8acfd703327a32831533", + "reference": "e82784d6a8d64a33f44a8acfd703327a32831533", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/lock": "^5.2|^6.0", - "symfony/options-resolver": "^5.1|^6.0" + "php": ">=8.1", + "symfony/options-resolver": "^5.4|^6.0" }, "require-dev": { - "psr/cache": "^1.0|^2.0|^3.0" + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/lock": "^5.4|^6.0" + }, + "suggest": { + "symfony/lock": "For preventing race conditions in rate limiters" }, "type": "library", "autoload": { @@ -10654,7 +9968,7 @@ "rate-limiter" ], "support": { - "source": "https://github.com/symfony/rate-limiter/tree/v5.4.21" + "source": "https://github.com/symfony/rate-limiter/tree/v6.2.7" }, "funding": [ { @@ -10670,41 +9984,39 @@ "type": "tidelift" } ], - "time": "2023-02-21T19:46:44+00:00" + "time": "2023-02-24T10:42:00+00:00" }, { "name": "symfony/routing", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "c2ac11eb34947999b7c38fb4c835a57306907e6d" + "reference": "69062e2823f03b82265d73a966999660f0e1e404" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/c2ac11eb34947999b7c38fb4c835a57306907e6d", - "reference": "c2ac11eb34947999b7c38fb4c835a57306907e6d", + "url": "https://api.github.com/repos/symfony/routing/zipball/69062e2823f03b82265d73a966999660f0e1e404", + "reference": "69062e2823f03b82265d73a966999660f0e1e404", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "conflict": { "doctrine/annotations": "<1.12", - "symfony/config": "<5.3", - "symfony/dependency-injection": "<4.4", - "symfony/yaml": "<4.4" + "symfony/config": "<6.2", + "symfony/dependency-injection": "<5.4", + "symfony/yaml": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.12|^2", "psr/log": "^1|^2|^3", - "symfony/config": "^5.3|^6.0", - "symfony/dependency-injection": "^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/yaml": "^4.4|^5.0|^6.0" + "symfony/config": "^6.2", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "symfony/config": "For using the all-in-one router or any loader", @@ -10744,7 +10056,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v5.4.22" + "source": "https://github.com/symfony/routing/tree/v6.2.8" }, "funding": [ { @@ -10760,36 +10072,35 @@ "type": "tidelift" } ], - "time": "2023-03-14T14:59:20+00:00" + "time": "2023-03-14T15:00:05+00:00" }, { "name": "symfony/runtime", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/runtime.git", - "reference": "4a78e519d40a3845437e29dc514959631badfed4" + "reference": "f8b0751b33888329be8f8f0481bb81d279ec4157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/runtime/zipball/4a78e519d40a3845437e29dc514959631badfed4", - "reference": "4a78e519d40a3845437e29dc514959631badfed4", + "url": "https://api.github.com/repos/symfony/runtime/zipball/f8b0751b33888329be8f8f0481bb81d279ec4157", + "reference": "f8b0751b33888329be8f8f0481bb81d279ec4157", "shasum": "" }, "require": { "composer-plugin-api": "^1.0|^2.0", - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15" + "php": ">=8.1" }, "conflict": { - "symfony/dotenv": "<5.1" + "symfony/dotenv": "<5.4" }, "require-dev": { "composer/composer": "^1.0.2|^2.0", - "symfony/console": "^4.4.30|^5.3.7|^6.0", - "symfony/dotenv": "^5.1|^6.0", - "symfony/http-foundation": "^4.4.30|^5.3.7|^6.0", - "symfony/http-kernel": "^4.4.30|^5.3.7|^6.0" + "symfony/console": "^5.4|^6.0", + "symfony/dotenv": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0" }, "type": "composer-plugin", "extra": { @@ -10824,7 +10135,7 @@ "runtime" ], "support": { - "source": "https://github.com/symfony/runtime/tree/v5.4.22" + "source": "https://github.com/symfony/runtime/tree/v6.2.8" }, "funding": [ { @@ -10840,64 +10151,62 @@ "type": "tidelift" } ], - "time": "2023-03-14T15:48:23+00:00" + "time": "2023-03-14T15:48:35+00:00" }, { "name": "symfony/security-bundle", - "version": "v5.4.22", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "36eddff8266126de032ab528417ad13eb43f6cb5" + "reference": "b12dcedbcf423ae6d34d79cfaa6791a21c90bd14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/36eddff8266126de032ab528417ad13eb43f6cb5", - "reference": "36eddff8266126de032ab528417ad13eb43f6cb5", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/b12dcedbcf423ae6d34d79cfaa6791a21c90bd14", + "reference": "b12dcedbcf423ae6d34d79cfaa6791a21c90bd14", "shasum": "" }, "require": { + "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^5.3|^6.0", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/event-dispatcher": "^5.1|^6.0", - "symfony/http-foundation": "^5.3|^6.0", - "symfony/http-kernel": "^5.3|^6.0", - "symfony/password-hasher": "^5.3|^6.0", - "symfony/polyfill-php80": "^1.16", - "symfony/security-core": "^5.4|^6.0", - "symfony/security-csrf": "^4.4|^5.0|^6.0", - "symfony/security-guard": "^5.3", - "symfony/security-http": "^5.4.20|~6.0.20|~6.1.12|^6.2.6" + "php": ">=8.1", + "symfony/config": "^6.1", + "symfony/dependency-injection": "^6.2", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/http-foundation": "^6.2", + "symfony/http-kernel": "^6.2", + "symfony/password-hasher": "^5.4|^6.0", + "symfony/security-core": "^6.2", + "symfony/security-csrf": "^5.4|^6.0", + "symfony/security-http": "^6.2.10" }, "conflict": { - "symfony/browser-kit": "<4.4", - "symfony/console": "<4.4", - "symfony/framework-bundle": "<4.4", - "symfony/ldap": "<5.1", - "symfony/twig-bundle": "<4.4" + "symfony/browser-kit": "<5.4", + "symfony/console": "<5.4", + "symfony/framework-bundle": "<5.4", + "symfony/ldap": "<5.4", + "symfony/twig-bundle": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.10.4|^2", - "symfony/asset": "^4.4|^5.0|^6.0", - "symfony/browser-kit": "^4.4|^5.0|^6.0", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/css-selector": "^4.4|^5.0|^6.0", - "symfony/dom-crawler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/form": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^5.3|^6.0", - "symfony/ldap": "^5.3|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/rate-limiter": "^5.2|^6.0", - "symfony/serializer": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", - "symfony/twig-bridge": "^4.4|^5.0|^6.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0", - "symfony/validator": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/asset": "^5.4|^6.0", + "symfony/browser-kit": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/dom-crawler": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/form": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/ldap": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/rate-limiter": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/twig-bridge": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, "type": "symfony-bundle", @@ -10926,7 +10235,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v5.4.22" + "source": "https://github.com/symfony/security-bundle/tree/v6.2.10" }, "funding": [ { @@ -10942,48 +10251,46 @@ "type": "tidelift" } ], - "time": "2023-03-10T10:02:45+00:00" + "time": "2023-04-21T15:49:06+00:00" }, { "name": "symfony/security-core", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "a801d525c7545332e2ddf7f52c163959354b1650" + "reference": "c141337bc7451f9a9e464733f1e536bf38d1d2fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/a801d525c7545332e2ddf7f52c163959354b1650", - "reference": "a801d525c7545332e2ddf7f52c163959354b1650", + "url": "https://api.github.com/repos/symfony/security-core/zipball/c141337bc7451f9a9e464733f1e536bf38d1d2fb", + "reference": "c141337bc7451f9a9e464733f1e536bf38d1d2fb", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", "symfony/event-dispatcher-contracts": "^1.1|^2|^3", - "symfony/password-hasher": "^5.3|^6.0", - "symfony/polyfill-php80": "^1.16", + "symfony/password-hasher": "^5.4|^6.0", "symfony/service-contracts": "^1.1.6|^2|^3" }, "conflict": { - "symfony/event-dispatcher": "<4.4", - "symfony/http-foundation": "<5.3", - "symfony/ldap": "<4.4", - "symfony/security-guard": "<4.4", - "symfony/validator": "<5.2" + "symfony/event-dispatcher": "<5.4", + "symfony/http-foundation": "<5.4", + "symfony/ldap": "<5.4", + "symfony/security-guard": "<5.4", + "symfony/validator": "<5.4" }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", - "psr/container": "^1.0|^2.0", + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^5.3|^6.0", - "symfony/ldap": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", - "symfony/validator": "^5.2|^6.0" + "symfony/cache": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/ldap": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0" }, "suggest": { "psr/container-implementation": "To instantiate the Security class", @@ -11019,7 +10326,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v5.4.22" + "source": "https://github.com/symfony/security-core/tree/v6.2.8" }, "funding": [ { @@ -11035,32 +10342,31 @@ "type": "tidelift" } ], - "time": "2023-03-10T10:02:45+00:00" + "time": "2023-03-10T10:06:03+00:00" }, { "name": "symfony/security-csrf", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "776a538e5f20fb560a182f790979c71455694203" + "reference": "6cce7efdce68e0670d2f19acebc21dcd0798e333" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/776a538e5f20fb560a182f790979c71455694203", - "reference": "776a538e5f20fb560a182f790979c71455694203", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/6cce7efdce68e0670d2f19acebc21dcd0798e333", + "reference": "6cce7efdce68e0670d2f19acebc21dcd0798e333", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16", - "symfony/security-core": "^4.4|^5.0|^6.0" + "php": ">=8.1", + "symfony/security-core": "^5.4|^6.0" }, "conflict": { - "symfony/http-foundation": "<5.3" + "symfony/http-foundation": "<5.4" }, "require-dev": { - "symfony/http-foundation": "^5.3|^6.0" + "symfony/http-foundation": "^5.4|^6.0" }, "suggest": { "symfony/http-foundation": "For using the class SessionTokenStorage." @@ -11091,7 +10397,7 @@ "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-csrf/tree/v5.4.21" + "source": "https://github.com/symfony/security-csrf/tree/v6.2.7" }, "funding": [ { @@ -11107,111 +10413,44 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:33:00+00:00" - }, - { - "name": "symfony/security-guard", - "version": "v5.4.22", - "source": { - "type": "git", - "url": "https://github.com/symfony/security-guard.git", - "reference": "62d064b1ee682e4617f4c5ddc0d31f73e1a7ecaa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/security-guard/zipball/62d064b1ee682e4617f4c5ddc0d31f73e1a7ecaa", - "reference": "62d064b1ee682e4617f4c5ddc0d31f73e1a7ecaa", - "shasum": "" - }, - "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.15", - "symfony/security-core": "^5.0", - "symfony/security-http": "^5.3" - }, - "require-dev": { - "psr/log": "^1|^2|^3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Security\\Guard\\": "" - }, - "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": "Symfony Security Component - Guard", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/security-guard/tree/v5.4.22" - }, - "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-03-06T21:29:33+00:00" + "time": "2023-02-16T09:57:23+00:00" }, { "name": "symfony/security-http", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "6791856229cc605834d169091981e4eae77dad45" + "reference": "c468f059fac27680acf7e84cea07ba5ffff8942a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/6791856229cc605834d169091981e4eae77dad45", - "reference": "6791856229cc605834d169091981e4eae77dad45", + "url": "https://api.github.com/repos/symfony/security-http/zipball/c468f059fac27680acf7e84cea07ba5ffff8942a", + "reference": "c468f059fac27680acf7e84cea07ba5ffff8942a", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-foundation": "^5.3|^6.0", - "symfony/http-kernel": "^5.3|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^6.2", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/property-access": "^4.4|^5.0|^6.0", - "symfony/security-core": "^5.4.19|~6.0.19|~6.1.11|^6.2.5" + "symfony/property-access": "^5.4|^6.0", + "symfony/security-core": "~6.0.19|~6.1.11|^6.2.5" }, "conflict": { - "symfony/event-dispatcher": "<4.3", - "symfony/security-bundle": "<5.3", - "symfony/security-csrf": "<4.4" + "symfony/event-dispatcher": "<5.4.9|>=6,<6.0.9", + "symfony/security-bundle": "<5.4", + "symfony/security-csrf": "<5.4" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/rate-limiter": "^5.2|^6.0", - "symfony/routing": "^4.4|^5.0|^6.0", - "symfony/security-csrf": "^4.4|^5.0|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0" + "symfony/cache": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/rate-limiter": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0", + "symfony/security-csrf": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0" }, "suggest": { "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", @@ -11243,7 +10482,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v5.4.23" + "source": "https://github.com/symfony/security-http/tree/v6.2.10" }, "funding": [ { @@ -11259,57 +10498,55 @@ "type": "tidelift" } ], - "time": "2023-04-21T11:34:27+00:00" + "time": "2023-04-21T11:56:14+00:00" }, { "name": "symfony/serializer", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "12535bb7b1d3b53802bf18d61a98bb1145fabcdb" + "reference": "0732edf0ad28dd3faacde4f1200ab9d7a4d5f40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/12535bb7b1d3b53802bf18d61a98bb1145fabcdb", - "reference": "12535bb7b1d3b53802bf18d61a98bb1145fabcdb", + "url": "https://api.github.com/repos/symfony/serializer/zipball/0732edf0ad28dd3faacde4f1200ab9d7a4d5f40d", + "reference": "0732edf0ad28dd3faacde4f1200ab9d7a4d5f40d", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { "doctrine/annotations": "<1.12", "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/dependency-injection": "<4.4", + "symfony/dependency-injection": "<5.4", "symfony/property-access": "<5.4", - "symfony/property-info": "<5.3.13", - "symfony/uid": "<5.3", - "symfony/yaml": "<4.4" + "symfony/property-info": "<5.4", + "symfony/uid": "<5.4", + "symfony/yaml": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.12|^2", "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", - "symfony/cache": "^4.4|^5.0|^6.0", - "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/filesystem": "^4.4|^5.0|^6.0", - "symfony/form": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0", + "symfony/cache": "^5.4|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/filesystem": "^5.4|^6.0", + "symfony/form": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/mime": "^5.4|^6.0", "symfony/property-access": "^5.4|^6.0", - "symfony/property-info": "^5.3.13|^6.0", - "symfony/uid": "^5.3|^6.0", - "symfony/validator": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0", - "symfony/var-exporter": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/property-info": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0", + "symfony/var-exporter": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "psr/cache-implementation": "For using the metadata cache.", @@ -11346,7 +10583,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v5.4.24" + "source": "https://github.com/symfony/serializer/tree/v6.2.10" }, "funding": [ { @@ -11362,26 +10599,25 @@ "type": "tidelift" } ], - "time": "2023-05-12T08:37:35+00:00" + "time": "2023-04-18T13:57:49+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "a8c9cedf55f314f3a186041d19537303766df09a" }, "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/a8c9cedf55f314f3a186041d19537303766df09a", + "reference": "a8c9cedf55f314f3a186041d19537303766df09a", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -11392,7 +10628,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -11402,7 +10638,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -11429,7 +10668,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" }, "funding": [ { @@ -11445,7 +10684,7 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/stimulus-bundle", @@ -11579,34 +10818,34 @@ }, { "name": "symfony/string", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62" + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", - "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", + "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", + "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", "shasum": "" }, "require": { - "php": ">=7.2.5", + "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", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.0" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/intl": "^6.2", + "symfony/translation-contracts": "^2.0|^3.0", + "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -11645,7 +10884,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.22" + "source": "https://github.com/symfony/string/tree/v6.2.8" }, "funding": [ { @@ -11661,54 +10900,55 @@ "type": "tidelift" } ], - "time": "2023-03-14T06:11:53+00:00" + "time": "2023-03-20T16:06:02+00:00" }, { "name": "symfony/translation", - "version": "v5.4.24", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "de237e59c5833422342be67402d487fbf50334ff" + "reference": "817535dbb1721df8b3a8f2489dc7e50bcd6209b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/de237e59c5833422342be67402d487fbf50334ff", - "reference": "de237e59c5833422342be67402d487fbf50334ff", + "url": "https://api.github.com/repos/symfony/translation/zipball/817535dbb1721df8b3a8f2489dc7e50bcd6209b5", + "reference": "817535dbb1721df8b3a8f2489dc7e50bcd6209b5", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/translation-contracts": "^2.3" + "symfony/translation-contracts": "^2.3|^3.0" }, "conflict": { - "symfony/config": "<4.4", - "symfony/console": "<5.3", - "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.3" + "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { + "nikic/php-parser": "^4.13", "psr/log": "^1|^2|^3", - "symfony/config": "^4.4|^5.0|^6.0", + "symfony/config": "^5.4|^6.0", "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^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.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^5.4|^6.0", "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/yaml": "^5.4|^6.0" }, "suggest": { + "nikic/php-parser": "To use PhpAstExtractor", "psr/log-implementation": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" @@ -11742,7 +10982,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v5.4.24" + "source": "https://github.com/symfony/translation/tree/v6.2.8" }, "funding": [ { @@ -11758,24 +10998,24 @@ "type": "tidelift" } ], - "time": "2023-05-19T12:34:17+00:00" + "time": "2023-03-31T09:14:44+00:00" }, { "name": "symfony/translation-contracts", - "version": "v2.5.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe" + "reference": "dfec258b9dd17a6b24420d464c43bffe347441c8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/136b19dd05cdf0709db6537d058bcab6dd6e2dbe", - "reference": "136b19dd05cdf0709db6537d058bcab6dd6e2dbe", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/dfec258b9dd17a6b24420d464c43bffe347441c8", + "reference": "dfec258b9dd17a6b24420d464c43bffe347441c8", "shasum": "" }, "require": { - "php": ">=7.2.5" + "php": ">=8.1" }, "suggest": { "symfony/translation-implementation": "" @@ -11783,7 +11023,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -11793,7 +11033,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -11820,7 +11063,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/translation-contracts/tree/v3.2.1" }, "funding": [ { @@ -11836,65 +11079,67 @@ "type": "tidelift" } ], - "time": "2022-06-27T16:58:25+00:00" + "time": "2023-03-01T10:32:47+00:00" }, { "name": "symfony/twig-bridge", - "version": "v5.4.22", + "version": "v6.2.8", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "e5b174464f68be6876046db3ad6e217d9a7dbbac" + "reference": "30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/e5b174464f68be6876046db3ad6e217d9a7dbbac", - "reference": "e5b174464f68be6876046db3ad6e217d9a7dbbac", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927", + "reference": "30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16", + "php": ">=8.1", "symfony/translation-contracts": "^1.1|^2|^3", "twig/twig": "^2.13|^3.0.4" }, "conflict": { "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", - "symfony/console": "<5.3", - "symfony/form": "<5.4.21|>=6,<6.2.7", - "symfony/http-foundation": "<5.3", - "symfony/http-kernel": "<4.4", - "symfony/translation": "<5.2", - "symfony/workflow": "<5.2" + "symfony/console": "<5.4", + "symfony/form": "<6.2.7", + "symfony/http-foundation": "<5.4", + "symfony/http-kernel": "<6.2", + "symfony/mime": "<6.2", + "symfony/translation": "<5.4", + "symfony/workflow": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.12|^2", "egulias/email-validator": "^2.1.10|^3|^4", + "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/asset": "^4.4|^5.0|^6.0", - "symfony/console": "^5.3|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/form": "^5.4.21|^6.2.7", - "symfony/http-foundation": "^5.3|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", - "symfony/mime": "^5.2|^6.0", + "symfony/asset": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/form": "^6.2.7", + "symfony/html-sanitizer": "^6.1", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^6.2", + "symfony/intl": "^5.4|^6.0", + "symfony/mime": "^6.2", "symfony/polyfill-intl-icu": "~1.0", - "symfony/property-info": "^4.4|^5.1|^6.0", - "symfony/routing": "^4.4|^5.0|^6.0", + "symfony/property-info": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0", "symfony/security-acl": "^2.8|^3.0", - "symfony/security-core": "^4.4|^5.0|^6.0", - "symfony/security-csrf": "^4.4|^5.0|^6.0", - "symfony/security-http": "^4.4|^5.0|^6.0", - "symfony/serializer": "^5.2|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0", - "symfony/translation": "^5.2|^6.0", - "symfony/web-link": "^4.4|^5.0|^6.0", - "symfony/workflow": "^5.2|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0", + "symfony/security-core": "^5.4|^6.0", + "symfony/security-csrf": "^5.4|^6.0", + "symfony/security-http": "^5.4|^6.0", + "symfony/serializer": "^6.2", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/web-link": "^5.4|^6.0", + "symfony/workflow": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0", "twig/cssinliner-extra": "^2.12|^3", "twig/inky-extra": "^2.12|^3", "twig/markdown-extra": "^2.12|^3" @@ -11904,6 +11149,7 @@ "symfony/expression-language": "For using the ExpressionExtension", "symfony/finder": "", "symfony/form": "For using the FormExtension", + "symfony/html-sanitizer": "For using the HtmlSanitizerExtension", "symfony/http-kernel": "For using the HttpKernelExtension", "symfony/routing": "For using the RoutingExtension", "symfony/security-core": "For using the SecurityExtension", @@ -11941,7 +11187,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v5.4.22" + "source": "https://github.com/symfony/twig-bridge/tree/v6.2.8" }, "funding": [ { @@ -11957,52 +11203,48 @@ "type": "tidelift" } ], - "time": "2023-03-31T08:28:44+00:00" + "time": "2023-03-31T09:14:44+00:00" }, { "name": "symfony/twig-bundle", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "875d0edfc8df7505c1993419882c4071fc28c477" + "reference": "8bb562655c6ae4b8fae9cf72077591f38b961566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/875d0edfc8df7505c1993419882c4071fc28c477", - "reference": "875d0edfc8df7505c1993419882c4071fc28c477", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/8bb562655c6ae4b8fae9cf72077591f38b961566", + "reference": "8bb562655c6ae4b8fae9cf72077591f38b961566", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^5.0|^6.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/twig-bridge": "^5.3|^6.0", + "composer-runtime-api": ">=2.1", + "php": ">=8.1", + "symfony/config": "^6.1", + "symfony/dependency-injection": "^6.1", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^6.2", + "symfony/twig-bridge": "^6.2", "twig/twig": "^2.13|^3.0.4" }, "conflict": { - "symfony/dependency-injection": "<5.3", - "symfony/framework-bundle": "<5.0", - "symfony/service-contracts": ">=3.0", - "symfony/translation": "<5.0" + "symfony/framework-bundle": "<5.4", + "symfony/translation": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.10.4|^2", - "doctrine/cache": "^1.0|^2.0", - "symfony/asset": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^5.3|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/form": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^5.0|^6.0", - "symfony/routing": "^4.4|^5.0|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0", - "symfony/translation": "^5.0|^6.0", - "symfony/web-link": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/asset": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/form": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/web-link": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "type": "symfony-bundle", "autoload": { @@ -12030,7 +11272,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v5.4.21" + "source": "https://github.com/symfony/twig-bundle/tree/v6.2.7" }, "funding": [ { @@ -12046,7 +11288,81 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-14T08:44:56+00:00" + }, + { + "name": "symfony/uid", + "version": "v6.2.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/uid.git", + "reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/uid/zipball/d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0", + "reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-uuid": "^1.15" + }, + "require-dev": { + "symfony/console": "^5.4|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Uid\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to generate and represent UIDs", + "homepage": "https://symfony.com", + "keywords": [ + "UID", + "ulid", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/uid/tree/v6.2.7" + }, + "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-02-14T08:44:56+00:00" }, { "name": "symfony/ux-turbo", @@ -12146,59 +11462,55 @@ }, { "name": "symfony/validator", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "47794a3cb530e01593ecad9856ba80f5c011e36b" + "reference": "c02ea86844926f04247bc1f5db5f85bb53330823" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/47794a3cb530e01593ecad9856ba80f5c011e36b", - "reference": "47794a3cb530e01593ecad9856ba80f5c011e36b", + "url": "https://api.github.com/repos/symfony/validator/zipball/c02ea86844926f04247bc1f5db5f85bb53330823", + "reference": "c02ea86844926f04247bc1f5db5f85bb53330823", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/deprecation-contracts": "^2.1|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "~1.0", - "symfony/polyfill-php80": "^1.16", - "symfony/polyfill-php81": "^1.22", "symfony/translation-contracts": "^1.1|^2|^3" }, "conflict": { "doctrine/annotations": "<1.13", - "doctrine/cache": "<1.11", "doctrine/lexer": "<1.1", - "symfony/dependency-injection": "<4.4", - "symfony/expression-language": "<5.1", - "symfony/http-kernel": "<4.4", - "symfony/intl": "<4.4", - "symfony/property-info": "<5.3", - "symfony/translation": "<4.4", - "symfony/yaml": "<4.4" + "phpunit/phpunit": "<5.4.3", + "symfony/dependency-injection": "<5.4", + "symfony/expression-language": "<5.4", + "symfony/http-kernel": "<5.4", + "symfony/intl": "<5.4", + "symfony/property-info": "<5.4", + "symfony/translation": "<5.4", + "symfony/yaml": "<5.4" }, "require-dev": { "doctrine/annotations": "^1.13|^2", - "doctrine/cache": "^1.11|^2.0", "egulias/email-validator": "^2.1.10|^3|^4", - "symfony/cache": "^4.4|^5.0|^6.0", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^5.1|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/intl": "^4.4|^5.0|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0", - "symfony/property-access": "^4.4|^5.0|^6.0", - "symfony/property-info": "^5.3|^6.0", - "symfony/translation": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0" + "symfony/cache": "^5.4|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/finder": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/intl": "^5.4|^6.0", + "symfony/mime": "^5.4|^6.0", + "symfony/property-access": "^5.4|^6.0", + "symfony/property-info": "^5.4|^6.0", + "symfony/translation": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "egulias/email-validator": "Strict (RFC compliant) email validation", @@ -12238,7 +11550,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v5.4.24" + "source": "https://github.com/symfony/validator/tree/v6.2.10" }, "funding": [ { @@ -12254,35 +11566,35 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:05:00+00:00" + "time": "2023-04-19T09:54:16+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.4.24", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "8e12706bf9c68a2da633f23bfdc15b4dce5970b3" + "reference": "41a750a23412ca76fdbbf5096943b4134272c1ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/8e12706bf9c68a2da633f23bfdc15b4dce5970b3", - "reference": "8e12706bf9c68a2da633f23bfdc15b4dce5970b3", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/41a750a23412ca76fdbbf5096943b4134272c1ab", + "reference": "41a750a23412ca76fdbbf5096943b4134272c1ab", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/console": "<4.4" + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/uid": "^5.1|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0", + "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, "suggest": { @@ -12326,7 +11638,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.24" + "source": "https://github.com/symfony/var-dumper/tree/v6.2.10" }, "funding": [ { @@ -12342,7 +11654,7 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:05:00+00:00" + "time": "2023-04-18T13:46:08+00:00" }, { "name": "symfony/var-exporter", @@ -12420,31 +11732,30 @@ }, { "name": "symfony/web-link", - "version": "v5.4.21", + "version": "v6.2.7", "source": { "type": "git", "url": "https://github.com/symfony/web-link.git", - "reference": "57c03a5e89ed7c2d7a1a09258dfec12f95f95adb" + "reference": "410aac2034608ac661cdca1968e3c56d4164abc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-link/zipball/57c03a5e89ed7c2d7a1a09258dfec12f95f95adb", - "reference": "57c03a5e89ed7c2d7a1a09258dfec12f95f95adb", + "url": "https://api.github.com/repos/symfony/web-link/zipball/410aac2034608ac661cdca1968e3c56d4164abc8", + "reference": "410aac2034608ac661cdca1968e3c56d4164abc8", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/link": "^1.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "psr/link": "^1.1|^2.0" }, "conflict": { - "symfony/http-kernel": "<5.3" + "symfony/http-kernel": "<5.4" }, "provide": { - "psr/link-implementation": "1.0" + "psr/link-implementation": "1.0|2.0" }, "require-dev": { - "symfony/http-kernel": "^5.3|^6.0" + "symfony/http-kernel": "^5.4|^6.0" }, "suggest": { "symfony/http-kernel": "" @@ -12487,7 +11798,7 @@ "push" ], "support": { - "source": "https://github.com/symfony/web-link/tree/v5.4.21" + "source": "https://github.com/symfony/web-link/tree/v6.2.7" }, "funding": [ { @@ -12503,7 +11814,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-14T08:44:56+00:00" }, { "name": "symfony/webpack-encore-bundle", @@ -12580,28 +11891,27 @@ }, { "name": "symfony/yaml", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b" + "reference": "61916f3861b1e9705b18cfde723921a71dd1559d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4cd2e3ea301aadd76a4172756296fe552fb45b0b", - "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/61916f3861b1e9705b18cfde723921a71dd1559d", + "reference": "61916f3861b1e9705b18cfde723921a71dd1559d", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.3" + "symfony/console": "<5.4" }, "require-dev": { - "symfony/console": "^5.3|^6.0" + "symfony/console": "^5.4|^6.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -12635,7 +11945,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.23" + "source": "https://github.com/symfony/yaml/tree/v6.2.10" }, "funding": [ { @@ -12651,7 +11961,7 @@ "type": "tidelift" } ], - "time": "2023-04-23T19:33:36+00:00" + "time": "2023-04-28T13:25:36+00:00" }, { "name": "tecnickcom/tc-lib-barcode", @@ -12822,145 +12132,6 @@ ], "time": "2023-05-18T08:09:02+00:00" }, - { - "name": "thecodingmachine/safe", - "version": "v1.3.3", - "source": { - "type": "git", - "url": "https://github.com/thecodingmachine/safe.git", - "reference": "a8ab0876305a4cdaef31b2350fcb9811b5608dbc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/a8ab0876305a4cdaef31b2350fcb9811b5608dbc", - "reference": "a8ab0876305a4cdaef31b2350fcb9811b5608dbc", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "require-dev": { - "phpstan/phpstan": "^0.12", - "squizlabs/php_codesniffer": "^3.2", - "thecodingmachine/phpstan-strict-rules": "^0.12" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.1-dev" - } - }, - "autoload": { - "files": [ - "deprecated/apc.php", - "deprecated/libevent.php", - "deprecated/mssql.php", - "deprecated/stats.php", - "lib/special_cases.php", - "generated/apache.php", - "generated/apcu.php", - "generated/array.php", - "generated/bzip2.php", - "generated/calendar.php", - "generated/classobj.php", - "generated/com.php", - "generated/cubrid.php", - "generated/curl.php", - "generated/datetime.php", - "generated/dir.php", - "generated/eio.php", - "generated/errorfunc.php", - "generated/exec.php", - "generated/fileinfo.php", - "generated/filesystem.php", - "generated/filter.php", - "generated/fpm.php", - "generated/ftp.php", - "generated/funchand.php", - "generated/gmp.php", - "generated/gnupg.php", - "generated/hash.php", - "generated/ibase.php", - "generated/ibmDb2.php", - "generated/iconv.php", - "generated/image.php", - "generated/imap.php", - "generated/info.php", - "generated/ingres-ii.php", - "generated/inotify.php", - "generated/json.php", - "generated/ldap.php", - "generated/libxml.php", - "generated/lzf.php", - "generated/mailparse.php", - "generated/mbstring.php", - "generated/misc.php", - "generated/msql.php", - "generated/mysql.php", - "generated/mysqli.php", - "generated/mysqlndMs.php", - "generated/mysqlndQc.php", - "generated/network.php", - "generated/oci8.php", - "generated/opcache.php", - "generated/openssl.php", - "generated/outcontrol.php", - "generated/password.php", - "generated/pcntl.php", - "generated/pcre.php", - "generated/pdf.php", - "generated/pgsql.php", - "generated/posix.php", - "generated/ps.php", - "generated/pspell.php", - "generated/readline.php", - "generated/rpminfo.php", - "generated/rrd.php", - "generated/sem.php", - "generated/session.php", - "generated/shmop.php", - "generated/simplexml.php", - "generated/sockets.php", - "generated/sodium.php", - "generated/solr.php", - "generated/spl.php", - "generated/sqlsrv.php", - "generated/ssdeep.php", - "generated/ssh2.php", - "generated/stream.php", - "generated/strings.php", - "generated/swoole.php", - "generated/uodbc.php", - "generated/uopz.php", - "generated/url.php", - "generated/var.php", - "generated/xdiff.php", - "generated/xml.php", - "generated/xmlrpc.php", - "generated/yaml.php", - "generated/yaz.php", - "generated/zip.php", - "generated/zlib.php" - ], - "psr-4": { - "Safe\\": [ - "lib/", - "deprecated/", - "generated/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHP core functions that throw exceptions instead of returning FALSE on error", - "support": { - "issues": "https://github.com/thecodingmachine/safe/issues", - "source": "https://github.com/thecodingmachine/safe/tree/v1.3.3" - }, - "time": "2020-10-28T17:51:34+00:00" - }, { "name": "tijsverkoyen/css-to-inline-styles", "version": "2.2.6", @@ -13551,25 +12722,43 @@ }, { "name": "web-auth/cose-lib", - "version": "v3.3.12", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/web-auth/cose-lib.git", - "reference": "efa6ec2ba4e840bc1316a493973c9916028afeeb" + "reference": "9e0cc49810b445ed0aa50d122ee82c63882af9a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/efa6ec2ba4e840bc1316a493973c9916028afeeb", - "reference": "efa6ec2ba4e840bc1316a493973c9916028afeeb", + "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/9e0cc49810b445ed0aa50d122ee82c63882af9a0", + "reference": "9e0cc49810b445ed0aa50d122ee82c63882af9a0", "shasum": "" }, "require": { - "beberlei/assert": "^3.2", + "brick/math": "^0.9|^0.10|^0.11", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", - "fgrosse/phpasn1": "^2.1", - "php": ">=7.2" + "php": ">=8.1", + "spomky-labs/pki-framework": "^1.0" + }, + "require-dev": { + "ekino/phpstan-banned-code": "^1.0", + "infection/infection": "^0.26.12", + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/phpstan": "^1.7", + "phpstan/phpstan-deprecation-rules": "^1.0", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.2", + "phpunit/phpunit": "^10.0", + "qossmic/deptrac-shim": "^1.0", + "rector/rector": "^0.15", + "symfony/phpunit-bridge": "^6.1", + "symplify/easy-coding-standard": "^11.0" + }, + "suggest": { + "ext-bcmath": "For better performance, please install either GMP (recommended) or BCMath extension", + "ext-gmp": "For better performance, please install either GMP (recommended) or BCMath extension" }, "type": "library", "autoload": { @@ -13598,7 +12787,8 @@ "RFC8152" ], "support": { - "source": "https://github.com/web-auth/cose-lib/tree/v3.3.12" + "issues": "https://github.com/web-auth/cose-lib/issues", + "source": "https://github.com/web-auth/cose-lib/tree/4.2.0" }, "funding": [ { @@ -13610,32 +12800,38 @@ "type": "patreon" } ], - "time": "2021-12-04T12:13:35+00:00" + "time": "2023-02-28T18:05:22+00:00" }, { "name": "web-auth/metadata-service", - "version": "v3.3.12", + "version": "4.5.2", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-metadata-service.git", - "reference": "ef40d2b7b68c4964247d13fab52e2fa8dbd65246" + "reference": "82b3a517894987db1f8959a9320b9891515af9e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/ef40d2b7b68c4964247d13fab52e2fa8dbd65246", - "reference": "ef40d2b7b68c4964247d13fab52e2fa8dbd65246", + "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/82b3a517894987db1f8959a9320b9891515af9e7", + "reference": "82b3a517894987db1f8959a9320b9891515af9e7", "shasum": "" }, "require": { - "beberlei/assert": "^3.2", "ext-json": "*", - "league/uri": "^6.0", - "php": ">=7.2", + "lcobucci/clock": "^2.2|^3.0", + "paragonie/constant_time_encoding": "^2.6", + "php": ">=8.1", + "psr/clock": "^1.0", + "psr/event-dispatcher": "^1.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/log": "^1.1" + "psr/log": "^1.0|^2.0|^3.0", + "spomky-labs/pki-framework": "^1.0", + "symfony/deprecation-contracts": "^3.2" }, "suggest": { + "psr/clock-implementation": "As of 4.5.x, the PSR Clock implementation will replace lcobucci/clock", + "psr/log-implementation": "Recommended to receive logs from the library", "web-token/jwt-key-mgmt": "Mandatory for fetching Metadata Statement from distant sources", "web-token/jwt-signature-algorithm-ecdsa": "Mandatory for fetching Metadata Statement from distant sources" }, @@ -13667,7 +12863,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-metadata-service/tree/v3.3.12" + "source": "https://github.com/web-auth/webauthn-metadata-service/tree/4.5.2" }, "funding": [ { @@ -13679,43 +12875,43 @@ "type": "patreon" } ], - "time": "2021-11-21T11:14:31+00:00" + "time": "2023-01-22T17:02:25+00:00" }, { "name": "web-auth/webauthn-lib", - "version": "v3.3.12", + "version": "4.5.2", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-lib.git", - "reference": "5ef9b21c8e9f8a817e524ac93290d08a9f065b33" + "reference": "30c5e891c6418abef6d87a4351132b01b1828a98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/5ef9b21c8e9f8a817e524ac93290d08a9f065b33", - "reference": "5ef9b21c8e9f8a817e524ac93290d08a9f065b33", + "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/30c5e891c6418abef6d87a4351132b01b1828a98", + "reference": "30c5e891c6418abef6d87a4351132b01b1828a98", "shasum": "" }, "require": { - "beberlei/assert": "^3.2", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", - "fgrosse/phpasn1": "^2.1", - "php": ">=7.2", + "paragonie/constant_time_encoding": "^2.6", + "php": ">=8.1", + "psr/event-dispatcher": "^1.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "psr/http-message": "^1.0", - "psr/log": "^1.1", - "ramsey/uuid": "^3.8|^4.0", - "spomky-labs/base64url": "^2.0", - "spomky-labs/cbor-php": "^1.0|^2.0", - "symfony/process": "^3.0|^4.0|^5.0", - "thecodingmachine/safe": "^1.1", - "web-auth/cose-lib": "self.version", + "psr/log": "^1.0|^2.0|^3.0", + "spomky-labs/cbor-php": "^3.0", + "symfony/uid": "^6.1", + "web-auth/cose-lib": "^4.0.12", "web-auth/metadata-service": "self.version" }, + "require-dev": { + "symfony/event-dispatcher": "^6.1" + }, "suggest": { "psr/log-implementation": "Recommended to receive logs from the library", + "symfony/event-dispatcher": "Recommended to use dispatched events", "web-token/jwt-key-mgmt": "Mandatory for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-ecdsa": "Recommended for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-eddsa": "Recommended for the AndroidSafetyNet Attestation Statement support", @@ -13749,7 +12945,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-lib/tree/v3.3.12" + "source": "https://github.com/web-auth/webauthn-lib/tree/4.5.2" }, "funding": [ { @@ -13761,29 +12957,39 @@ "type": "patreon" } ], - "time": "2022-02-18T07:13:44+00:00" + "time": "2023-05-12T18:26:01+00:00" }, { "name": "web-auth/webauthn-symfony-bundle", - "version": "v3.3.12", + "version": "4.5.2", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-symfony-bundle.git", - "reference": "15f2091dc351f190d27a377a0dbbc117e6be5329" + "reference": "753854e2b3c4b5a61febe63b802739bd9f6e7143" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-symfony-bundle/zipball/15f2091dc351f190d27a377a0dbbc117e6be5329", - "reference": "15f2091dc351f190d27a377a0dbbc117e6be5329", + "url": "https://api.github.com/repos/web-auth/webauthn-symfony-bundle/zipball/753854e2b3c4b5a61febe63b802739bd9f6e7143", + "reference": "753854e2b3c4b5a61febe63b802739bd9f6e7143", "shasum": "" }, "require": { - "spomky-labs/cbor-bundle": "^2.0", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", + "nyholm/psr7": "^1.5", + "php": ">=8.1", + "psr/event-dispatcher": "^1.0", + "spomky-labs/cbor-bundle": "^3.0", + "symfony/config": "^6.1", + "symfony/dependency-injection": "^6.1", + "symfony/framework-bundle": "^6.1", + "symfony/http-client": "^6.1", + "symfony/psr-http-message-bridge": "^2.1", + "symfony/security-bundle": "^6.1", + "symfony/security-core": "^6.1", + "symfony/security-http": "^6.1", + "symfony/serializer": "^6.1", + "symfony/validator": "^6.1", "web-auth/webauthn-lib": "self.version", - "web-token/jwt-signature": "^2.0.9" + "web-token/jwt-signature": "^3.1" }, "type": "symfony-bundle", "autoload": { @@ -13813,7 +13019,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-symfony-bundle/tree/v3.3.12" + "source": "https://github.com/web-auth/webauthn-symfony-bundle/tree/4.5.2" }, "funding": [ { @@ -13825,29 +13031,29 @@ "type": "patreon" } ], - "time": "2021-11-21T11:14:31+00:00" + "time": "2023-01-24T19:32:30+00:00" }, { "name": "web-token/jwt-core", - "version": "v2.2.11", + "version": "3.2.7", "source": { "type": "git", "url": "https://github.com/web-token/jwt-core.git", - "reference": "53beb6f6c1eec4fa93c1c3e5d9e5701e71fa1678" + "reference": "db58b6ebbe1a7d5869688e989b1cf110c6ab888f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-core/zipball/53beb6f6c1eec4fa93c1c3e5d9e5701e71fa1678", - "reference": "53beb6f6c1eec4fa93c1c3e5d9e5701e71fa1678", + "url": "https://api.github.com/repos/web-token/jwt-core/zipball/db58b6ebbe1a7d5869688e989b1cf110c6ab888f", + "reference": "db58b6ebbe1a7d5869688e989b1cf110c6ab888f", "shasum": "" }, "require": { - "brick/math": "^0.8.17|^0.9", + "brick/math": "^0.9|^0.10|^0.11", "ext-json": "*", "ext-mbstring": "*", - "fgrosse/phpasn1": "^2.0", - "php": ">=7.2", - "spomky-labs/base64url": "^1.0|^2.0" + "paragonie/constant_time_encoding": "^2.4", + "php": ">=8.1", + "spomky-labs/pki-framework": "^1.0" }, "conflict": { "spomky-labs/jose": "*" @@ -13893,7 +13099,7 @@ "symfony" ], "support": { - "source": "https://github.com/web-token/jwt-core/tree/v2.2.11" + "source": "https://github.com/web-token/jwt-core/tree/3.2.7" }, "funding": [ { @@ -13901,24 +13107,25 @@ "type": "patreon" } ], - "time": "2021-03-17T14:55:52+00:00" + "time": "2023-02-02T17:35:17+00:00" }, { "name": "web-token/jwt-signature", - "version": "v2.2.11", + "version": "3.2.7", "source": { "type": "git", "url": "https://github.com/web-token/jwt-signature.git", - "reference": "015b59aaf3b6e8fb9f5bd1338845b7464c7d8103" + "reference": "156e0b0ef534e53eecf23a32a92ee6d8cb4fdac4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-token/jwt-signature/zipball/015b59aaf3b6e8fb9f5bd1338845b7464c7d8103", - "reference": "015b59aaf3b6e8fb9f5bd1338845b7464c7d8103", + "url": "https://api.github.com/repos/web-token/jwt-signature/zipball/156e0b0ef534e53eecf23a32a92ee6d8cb4fdac4", + "reference": "156e0b0ef534e53eecf23a32a92ee6d8cb4fdac4", "shasum": "" }, "require": { - "web-token/jwt-core": "^2.1" + "php": ">=8.1", + "web-token/jwt-core": "^3.2" }, "suggest": { "web-token/jwt-signature-algorithm-ecdsa": "ECDSA Based Signature Algorithms", @@ -13969,7 +13176,7 @@ "symfony" ], "support": { - "source": "https://github.com/web-token/jwt-signature/tree/v2.2.11" + "source": "https://github.com/web-token/jwt-signature/tree/3.2.7" }, "funding": [ { @@ -13977,7 +13184,7 @@ "type": "patreon" } ], - "time": "2021-03-01T19:55:28+00:00" + "time": "2023-05-18T16:20:51+00:00" }, { "name": "webmozart/assert", @@ -16091,31 +15298,26 @@ }, { "name": "symfony/dom-crawler", - "version": "v5.4.23", + "version": "v6.2.9", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "4a286c916b74ecfb6e2caf1aa31d3fe2a34b7e08" + "reference": "328bc3795059651d2d4e462e8febdf7ec2d7a626" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4a286c916b74ecfb6e2caf1aa31d3fe2a34b7e08", - "reference": "4a286c916b74ecfb6e2caf1aa31d3fe2a34b7e08", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/328bc3795059651d2d4e462e8febdf7ec2d7a626", + "reference": "328bc3795059651d2d4e462e8febdf7ec2d7a626", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "masterminds/html5": "^2.6", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "masterminds/html5": "<2.6" + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "masterminds/html5": "^2.6", - "symfony/css-selector": "^4.4|^5.0|^6.0" + "symfony/css-selector": "^5.4|^6.0" }, "suggest": { "symfony/css-selector": "" @@ -16146,7 +15348,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v5.4.23" + "source": "https://github.com/symfony/dom-crawler/tree/v6.2.9" }, "funding": [ { @@ -16162,7 +15364,7 @@ "type": "tidelift" } ], - "time": "2023-04-08T21:20:19+00:00" + "time": "2023-04-11T16:03:19+00:00" }, { "name": "symfony/maker-bundle", @@ -16259,27 +15461,27 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v5.4.23", + "version": "v6.2.10", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "1572c5b7cad812bdf0414d89a32a33a2dafb38ba" + "reference": "552950db2919421ad917e29e76d1999a2a31a8e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/1572c5b7cad812bdf0414d89a32a33a2dafb38ba", - "reference": "1572c5b7cad812bdf0414d89a32a33a2dafb38ba", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/552950db2919421ad917e29e76d1999a2a31a8e3", + "reference": "552950db2919421ad917e29e76d1999a2a31a8e3", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=7.1.3" }, "conflict": { "phpunit/phpunit": "<7.5|9.1.2" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0" + "symfony/deprecation-contracts": "^2.1|^3.0", + "symfony/error-handler": "^5.4|^6.0" }, "suggest": { "symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" @@ -16322,7 +15524,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v5.4.23" + "source": "https://github.com/symfony/phpunit-bridge/tree/v6.2.10" }, "funding": [ { @@ -16338,7 +15540,7 @@ "type": "tidelift" } ], - "time": "2023-04-18T09:42:03+00:00" + "time": "2023-04-18T13:46:08+00:00" }, { "name": "symfony/web-profiler-bundle", @@ -16589,6 +15791,7 @@ "minimum-stability": "stable", "stability-flags": { "florianv/swap-bundle": 20, + "jbtronics/2fa-webauthn": 20, "roave/security-advisories": 20 }, "prefer-stable": false, diff --git a/config/bundles.php b/config/bundles.php index 91ddea04..8ca67ae7 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -27,5 +27,4 @@ return [ Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true], SpomkyLabs\CborBundle\SpomkyLabsCborBundle::class => ['all' => true], Webauthn\Bundle\WebauthnBundle::class => ['all' => true], - Hslavich\OneloginSamlBundle\HslavichOneloginSamlBundle::class => ['all' => true], ]; diff --git a/config/packages/lock.yaml b/config/packages/lock.yaml deleted file mode 100644 index 574879f8..00000000 --- a/config/packages/lock.yaml +++ /dev/null @@ -1,2 +0,0 @@ -framework: - lock: '%env(LOCK_DSN)%' diff --git a/config/packages/uid.yaml b/config/packages/uid.yaml new file mode 100644 index 00000000..01520944 --- /dev/null +++ b/config/packages/uid.yaml @@ -0,0 +1,4 @@ +framework: + uid: + default_uuid_version: 7 + time_based_uuid_version: 7 diff --git a/symfony.lock b/symfony.lock index a4bb23ff..061acab8 100644 --- a/symfony.lock +++ b/symfony.lock @@ -173,9 +173,6 @@ "gregwar/captcha-bundle": { "version": "v2.0.6" }, - "hslavich/oneloginsaml-bundle": { - "version": "v2.10.0" - }, "imagine/imagine": { "version": "1.2.2" }, @@ -533,18 +530,6 @@ "symfony/intl": { "version": "v4.2.3" }, - "symfony/lock": { - "version": "5.4", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "5.2", - "ref": "8e937ff2b4735d110af1770f242c1107fdab4c8e" - }, - "files": [ - "./config/packages/lock.yaml" - ] - }, "symfony/mailer": { "version": "5.4", "recipe": { @@ -626,15 +611,9 @@ "symfony/polyfill-php72": { "version": "v1.10.0" }, - "symfony/polyfill-php73": { - "version": "v1.11.0" - }, "symfony/polyfill-php80": { "version": "v1.17.0" }, - "symfony/polyfill-php81": { - "version": "v1.23.0" - }, "symfony/process": { "version": "v4.2.3" }, @@ -681,9 +660,6 @@ "symfony/security-csrf": { "version": "v4.2.3" }, - "symfony/security-guard": { - "version": "v4.2.3" - }, "symfony/security-http": { "version": "v4.2.3" }, @@ -731,6 +707,18 @@ "templates/base.html.twig" ] }, + "symfony/uid": { + "version": "6.2", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "6.2", + "ref": "d294ad4add3e15d7eb1bae0221588ca89b38e558" + }, + "files": [ + "./config/packages/uid.yaml" + ] + }, "symfony/ux-turbo": { "version": "v2.0.1" }, From 9f52d364c9a9407345e187a12b410f4b639ff5ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:38:32 +0200 Subject: [PATCH 06/91] Use newer nbgrp/onelogin-saml-bundle bundle for handling SAML --- composer.json | 1 + composer.lock | 167 +++++++++++++++++++- config/bundles.php | 1 + config/packages/hslavich_onelogin_saml.yaml | 60 ------- config/packages/nbgrp_onelogin_saml.yaml | 62 ++++++++ symfony.lock | 3 + 6 files changed, 233 insertions(+), 61 deletions(-) delete mode 100644 config/packages/hslavich_onelogin_saml.yaml create mode 100644 config/packages/nbgrp_onelogin_saml.yaml diff --git a/composer.json b/composer.json index 8aa27bc9..2da6664e 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,7 @@ "league/csv": "^9.8.0", "league/html-to-markdown": "^5.0.1", "liip/imagine-bundle": "^2.2", + "nbgrp/onelogin-saml-bundle": "^1.3", "nelexa/zip": "^4.0", "nelmio/security-bundle": "^3.0", "nyholm/psr7": "^1.1", diff --git a/composer.lock b/composer.lock index 687fcbf6..2fd6f728 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": "ef71583adf031fff76718bf97c9ca69c", + "content-hash": "bc9721bfdd7cdf88630f55f2ff97a28d", "packages": [ { "name": "beberlei/assert", @@ -3431,6 +3431,73 @@ ], "time": "2023-02-06T13:46:10+00:00" }, + { + "name": "nbgrp/onelogin-saml-bundle", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/nbgrp/onelogin-saml-bundle.git", + "reference": "907a59431edcfbb962b2bb952d987693b63ca757" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nbgrp/onelogin-saml-bundle/zipball/907a59431edcfbb962b2bb952d987693b63ca757", + "reference": "907a59431edcfbb962b2bb952d987693b63ca757", + "shasum": "" + }, + "require": { + "onelogin/php-saml": "^4", + "php": "^8.1", + "psr/log": "^1 || ^2 || ^3", + "symfony/config": "^6", + "symfony/dependency-injection": "^6", + "symfony/deprecation-contracts": "^3", + "symfony/event-dispatcher-contracts": "^3", + "symfony/http-foundation": "^6", + "symfony/http-kernel": "^6", + "symfony/routing": "^6", + "symfony/security-bundle": "^6", + "symfony/security-core": "^6", + "symfony/security-http": "^6" + }, + "conflict": { + "symfony/http-kernel": "<6.2", + "symfony/security-core": "<6.2" + }, + "require-dev": { + "doctrine/orm": "^2.3 || ^3", + "symfony/event-dispatcher": "^6", + "symfony/phpunit-bridge": "^6" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Nbgrp\\OneloginSamlBundle\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Alexander Menshchikov", + "email": "alexander.menshchikov@yandex.ru" + } + ], + "description": "OneLogin SAML Symfony Bundle", + "keywords": [ + "SSO", + "multiple IdP", + "onelogin", + "saml" + ], + "support": { + "issues": "https://github.com/nbgrp/onelogin-saml-bundle/issues", + "source": "https://github.com/nbgrp/onelogin-saml-bundle/tree/v1.3.2" + }, + "time": "2023-03-22T20:23:42+00:00" + }, { "name": "nelexa/zip", "version": "4.0.2", @@ -3933,6 +4000,62 @@ }, "time": "2023-04-24T09:09:02+00:00" }, + { + "name": "onelogin/php-saml", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/onelogin/php-saml.git", + "reference": "b22a57ebd13e838b90df5d3346090bc37056409d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/onelogin/php-saml/zipball/b22a57ebd13e838b90df5d3346090bc37056409d", + "reference": "b22a57ebd13e838b90df5d3346090bc37056409d", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "robrichards/xmlseclibs": ">=3.1.1" + }, + "require-dev": { + "pdepend/pdepend": "^2.8.0", + "php-coveralls/php-coveralls": "^2.0", + "phploc/phploc": "^4.0 || ^5.0 || ^6.0 || ^7.0", + "phpunit/phpunit": "^9.5", + "sebastian/phpcpd": "^4.0 || ^5.0 || ^6.0 ", + "squizlabs/php_codesniffer": "^3.5.8" + }, + "suggest": { + "ext-curl": "Install curl lib to be able to use the IdPMetadataParser for parsing remote XMLs", + "ext-dom": "Install xml lib", + "ext-openssl": "Install openssl lib in order to handle with x509 certs (require to support sign and encryption)", + "ext-zlib": "Install zlib" + }, + "type": "library", + "autoload": { + "psr-4": { + "OneLogin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "OneLogin PHP SAML Toolkit", + "homepage": "https://developers.onelogin.com/saml/php", + "keywords": [ + "SAML2", + "onelogin", + "saml" + ], + "support": { + "email": "sixto.garcia@onelogin.com", + "issues": "https://github.com/onelogin/php-saml/issues", + "source": "https://github.com/onelogin/php-saml/" + }, + "time": "2022-07-15T20:44:36+00:00" + }, { "name": "paragonie/constant_time_encoding", "version": "v2.6.3", @@ -5297,6 +5420,48 @@ }, "time": "2021-10-29T13:26:27+00:00" }, + { + "name": "robrichards/xmlseclibs", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/robrichards/xmlseclibs.git", + "reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/robrichards/xmlseclibs/zipball/f8f19e58f26cdb42c54b214ff8a820760292f8df", + "reference": "f8f19e58f26cdb42c54b214ff8a820760292f8df", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">= 5.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "RobRichards\\XMLSecLibs\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "A PHP library for XML Security", + "homepage": "https://github.com/robrichards/xmlseclibs", + "keywords": [ + "security", + "signature", + "xml", + "xmldsig" + ], + "support": { + "issues": "https://github.com/robrichards/xmlseclibs/issues", + "source": "https://github.com/robrichards/xmlseclibs/tree/3.1.1" + }, + "time": "2020-09-05T13:00:25+00:00" + }, { "name": "s9e/regexp-builder", "version": "1.4.6", diff --git a/config/bundles.php b/config/bundles.php index 8ca67ae7..da858c91 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -27,4 +27,5 @@ return [ Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true], SpomkyLabs\CborBundle\SpomkyLabsCborBundle::class => ['all' => true], Webauthn\Bundle\WebauthnBundle::class => ['all' => true], + Nbgrp\OneloginSamlBundle\NbgrpOneloginSamlBundle::class => ['all' => true], ]; diff --git a/config/packages/hslavich_onelogin_saml.yaml b/config/packages/hslavich_onelogin_saml.yaml deleted file mode 100644 index cae3c539..00000000 --- a/config/packages/hslavich_onelogin_saml.yaml +++ /dev/null @@ -1,60 +0,0 @@ -# See https://github.com/SAML-Toolkits/php-saml for more information about the SAML settings - -hslavich_onelogin_saml: - # Basic settings - idp: - entityId: '%env(string:SAML_IDP_ENTITY_ID)%' - singleSignOnService: - url: '%env(string:SAML_IDP_SINGLE_SIGN_ON_SERVICE)%' - binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' - singleLogoutService: - url: '%env(string:SAML_IDP_SINGLE_LOGOUT_SERVICE)%' - binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' - x509cert: '%env(string:SAML_IDP_X509_CERT)%' - sp: - entityId: '%env(string:SAML_SP_ENTITY_ID)%' - assertionConsumerService: - url: '%partdb.default_uri%saml/acs' - binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' - singleLogoutService: - url: '%partdb.default_uri%logout' - binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' - x509cert: '%env(string:SAML_SP_X509_CERT)%' - privateKey: '%env(string:SAMLP_SP_PRIVATE_KEY)%' - - # Optional settings - #baseurl: 'http://myapp.com' - strict: true - debug: false - security: - allowRepeatAttributeName: true - # nameIdEncrypted: false - authnRequestsSigned: true - logoutRequestSigned: true - logoutResponseSigned: true - # wantMessagesSigned: false - # wantAssertionsSigned: true - # wantNameIdEncrypted: false - # requestedAuthnContext: true - # signMetadata: false - # wantXMLValidation: true - # relaxDestinationValidation: false - # destinationStrictlyMatches: true - # rejectUnsolicitedResponsesWithInResponseTo: false - # signatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' - # digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' - #contactPerson: - # technical: - # givenName: 'Tech User' - # emailAddress: 'techuser@example.com' - # support: - # givenName: 'Support User' - # emailAddress: 'supportuser@example.com' - # administrative: - # givenName: 'Administrative User' - # emailAddress: 'administrativeuser@example.com' - #organization: - # en: - # name: 'Part-DB-name' - # displayname: 'Displayname' - # url: 'http://example.com' \ No newline at end of file diff --git a/config/packages/nbgrp_onelogin_saml.yaml b/config/packages/nbgrp_onelogin_saml.yaml new file mode 100644 index 00000000..d2f5bae0 --- /dev/null +++ b/config/packages/nbgrp_onelogin_saml.yaml @@ -0,0 +1,62 @@ +# See https://github.com/SAML-Toolkits/php-saml for more information about the SAML settings + +nbgrp_onelogin_saml: + onelogin_settings: + default: + # Basic settings + idp: + entityId: '%env(string:SAML_IDP_ENTITY_ID)%' + singleSignOnService: + url: '%env(string:SAML_IDP_SINGLE_SIGN_ON_SERVICE)%' + binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' + singleLogoutService: + url: '%env(string:SAML_IDP_SINGLE_LOGOUT_SERVICE)%' + binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' + x509cert: '%env(string:SAML_IDP_X509_CERT)%' + sp: + entityId: '%env(string:SAML_SP_ENTITY_ID)%' + assertionConsumerService: + url: '%partdb.default_uri%saml/acs' + binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' + singleLogoutService: + url: '%partdb.default_uri%logout' + binding: 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' + x509cert: '%env(string:SAML_SP_X509_CERT)%' + privateKey: '%env(string:SAMLP_SP_PRIVATE_KEY)%' + + # Optional settings + #baseurl: 'http://myapp.com' + strict: true + debug: false + security: + allowRepeatAttributeName: true + # nameIdEncrypted: false + authnRequestsSigned: true + logoutRequestSigned: true + logoutResponseSigned: true + # wantMessagesSigned: false + # wantAssertionsSigned: true + # wantNameIdEncrypted: false + # requestedAuthnContext: true + # signMetadata: false + # wantXMLValidation: true + # relaxDestinationValidation: false + # destinationStrictlyMatches: true + # rejectUnsolicitedResponsesWithInResponseTo: false + # signatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' + # digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256' + #contactPerson: + # technical: + # givenName: 'Tech User' + # emailAddress: 'techuser@example.com' + # support: + # givenName: 'Support User' + # emailAddress: 'supportuser@example.com' + # administrative: + # givenName: 'Administrative User' + # emailAddress: 'administrativeuser@example.com' + #organization: + # en: + # name: 'Part-DB-name' + # displayname: 'Displayname' + # url: 'http://example.com' \ No newline at end of file diff --git a/symfony.lock b/symfony.lock index 061acab8..d5cfaf98 100644 --- a/symfony.lock +++ b/symfony.lock @@ -204,6 +204,9 @@ "monolog/monolog": { "version": "1.24.0" }, + "nbgrp/onelogin-saml-bundle": { + "version": "v1.3.2" + }, "nelmio/security-bundle": { "version": "2.4", "recipe": { From 55641a234c820097c63007e911cf071685e06f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:40:30 +0200 Subject: [PATCH 07/91] Require PHP 8.1 in composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2da6664e..ff2f2702 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "type": "project", "license": "AGPL-3.0-or-later", "require": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-ctype": "*", "ext-dom": "*", "ext-gd": "*", From c24019fd576039ae73a03e1f934aa04582ca568f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:46:02 +0200 Subject: [PATCH 08/91] Fixed error preventing the service container from compiling --- config/routes/{hslavich_saml.yaml => nbgrp_saml.yaml} | 4 ++-- src/Entity/UserSystem/User.php | 4 ++-- src/Helpers/LabelResponse.php | 4 ++-- src/Repository/UserRepository.php | 3 ++- src/Security/SamlUserFactory.php | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) rename config/routes/{hslavich_saml.yaml => nbgrp_saml.yaml} (58%) diff --git a/config/routes/hslavich_saml.yaml b/config/routes/nbgrp_saml.yaml similarity index 58% rename from config/routes/hslavich_saml.yaml rename to config/routes/nbgrp_saml.yaml index a902a93e..6bf45795 100644 --- a/config/routes/hslavich_saml.yaml +++ b/config/routes/nbgrp_saml.yaml @@ -1,4 +1,4 @@ -hslavich_saml_sp: - resource: "@HslavichOneloginSamlBundle/Resources/config/routing.yml" +nbgrp_saml: + resource: "@NbgrpOneloginSamlBundle/Resources/config/routes.php" # Only load the SAML routes if SAML is enabled condition: "env('SAML_ENABLED') == '1' or env('SAML_ENABLED') == 'true'" diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 7c271c6c..eba234c4 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -30,8 +30,8 @@ use App\Security\Interfaces\HasPermissionsInterface; use App\Validator\Constraints\Selectable; use App\Validator\Constraints\ValidPermission; use App\Validator\Constraints\ValidTheme; -use Hslavich\OneloginSamlBundle\Security\User\SamlUserInterface; use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface; +use Nbgrp\OneloginSamlBundle\Security\User\SamlUserInterface; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Serializer\Annotation\Groups; use Webauthn\PublicKeyCredentialUserEntity; @@ -967,7 +967,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe - public function setSamlAttributes(array $attributes) + public function setSamlAttributes(array $attributes): void { //When mail attribute exists, set it if (isset($attributes['email'])) { diff --git a/src/Helpers/LabelResponse.php b/src/Helpers/LabelResponse.php index 1dbb947b..3ce26516 100644 --- a/src/Helpers/LabelResponse.php +++ b/src/Helpers/LabelResponse.php @@ -54,7 +54,7 @@ class LabelResponse extends Response parent::__construct($content, $status, $headers); } - public function setContent($content): self + public function setContent($content): static { parent::setContent($content); @@ -64,7 +64,7 @@ class LabelResponse extends Response return $this; } - public function prepare(Request $request): self + public function prepare(Request $request): static { parent::prepare($request); diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index 3cc29788..648f86bd 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -24,6 +24,7 @@ namespace App\Repository; use App\Entity\UserSystem\User; use Doctrine\ORM\NonUniqueResultException; +use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -82,7 +83,7 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU } } - public function upgradePassword(UserInterface $user, string $newHashedPassword): void + public function upgradePassword(UserInterface|PasswordAuthenticatedUserInterface $user, string $newHashedPassword): void { if ($user instanceof User) { $user->setPassword($newHashedPassword); diff --git a/src/Security/SamlUserFactory.php b/src/Security/SamlUserFactory.php index 39e67c0c..b5434be9 100644 --- a/src/Security/SamlUserFactory.php +++ b/src/Security/SamlUserFactory.php @@ -23,8 +23,8 @@ namespace App\Security; use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; use Doctrine\ORM\EntityManagerInterface; -use Hslavich\OneloginSamlBundle\Security\Http\Authenticator\Token\SamlToken; -use Hslavich\OneloginSamlBundle\Security\User\SamlUserFactoryInterface; +use Nbgrp\OneloginSamlBundle\Security\Http\Authenticator\Token\SamlToken; +use Nbgrp\OneloginSamlBundle\Security\User\SamlUserFactoryInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; use Symfony\Component\Security\Core\User\UserInterface; From 1a3f0675bf63d541e2ca6a6f8823d9f8e725fabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:51:05 +0200 Subject: [PATCH 09/91] Updated doctrine bundle recipe --- config/packages/doctrine.yaml | 1 + symfony.lock | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 5cdb115a..5d255beb 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -21,6 +21,7 @@ doctrine: orm: auto_generate_proxy_classes: true + enable_lazy_ghost_objects: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true mappings: diff --git a/symfony.lock b/symfony.lock index d5cfaf98..c9540996 100644 --- a/symfony.lock +++ b/symfony.lock @@ -75,12 +75,12 @@ "version": "v0.5.3" }, "doctrine/doctrine-bundle": { - "version": "2.8", + "version": "2.9", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "2.4", - "ref": "013b823e7fee65890b23e40f31e6667a1ac519ac" + "version": "2.8", + "ref": "67961f095352f829a24c035639b3d0d3378ffbf2" }, "files": [ "config/packages/doctrine.yaml", From 92ddebc289877e092ab83ca0b2873c7bf99c8f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:52:04 +0200 Subject: [PATCH 10/91] Updated recipe of php-http/discovery --- config/packages/http_discovery.yaml | 10 ++++++++++ symfony.lock | 11 ++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 config/packages/http_discovery.yaml diff --git a/config/packages/http_discovery.yaml b/config/packages/http_discovery.yaml new file mode 100644 index 00000000..2a789e73 --- /dev/null +++ b/config/packages/http_discovery.yaml @@ -0,0 +1,10 @@ +services: + Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory' + + http_discovery.psr17_factory: + class: Http\Discovery\Psr17Factory diff --git a/symfony.lock b/symfony.lock index c9540996..93c65b10 100644 --- a/symfony.lock +++ b/symfony.lock @@ -262,7 +262,16 @@ "version": "v0.3.3" }, "php-http/discovery": { - "version": "1.7.0" + "version": "1.18", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.18", + "ref": "f45b5dd173a27873ab19f5e3180b2f661c21de02" + }, + "files": [ + "./config/packages/http_discovery.yaml" + ] }, "php-http/httplug": { "version": "v2.0.0" From 0ecb339fdf808261faf5985c1c82f12fe94a0a96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 20:53:34 +0200 Subject: [PATCH 11/91] Updated recipe of scheb/2fa bundle --- config/packages/scheb_2fa.yaml | 6 +++--- symfony.lock | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/config/packages/scheb_2fa.yaml b/config/packages/scheb_2fa.yaml index f58bdacc..62a6611d 100644 --- a/config/packages/scheb_2fa.yaml +++ b/config/packages/scheb_2fa.yaml @@ -1,4 +1,4 @@ -# See the configuration reference at https://symfony.com/bundles/SchebTwoFactorBundle/5.x/configuration.html +# See the configuration reference at https://symfony.com/bundles/SchebTwoFactorBundle/6.x/configuration.html scheb_two_factor: google: @@ -23,6 +23,6 @@ scheb_two_factor: security_tokens: - Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken # If you're using guard-based authentication, you have to use this one: - # - Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken + # - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken # If you're using authenticator-based security (introduced in Symfony 5.1), you have to use this one: - # - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken \ No newline at end of file + - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken diff --git a/symfony.lock b/symfony.lock index 93c65b10..c5239b19 100644 --- a/symfony.lock +++ b/symfony.lock @@ -373,16 +373,16 @@ "version": "8.3.0" }, "scheb/2fa-bundle": { - "version": "5.13", + "version": "6.8", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "5.0", - "ref": "0a83961ef50ff91812b229a6f0caf28431d94aec" + "version": "6.0", + "ref": "1e6f68089146853a790b5da9946fc5974f6fcd49" }, "files": [ - "./config/packages/scheb_2fa.yaml", - "./config/routes/scheb_2fa.yaml" + "config/packages/scheb_2fa.yaml", + "config/routes/scheb_2fa.yaml" ] }, "sebastian/diff": { From 05b2515b3b5dcbf4eecb7ebae903f99335ceb077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 21:02:02 +0200 Subject: [PATCH 12/91] Updated recipe of symfony/framework-bundle --- config/packages/framework.yaml | 3 ++- symfony.lock | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 6adac2bb..8ad7bf1a 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -2,8 +2,9 @@ framework: secret: '%env(APP_SECRET)%' csrf_protection: true + handle_all_throwables: true - # Must be set to true, to enable the change of HTTP methhod via _method parameter, otherwise our delete routines does not work anymore + # Must be set to true, to enable the change of HTTP method via _method parameter, otherwise our delete routines does not work anymore # TODO: Rework delete routines to work without _method parameter as it is not recommended anymore (see https://github.com/symfony/symfony/issues/45278) http_method_override: true diff --git a/symfony.lock b/symfony.lock index c5239b19..e112bc2b 100644 --- a/symfony.lock +++ b/symfony.lock @@ -509,12 +509,12 @@ "version": "v4.2.3" }, "symfony/framework-bundle": { - "version": "5.4", + "version": "6.2", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.4", - "ref": "3cd216a4d007b78d8554d44a5b1c0a446dab24fb" + "branch": "main", + "version": "6.2", + "ref": "af47254c5e4cd543e6af3e4508298ffebbdaddd3" }, "files": [ "config/packages/cache.yaml", From 8fb4e6c4eea0d08c9594ce24de2a7ecd5d40a67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 21:02:59 +0200 Subject: [PATCH 13/91] Updated recipe of symfony/recipe --- config/routes.yaml | 8 +++++--- symfony.lock | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/config/routes.yaml b/config/routes.yaml index 7d495d6d..980c9508 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,6 +1,8 @@ -#index: -# path: / -# controller: App\Controller\DefaultController::index +controllers: + resource: + path: ../src/Controller/ + namespace: App\Controller + type: attribute # Redirect every url without an locale to the locale of the user/the global base locale diff --git a/symfony.lock b/symfony.lock index e112bc2b..fc7aad39 100644 --- a/symfony.lock +++ b/symfony.lock @@ -639,12 +639,12 @@ "version": "v5.2.1" }, "symfony/routing": { - "version": "5.4", + "version": "6.2", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.3", - "ref": "85de1d8ae45b284c3c84b668171d2615049e698f" + "branch": "main", + "version": "6.2", + "ref": "e0a11b4ccb8c9e70b574ff5ad3dfdcd41dec5aa6" }, "files": [ "config/packages/routing.yaml", From 0573f8052501eed4259bd0e1a63b8620486d5e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 21:04:28 +0200 Subject: [PATCH 14/91] Updated symfony/security recipe --- config/packages/security.yaml | 2 +- symfony.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 7e0ded3c..f664e7f9 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,6 +1,6 @@ security: enable_authenticator_manager: true - + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' diff --git a/symfony.lock b/symfony.lock index fc7aad39..f51672f5 100644 --- a/symfony.lock +++ b/symfony.lock @@ -655,12 +655,12 @@ "version": "v5.3.4" }, "symfony/security-bundle": { - "version": "5.4", + "version": "6.2", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "5.3", - "ref": "98f1f2b0d635908c2b40f3675da2d23b1a069d30" + "version": "6.0", + "ref": "8a5b112826f7d3d5b07027f93786ae11a1c7de48" }, "files": [ "config/packages/security.yaml" From ccfe259c69d617fb19051eff9f379f424d216818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 21:05:03 +0200 Subject: [PATCH 15/91] Updated recipe of symfony/webpack-encore --- symfony.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/symfony.lock b/symfony.lock index f51672f5..00530684 100644 --- a/symfony.lock +++ b/symfony.lock @@ -769,12 +769,12 @@ ] }, "symfony/webpack-encore-bundle": { - "version": "1.16", + "version": "1.17", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", "version": "1.10", - "ref": "f8fc53f1942f76679e9ee3c25fd44865355707b5" + "ref": "eff2e505d4557c967b6710fe06bd947ba555cae5" }, "files": [ "assets/app.js", From 508de10191153b5316ab33b53a59e60e1e4b7ac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 21:20:21 +0200 Subject: [PATCH 16/91] Modernized phpunit.xml.dist --- phpunit.xml.dist | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 94534e9d..59622803 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,20 +1,27 @@ - - - - src - - + - + + + + src + + + tests From 1dbf36b86bdd039e875d0eae60f7d99e11f5eecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 27 May 2023 23:58:28 +0200 Subject: [PATCH 17/91] Use str_contains and similar instead of strpos --- config/packages/test/framework.yaml | 2 -- phpunit.xml.dist | 1 + src/Controller/RedirectController.php | 2 +- src/Controller/SelectAPIController.php | 2 +- src/Entity/Attachments/Attachment.php | 2 +- src/Entity/LogSystem/AbstractLogEntry.php | 2 +- src/Entity/UserSystem/PermissionData.php | 2 +- .../UserSystem/PasswordChangeNeededSubscriber.php | 2 +- src/Form/Type/SIUnitType.php | 2 +- src/Helpers/LabelResponse.php | 2 +- src/Services/Attachments/AttachmentPathResolver.php | 4 ++-- src/Services/Attachments/AttachmentURLGenerator.php | 2 +- src/Services/Attachments/FileTypeFilterTools.php | 6 +++--- src/Services/LabelSystem/BarcodeGenerator.php | 2 +- src/Services/Trees/TreeViewGenerator.php | 2 +- src/Services/UserSystem/PermissionManager.php | 2 +- 16 files changed, 18 insertions(+), 19 deletions(-) diff --git a/config/packages/test/framework.yaml b/config/packages/test/framework.yaml index d051c840..f76cc2ef 100644 --- a/config/packages/test/framework.yaml +++ b/config/packages/test/framework.yaml @@ -1,4 +1,2 @@ framework: test: true - session: - storage_id: session.storage.mock_file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 59622803..05724d3b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,6 +9,7 @@ > + diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index 811ab135..a6099ace 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -62,7 +62,7 @@ class RedirectController extends AbstractController //If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable()) - && false === strpos($new_url, 'index.php')) { + && !str_contains($new_url, 'index.php')) { //Like Request::getUriForPath only with index.php $new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo(); } diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php index f01f03ca..18cca638 100644 --- a/src/Controller/SelectAPIController.php +++ b/src/Controller/SelectAPIController.php @@ -198,7 +198,7 @@ class SelectAPIController extends AbstractController //Remove the data-* prefix for each key $data = array_combine( array_map(static function ($key) { - if (strpos($key, 'data-') === 0) { + if (str_starts_with($key, 'data-')) { return substr($key, 5); } return $key; diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 35c07571..39b755ce 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -417,7 +417,7 @@ abstract class Attachment extends AbstractNamedDBElement { //Only set if the URL is not empty if (!empty($url)) { - if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) { + if (str_contains($url, '%BASE%') || str_contains($url, '%MEDIA%')) { throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!'); } diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index 703049e8..76b0d746 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -222,7 +222,7 @@ abstract class AbstractLogEntry extends AbstractDBElement */ public function isCLIEntry(): bool { - return strpos($this->username, '!!!CLI ') === 0; + return str_starts_with($this->username, '!!!CLI '); } /** diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index bac73282..d67ee866 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -128,7 +128,7 @@ final class PermissionData implements \JsonSerializable public function isPermissionSet(string $permission, string $operation): bool { //We cannot access metadata via normal permission data - if (strpos($permission, '$') !== false) { + if (str_contains($permission, '$')) { return false; } diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php index ef7da6a9..fb12942b 100644 --- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php +++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php @@ -96,7 +96,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface /* Dont redirect tree endpoints, as this would cause trouble and creates multiple flash warnigs for one page reload */ - if (false !== strpos($request->getUri(), '/tree/')) { + if (str_contains($request->getUri(), '/tree/')) { return; } diff --git a/src/Form/Type/SIUnitType.php b/src/Form/Type/SIUnitType.php index bfec23e2..0cddb2a1 100644 --- a/src/Form/Type/SIUnitType.php +++ b/src/Form/Type/SIUnitType.php @@ -138,7 +138,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface //Check if we need to make this thing small if (isset($options['attr']['class'])) { - $view->vars['sm'] = false !== strpos($options['attr']['class'], 'form-control-sm'); + $view->vars['sm'] = str_contains($options['attr']['class'], 'form-control-sm'); } $view->vars['unit'] = $options['unit']; diff --git a/src/Helpers/LabelResponse.php b/src/Helpers/LabelResponse.php index 3ce26516..98451e2f 100644 --- a/src/Helpers/LabelResponse.php +++ b/src/Helpers/LabelResponse.php @@ -110,7 +110,7 @@ class LabelResponse extends Response */ public function setContentDisposition(string $disposition, string $filename, string $filenameFallback = ''): self { - if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || false !== strpos($filename, '%'))) { + if ('' === $filenameFallback && (!preg_match('/^[\x20-\x7e]*$/', $filename) || str_contains($filename, '%'))) { $encoding = mb_detect_encoding($filename, null, true) ?: '8bit'; for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { diff --git a/src/Services/Attachments/AttachmentPathResolver.php b/src/Services/Attachments/AttachmentPathResolver.php index 9617024e..635d0bc6 100644 --- a/src/Services/Attachments/AttachmentPathResolver.php +++ b/src/Services/Attachments/AttachmentPathResolver.php @@ -134,7 +134,7 @@ class AttachmentPathResolver $count = 0; //When path is a footprint we have to first run the string through our lecagy german mapping functions - if (strpos($placeholder_path, '%FOOTPRINTS%') !== false) { + if (str_contains($placeholder_path, '%FOOTPRINTS%')) { $placeholder_path = $this->convertOldFootprintPath($placeholder_path); } @@ -151,7 +151,7 @@ class AttachmentPathResolver } //Path is invalid if path is directory traversal - if (false !== strpos($placeholder_path, '..')) { + if (str_contains($placeholder_path, '..')) { return null; } diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index 742cce81..cbeab36a 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -78,7 +78,7 @@ class AttachmentURLGenerator } //Our absolute path must begin with public path, or we can not use it for asset pathes. - if (0 !== strpos($absolute_path, $public_path)) { + if (!str_starts_with($absolute_path, $public_path)) { return null; } diff --git a/src/Services/Attachments/FileTypeFilterTools.php b/src/Services/Attachments/FileTypeFilterTools.php index 6fc0a162..1b06655a 100644 --- a/src/Services/Attachments/FileTypeFilterTools.php +++ b/src/Services/Attachments/FileTypeFilterTools.php @@ -108,7 +108,7 @@ class FileTypeFilterTools } //Convert *.jpg to .jpg - if (0 === strpos($element, '*.')) { + if (str_starts_with($element, '*.')) { $element = str_replace('*.', '.', $element); } @@ -119,7 +119,7 @@ class FileTypeFilterTools $element = 'video/*'; } elseif ('audio' === $element || 'audio/' === $element) { $element = 'audio/*'; - } elseif (!preg_match('#^[-\w.]+/[-\w.*]+#', $element) && 0 !== strpos($element, '.')) { + } elseif (!preg_match('#^[-\w.]+/[-\w.*]+#', $element) && !str_starts_with($element, '.')) { //Convert jpg to .jpg $element = '.'.$element; } @@ -147,7 +147,7 @@ class FileTypeFilterTools foreach ($elements as $element) { $element = trim($element); - if (0 === strpos($element, '.')) { + if (str_starts_with($element, '.')) { //We found an explicit specified file extension -> add it to list $extensions[] = substr($element, 1); } elseif ('image/*' === $element) { diff --git a/src/Services/LabelSystem/BarcodeGenerator.php b/src/Services/LabelSystem/BarcodeGenerator.php index d88210ca..801154a3 100644 --- a/src/Services/LabelSystem/BarcodeGenerator.php +++ b/src/Services/LabelSystem/BarcodeGenerator.php @@ -79,7 +79,7 @@ final class BarcodeGenerator $repr = 'data:'; $repr .= $mime; - if (0 === strpos($mime, 'text/')) { + if (str_starts_with($mime, 'text/')) { $repr .= ','.rawurlencode($data); } else { $repr .= ';base64,'.base64_encode($data); diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index 29d09f9b..e5bb4ddc 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -130,7 +130,7 @@ class TreeViewGenerator } //Translate text if text starts with $$ - if (0 === strpos($item->getText(), '$$')) { + if (str_starts_with($item->getText(), '$$')) { $item->setText($this->translator->trans(substr($item->getText(), 2))); } } diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php index 1e3209fa..47e42635 100644 --- a/src/Services/UserSystem/PermissionManager.php +++ b/src/Services/UserSystem/PermissionManager.php @@ -215,7 +215,7 @@ class PermissionManager //Set every op listed in also Set foreach ($op['alsoSet'] as $set_also) { //If the alsoSet value contains a dot then we set the operation of another permission - if (false !== strpos($set_also, '.')) { + if (str_contains($set_also, '.')) { [$set_perm, $set_op] = explode('.', $set_also); } else { //Else we set the operation of the same permission From 132aac39517583971630f5d2a3e54825a14a1c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:01:19 +0200 Subject: [PATCH 18/91] Removed config/bootstrap.php which was left over from symfony 4.4 and which caused problems with phpunit --- config/bootstrap.php | 23 ----------------------- phpunit.xml.dist | 1 - 2 files changed, 24 deletions(-) delete mode 100644 config/bootstrap.php diff --git a/config/bootstrap.php b/config/bootstrap.php deleted file mode 100644 index 55560fb8..00000000 --- a/config/bootstrap.php +++ /dev/null @@ -1,23 +0,0 @@ -=1.2) -if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) { - (new Dotenv(false))->populate($env); -} else { - // load all the .env files - (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); -} - -$_SERVER += $_ENV; -$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; -$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; -$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 05724d3b..59622803 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,7 +9,6 @@ > - From 88ea920dfbcbb28fef422e8a61486f1166e871f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:16:12 +0200 Subject: [PATCH 19/91] Add rector for automated refactoring --- composer.json | 5 +-- composer.lock | 65 +++++++++++++++++++++++++++++++++++-- rector.php | 34 +++++++++++++++++++ tests/symfony-container.php | 10 ++++++ 4 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 rector.php create mode 100644 tests/symfony-container.php diff --git a/composer.json b/composer.json index ff2f2702..49d3625f 100644 --- a/composer.json +++ b/composer.json @@ -84,12 +84,14 @@ }, "require-dev": { "dama/doctrine-test-bundle": "^7.0", + "doctrine/doctrine-fixtures-bundle": "^3.2", "ekino/phpstan-banned-code": "^v1.0.0", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.4.7", "phpstan/phpstan-doctrine": "^1.2.11", "phpstan/phpstan-symfony": "^1.1.7", "psalm/plugin-symfony": "^v5.0.1", + "rector/rector": "^0.16.0", "roave/security-advisories": "dev-latest", "symfony/browser-kit": "^5.2", "symfony/css-selector": "^5.2", @@ -99,8 +101,7 @@ "symfony/stopwatch": "^5.2", "symfony/web-profiler-bundle": "^5.2", "symplify/easy-coding-standard": "^11.0", - "vimeo/psalm": "^5.6.0", - "doctrine/doctrine-fixtures-bundle": "^3.2" + "vimeo/psalm": "^5.6.0" }, "suggest": { "ext-bcmath": "Used to improve price calculation performance", diff --git a/composer.lock b/composer.lock index 2fd6f728..0110dcba 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": "bc9721bfdd7cdf88630f55f2ff97a28d", + "content-hash": "b0d4bf26f478ca8451e65e618de7bde7", "packages": [ { "name": "beberlei/assert", @@ -14572,6 +14572,67 @@ }, "time": "2023-04-21T15:40:12+00:00" }, + { + "name": "rector/rector", + "version": "0.16.0", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.14" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.15-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.16.0" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2023-05-05T12:12:17+00:00" + }, { "name": "roave/security-advisories", "version": "dev-latest", @@ -15962,7 +16023,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4 || ^8.0", + "php": "^8.1", "ext-ctype": "*", "ext-dom": "*", "ext-gd": "*", diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..c8545b90 --- /dev/null +++ b/rector.php @@ -0,0 +1,34 @@ +symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'); + $rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php'); + + $rectorConfig->paths([ + __DIR__ . '/config', + __DIR__ . '/public', + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + // register a single rule + //$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + + // define sets of rules + $rectorConfig->sets([ + //SetList::CODE_QUALITY, + //LevelSetList::UP_TO_PHP_81, + SymfonyLevelSetList::UP_TO_SYMFONY_62, + //SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, + SymfonySetList::SYMFONY_CODE_QUALITY, + ]); +}; diff --git a/tests/symfony-container.php b/tests/symfony-container.php new file mode 100644 index 00000000..f4b63872 --- /dev/null +++ b/tests/symfony-container.php @@ -0,0 +1,10 @@ +boot(); + +return $appKernel->getContainer(); From a43af180a701b1265554587d781d28d844ada897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:21:05 +0200 Subject: [PATCH 20/91] Applied rector rules up to symfony 6.2 --- .../Attachments/CleanAttachmentsCommand.php | 13 ++--- src/Command/BackupCommand.php | 4 +- src/Command/CheckRequirementsCommand.php | 7 +-- .../Currencies/UpdateExchangeRatesCommand.php | 11 ++-- src/Command/Logs/ShowEventLogCommand.php | 13 ++--- .../Migrations/ConvertBBCodeCommand.php | 9 ++- .../Migrations/ImportPartKeeprCommand.php | 8 +-- src/Command/User/ConvertToSAMLUserCommand.php | 9 ++- src/Command/User/SetPasswordCommand.php | 15 +++-- .../User/UpgradePermissionsSchemaCommand.php | 8 +-- src/Command/User/UserEnableCommand.php | 7 +-- src/Command/User/UserListCommand.php | 7 +-- src/Command/User/UsersPermissionsCommand.php | 4 +- src/Command/VersionCommand.php | 8 +-- .../AdminPages/AttachmentTypeController.php | 30 +++------- .../AdminPages/BaseAdminController.php | 4 +- .../AdminPages/CategoryController.php | 30 +++------- .../AdminPages/CurrencyController.php | 29 +++------- .../AdminPages/FootprintController.php | 30 +++------- .../AdminPages/LabelProfileController.php | 30 +++------- .../AdminPages/ManufacturerController.php | 29 +++------- .../AdminPages/MeasurementUnitController.php | 30 +++------- .../AdminPages/ProjectAdminController.php | 30 +++------- .../AdminPages/StorelocationController.php | 30 +++------- .../AdminPages/SupplierController.php | 30 +++------- src/Controller/AttachmentFileController.php | 12 ++-- src/Controller/GroupController.php | 30 +++------- src/Controller/HomepageController.php | 4 +- src/Controller/LabelController.php | 12 ++-- src/Controller/LogController.php | 21 +++---- src/Controller/PartController.php | 30 ++++------ src/Controller/PartImportExportController.php | 6 +- src/Controller/PartListsController.php | 28 +++------- src/Controller/ProjectController.php | 26 +++------ src/Controller/ScanController.php | 10 +--- src/Controller/SecurityController.php | 18 ++---- src/Controller/SelectAPIController.php | 31 +++-------- src/Controller/StatisticsController.php | 4 +- src/Controller/ToolsController.php | 16 ++---- src/Controller/TreeController.php | 55 +++++++------------ src/Controller/TypeaheadController.php | 19 +++---- src/Controller/UserController.php | 37 ++++--------- src/Controller/UserSettingsController.php | 20 ++----- .../WebauthnKeyRegistrationController.php | 4 +- src/DataTables/Column/RevertLogColumn.php | 4 +- src/DataTables/LogDataTable.php | 4 +- src/DataTables/PartsDataTable.php | 4 +- src/Entity/Attachments/Attachment.php | 6 +- .../AttachmentContainingDBElement.php | 2 +- src/Entity/Attachments/AttachmentType.php | 4 +- .../Attachments/AttachmentTypeAttachment.php | 2 +- src/Entity/Attachments/CategoryAttachment.php | 2 +- src/Entity/Attachments/CurrencyAttachment.php | 2 +- .../Attachments/FootprintAttachment.php | 2 +- src/Entity/Attachments/GroupAttachment.php | 2 +- src/Entity/Attachments/LabelAttachment.php | 2 +- .../Attachments/ManufacturerAttachment.php | 2 +- .../Attachments/MeasurementUnitAttachment.php | 2 +- src/Entity/Attachments/PartAttachment.php | 2 +- src/Entity/Attachments/ProjectAttachment.php | 2 +- .../Attachments/StorelocationAttachment.php | 2 +- src/Entity/Attachments/SupplierAttachment.php | 2 +- src/Entity/Attachments/UserAttachment.php | 2 +- src/Entity/Base/AbstractCompany.php | 14 ++--- src/Entity/Base/AbstractDBElement.php | 37 +------------ src/Entity/Base/AbstractNamedDBElement.php | 4 +- .../Base/AbstractPartsContainingDBElement.php | 2 +- .../Base/AbstractStructuralDBElement.php | 11 ++-- src/Entity/Base/MasterAttachmentTrait.php | 2 +- src/Entity/Base/TimestampTrait.php | 4 +- src/Entity/LabelSystem/LabelOptions.php | 12 ++-- src/Entity/LabelSystem/LabelProfile.php | 4 +- src/Entity/Parameters/AbstractParameter.php | 30 +++++----- .../Parameters/AttachmentTypeParameter.php | 2 +- src/Entity/Parameters/CategoryParameter.php | 2 +- src/Entity/Parameters/CurrencyParameter.php | 2 +- src/Entity/Parameters/FootprintParameter.php | 2 +- src/Entity/Parameters/GroupParameter.php | 2 +- .../Parameters/ManufacturerParameter.php | 2 +- .../Parameters/MeasurementUnitParameter.php | 2 +- src/Entity/Parameters/ParametersTrait.php | 2 +- src/Entity/Parameters/PartParameter.php | 2 +- src/Entity/Parameters/ProjectParameter.php | 2 +- .../Parameters/StorelocationParameter.php | 2 +- src/Entity/Parameters/SupplierParameter.php | 2 +- src/Entity/Parts/Category.php | 24 ++++---- src/Entity/Parts/Footprint.php | 4 +- src/Entity/Parts/Manufacturer.php | 4 +- src/Entity/Parts/MeasurementUnit.php | 16 +++--- src/Entity/Parts/Part.php | 16 +++--- src/Entity/Parts/PartLot.php | 22 ++++---- .../PartTraits/AdvancedPropertyTrait.php | 12 ++-- .../Parts/PartTraits/BasicPropertyTrait.php | 12 ++-- src/Entity/Parts/PartTraits/InstockTrait.php | 10 ++-- .../Parts/PartTraits/ManufacturerTrait.php | 12 ++-- src/Entity/Parts/PartTraits/OrderTrait.php | 4 +- src/Entity/Parts/Storelocation.php | 12 ++-- src/Entity/Parts/Supplier.php | 6 +- src/Entity/PriceInformations/Currency.php | 10 ++-- src/Entity/PriceInformations/Orderdetail.php | 20 +++---- src/Entity/PriceInformations/Pricedetail.php | 16 +++--- src/Entity/ProjectSystem/Project.php | 14 ++--- src/Entity/ProjectSystem/ProjectBOMEntry.php | 20 ++----- src/Entity/UserSystem/Group.php | 8 +-- src/Entity/UserSystem/User.php | 42 +++++++------- .../LogSystem/LogoutLoggerListener.php | 9 ++- .../LogoutDisabledUserSubscriber.php | 4 +- .../PasswordChangeNeededSubscriber.php | 4 +- .../UserSystem/SetUserTimezoneSubscriber.php | 4 +- .../UpgradePermissionsSchemaSubscriber.php | 4 +- .../AdminPages/AttachmentTypeAdminForm.php | 2 +- src/Form/AdminPages/BaseEntityAdminForm.php | 4 +- src/Form/AdminPages/CurrencyAdminForm.php | 2 +- src/Form/AdminPages/ImportType.php | 4 +- src/Form/AdminPages/MassCreationForm.php | 4 +- src/Form/AdminPages/SupplierForm.php | 2 +- src/Form/AttachmentFormType.php | 4 +- src/Form/LabelOptionsType.php | 4 +- src/Form/LabelSystem/LabelDialogType.php | 4 +- src/Form/Part/OrderdetailType.php | 4 +- src/Form/Part/PartBaseType.php | 4 +- src/Form/Part/PartLotType.php | 4 +- src/Form/Permissions/PermissionsMapper.php | 4 +- .../ProjectBOMEntryCollectionType.php | 5 -- .../ProjectSystem/ProjectBOMEntryType.php | 6 -- src/Form/ProjectSystem/ProjectBuildType.php | 4 +- src/Form/Type/PartSelectType.php | 9 +-- src/Form/Type/RichTextEditorType.php | 5 -- src/Form/Type/SIUnitType.php | 4 +- src/Form/UserAdminForm.php | 4 +- src/Form/UserSettingsType.php | 4 +- src/Security/Voter/AttachmentVoter.php | 4 +- src/Security/Voter/LogEntryVoter.php | 4 +- src/Security/Voter/OrderdetailVoter.php | 4 +- src/Security/Voter/ParameterVoter.php | 4 +- src/Security/Voter/PartLotVoter.php | 4 +- src/Security/Voter/PricedetailVoter.php | 4 +- .../StructuralElementDenormalizer.php | 2 +- .../LabelSystem/LabelHTMLGenerator.php | 4 +- .../PlaceholderProviders/GlobalProviders.php | 4 +- src/Services/LogSystem/EventLogger.php | 4 +- .../Parts/PartsTableActionHandler.php | 4 +- src/Services/Trees/ToolsTreeBuilder.php | 4 +- .../UserSystem/UserCacheKeyGenerator.php | 4 +- .../Constraints/NoLockoutValidator.php | 4 +- 145 files changed, 563 insertions(+), 889 deletions(-) diff --git a/src/Command/Attachments/CleanAttachmentsCommand.php b/src/Command/Attachments/CleanAttachmentsCommand.php index 40f568bf..6004a3eb 100644 --- a/src/Command/Attachments/CleanAttachmentsCommand.php +++ b/src/Command/Attachments/CleanAttachmentsCommand.php @@ -40,9 +40,10 @@ use function count; use const DIRECTORY_SEPARATOR; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')] class CleanAttachmentsCommand extends Command { - protected static $defaultName = 'partdb:attachments:clean-unused|app:clean-attachments'; + protected static $defaultDescription = 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).'; protected AttachmentManager $attachment_helper; protected AttachmentReverseSearch $reverseSearch; @@ -60,10 +61,8 @@ class CleanAttachmentsCommand extends Command protected function configure(): void { - $this - ->setDescription('Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).') - ->setHelp('This command allows to find all files in the media folder which are not associated with an attachment anymore.'. - ' These files are not needed and can eventually deleted.'); + $this->setHelp('This command allows to find all files in the media folder which are not associated with an attachment anymore.'. + ' These files are not needed and can eventually deleted.'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -108,7 +107,7 @@ class CleanAttachmentsCommand extends Command if (!$continue) { //We are finished here, when no files should be deleted - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } //Delete the files @@ -121,7 +120,7 @@ class CleanAttachmentsCommand extends Command $io->success('No abandoned files found.'); } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } /** diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php index d12add92..dc248126 100644 --- a/src/Command/BackupCommand.php +++ b/src/Command/BackupCommand.php @@ -16,11 +16,9 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:backup', 'Backup the files and the database of Part-DB')] class BackupCommand extends Command { - protected static $defaultName = 'partdb:backup'; - protected static $defaultDescription = 'Backup the files and the database of Part-DB'; - private string $project_dir; private EntityManagerInterface $entityManager; diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 60883f81..8bc4c62d 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -27,9 +27,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')] class CheckRequirementsCommand extends Command { - protected static $defaultName = 'partdb:check-requirements'; + protected static $defaultDescription = 'Checks if the requirements Part-DB needs or recommends are fulfilled.'; protected ContainerBagInterface $params; @@ -41,9 +42,7 @@ class CheckRequirementsCommand extends Command protected function configure(): void { - $this - ->setDescription('Checks if the requirements Part-DB needs or recommends are fulfilled.') - ->addOption('only_issues', 'i', InputOption::VALUE_NONE, 'Only show issues, not success messages.') + $this->addOption('only_issues', 'i', InputOption::VALUE_NONE, 'Only show issues, not success messages.') ; } diff --git a/src/Command/Currencies/UpdateExchangeRatesCommand.php b/src/Command/Currencies/UpdateExchangeRatesCommand.php index b0735cbc..092121b8 100644 --- a/src/Command/Currencies/UpdateExchangeRatesCommand.php +++ b/src/Command/Currencies/UpdateExchangeRatesCommand.php @@ -35,9 +35,10 @@ use Symfony\Component\Console\Style\SymfonyStyle; use function count; use function strlen; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')] class UpdateExchangeRatesCommand extends Command { - protected static $defaultName = 'partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates'; + protected static $defaultDescription = 'Updates the currency exchange rates.'; protected string $base_current; protected EntityManagerInterface $em; @@ -56,9 +57,7 @@ class UpdateExchangeRatesCommand extends Command protected function configure(): void { - $this - ->setDescription('Updates the currency exchange rates.') - ->addArgument('iso_code', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The ISO Codes of the currencies that should be updated.'); + $this->addArgument('iso_code', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'The ISO Codes of the currencies that should be updated.'); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -69,7 +68,7 @@ class UpdateExchangeRatesCommand extends Command if (3 !== strlen($this->base_current)) { $io->error('Chosen Base current is not valid. Check your settings!'); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $io->note('Update currency exchange rates with base currency: '.$this->base_current); @@ -106,6 +105,6 @@ class UpdateExchangeRatesCommand extends Command $io->success(sprintf('%d (of %d) currency exchange rates were updated.', $success_counter, count($candidates))); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } diff --git a/src/Command/Logs/ShowEventLogCommand.php b/src/Command/Logs/ShowEventLogCommand.php index 7eef7a2d..6f560738 100644 --- a/src/Command/Logs/ShowEventLogCommand.php +++ b/src/Command/Logs/ShowEventLogCommand.php @@ -36,9 +36,10 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Contracts\Translation\TranslatorInterface; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')] class ShowEventLogCommand extends Command { - protected static $defaultName = 'partdb:logs:show|app:show-logs'; + protected static $defaultDescription = 'List the last event log entries.'; protected EntityManagerInterface $entityManager; protected TranslatorInterface $translator; protected ElementTypeNameGenerator $elementTypeNameGenerator; @@ -74,7 +75,7 @@ class ShowEventLogCommand extends Command if ($page > $max_page && $max_page > 0) { $io->error("There is no page ${page}! The maximum page is ${max_page}."); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $io->note("There are a total of ${total_count} log entries in the DB."); @@ -84,21 +85,19 @@ class ShowEventLogCommand extends Command $this->showPage($output, $desc, $limit, $page, $max_page, $showExtra); if ($onePage) { - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } $continue = $io->confirm('Do you want to show the next page?'); ++$page; } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } protected function configure(): void { - $this - ->setDescription('List the last event log entries.') - ->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'How many log entries should be shown per page.', 50) + $this->addOption('count', 'c', InputOption::VALUE_REQUIRED, 'How many log entries should be shown per page.', 50) ->addOption('oldest_first', null, InputOption::VALUE_NONE, 'Show older entries first.') ->addOption('page', 'p', InputOption::VALUE_REQUIRED, 'Which page should be shown?', 1) ->addOption('onePage', null, InputOption::VALUE_NONE, 'Show only one page (dont ask to go to next).') diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php index 3b861b49..4ea3c2c0 100644 --- a/src/Command/Migrations/ConvertBBCodeCommand.php +++ b/src/Command/Migrations/ConvertBBCodeCommand.php @@ -47,6 +47,7 @@ use function count; /** * This command converts the BBCode used by old Part-DB versions (<1.0), to the current used Markdown format. */ +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:migrations:convert-bbcode|app:convert-bbcode', 'Converts BBCode used in old Part-DB versions to newly used Markdown')] class ConvertBBCodeCommand extends Command { /** @@ -58,7 +59,7 @@ class ConvertBBCodeCommand extends Command */ protected const BBCODE_REGEX = '/\\[.+\\].*\\[\\/.+\\]/'; - protected static $defaultName = 'partdb:migrations:convert-bbcode|app:convert-bbcode'; + protected static $defaultDescription = 'Converts BBCode used in old Part-DB versions to newly used Markdown'; protected EntityManagerInterface $em; protected PropertyAccessorInterface $propertyAccessor; @@ -76,9 +77,7 @@ class ConvertBBCodeCommand extends Command protected function configure(): void { - $this - ->setDescription('Converts BBCode used in old Part-DB versions to newly used Markdown') - ->setHelp('Older versions of Part-DB (<1.0) used BBCode for rich text formatting. + $this->setHelp('Older versions of Part-DB (<1.0) used BBCode for rich text formatting. Part-DB now uses Markdown which offers more features but is incompatible with BBCode. When you upgrade from an pre 1.0 version you have to run this command to convert your comment fields'); @@ -168,6 +167,6 @@ class ConvertBBCodeCommand extends Command $io->success('Changes saved to DB successfully!'); } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index d436bb1c..b325ca9e 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -33,10 +33,11 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:migrations:import-partkeepr', 'Import a PartKeepr database XML dump into Part-DB')] class ImportPartKeeprCommand extends Command { - protected static $defaultName = 'partdb:migrations:import-partkeepr'; + protected static $defaultDescription = 'Import a PartKeepr database XML dump into Part-DB'; protected EntityManagerInterface $em; protected MySQLDumpXMLConverter $xml_converter; @@ -60,7 +61,6 @@ class ImportPartKeeprCommand extends Command protected function configure() { - $this->setDescription('Import a PartKeepr database XML dump into Part-DB'); $this->setHelp('This command allows you to import a PartKeepr database exported by mysqldump as XML file into Part-DB'); $this->addArgument('file', InputArgument::REQUIRED, 'The file to which should be imported.'); @@ -100,7 +100,7 @@ class ImportPartKeeprCommand extends Command if (!$this->importHelper->checkVersion($data)) { $db_version = $this->importHelper->getDatabaseSchemaVersion($data); $io->error('The version of the imported database is not supported! (Version: '.$db_version.')'); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } //Import the mandatory data @@ -118,7 +118,7 @@ class ImportPartKeeprCommand extends Command $io->success('Imported '.$count.' users.'); } - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } private function doImport(SymfonyStyle $io, array $data): void diff --git a/src/Command/User/ConvertToSAMLUserCommand.php b/src/Command/User/ConvertToSAMLUserCommand.php index df48ce06..2144dc85 100644 --- a/src/Command/User/ConvertToSAMLUserCommand.php +++ b/src/Command/User/ConvertToSAMLUserCommand.php @@ -30,9 +30,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')] class ConvertToSAMLUserCommand extends Command { - protected static $defaultName = 'partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user'; + protected static $defaultDescription = 'Converts a local user to a SAML user (and vice versa)'; protected EntityManagerInterface $entityManager; protected bool $saml_enabled; @@ -46,9 +47,7 @@ class ConvertToSAMLUserCommand extends Command protected function configure(): void { - $this - ->setDescription('Converts a local user to a SAML user (and vice versa)') - ->setHelp('This converts a local user, which can login via the login form, to a SAML user, which can only login via SAML. This is useful if you want to migrate from a local user system to a SAML user system.') + $this->setHelp('This converts a local user, which can login via the login form, to a SAML user, which can only login via SAML. This is useful if you want to migrate from a local user system to a SAML user system.') ->addArgument('user', InputArgument::REQUIRED, 'The username (or email) of the user') ->addOption('to-local', null, InputOption::VALUE_NONE, 'Converts a SAML user to a local user') ; @@ -70,7 +69,7 @@ class ConvertToSAMLUserCommand extends Command if (!$user) { $io->error('User not found!'); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $io->info('User found: '.$user->getFullName(true) . ': '.$user->getEmail().' [ID: ' . $user->getID() . ']'); diff --git a/src/Command/User/SetPasswordCommand.php b/src/Command/User/SetPasswordCommand.php index 78724ecf..a1f3d0b9 100644 --- a/src/Command/User/SetPasswordCommand.php +++ b/src/Command/User/SetPasswordCommand.php @@ -34,9 +34,10 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')] class SetPasswordCommand extends Command { - protected static $defaultName = 'partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password'; + protected static $defaultDescription = 'Sets the password of a user'; protected EntityManagerInterface $entityManager; protected UserPasswordHasherInterface $encoder; @@ -53,9 +54,7 @@ class SetPasswordCommand extends Command protected function configure(): void { - $this - ->setDescription('Sets the password of a user') - ->setHelp('This password allows you to set the password of a user, without knowing the old password.') + $this->setHelp('This password allows you to set the password of a user, without knowing the old password.') ->addArgument('user', InputArgument::REQUIRED, 'The username or email of the user') ; } @@ -70,14 +69,14 @@ class SetPasswordCommand extends Command if (!$user) { $io->error(sprintf('No user with the given username %s found in the database!', $user_name)); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $io->note('User found!'); if ($user->isSamlUser()) { $io->error('This user is a SAML user, so you can not change the password!'); - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $proceed = $io->confirm( @@ -85,7 +84,7 @@ class SetPasswordCommand extends Command $user->getFullName(true), $user->getID())); if (!$proceed) { - return 1; + return \Symfony\Component\Console\Command\Command::FAILURE; } $success = false; @@ -116,6 +115,6 @@ class SetPasswordCommand extends Command $security_event = new SecurityEvent($user); $this->eventDispatcher->dispatch($security_event, SecurityEvents::PASSWORD_CHANGED); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index 36e933cc..94d65c67 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -31,11 +31,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:upgrade-permissions-schema', '(Manually) upgrades the permissions schema of all users to the latest version.')] final class UpgradePermissionsSchemaCommand extends Command { - protected static $defaultName = 'partdb:users:upgrade-permissions-schema'; - protected static $defaultDescription = '(Manually) upgrades the permissions schema of all users to the latest version.'; - private PermissionSchemaUpdater $permissionSchemaUpdater; private EntityManagerInterface $em; private EventCommentHelper $eventCommentHelper; @@ -84,7 +82,7 @@ final class UpgradePermissionsSchemaCommand extends Command if (empty($groups_to_upgrade) && empty($users_to_upgrade)) { $io->success('All users and group permissions schemas are up-to-date. No update needed.'); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } //List all users and groups that need an update @@ -100,7 +98,7 @@ final class UpgradePermissionsSchemaCommand extends Command if(!$io->confirm('Continue with the update?', false)) { $io->warning('Update aborted.'); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } //Update all users and groups diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index 2b913e26..daae874c 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -29,9 +29,10 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')] class UserEnableCommand extends Command { - protected static $defaultName = 'partdb:users:enable|partdb:user:enable'; + protected static $defaultDescription = 'Enables/Disable the login of one or more users'; protected EntityManagerInterface $entityManager; @@ -44,9 +45,7 @@ class UserEnableCommand extends Command protected function configure(): void { - $this - ->setDescription('Enables/Disable the login of one or more users') - ->setHelp('This allows you to allow or prevent the login of certain user. Use the --disable option to disable the login for the given users') + $this->setHelp('This allows you to allow or prevent the login of certain user. Use the --disable option to disable the login for the given users') ->addArgument('users', InputArgument::IS_ARRAY, 'The usernames of the users to use') ->addOption('all', 'a', InputOption::VALUE_NONE, 'Enable/Disable all users') ->addOption('disable', 'd', InputOption::VALUE_NONE, 'Disable the login of the given users') diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php index 66265dd8..ca8f5364 100644 --- a/src/Command/User/UserListCommand.php +++ b/src/Command/User/UserListCommand.php @@ -28,9 +28,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:list|users:list', 'Lists all users')] class UserListCommand extends Command { - protected static $defaultName = 'partdb:users:list|users:list'; + protected static $defaultDescription = 'Lists all users'; protected EntityManagerInterface $entityManager; @@ -43,9 +44,7 @@ class UserListCommand extends Command protected function configure(): void { - $this - ->setDescription('Lists all users') - ->setHelp('This command lists all users in the database.') + $this->setHelp('This command lists all users in the database.') ->addOption('local', 'l', null, 'Only list local users') ->addOption('saml', 's', null, 'Only list SAML users') ; diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php index 3d57a4dc..f01bcedb 100644 --- a/src/Command/User/UsersPermissionsCommand.php +++ b/src/Command/User/UsersPermissionsCommand.php @@ -34,11 +34,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Contracts\Translation\TranslatorInterface; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:permissions|partdb:user:permissions', 'View and edit the permissions of a given user')] class UsersPermissionsCommand extends Command { - protected static $defaultName = 'partdb:users:permissions|partdb:user:permissions'; - protected static $defaultDescription = 'View and edit the permissions of a given user'; - protected EntityManagerInterface $entityManager; protected UserRepository $userRepository; protected PermissionManager $permissionResolver; diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php index a5437684..0e0408e7 100644 --- a/src/Command/VersionCommand.php +++ b/src/Command/VersionCommand.php @@ -27,9 +27,10 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[\Symfony\Component\Console\Attribute\AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')] class VersionCommand extends Command { - protected static $defaultName = 'partdb:version|app:version'; + protected static $defaultDescription = 'Shows the currently installed version of Part-DB.'; protected VersionManagerInterface $versionManager; protected GitVersionInfo $gitVersionInfo; @@ -43,9 +44,6 @@ class VersionCommand extends Command protected function configure(): void { - $this - ->setDescription('Shows the currently installed version of Part-DB.') - ; } protected function execute(InputInterface $input, OutputInterface $output): int @@ -66,6 +64,6 @@ class VersionCommand extends Command $io->info('OS: '. php_uname()); $io->info('PHP extension: '. implode(', ', get_loaded_extensions())); - return 0; + return \Symfony\Component\Console\Command\Command::SUCCESS; } } \ No newline at end of file diff --git a/src/Controller/AdminPages/AttachmentTypeController.php b/src/Controller/AdminPages/AttachmentTypeController.php index 6ff5d930..0b85f4a0 100644 --- a/src/Controller/AdminPages/AttachmentTypeController.php +++ b/src/Controller/AdminPages/AttachmentTypeController.php @@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/attachment_type") - */ +#[Route(path: '/attachment_type')] class AttachmentTypeController extends BaseAdminController { protected string $entity_class = AttachmentType::class; @@ -48,44 +46,34 @@ class AttachmentTypeController extends BaseAdminController protected string $attachment_class = AttachmentTypeAttachment::class; protected ?string $parameter_class = AttachmentTypeParameter::class; - /** - * @Route("/{id}", name="attachment_type_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'attachment_type_delete', methods: ['DELETE'])] public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'attachment_type_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="attachment_type_new") - * @Route("/{id}/clone", name="attachment_type_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'attachment_type_new')] + #[Route(path: '/{id}/clone', name: 'attachment_type_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="attachment_type_export_all") - */ + #[Route(path: '/export', name: 'attachment_type_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="attachment_type_export") - */ + #[Route(path: '/{id}/export', name: 'attachment_type_export')] public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index d5f00767..65a17668 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -245,7 +245,7 @@ abstract class BaseAdminController extends AbstractController /** @var AbstractPartsContainingRepository $repo */ $repo = $this->entityManager->getRepository($this->entity_class); - return $this->renderForm($this->twig_template, [ + return $this->render($this->twig_template, [ 'entity' => $entity, 'form' => $form, 'route_base' => $this->route_base, @@ -402,7 +402,7 @@ abstract class BaseAdminController extends AbstractController } ret: - return $this->renderForm($this->twig_template, [ + return $this->render($this->twig_template, [ 'entity' => $new_entity, 'form' => $form, 'import_form' => $import_form, diff --git a/src/Controller/AdminPages/CategoryController.php b/src/Controller/AdminPages/CategoryController.php index 4f247a1d..622de1eb 100644 --- a/src/Controller/AdminPages/CategoryController.php +++ b/src/Controller/AdminPages/CategoryController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/category") - */ +#[Route(path: '/category')] class CategoryController extends BaseAdminController { protected string $entity_class = Category::class; @@ -47,44 +45,34 @@ class CategoryController extends BaseAdminController protected string $attachment_class = CategoryAttachment::class; protected ?string $parameter_class = CategoryParameter::class; - /** - * @Route("/{id}", name="category_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'category_delete', methods: ['DELETE'])] public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'category_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="category_new") - * @Route("/{id}/clone", name="category_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'category_new')] + #[Route(path: '/{id}/clone', name: 'category_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="category_export_all") - */ + #[Route(path: '/export', name: 'category_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="category_export") - */ + #[Route(path: '/{id}/export', name: 'category_export')] public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/CurrencyController.php b/src/Controller/AdminPages/CurrencyController.php index bda992c5..d607c792 100644 --- a/src/Controller/AdminPages/CurrencyController.php +++ b/src/Controller/AdminPages/CurrencyController.php @@ -52,10 +52,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** - * @Route("/currency") - * * Class CurrencyController */ +#[Route(path: '/currency')] class CurrencyController extends BaseAdminController { protected string $entity_class = Currency::class; @@ -98,9 +97,7 @@ class CurrencyController extends BaseAdminController ); } - /** - * @Route("/{id}", name="currency_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'currency_delete', methods: ['DELETE'])] public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); @@ -131,36 +128,28 @@ class CurrencyController extends BaseAdminController return true; } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'currency_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="currency_new") - * @Route("/{id}/clone", name="currency_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'currency_new')] + #[Route(path: '/{id}/clone', name: 'currency_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="currency_export_all") - */ + #[Route(path: '/export', name: 'currency_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="currency_export") - */ + #[Route(path: '/{id}/export', name: 'currency_export')] public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/FootprintController.php b/src/Controller/AdminPages/FootprintController.php index ba37256c..8edd0b06 100644 --- a/src/Controller/AdminPages/FootprintController.php +++ b/src/Controller/AdminPages/FootprintController.php @@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/footprint") - */ +#[Route(path: '/footprint')] class FootprintController extends BaseAdminController { protected string $entity_class = Footprint::class; @@ -48,44 +46,34 @@ class FootprintController extends BaseAdminController protected string $attachment_class = FootprintAttachment::class; protected ?string $parameter_class = FootprintParameter::class; - /** - * @Route("/{id}", name="footprint_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'footprint_delete', methods: ['DELETE'])] public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'footprint_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="footprint_new") - * @Route("/{id}/clone", name="footprint_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'footprint_new')] + #[Route(path: '/{id}/clone', name: 'footprint_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="footprint_export_all") - */ + #[Route(path: '/export', name: 'footprint_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="footprint_export") - */ + #[Route(path: '/{id}/export', name: 'footprint_export')] public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/LabelProfileController.php b/src/Controller/AdminPages/LabelProfileController.php index 1b3579db..b89858dd 100644 --- a/src/Controller/AdminPages/LabelProfileController.php +++ b/src/Controller/AdminPages/LabelProfileController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/label_profile") - */ +#[Route(path: '/label_profile')] class LabelProfileController extends BaseAdminController { protected string $entity_class = LabelProfile::class; @@ -48,44 +46,34 @@ class LabelProfileController extends BaseAdminController //Just a placeholder protected ?string $parameter_class = null; - /** - * @Route("/{id}", name="label_profile_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'label_profile_delete', methods: ['DELETE'])] public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="label_profile_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'label_profile_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="label_profile_new") - * @Route("/{id}/clone", name="label_profile_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'label_profile_new')] + #[Route(path: '/{id}/clone', name: 'label_profile_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?LabelProfile $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="label_profile_export_all") - */ + #[Route(path: '/export', name: 'label_profile_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="label_profile_export") - */ + #[Route(path: '/{id}/export', name: 'label_profile_export')] public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/ManufacturerController.php b/src/Controller/AdminPages/ManufacturerController.php index 2ded7d10..09311e25 100644 --- a/src/Controller/AdminPages/ManufacturerController.php +++ b/src/Controller/AdminPages/ManufacturerController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/manufacturer") - */ +#[Route(path: '/manufacturer')] class ManufacturerController extends BaseAdminController { protected string $entity_class = Manufacturer::class; @@ -48,45 +46,36 @@ class ManufacturerController extends BaseAdminController protected ?string $parameter_class = ManufacturerParameter::class; /** - * @Route("/{id}", name="manufacturer_delete", methods={"DELETE"}) - * * @return RedirectResponse */ + #[Route(path: '/{id}', name: 'manufacturer_delete', methods: ['DELETE'])] public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="manufacturer_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'manufacturer_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Manufacturer $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="manufacturer_new") - * @Route("/{id}/clone", name="manufacturer_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'manufacturer_new')] + #[Route(path: '/{id}/clone', name: 'manufacturer_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="manufacturer_export_all") - */ + #[Route(path: '/export', name: 'manufacturer_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="manufacturer_export") - */ + #[Route(path: '/{id}/export', name: 'manufacturer_export')] public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/MeasurementUnitController.php b/src/Controller/AdminPages/MeasurementUnitController.php index 402c2018..b8a566ec 100644 --- a/src/Controller/AdminPages/MeasurementUnitController.php +++ b/src/Controller/AdminPages/MeasurementUnitController.php @@ -36,9 +36,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/measurement_unit") - */ +#[Route(path: '/measurement_unit')] class MeasurementUnitController extends BaseAdminController { protected string $entity_class = MeasurementUnit::class; @@ -48,44 +46,34 @@ class MeasurementUnitController extends BaseAdminController protected string $attachment_class = MeasurementUnitAttachment::class; protected ?string $parameter_class = MeasurementUnitParameter::class; - /** - * @Route("/{id}", name="measurement_unit_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'measurement_unit_delete', methods: ['DELETE'])] public function delete(Request $request, MeasurementUnit $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="measurement_unit_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'measurement_unit_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(MeasurementUnit $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="measurement_unit_new") - * @Route("/{id}/clone", name="measurement_unit_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'measurement_unit_new')] + #[Route(path: '/{id}/clone', name: 'measurement_unit_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="measurement_unit_export_all") - */ + #[Route(path: '/export', name: 'measurement_unit_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="measurement_unit_export") - */ + #[Route(path: '/{id}/export', name: 'measurement_unit_export')] public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/ProjectAdminController.php b/src/Controller/AdminPages/ProjectAdminController.php index 08d088ec..16bf6df1 100644 --- a/src/Controller/AdminPages/ProjectAdminController.php +++ b/src/Controller/AdminPages/ProjectAdminController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/project") - */ +#[Route(path: '/project')] class ProjectAdminController extends BaseAdminController { protected string $entity_class = Project::class; @@ -47,44 +45,34 @@ class ProjectAdminController extends BaseAdminController protected string $attachment_class = ProjectAttachment::class; protected ?string $parameter_class = ProjectParameter::class; - /** - * @Route("/{id}", name="project_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'project_delete', methods: ['DELETE'])] public function delete(Request $request, Project $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="project_edit") - * @Route("/{id}/edit", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'project_edit')] + #[Route(path: '/{id}/edit', requirements: ['id' => '\d+'])] public function edit(Project $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="project_new") - * @Route("/{id}/clone", name="device_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'project_new')] + #[Route(path: '/{id}/clone', name: 'device_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Project $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="project_export_all") - */ + #[Route(path: '/export', name: 'project_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="project_export") - */ + #[Route(path: '/{id}/export', name: 'project_export')] public function exportEntity(Project $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/StorelocationController.php b/src/Controller/AdminPages/StorelocationController.php index 080690ab..36e8da34 100644 --- a/src/Controller/AdminPages/StorelocationController.php +++ b/src/Controller/AdminPages/StorelocationController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/store_location") - */ +#[Route(path: '/store_location')] class StorelocationController extends BaseAdminController { protected string $entity_class = Storelocation::class; @@ -47,44 +45,34 @@ class StorelocationController extends BaseAdminController protected string $attachment_class = StorelocationAttachment::class; protected ?string $parameter_class = StorelocationParameter::class; - /** - * @Route("/{id}", name="store_location_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'store_location_delete', methods: ['DELETE'])] public function delete(Request $request, Storelocation $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="store_location_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'store_location_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Storelocation $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="store_location_new") - * @Route("/{id}/clone", name="store_location_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'store_location_new')] + #[Route(path: '/{id}/clone', name: 'store_location_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="store_location_export_all") - */ + #[Route(path: '/export', name: 'store_location_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="store_location_export") - */ + #[Route(path: '/{id}/export', name: 'store_location_export')] public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AdminPages/SupplierController.php b/src/Controller/AdminPages/SupplierController.php index f7505c6a..c28a114d 100644 --- a/src/Controller/AdminPages/SupplierController.php +++ b/src/Controller/AdminPages/SupplierController.php @@ -35,9 +35,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/supplier") - */ +#[Route(path: '/supplier')] class SupplierController extends BaseAdminController { protected string $entity_class = Supplier::class; @@ -47,44 +45,34 @@ class SupplierController extends BaseAdminController protected string $attachment_class = SupplierAttachment::class; protected ?string $parameter_class = SupplierParameter::class; - /** - * @Route("/{id}", name="supplier_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'supplier_delete', methods: ['DELETE'])] public function delete(Request $request, Supplier $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="supplier_edit") - * @Route("/{id}", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'supplier_edit')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function edit(Supplier $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="supplier_new") - * @Route("/{id}/clone", name="supplier_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'supplier_new')] + #[Route(path: '/{id}/clone', name: 'supplier_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/export", name="supplier_export_all") - */ + #[Route(path: '/export', name: 'supplier_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="supplier_export") - */ + #[Route(path: '/{id}/export', name: 'supplier_export')] public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/AttachmentFileController.php b/src/Controller/AttachmentFileController.php index 8df2a8bc..16b07ab9 100644 --- a/src/Controller/AttachmentFileController.php +++ b/src/Controller/AttachmentFileController.php @@ -42,9 +42,8 @@ class AttachmentFileController extends AbstractController { /** * Download the selected attachment. - * - * @Route("/attachment/{id}/download", name="attachment_download") */ + #[Route(path: '/attachment/{id}/download', name: 'attachment_download')] public function download(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse { $this->denyAccessUnlessGranted('read', $attachment); @@ -72,9 +71,8 @@ class AttachmentFileController extends AbstractController /** * View the attachment. - * - * @Route("/attachment/{id}/view", name="attachment_view") */ + #[Route(path: '/attachment/{id}/view', name: 'attachment_view')] public function view(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse { $this->denyAccessUnlessGranted('read', $attachment); @@ -100,9 +98,7 @@ class AttachmentFileController extends AbstractController return $response; } - /** - * @Route("/attachment/list", name="attachment_list") - */ + #[Route(path: '/attachment/list', name: 'attachment_list')] public function attachmentsTable(Request $request, DataTableFactory $dataTableFactory, NodesListBuilder $nodesListBuilder): Response { $this->denyAccessUnlessGranted('@attachments.list_attachments'); @@ -124,7 +120,7 @@ class AttachmentFileController extends AbstractController return $this->render('attachment_list.html.twig', [ 'datatable' => $table, - 'filterForm' => $filterForm->createView(), + 'filterForm' => $filterForm, ]); } } diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 5aa8a371..645ef8f9 100644 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -39,9 +39,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/group") - */ +#[Route(path: '/group')] class GroupController extends BaseAdminController { protected string $entity_class = Group::class; @@ -51,10 +49,8 @@ class GroupController extends BaseAdminController protected string $attachment_class = GroupAttachment::class; protected ?string $parameter_class = GroupParameter::class; - /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit") - * @Route("/{id}/", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'group_edit')] + #[Route(path: '/{id}/', requirements: ['id' => '\d+'])] public function edit(Group $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response { //Do an upgrade of the permission schema if needed (so the user can see the permissions a user get on next request (even if it was not done yet) @@ -82,35 +78,27 @@ class GroupController extends BaseAdminController return $this->_edit($entity, $request, $em, $timestamp); } - /** - * @Route("/new", name="group_new") - * @Route("/{id}/clone", name="group_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'group_new')] + #[Route(path: '/{id}/clone', name: 'group_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/{id}", name="group_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}', name: 'group_delete', methods: ['DELETE'])] public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/export", name="group_export_all") - */ + #[Route(path: '/export', name: 'group_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="group_export") - */ + #[Route(path: '/{id}/export', name: 'group_export')] public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); diff --git a/src/Controller/HomepageController.php b/src/Controller/HomepageController.php index 51447c17..fe3025e9 100644 --- a/src/Controller/HomepageController.php +++ b/src/Controller/HomepageController.php @@ -61,9 +61,7 @@ class HomepageController extends AbstractController return $banner; } - /** - * @Route("/", name="homepage") - */ + #[Route(path: '/', name: 'homepage')] public function homepage(Request $request, GitVersionInfo $versionInfo, EntityManagerInterface $entityManager): Response { if ($this->isGranted('@tools.lastActivity')) { diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php index 769639d4..02b44112 100644 --- a/src/Controller/LabelController.php +++ b/src/Controller/LabelController.php @@ -59,9 +59,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; -/** - * @Route("/label") - */ +#[Route(path: '/label')] class LabelController extends AbstractController { protected LabelGenerator $labelGenerator; @@ -80,10 +78,8 @@ class LabelController extends AbstractController $this->translator = $translator; } - /** - * @Route("/dialog", name="label_dialog") - * @Route("/{profile}/dialog", name="label_dialog_profile") - */ + #[Route(path: '/dialog', name: 'label_dialog')] + #[Route(path: '/{profile}/dialog', name: 'label_dialog_profile')] public function generator(Request $request, ?LabelProfile $profile = null): Response { $this->denyAccessUnlessGranted('@labels.create_labels'); @@ -146,7 +142,7 @@ class LabelController extends AbstractController } } - return $this->renderForm('label_system/dialog.html.twig', [ + return $this->render('label_system/dialog.html.twig', [ 'form' => $form, 'pdf_data' => $pdf_data, 'filename' => $filename, diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index 24be85c9..28d7cbac 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -49,9 +49,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/log") - */ +#[Route(path: '/log')] class LogController extends AbstractController { protected EntityManagerInterface $entityManager; @@ -66,10 +64,9 @@ class LogController extends AbstractController } /** - * @Route("/", name="log_view") - * * @return Response */ + #[Route(path: '/', name: 'log_view')] public function showLogs(Request $request, DataTableFactory $dataTable): Response { $this->denyAccessUnlessGranted('@system.show_logs'); @@ -93,17 +90,17 @@ class LogController extends AbstractController return $this->render('log_system/log_list.html.twig', [ 'datatable' => $table, - 'filterForm' => $filterForm->createView(), + 'filterForm' => $filterForm, ]); } /** - * @Route("/{id}/details", name="log_details") * @param Request $request * @param AbstractLogEntry $logEntry * @return Response */ - public function logDetails(Request $request, AbstractLogEntry $logEntry, LogEntryExtraFormatter $logEntryExtraFormatter, + #[Route(path: '/{id}/details', name: 'log_details')] + public function logDetails(AbstractLogEntry $logEntry, LogEntryExtraFormatter $logEntryExtraFormatter, LogLevelHelper $logLevelHelper, LogTargetHelper $logTargetHelper, EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('show_details', $logEntry); @@ -123,9 +120,7 @@ class LogController extends AbstractController ]); } - /** - * @Route("/{id}/delete", name="log_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}/delete', name: 'log_delete', methods: ['DELETE'])] public function deleteLogEntry(Request $request, AbstractLogEntry $logEntry, EntityManagerInterface $entityManager): RedirectResponse { $this->denyAccessUnlessGranted('delete', $logEntry); @@ -142,9 +137,7 @@ class LogController extends AbstractController } - /** - * @Route("/undo", name="log_undo", methods={"POST"}) - */ + #[Route(path: '/undo', name: 'log_undo', methods: ['POST'])] public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper): RedirectResponse { $mode = EventUndoHelper::MODE_UNDO; diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index b7a3fd0e..20a2006c 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -59,9 +59,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; use function Symfony\Component\Translation\t; -/** - * @Route("/part") - */ +#[Route(path: '/part')] class PartController extends AbstractController { protected PricedetailHelper $pricedetailHelper; @@ -77,11 +75,11 @@ class PartController extends AbstractController } /** - * @Route("/{id}/info/{timestamp}", name="part_info") - * @Route("/{id}", requirements={"id"="\d+"}) * * @throws Exception */ + #[Route(path: '/{id}/info/{timestamp}', name: 'part_info')] + #[Route(path: '/{id}', requirements: ['id' => '\d+'])] public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper, DataTableFactory $dataTable, ParameterExtractor $parameterExtractor, PartLotWithdrawAddHelper $withdrawAddHelper, ?string $timestamp = null): Response { @@ -129,9 +127,7 @@ class PartController extends AbstractController ); } - /** - * @Route("/{id}/edit", name="part_edit") - */ + #[Route(path: '/{id}/edit', name: 'part_edit')] public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator, AttachmentSubmitHandler $attachmentSubmitHandler): Response { @@ -182,16 +178,14 @@ class PartController extends AbstractController $this->addFlash('error', 'part.edited_flash.invalid'); } - return $this->renderForm('parts/edit/edit_part_info.html.twig', + return $this->render('parts/edit/edit_part_info.html.twig', [ 'part' => $part, 'form' => $form, ]); } - /** - * @Route("/{id}/delete", name="part_delete", methods={"DELETE"}) - */ + #[Route(path: '/{id}/delete', name: 'part_delete', methods: ['DELETE'])] public function delete(Request $request, Part $part, EntityManagerInterface $entityManager): RedirectResponse { $this->denyAccessUnlessGranted('delete', $part); @@ -213,12 +207,12 @@ class PartController extends AbstractController } /** - * @Route("/new", name="part_new") - * @Route("/{id}/clone", name="part_clone") - * @Route("/new_build_part/{project_id}", name="part_new_build_part") * @ParamConverter("part", options={"id" = "id"}) * @ParamConverter("project", options={"id" = "project_id"}) */ + #[Route(path: '/new', name: 'part_new')] + #[Route(path: '/{id}/clone', name: 'part_clone')] + #[Route(path: '/new_build_part/{project_id}', name: 'part_new_build_part')] public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator, AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper, ?Part $part = null, ?Project $project = null): Response @@ -328,16 +322,14 @@ class PartController extends AbstractController $this->addFlash('error', 'part.created_flash.invalid'); } - return $this->renderForm('parts/edit/new_part.html.twig', + return $this->render('parts/edit/new_part.html.twig', [ 'part' => $new_part, 'form' => $form, ]); } - /** - * @Route("/{id}/add_withdraw", name="part_add_withdraw", methods={"POST"}) - */ + #[Route(path: '/{id}/add_withdraw', name: 'part_add_withdraw', methods: ['POST'])] public function withdrawAddHandler(Part $part, Request $request, EntityManagerInterface $em, PartLotWithdrawAddHelper $withdrawAddHelper): Response { if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) { diff --git a/src/Controller/PartImportExportController.php b/src/Controller/PartImportExportController.php index 81754b3b..fd37c045 100644 --- a/src/Controller/PartImportExportController.php +++ b/src/Controller/PartImportExportController.php @@ -49,10 +49,10 @@ class PartImportExportController extends AbstractController } /** - * @Route("/parts/import", name="parts_import") * @param Request $request * @return Response */ + #[Route(path: '/parts/import', name: 'parts_import')] public function importParts(Request $request): Response { $this->denyAccessUnlessGranted('@parts.import'); @@ -109,7 +109,7 @@ class PartImportExportController extends AbstractController ret: - return $this->renderForm('parts/import/parts_import.html.twig', [ + return $this->render('parts/import/parts_import.html.twig', [ 'import_form' => $import_form, 'imported_entities' => $entities ?? [], 'import_errors' => $errors ?? [], @@ -117,9 +117,9 @@ class PartImportExportController extends AbstractController } /** - * @Route("/parts/export", name="parts_export", methods={"GET"}) * @return Response */ + #[Route(path: '/parts/export', name: 'parts_export', methods: ['GET'])] public function exportParts(Request $request, EntityExporter $entityExporter): Response { $ids = $request->query->get('ids', ''); diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php index 52d65d2a..271adb06 100644 --- a/src/Controller/PartListsController.php +++ b/src/Controller/PartListsController.php @@ -62,9 +62,7 @@ class PartListsController extends AbstractController $this->translator = $translator; } - /** - * @Route("/table/action", name="table_action", methods={"POST"}) - */ + #[Route(path: '/table/action', name: 'table_action', methods: ['POST'])] public function tableAction(Request $request, PartsTableActionHandler $actionHandler): Response { $this->denyAccessUnlessGranted('@parts.edit'); @@ -175,10 +173,9 @@ class PartListsController extends AbstractController } /** - * @Route("/category/{id}/parts", name="part_list_category") - * * @return JsonResponse|Response */ + #[Route(path: '/category/{id}/parts', name: 'part_list_category')] public function showCategory(Category $category, Request $request): Response { $this->denyAccessUnlessGranted('@categories.read'); @@ -197,10 +194,9 @@ class PartListsController extends AbstractController } /** - * @Route("/footprint/{id}/parts", name="part_list_footprint") - * * @return JsonResponse|Response */ + #[Route(path: '/footprint/{id}/parts', name: 'part_list_footprint')] public function showFootprint(Footprint $footprint, Request $request): Response { $this->denyAccessUnlessGranted('@footprints.read'); @@ -219,10 +215,9 @@ class PartListsController extends AbstractController } /** - * @Route("/manufacturer/{id}/parts", name="part_list_manufacturer") - * * @return JsonResponse|Response */ + #[Route(path: '/manufacturer/{id}/parts', name: 'part_list_manufacturer')] public function showManufacturer(Manufacturer $manufacturer, Request $request): Response { $this->denyAccessUnlessGranted('@manufacturers.read'); @@ -241,10 +236,9 @@ class PartListsController extends AbstractController } /** - * @Route("/store_location/{id}/parts", name="part_list_store_location") - * * @return JsonResponse|Response */ + #[Route(path: '/store_location/{id}/parts', name: 'part_list_store_location')] public function showStorelocation(Storelocation $storelocation, Request $request): Response { $this->denyAccessUnlessGranted('@storelocations.read'); @@ -263,10 +257,9 @@ class PartListsController extends AbstractController } /** - * @Route("/supplier/{id}/parts", name="part_list_supplier") - * * @return JsonResponse|Response */ + #[Route(path: '/supplier/{id}/parts', name: 'part_list_supplier')] public function showSupplier(Supplier $supplier, Request $request): Response { $this->denyAccessUnlessGranted('@suppliers.read'); @@ -285,10 +278,9 @@ class PartListsController extends AbstractController } /** - * @Route("/parts/by_tag/{tag}", name="part_list_tags", requirements={"tag": ".*"}) - * * @return JsonResponse|Response */ + #[Route(path: '/parts/by_tag/{tag}', name: 'part_list_tags', requirements: ['tag' => '.*'])] public function showTag(string $tag, Request $request): Response { $tag = trim($tag); @@ -330,10 +322,9 @@ class PartListsController extends AbstractController } /** - * @Route("/parts/search", name="parts_search") - * * @return JsonResponse|Response */ + #[Route(path: '/parts/search', name: 'parts_search')] public function showSearch(Request $request, DataTableFactory $dataTable): Response { $searchFilter = $this->searchRequestToFilter($request); @@ -353,10 +344,9 @@ class PartListsController extends AbstractController } /** - * @Route("/parts", name="parts_show_all") - * * @return Response */ + #[Route(path: '/parts', name: 'parts_show_all')] public function showAll(Request $request): Response { return $this->showListWithFilter($request,'parts/lists/all_list.html.twig'); diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 56ba6b7d..2db1c1a7 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -47,9 +47,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; use function Symfony\Component\Translation\t; -/** - * @Route("/project") - */ +#[Route(path: '/project')] class ProjectController extends AbstractController { private DataTableFactory $dataTableFactory; @@ -59,9 +57,7 @@ class ProjectController extends AbstractController $this->dataTableFactory = $dataTableFactory; } - /** - * @Route("/{id}/info", name="project_info", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/info', name: 'project_info', requirements: ['id' => '\d+'])] public function info(Project $project, Request $request, ProjectBuildHelper $buildHelper): Response { $this->denyAccessUnlessGranted('read', $project); @@ -80,9 +76,7 @@ class ProjectController extends AbstractController ]); } - /** - * @Route("/{id}/build", name="project_build", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/build', name: 'project_build', requirements: ['id' => '\d+'])] public function build(Project $project, Request $request, ProjectBuildHelper $buildHelper, EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('read', $project); @@ -117,7 +111,7 @@ class ProjectController extends AbstractController $this->addFlash('error', 'project.build.flash.invalid_input'); } - return $this->renderForm('projects/build/build.html.twig', [ + return $this->render('projects/build/build.html.twig', [ 'buildHelper' => $buildHelper, 'project' => $project, 'build_request' => $projectBuildRequest, @@ -126,9 +120,7 @@ class ProjectController extends AbstractController ]); } - /** - * @Route("/{id}/import_bom", name="project_import_bom", requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}/import_bom', name: 'project_import_bom', requirements: ['id' => '\d+'])] public function importBOM(Request $request, EntityManagerInterface $entityManager, Project $project, BOMImporter $BOMImporter, ValidatorInterface $validator): Response { @@ -195,7 +187,7 @@ class ProjectController extends AbstractController } } - return $this->renderForm('projects/import_bom.html.twig', [ + return $this->render('projects/import_bom.html.twig', [ 'project' => $project, 'form' => $form, 'errors' => $errors ?? null, @@ -203,11 +195,11 @@ class ProjectController extends AbstractController } /** - * @Route("/add_parts", name="project_add_parts_no_id") - * @Route("/{id}/add_parts", name="project_add_parts", requirements={"id"="\d+"}) * @param Request $request * @param Project|null $project */ + #[Route(path: '/add_parts', name: 'project_add_parts_no_id')] + #[Route(path: '/{id}/add_parts', name: 'project_add_parts', requirements: ['id' => '\d+'])] public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response { if($project) { @@ -274,7 +266,7 @@ class ProjectController extends AbstractController return $this->redirectToRoute('project_info', ['id' => $target_project->getID()]); } - return $this->renderForm('projects/add_parts.html.twig', [ + return $this->render('projects/add_parts.html.twig', [ 'project' => $project, 'form' => $form, ]); diff --git a/src/Controller/ScanController.php b/src/Controller/ScanController.php index 8c0c9ad8..1c7a2670 100644 --- a/src/Controller/ScanController.php +++ b/src/Controller/ScanController.php @@ -51,9 +51,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/scan") - */ +#[Route(path: '/scan')] class ScanController extends AbstractController { protected BarcodeRedirector $barcodeParser; @@ -65,9 +63,7 @@ class ScanController extends AbstractController $this->barcodeNormalizer = $barcodeNormalizer; } - /** - * @Route("", name="scan_dialog") - */ + #[Route(path: '', name: 'scan_dialog')] public function dialog(Request $request): Response { $this->denyAccessUnlessGranted('@tools.label_scanner'); @@ -91,7 +87,7 @@ class ScanController extends AbstractController } } - return $this->renderForm('label_system/scanner/scanner.html.twig', [ + return $this->render('label_system/scanner/scanner.html.twig', [ 'form' => $form, ]); } diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 026e18c1..bd696e1e 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -57,9 +57,7 @@ class SecurityController extends AbstractController $this->allow_email_pw_reset = $allow_email_pw_reset; } - /** - * @Route("/login", name="login", methods={"GET", "POST"}) - */ + #[Route(path: '/login', name: 'login', methods: ['GET', 'POST'])] public function login(AuthenticationUtils $authenticationUtils): Response { // get the login error if there is one @@ -75,10 +73,9 @@ class SecurityController extends AbstractController } /** - * @Route("/pw_reset/request", name="pw_reset_request") - * * @return RedirectResponse|Response */ + #[Route(path: '/pw_reset/request', name: 'pw_reset_request')] public function requestPwReset(PasswordResetManager $passwordReset, Request $request) { if (!$this->allow_email_pw_reset) { @@ -113,16 +110,15 @@ class SecurityController extends AbstractController return $this->redirectToRoute('login'); } - return $this->renderForm('security/pw_reset_request.html.twig', [ + return $this->render('security/pw_reset_request.html.twig', [ 'form' => $form, ]); } /** - * @Route("/pw_reset/new_pw/{user}/{token}", name="pw_reset_new_pw") - * * @return RedirectResponse|Response */ + #[Route(path: '/pw_reset/new_pw/{user}/{token}', name: 'pw_reset_new_pw')] public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null) { if (!$this->allow_email_pw_reset) { @@ -187,14 +183,12 @@ class SecurityController extends AbstractController } } - return $this->renderForm('security/pw_reset_new_pw.html.twig', [ + return $this->render('security/pw_reset_new_pw.html.twig', [ 'form' => $form, ]); } - /** - * @Route("/logout", name="logout") - */ + #[Route(path: '/logout', name: 'logout')] public function logout(): void { throw new RuntimeException('Will be intercepted before getting here'); diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php index 18cca638..7ea9a8bd 100644 --- a/src/Controller/SelectAPIController.php +++ b/src/Controller/SelectAPIController.php @@ -37,10 +37,9 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Contracts\Translation\TranslatorInterface; /** - * @Route("/select_api") - * * This endpoint is used by the select2 library to dynamically load data (used in the multiselect action helper in parts lists) */ +#[Route(path: '/select_api')] class SelectAPIController extends AbstractController { private NodesListBuilder $nodesListBuilder; @@ -54,49 +53,37 @@ class SelectAPIController extends AbstractController $this->choiceHelper = $choiceHelper; } - /** - * @Route("/category", name="select_category") - */ + #[Route(path: '/category', name: 'select_category')] public function category(): Response { return $this->getResponseForClass(Category::class); } - /** - * @Route("/footprint", name="select_footprint") - */ + #[Route(path: '/footprint', name: 'select_footprint')] public function footprint(): Response { return $this->getResponseForClass(Footprint::class, true); } - /** - * @Route("/manufacturer", name="select_manufacturer") - */ + #[Route(path: '/manufacturer', name: 'select_manufacturer')] public function manufacturer(): Response { return $this->getResponseForClass(Manufacturer::class, true); } - /** - * @Route("/measurement_unit", name="select_measurement_unit") - */ + #[Route(path: '/measurement_unit', name: 'select_measurement_unit')] public function measurement_unit(): Response { return $this->getResponseForClass(MeasurementUnit::class, true); } - /** - * @Route("/project", name="select_project") - */ + #[Route(path: '/project', name: 'select_project')] public function projects(): Response { return $this->getResponseForClass(Project::class, false); } - /** - * @Route("/export_level", name="select_export_level") - */ + #[Route(path: '/export_level', name: 'select_export_level')] public function exportLevel(): Response { $entries = [ @@ -114,9 +101,9 @@ class SelectAPIController extends AbstractController } /** - * @Route("/label_profiles", name="select_label_profiles") * @return Response */ + #[Route(path: '/label_profiles', name: 'select_label_profiles')] public function labelProfiles(EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('@labels.create_labels'); @@ -135,9 +122,9 @@ class SelectAPIController extends AbstractController } /** - * @Route("/label_profiles_lot", name="select_label_profiles_lot") * @return Response */ + #[Route(path: '/label_profiles_lot', name: 'select_label_profiles_lot')] public function labelProfilesLot(EntityManagerInterface $entityManager): Response { $this->denyAccessUnlessGranted('@labels.create_labels'); diff --git a/src/Controller/StatisticsController.php b/src/Controller/StatisticsController.php index d9c467f4..6ff09e83 100644 --- a/src/Controller/StatisticsController.php +++ b/src/Controller/StatisticsController.php @@ -48,9 +48,7 @@ use Symfony\Component\Routing\Annotation\Route; class StatisticsController extends AbstractController { - /** - * @Route("/statistics", name="statistics_view") - */ + #[Route(path: '/statistics', name: 'statistics_view')] public function showStatistics(StatisticsHelper $helper): Response { $this->denyAccessUnlessGranted('@tools.statistics'); diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index 3ef68b8f..56711d43 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -32,14 +32,10 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Generator\UrlGenerator; -/** - * @Route("/tools") - */ +#[Route(path: '/tools')] class ToolsController extends AbstractController { - /** - * @Route("/reel_calc", name="tools_reel_calculator") - */ + #[Route(path: '/reel_calc', name: 'tools_reel_calculator')] public function reelCalculator(): Response { $this->denyAccessUnlessGranted('@tools.reel_calculator'); @@ -47,9 +43,7 @@ class ToolsController extends AbstractController return $this->render('tools/reel_calculator/reel_calculator.html.twig'); } - /** - * @Route("/server_infos", name="tools_server_infos") - */ + #[Route(path: '/server_infos', name: 'tools_server_infos')] public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper, AttachmentSubmitHandler $attachmentSubmitHandler): Response { @@ -98,9 +92,9 @@ class ToolsController extends AbstractController } /** - * @Route("/builtin_footprints", name="tools_builtin_footprints_viewer") * @return Response */ + #[Route(path: '/builtin_footprints', name: 'tools_builtin_footprints_viewer')] public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator): Response { $this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer'); @@ -121,9 +115,9 @@ class ToolsController extends AbstractController } /** - * @Route("/ic_logos", name="tools_ic_logos") * @return Response */ + #[Route(path: '/ic_logos', name: 'tools_ic_logos')] public function icLogos(): Response { $this->denyAccessUnlessGranted('@tools.ic_logos'); diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php index 6ab3b420..806dd4d2 100644 --- a/src/Controller/TreeController.php +++ b/src/Controller/TreeController.php @@ -36,9 +36,8 @@ use Symfony\Component\Routing\Annotation\Route; /** * This controller has the purpose to provide the data for all treeviews. - * - * @Route("/tree") */ +#[Route(path: '/tree')] class TreeController extends AbstractController { protected TreeViewGenerator $treeGenerator; @@ -48,9 +47,7 @@ class TreeController extends AbstractController $this->treeGenerator = $treeGenerator; } - /** - * @Route("/tools", name="tree_tools") - */ + #[Route(path: '/tools', name: 'tree_tools')] public function tools(ToolsTreeBuilder $builder): JsonResponse { $tree = $builder->getTree(); @@ -58,90 +55,78 @@ class TreeController extends AbstractController return new JsonResponse($tree); } - /** - * @Route("/category/{id}", name="tree_category") - * @Route("/categories", name="tree_category_root") - */ + #[Route(path: '/category/{id}', name: 'tree_category')] + #[Route(path: '/categories', name: 'tree_category_root')] public function categoryTree(?Category $category = null): JsonResponse { if ($this->isGranted('@parts.read') && $this->isGranted('@categories.read')) { $tree = $this->treeGenerator->getTreeView(Category::class, $category, 'list_parts_root'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/footprint/{id}", name="tree_footprint") - * @Route("/footprints", name="tree_footprint_root") - */ + #[Route(path: '/footprint/{id}', name: 'tree_footprint')] + #[Route(path: '/footprints', name: 'tree_footprint_root')] public function footprintTree(?Footprint $footprint = null): JsonResponse { if ($this->isGranted('@parts.read') && $this->isGranted('@footprints.read')) { $tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint, 'list_parts_root'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/location/{id}", name="tree_location") - * @Route("/locations", name="tree_location_root") - */ + #[Route(path: '/location/{id}', name: 'tree_location')] + #[Route(path: '/locations', name: 'tree_location_root')] public function locationTree(?Storelocation $location = null): JsonResponse { if ($this->isGranted('@parts.read') && $this->isGranted('@storelocations.read')) { $tree = $this->treeGenerator->getTreeView(Storelocation::class, $location, 'list_parts_root'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/manufacturer/{id}", name="tree_manufacturer") - * @Route("/manufacturers", name="tree_manufacturer_root") - */ + #[Route(path: '/manufacturer/{id}', name: 'tree_manufacturer')] + #[Route(path: '/manufacturers', name: 'tree_manufacturer_root')] public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse { if ($this->isGranted('@parts.read') && $this->isGranted('@manufacturers.read')) { $tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer, 'list_parts_root'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/supplier/{id}", name="tree_supplier") - * @Route("/suppliers", name="tree_supplier_root") - */ + #[Route(path: '/supplier/{id}', name: 'tree_supplier')] + #[Route(path: '/suppliers', name: 'tree_supplier_root')] public function supplierTree(?Supplier $supplier = null): JsonResponse { if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) { $tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } - /** - * @Route("/device/{id}", name="tree_device") - * @Route("/devices", name="tree_device_root") - */ + #[Route(path: '/device/{id}', name: 'tree_device')] + #[Route(path: '/devices', name: 'tree_device_root')] public function deviceTree(?Project $device = null): JsonResponse { if ($this->isGranted('@projects.read')) { $tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices'); } else { - return new JsonResponse("Access denied", 403); + return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index c5d440d2..19385d0f 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -51,9 +51,8 @@ use Symfony\Component\Serializer\Serializer; /** * In this controller the endpoints for the typeaheads are collected. - * - * @Route("/typeahead") */ +#[Route(path: '/typeahead')] class TypeaheadController extends AbstractController { protected AttachmentURLGenerator $urlGenerator; @@ -65,9 +64,7 @@ class TypeaheadController extends AbstractController $this->assets = $assets; } - /** - * @Route("/builtInResources/search", name="typeahead_builtInRessources") - */ + #[Route(path: '/builtInResources/search', name: 'typeahead_builtInRessources')] public function builtInResources(Request $request, BuiltinAttachmentsFinder $finder): JsonResponse { $query = $request->get('query'); @@ -91,7 +88,7 @@ class TypeaheadController extends AbstractController $serializer = new Serializer($normalizers, $encoders); $data = $serializer->serialize($result, 'json'); - return new JsonResponse($data, 200, [], true); + return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true); } /** @@ -131,11 +128,11 @@ class TypeaheadController extends AbstractController } /** - * @Route("/parts/search/{query}", name="typeahead_parts") * @param string $query * @param EntityManagerInterface $entityManager * @return JsonResponse */ + #[Route(path: '/parts/search/{query}', name: 'typeahead_parts')] public function parts(EntityManagerInterface $entityManager, PartPreviewGenerator $previewGenerator, AttachmentURLGenerator $attachmentURLGenerator, string $query = ""): JsonResponse { @@ -170,10 +167,10 @@ class TypeaheadController extends AbstractController } /** - * @Route("/parameters/{type}/search/{query}", name="typeahead_parameters", requirements={"type" = ".+"}) * @param string $query * @return JsonResponse */ + #[Route(path: '/parameters/{type}/search/{query}', name: 'typeahead_parameters', requirements: ['type' => '.+'])] public function parameters(string $type, EntityManagerInterface $entityManager, string $query = ""): JsonResponse { $class = $this->typeToParameterClass($type); @@ -190,9 +187,7 @@ class TypeaheadController extends AbstractController return new JsonResponse($data); } - /** - * @Route("/tags/search/{query}", name="typeahead_tags", requirements={"query"= ".+"}) - */ + #[Route(path: '/tags/search/{query}', name: 'typeahead_tags', requirements: ['query' => '.+'])] public function tags(string $query, TagFinder $finder): JsonResponse { $this->denyAccessUnlessGranted('@parts.read'); @@ -209,6 +204,6 @@ class TypeaheadController extends AbstractController $serializer = new Serializer($normalizers, $encoders); $data = $serializer->serialize($array, 'json'); - return new JsonResponse($data, 200, [], true); + return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true); } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 9669a3a6..7d2b8160 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -46,10 +46,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; -/** - * @Route("/user") - * Class UserController - */ +#[Route(path: '/user')] class UserController extends AdminPages\BaseAdminController { protected string $entity_class = User::class; @@ -76,11 +73,11 @@ class UserController extends AdminPages\BaseAdminController } /** - * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="user_edit") - * @Route("/{id}/", requirements={"id"="\d+"}) * * @throws Exception */ + #[Route(path: '/{id}/edit/{timestamp}', requirements: ['id' => '\d+'], name: 'user_edit')] + #[Route(path: '/{id}/', requirements: ['id' => '\d+'])] public function edit(User $entity, Request $request, EntityManagerInterface $em, PermissionPresetsHelper $permissionPresetsHelper, PermissionSchemaUpdater $permissionSchemaUpdater, ?string $timestamp = null): Response { //Do an upgrade of the permission schema if needed (so the user can see the permissions a user get on next request (even if it was not done yet) @@ -148,19 +145,15 @@ class UserController extends AdminPages\BaseAdminController return true; } - /** - * @Route("/new", name="user_new") - * @Route("/{id}/clone", name="user_clone") - * @Route("/") - */ + #[Route(path: '/new', name: 'user_new')] + #[Route(path: '/{id}/clone', name: 'user_clone')] + #[Route(path: '/')] public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } - /** - * @Route("/{id}", name="user_delete", methods={"DELETE"}, requirements={"id"="\d+"}) - */ + #[Route(path: '/{id}', name: 'user_delete', methods: ['DELETE'], requirements: ['id' => '\d+'])] public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { if (User::ID_ANONYMOUS === $entity->getID()) { @@ -170,26 +163,20 @@ class UserController extends AdminPages\BaseAdminController return $this->_delete($request, $entity, $recursionHelper); } - /** - * @Route("/export", name="user_export_all") - */ + #[Route(path: '/export', name: 'user_export_all')] public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response { return $this->_exportAll($em, $exporter, $request); } - /** - * @Route("/{id}/export", name="user_export") - */ + #[Route(path: '/{id}/export', name: 'user_export')] public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); } - /** - * @Route("/info", name="user_info_self") - * @Route("/{id}/info", name="user_info") - */ + #[Route(path: '/info', name: 'user_info_self')] + #[Route(path: '/{id}/info', name: 'user_info')] public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response { //If no user id was passed, then we show info about the current user @@ -229,7 +216,7 @@ class UserController extends AdminPages\BaseAdminController 'data' => $user, ]); - return $this->renderForm('users/user_info.html.twig', [ + return $this->render('users/user_info.html.twig', [ 'user' => $user, 'form' => $builder->getForm(), 'datatable' => $table ?? null, diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php index c1c38d6b..298b94d0 100644 --- a/src/Controller/UserSettingsController.php +++ b/src/Controller/UserSettingsController.php @@ -51,9 +51,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Validator\Constraints\UserPassword; use Symfony\Component\Validator\Constraints\Length; -/** - * @Route("/user") - */ +#[Route(path: '/user')] class UserSettingsController extends AbstractController { protected bool $demo_mode; @@ -69,9 +67,7 @@ class UserSettingsController extends AbstractController $this->eventDispatcher = $eventDispatcher; } - /** - * @Route("/2fa_backup_codes", name="show_backup_codes") - */ + #[Route(path: '/2fa_backup_codes', name: 'show_backup_codes')] public function showBackupCodes() { $user = $this->getUser(); @@ -98,9 +94,7 @@ class UserSettingsController extends AbstractController ]); } - /** - * @Route("/u2f_delete", name="u2f_delete", methods={"DELETE"}) - */ + #[Route(path: '/u2f_delete', name: 'u2f_delete', methods: ['DELETE'])] public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse { if ($this->demo_mode) { @@ -181,10 +175,9 @@ class UserSettingsController extends AbstractController } /** - * @Route("/invalidate_trustedDevices", name="tfa_trustedDevices_invalidate", methods={"DELETE"}) - * * @return RuntimeException|RedirectResponse */ + #[Route(path: '/invalidate_trustedDevices', name: 'tfa_trustedDevices_invalidate', methods: ['DELETE'])] public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager) { if ($this->demo_mode) { @@ -219,10 +212,9 @@ class UserSettingsController extends AbstractController } /** - * @Route("/settings", name="user_settings") - * * @return RedirectResponse|Response */ + #[Route(path: '/settings', name: 'user_settings')] public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper) { /** @var User $user */ @@ -397,7 +389,7 @@ class UserSettingsController extends AbstractController * Output both forms *****************************/ - return $this->renderForm('users/user_settings.html.twig', [ + return $this->render('users/user_settings.html.twig', [ 'user' => $user, 'settings_form' => $form, 'pw_form' => $pw_form, diff --git a/src/Controller/WebauthnKeyRegistrationController.php b/src/Controller/WebauthnKeyRegistrationController.php index 8a26346a..ee39954a 100644 --- a/src/Controller/WebauthnKeyRegistrationController.php +++ b/src/Controller/WebauthnKeyRegistrationController.php @@ -40,9 +40,7 @@ class WebauthnKeyRegistrationController extends AbstractController $this->demo_mode = $demo_mode; } - /** - * @Route("/webauthn/register", name="webauthn_register") - */ + #[Route(path: '/webauthn/register', name: 'webauthn_register')] public function register(Request $request, TFAWebauthnRegistrationHelper $registrationHelper, EntityManagerInterface $em) { //When user change its settings, he should be logged in fully. diff --git a/src/DataTables/Column/RevertLogColumn.php b/src/DataTables/Column/RevertLogColumn.php index 16f3365a..0215bd24 100644 --- a/src/DataTables/Column/RevertLogColumn.php +++ b/src/DataTables/Column/RevertLogColumn.php @@ -52,9 +52,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; class RevertLogColumn extends AbstractColumn { protected TranslatorInterface $translator; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(TranslatorInterface $translator, Security $security) + public function __construct(TranslatorInterface $translator, \Symfony\Bundle\SecurityBundle\Security $security) { $this->translator = $translator; $this->security = $security; diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php index bef88955..424297e0 100644 --- a/src/DataTables/LogDataTable.php +++ b/src/DataTables/LogDataTable.php @@ -66,13 +66,13 @@ class LogDataTable implements DataTableTypeInterface protected UrlGeneratorInterface $urlGenerator; protected EntityURLGenerator $entityURLGenerator; protected LogEntryRepository $logRepo; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected UserAvatarHelper $userAvatarHelper; protected LogLevelHelper $logLevelHelper; public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, - Security $security, UserAvatarHelper $userAvatarHelper, LogLevelHelper $logLevelHelper) + \Symfony\Bundle\SecurityBundle\Security $security, UserAvatarHelper $userAvatarHelper, LogLevelHelper $logLevelHelper) { $this->elementTypeNameGenerator = $elementTypeNameGenerator; $this->translator = $translator; diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 8dc94ba0..8436cd89 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -56,14 +56,14 @@ final class PartsDataTable implements DataTableTypeInterface { private TranslatorInterface $translator; private AmountFormatter $amountFormatter; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private PartDataTableHelper $partDataTableHelper; private EntityURLGenerator $urlGenerator; public function __construct(EntityURLGenerator $urlGenerator, TranslatorInterface $translator, - AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, Security $security) + AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, \Symfony\Bundle\SecurityBundle\Security $security) { $this->urlGenerator = $urlGenerator; $this->translator = $translator; diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 39b755ce..d33f3a30 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -99,9 +99,9 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var string the name of this element * @ORM\Column(type="string") - * @Assert\NotBlank(message="validator.attachment.name_not_blank") - * @Groups({"simple", "extended", "full"}) */ + #[Assert\NotBlank(message: 'validator.attachment.name_not_blank')] + #[Groups(['simple', 'extended', 'full'])] protected string $name = ''; /** @@ -120,8 +120,8 @@ abstract class Attachment extends AbstractNamedDBElement * @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type") * @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false) * @Selectable() - * @Assert\NotNull(message="validator.attachment.must_not_be_null") */ + #[Assert\NotNull(message: 'validator.attachment.must_not_be_null')] protected ?AttachmentType $attachment_type = null; public function __construct() diff --git a/src/Entity/Attachments/AttachmentContainingDBElement.php b/src/Entity/Attachments/AttachmentContainingDBElement.php index e74d7cb6..5f592ed2 100644 --- a/src/Entity/Attachments/AttachmentContainingDBElement.php +++ b/src/Entity/Attachments/AttachmentContainingDBElement.php @@ -44,8 +44,8 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl * //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element") * * Mapping is done in sub classes like part - * @Groups({"full"}) */ + #[Groups(['full'])] protected Collection $attachments; public function __construct() diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index 683c7be5..a7e3742f 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -63,15 +63,15 @@ class AttachmentType extends AbstractStructuralDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php index 8cc3e5d6..8b29d8a1 100644 --- a/src/Entity/Attachments/AttachmentTypeAttachment.php +++ b/src/Entity/Attachments/AttachmentTypeAttachment.php @@ -29,8 +29,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to an attachmentType element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class AttachmentTypeAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php index bfc54af0..49685f15 100644 --- a/src/Entity/Attachments/CategoryAttachment.php +++ b/src/Entity/Attachments/CategoryAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a category element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class CategoryAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Category::class; diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php index ebfef170..caa595f6 100644 --- a/src/Entity/Attachments/CurrencyAttachment.php +++ b/src/Entity/Attachments/CurrencyAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a currency element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class CurrencyAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Currency::class; diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php index 7eb65db1..5bca593b 100644 --- a/src/Entity/Attachments/FootprintAttachment.php +++ b/src/Entity/Attachments/FootprintAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a footprint element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class FootprintAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Footprint::class; diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php index b6ab93f4..b48ca523 100644 --- a/src/Entity/Attachments/GroupAttachment.php +++ b/src/Entity/Attachments/GroupAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a Group element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class GroupAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Group::class; diff --git a/src/Entity/Attachments/LabelAttachment.php b/src/Entity/Attachments/LabelAttachment.php index f0f70b79..a8c09bee 100644 --- a/src/Entity/Attachments/LabelAttachment.php +++ b/src/Entity/Attachments/LabelAttachment.php @@ -49,8 +49,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a user element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class LabelAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = LabelProfile::class; diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php index 25451b7c..ca11d0b3 100644 --- a/src/Entity/Attachments/ManufacturerAttachment.php +++ b/src/Entity/Attachments/ManufacturerAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a manufacturer element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class ManufacturerAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php index 8a007101..623e0661 100644 --- a/src/Entity/Attachments/MeasurementUnitAttachment.php +++ b/src/Entity/Attachments/MeasurementUnitAttachment.php @@ -31,8 +31,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a measurement unit element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class MeasurementUnitAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php index 3aa2d05c..2efb0088 100644 --- a/src/Entity/Attachments/PartAttachment.php +++ b/src/Entity/Attachments/PartAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a part element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class PartAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Part::class; diff --git a/src/Entity/Attachments/ProjectAttachment.php b/src/Entity/Attachments/ProjectAttachment.php index 3f2d36d9..f9d3d24e 100644 --- a/src/Entity/Attachments/ProjectAttachment.php +++ b/src/Entity/Attachments/ProjectAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a device element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class ProjectAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Project::class; diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php index 71e5672e..95e0136d 100644 --- a/src/Entity/Attachments/StorelocationAttachment.php +++ b/src/Entity/Attachments/StorelocationAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a measurement unit element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class StorelocationAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Storelocation::class; diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php index a6058ccc..fffa2e5b 100644 --- a/src/Entity/Attachments/SupplierAttachment.php +++ b/src/Entity/Attachments/SupplierAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * A attachment attached to a supplier element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class SupplierAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Supplier::class; diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php index 65cd8730..67998d8e 100644 --- a/src/Entity/Attachments/UserAttachment.php +++ b/src/Entity/Attachments/UserAttachment.php @@ -30,8 +30,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a user element. * * @ORM\Entity() - * @UniqueEntity({"name", "attachment_type", "element"}) */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] class UserAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = User::class; diff --git a/src/Entity/Base/AbstractCompany.php b/src/Entity/Base/AbstractCompany.php index af77106f..87acface 100644 --- a/src/Entity/Base/AbstractCompany.php +++ b/src/Entity/Base/AbstractCompany.php @@ -37,38 +37,38 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement /** * @var string The address of the company * @ORM\Column(type="string") - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $address = ''; /** * @var string The phone number of the company * @ORM\Column(type="string") - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $phone_number = ''; /** * @var string The fax number of the company * @ORM\Column(type="string") - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $fax_number = ''; /** * @var string The email address of the company * @ORM\Column(type="string") - * @Assert\Email() - * @Groups({"full"}) */ + #[Assert\Email] + #[Groups(['full'])] protected string $email_address = ''; /** * @var string The website of the company * @ORM\Column(type="string") - * @Assert\Url() - * @Groups({"full"}) */ + #[Assert\Url] + #[Groups(['full'])] protected string $website = ''; /** diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index 97b77d53..e2946f4e 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -36,41 +36,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * must have the table row "id"!! The ID is the unique key to identify the elements. * * @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository") - * - * @DiscriminatorMap(typeProperty="type", mapping={ - * "attachment_type" = "App\Entity\Attachments\AttachmentType", - * "attachment" = "App\Entity\Attachments\Attachment", - * "attachment_type_attachment" = "App\Entity\Attachments\AttachmentTypeAttachment", - * "category_attachment" = "App\Entity\Attachments\CategoryAttachment", - * "currency_attachment" = "App\Entity\Attachments\CurrencyAttachment", - * "footprint_attachment" = "App\Entity\Attachments\FootprintAttachment", - * "group_attachment" = "App\Entity\Attachments\GroupAttachment", - * "label_attachment" = "App\Entity\Attachments\LabelAttachment", - * "manufacturer_attachment" = "App\Entity\Attachments\ManufacturerAttachment", - * "measurement_unit_attachment" = "App\Entity\Attachments\MeasurementUnitAttachment", - * "part_attachment" = "App\Entity\Attachments\PartAttachment", - * "project_attachment" = "App\Entity\Attachments\ProjectAttachment", - * "storelocation_attachment" = "App\Entity\Attachments\StorelocationAttachment", - * "supplier_attachment" = "App\Entity\Attachments\SupplierAttachment", - * "user_attachment" = "App\Entity\Attachments\UserAttachment", - * "category" = "App\Entity\Parts\Category", - * "project" = "App\Entity\ProjectSystem\Project", - * "project_bom_entry" = "App\Entity\ProjectSystem\ProjectBOMEntry", - * "footprint" = "App\Entity\Parts\Footprint", - * "group" = "App\Entity\UserSystem\Group", - * "manufacturer" = "App\Entity\Parts\Manufacturer", - * "orderdetail" = "App\Entity\PriceInformations\Orderdetail", - * "part" = "App\Entity\Parts\Part", - * "pricedetail" = "App\Entity\PriceInformation\Pricedetail", - * "storelocation" = "App\Entity\Parts\Storelocation", - * "part_lot" = "App\Entity\Parts\PartLot", - * "currency" = "App\Entity\PriceInformations\Currency", - * "measurement_unit" = "App\Entity\Parts\MeasurementUnit", - * "parameter" = "App\Entity\Parts\AbstractParameter", - * "supplier" = "App\Entity\Parts\Supplier", - * "user" = "App\Entity\UserSystem\User" - * }) */ +#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => 'App\Entity\Attachments\AttachmentType', 'attachment' => 'App\Entity\Attachments\Attachment', 'attachment_type_attachment' => 'App\Entity\Attachments\AttachmentTypeAttachment', 'category_attachment' => 'App\Entity\Attachments\CategoryAttachment', 'currency_attachment' => 'App\Entity\Attachments\CurrencyAttachment', 'footprint_attachment' => 'App\Entity\Attachments\FootprintAttachment', 'group_attachment' => 'App\Entity\Attachments\GroupAttachment', 'label_attachment' => 'App\Entity\Attachments\LabelAttachment', 'manufacturer_attachment' => 'App\Entity\Attachments\ManufacturerAttachment', 'measurement_unit_attachment' => 'App\Entity\Attachments\MeasurementUnitAttachment', 'part_attachment' => 'App\Entity\Attachments\PartAttachment', 'project_attachment' => 'App\Entity\Attachments\ProjectAttachment', 'storelocation_attachment' => 'App\Entity\Attachments\StorelocationAttachment', 'supplier_attachment' => 'App\Entity\Attachments\SupplierAttachment', 'user_attachment' => 'App\Entity\Attachments\UserAttachment', 'category' => 'App\Entity\Parts\Category', 'project' => 'App\Entity\ProjectSystem\Project', 'project_bom_entry' => 'App\Entity\ProjectSystem\ProjectBOMEntry', 'footprint' => 'App\Entity\Parts\Footprint', 'group' => 'App\Entity\UserSystem\Group', 'manufacturer' => 'App\Entity\Parts\Manufacturer', 'orderdetail' => 'App\Entity\PriceInformations\Orderdetail', 'part' => 'App\Entity\Parts\Part', 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => 'App\Entity\Parts\Storelocation', 'part_lot' => 'App\Entity\Parts\PartLot', 'currency' => 'App\Entity\PriceInformations\Currency', 'measurement_unit' => 'App\Entity\Parts\MeasurementUnit', 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => 'App\Entity\Parts\Supplier', 'user' => 'App\Entity\UserSystem\User'])] abstract class AbstractDBElement implements JsonSerializable { /** @var int|null The Identification number for this part. This value is unique for the element in this table. @@ -78,8 +45,8 @@ abstract class AbstractDBElement implements JsonSerializable * @ORM\Column(type="integer") * @ORM\Id() * @ORM\GeneratedValue() - * @Groups({"full"}) */ + #[Groups(['full'])] protected ?int $id = null; public function __clone() diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php index ddb758c0..90ebc91c 100644 --- a/src/Entity/Base/AbstractNamedDBElement.php +++ b/src/Entity/Base/AbstractNamedDBElement.php @@ -41,9 +41,9 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named /** * @var string the name of this element * @ORM\Column(type="string") - * @Assert\NotBlank() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\NotBlank] + #[Groups(['simple', 'extended', 'full', 'import'])] protected string $name = ''; /****************************************************************************** diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index 52326907..a4a047ef 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -33,6 +33,6 @@ use Symfony\Component\Serializer\Annotation\Groups; */ abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement { - /** @Groups({"full"}) */ + #[Groups(['full'])] protected Collection $parameters; } diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 1353448d..8ce54f0e 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -46,9 +46,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository") * * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - * - * @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name") */ +#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')] abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement { use ParametersTrait; @@ -63,16 +62,16 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement /** * @var string The comment info for this element * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $comment = ''; /** * @var bool If this property is set, this element can not be selected for part properties. * Useful if this element should be used only for grouping, sorting. * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $not_selectable = false; /** @@ -85,15 +84,15 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement * subclasses. * * @var AbstractStructuralDBElement[]|Collection - * @Groups({"include_children"}) */ + #[Groups(['include_children'])] protected Collection $children; /** * @var AbstractStructuralDBElement * @NoneOfItsChildren() - * @Groups({"include_parents", "import"}) */ + #[Groups(['include_parents', 'import'])] protected ?AbstractStructuralDBElement $parent = null; /** @var string[] all names of all parent elements as an array of strings, diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php index b6c5657f..b5e0f29a 100644 --- a/src/Entity/Base/MasterAttachmentTrait.php +++ b/src/Entity/Base/MasterAttachmentTrait.php @@ -35,8 +35,8 @@ trait MasterAttachmentTrait * @var Attachment|null * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") * @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) - * @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture") */ + #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] protected ?Attachment $master_picture_attachment = null; /** diff --git a/src/Entity/Base/TimestampTrait.php b/src/Entity/Base/TimestampTrait.php index df3779eb..c4c74255 100644 --- a/src/Entity/Base/TimestampTrait.php +++ b/src/Entity/Base/TimestampTrait.php @@ -34,15 +34,15 @@ trait TimestampTrait /** * @var DateTime|null the date when this element was modified the last time * @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"}) - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected ?DateTime $lastModified = null; /** * @var DateTime|null the date when this element was created * @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"}) - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected ?DateTime $addedDate = null; /** diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index f3f448ad..913aa5b3 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -57,37 +57,37 @@ class LabelOptions /** * @var float The page size of the label in mm - * @Assert\Positive() * @ORM\Column(type="float") */ + #[Assert\Positive] protected float $width = 50.0; /** * @var float The page size of the label in mm - * @Assert\Positive() * @ORM\Column(type="float") */ + #[Assert\Positive] protected float $height = 30.0; /** * @var string The type of the barcode that should be used in the label (e.g. 'qr') - * @Assert\Choice(choices=LabelOptions::BARCODE_TYPES) * @ORM\Column(type="string") */ + #[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)] protected string $barcode_type = 'none'; /** * @var string What image should be shown along the - * @Assert\Choice(choices=LabelOptions::PICTURE_TYPES) * @ORM\Column(type="string") */ + #[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)] protected string $picture_type = 'none'; /** * @var string - * @Assert\Choice(choices=LabelOptions::SUPPORTED_ELEMENTS) * @ORM\Column(type="string") */ + #[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)] protected string $supported_element = 'part'; /** @@ -97,9 +97,9 @@ class LabelOptions protected string $additional_css = ''; /** @var string The mode that will be used to interpret the lines - * @Assert\Choice(choices=LabelOptions::LINES_MODES) * @ORM\Column(type="string") */ + #[Assert\Choice(choices: LabelOptions::LINES_MODES)] protected string $lines_mode = 'html'; /** diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php index 12f6d659..ccd4087b 100644 --- a/src/Entity/LabelSystem/LabelProfile.php +++ b/src/Entity/LabelSystem/LabelProfile.php @@ -52,8 +52,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository") * @ORM\Table(name="label_profiles") * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - * @UniqueEntity({"name", "options.supported_element"}) */ +#[UniqueEntity(['name', 'options.supported_element'])] class LabelProfile extends AttachmentContainingDBElement { /** @@ -66,8 +66,8 @@ class LabelProfile extends AttachmentContainingDBElement /** * @var LabelOptions * @ORM\Embedded(class="LabelOptions") - * @Assert\Valid() */ + #[Assert\Valid] protected LabelOptions $options; /** diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 9281970c..134d44aa 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -83,59 +83,59 @@ abstract class AbstractParameter extends AbstractNamedDBElement /** * @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short - * @Assert\Length(max=20) * @ORM\Column(type="string", nullable=false) - * @Groups({"full"}) */ + #[Assert\Length(max: 20)] + #[Groups(['full'])] protected string $symbol = ''; /** * @var float|null the guaranteed minimum value of this property - * @Assert\Type({"float","null"}) - * @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical") - * @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max") * @ORM\Column(type="float", nullable=true) - * @Groups({"full"}) */ + #[Assert\Type(['float', null])] + #[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')] + #[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')] + #[Groups(['full'])] protected ?float $value_min = null; /** * @var float|null the typical value of this property - * @Assert\Type({"null", "float"}) * @ORM\Column(type="float", nullable=true) - * @Groups({"full"}) */ + #[Assert\Type([null, 'float'])] + #[Groups(['full'])] protected ?float $value_typical = null; /** * @var float|null the maximum value of this property - * @Assert\Type({"float", "null"}) - * @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical") * @ORM\Column(type="float", nullable=true) - * @Groups({"full"}) */ + #[Assert\Type(['float', null])] + #[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')] + #[Groups(['full'])] protected ?float $value_max = null; /** * @var string The unit in which the value values are given (e.g. V) * @ORM\Column(type="string", nullable=false) - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $unit = ''; /** * @var string a text value for the given property * @ORM\Column(type="string", nullable=false) - * @Groups({"full"}) */ + #[Groups(['full'])] protected string $value_text = ''; /** * @var string the group this parameter belongs to * @ORM\Column(type="string", nullable=false, name="param_group") - * @Groups({"full"}) - * @Groups({"full"}) */ + #[Groups(['full'])] + #[Groups(['full'])] protected string $group = ''; /** diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php index 8a161883..12b05ae7 100644 --- a/src/Entity/Parameters/AttachmentTypeParameter.php +++ b/src/Entity/Parameters/AttachmentTypeParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class AttachmentTypeParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php index cce90a86..c80004a0 100644 --- a/src/Entity/Parameters/CategoryParameter.php +++ b/src/Entity/Parameters/CategoryParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class CategoryParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Category::class; diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php index cb5fad26..a9f1133e 100644 --- a/src/Entity/Parameters/CurrencyParameter.php +++ b/src/Entity/Parameters/CurrencyParameter.php @@ -50,8 +50,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a category element. * * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class CurrencyParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Currency::class; diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php index cb1dd185..be65d737 100644 --- a/src/Entity/Parameters/FootprintParameter.php +++ b/src/Entity/Parameters/FootprintParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class FootprintParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Footprint::class; diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php index 81a0d39c..c283e142 100644 --- a/src/Entity/Parameters/GroupParameter.php +++ b/src/Entity/Parameters/GroupParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class GroupParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Group::class; diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php index 56d785f2..fd990dd2 100644 --- a/src/Entity/Parameters/ManufacturerParameter.php +++ b/src/Entity/Parameters/ManufacturerParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class ManufacturerParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php index e4980431..2dbc94f8 100644 --- a/src/Entity/Parameters/MeasurementUnitParameter.php +++ b/src/Entity/Parameters/MeasurementUnitParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class MeasurementUnitParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; diff --git a/src/Entity/Parameters/ParametersTrait.php b/src/Entity/Parameters/ParametersTrait.php index f8ac8e78..44cbe664 100644 --- a/src/Entity/Parameters/ParametersTrait.php +++ b/src/Entity/Parameters/ParametersTrait.php @@ -50,8 +50,8 @@ trait ParametersTrait * Mapping done in subclasses. * * @var Collection - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index a3845e55..11798919 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class PartParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Part::class; diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php index d4f8cd1a..362cde04 100644 --- a/src/Entity/Parameters/ProjectParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class ProjectParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Project::class; diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php index 6c7d430b..6b792588 100644 --- a/src/Entity/Parameters/StorelocationParameter.php +++ b/src/Entity/Parameters/StorelocationParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class StorelocationParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Storelocation::class; diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php index 6acac705..3281a722 100644 --- a/src/Entity/Parameters/SupplierParameter.php +++ b/src/Entity/Parameters/SupplierParameter.php @@ -48,8 +48,8 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @UniqueEntity(fields={"name", "group", "element"}) */ +#[UniqueEntity(fields: ['name', 'group', 'element'])] class SupplierParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Supplier::class; diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 8a79d871..990a7a1e 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -58,74 +58,74 @@ class Category extends AbstractPartsContainingDBElement /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $partname_hint = ''; /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $partname_regex = ''; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_footprints = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_manufacturers = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_autodatasheets = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $disable_properties = false; /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $default_description = ''; /** * @var string * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $default_comment = ''; /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $parameters; public function getPartnameHint(): string diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index 09a4f4d0..2949d6a8 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -57,8 +57,8 @@ class Footprint extends AbstractPartsContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @@ -71,8 +71,8 @@ class Footprint extends AbstractPartsContainingDBElement /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /**************************************** diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 74d0e308..7e8f75b1 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -57,14 +57,14 @@ class Manufacturer extends AbstractCompany * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; } diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index b33d47fc..10bfc90d 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -40,34 +40,34 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Index(name="unit_idx_name", columns={"name"}), * @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}), * }) - * @UniqueEntity("unit") */ +#[UniqueEntity('unit')] class MeasurementUnit extends AbstractPartsContainingDBElement { /** * @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams) * or m (for meters). * @ORM\Column(type="string", name="unit", nullable=true) - * @Assert\Length(max=10) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Length(max: 10)] + #[Groups(['extended', 'full', 'import'])] protected ?string $unit = null; /** * @var bool Determines if the amount value associated with this unit should be treated as integer. * Set to false, to measure continuous sizes likes masses or lengths. * @ORM\Column(type="boolean", name="is_integer") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $is_integer = false; /** * @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.). * Useful for sizes like meters. For this the unit must be set * @ORM\Column(type="boolean", name="use_si_prefix") - * @Assert\Expression("this.isUseSIPrefix() == false or this.getUnit() != null", message="validator.measurement_unit.use_si_prefix_needs_unit") - * @Groups({"full", "import"}) */ + #[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')] + #[Groups(['full', 'import'])] protected bool $use_si_prefix = false; /** @@ -87,15 +87,15 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index d9b7e601..c4e9d00a 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -54,8 +54,8 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * @ORM\Index(name="parts_idx_name", columns={"name"}), * @ORM\Index(name="parts_idx_ipn", columns={"ipn"}), * }) - * @UniqueEntity(fields={"ipn"}, message="part.ipn.must_be_unique") */ +#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')] class Part extends AttachmentContainingDBElement { use AdvancedPropertyTrait; @@ -68,11 +68,11 @@ class Part extends AttachmentContainingDBElement use ProjectTrait; /** @var Collection - * @Assert\Valid() * @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $parameters; /** @@ -95,9 +95,9 @@ class Part extends AttachmentContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() - * @Groups({"full"}) */ + #[Assert\Valid] + #[Groups(['full'])] protected Collection $attachments; /** @@ -110,8 +110,8 @@ class Part extends AttachmentContainingDBElement * @var Attachment|null * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") * @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) - * @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture") */ + #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] protected ?Attachment $master_picture_attachment = null; public function __construct() @@ -150,9 +150,7 @@ class Part extends AttachmentContainingDBElement parent::__clone(); } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { //Ensure that the part name fullfills the regex of the category diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index cd69651f..e8bc4917 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -55,23 +55,23 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * @var string A short description about this lot, shown in table * @ORM\Column(type="text") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected string $description = ''; /** * @var string a comment stored with this lot * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $comment = ''; /** * @var ?DateTime Set a time until when the lot must be used. * Set to null, if the lot can be used indefinitely. * @ORM\Column(type="datetime", name="expiration_date", nullable=true) - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?DateTime $expiration_date = null; /** @@ -79,38 +79,38 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @ORM\ManyToOne(targetEntity="Storelocation") * @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true) * @Selectable() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Storelocation $storage_location = null; /** * @var bool If this is set to true, the instock amount is marked as not known * @ORM\Column(type="boolean") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected bool $instock_unknown = false; /** * @var float For continuous sizes (length, volume, etc.) the instock is saved here. * @ORM\Column(type="float") - * @Assert\PositiveOrZero() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\PositiveOrZero] + #[Groups(['simple', 'extended', 'full', 'import'])] protected float $amount = 0.0; /** * @var bool determines if this lot was manually marked for refilling * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $needs_refill = false; /** * @var Part The part that is stored in this lot * @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots") * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE") - * @Assert\NotNull() */ + #[Assert\NotNull] protected Part $part; /** @@ -338,9 +338,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named return $this->description; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { //Ensure that the owner is not the anonymous user diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index 50935fd3..43c0c57d 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -35,31 +35,31 @@ trait AdvancedPropertyTrait /** * @var bool Determines if this part entry needs review (for example, because it is work in progress) * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $needs_review = false; /** * @var string a comma separated list of tags, associated with the part * @ORM\Column(type="text") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $tags = ''; /** * @var float|null how much a single part unit weighs in grams * @ORM\Column(type="float", nullable=true) - * @Assert\PositiveOrZero() - * @Groups({"extended", "full", "import"}) */ + #[Assert\PositiveOrZero] + #[Groups(['extended', 'full', 'import'])] protected ?float $mass = null; /** * @var string|null The internal part number of the part * @ORM\Column(type="string", length=100, nullable=true, unique=true) - * @Assert\Length(max="100") - * @Groups({"extended", "full", "import"}) */ + #[Assert\Length(max: 100)] + #[Groups(['extended', 'full', 'import'])] protected ?string $ipn = null; /** diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php index f675dc72..6dfc26ec 100644 --- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php @@ -34,15 +34,15 @@ trait BasicPropertyTrait /** * @var string A text describing what this part does * @ORM\Column(type="text") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected string $description = ''; /** * @var string A comment/note related to this part * @ORM\Column(type="text") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $comment = ''; /** @@ -54,8 +54,8 @@ trait BasicPropertyTrait /** * @var bool true, if the part is marked as favorite * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $favorite = false; /** @@ -64,9 +64,9 @@ trait BasicPropertyTrait * @ORM\ManyToOne(targetEntity="Category") * @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false) * @Selectable() - * @Assert\NotNull(message="validator.select_valid_category") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\NotNull(message: 'validator.select_valid_category')] + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Category $category = null; /** @@ -74,8 +74,8 @@ trait BasicPropertyTrait * @ORM\ManyToOne(targetEntity="Footprint") * @ORM\JoinColumn(name="id_footprint", referencedColumnName="id") * @Selectable() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Footprint $footprint = null; /** diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 8ab300b5..cf1da1e0 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -37,27 +37,27 @@ trait InstockTrait /** * @var Collection|PartLot[] A list of part lots where this part is stored * @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() * @ORM\OrderBy({"amount" = "DESC"}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full', 'import'])] protected $partLots; /** * @var float The minimum amount of the part that has to be instock, otherwise more is ordered. * Given in the partUnit. * @ORM\Column(type="float") - * @Assert\PositiveOrZero() - * @Groups({"extended", "full", "import"}) */ + #[Assert\PositiveOrZero] + #[Groups(['extended', 'full', 'import'])] protected float $minamount = 0; /** * @var ?MeasurementUnit the unit in which the part's amount is measured * @ORM\ManyToOne(targetEntity="MeasurementUnit") * @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true) - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?MeasurementUnit $partUnit = null; /** diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php index de4bd940..fea580d0 100644 --- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php +++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php @@ -39,31 +39,31 @@ trait ManufacturerTrait * @ORM\ManyToOne(targetEntity="Manufacturer") * @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id") * @Selectable() - * @Groups({"simple","extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?Manufacturer $manufacturer = null; /** * @var string the url to the part on the manufacturer's homepage * @ORM\Column(type="string") - * @Assert\Url() - * @Groups({"full", "import"}) */ + #[Assert\Url] + #[Groups(['full', 'import'])] protected string $manufacturer_product_url = ''; /** * @var string The product number used by the manufacturer. If this is set to "", the name field is used. * @ORM\Column(type="string") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $manufacturer_product_number = ''; /** * @var string|null The production status of this part. Can be one of the specified ones. * @ORM\Column(type="string", length=255, nullable=true) - * @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])] + #[Groups(['extended', 'full', 'import'])] protected ?string $manufacturing_status = ''; /** diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index d92ab762..b2feb024 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -37,10 +37,10 @@ trait OrderTrait /** * @var Orderdetail[]|Collection the details about how and where you can order this part * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() * @ORM\OrderBy({"supplierpartnr" = "ASC"}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full', 'import'])] protected $orderdetails; /** diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index 03c5951f..3f18c79e 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -66,37 +66,37 @@ class Storelocation extends AbstractPartsContainingDBElement /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $is_full = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $only_single_part = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected bool $limit_to_existing_parts = false; /** * @var User|null The owner of this storage location * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User") * @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL") - * @Assert\Expression("this.getOwner() == null or this.getOwner().isAnonymousUser() === false", message="validator.part_lot.owner_must_not_be_anonymous") */ + #[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')] protected ?User $owner = null; /** @@ -108,8 +108,8 @@ class Storelocation extends AbstractPartsContainingDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /******************************************************************************** diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index f8ab4202..95fd25fe 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -76,24 +76,24 @@ class Supplier extends AbstractCompany /** * @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier * @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5) - * @Groups({"extended", "full", "import"}) * @BigDecimalPositiveOrZero() */ + #[Groups(['extended', 'full', 'import'])] protected ?BigDecimal $shipping_costs = null; /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index 6b78de19..ee90cdd3 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -38,13 +38,13 @@ use Symfony\Component\Validator\Constraints as Assert; /** * This entity describes a currency that can be used for price information. * - * @UniqueEntity("iso_code") * @ORM\Entity() * @ORM\Table(name="currencies", indexes={ * @ORM\Index(name="currency_idx_name", columns={"name"}), * @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}), * }) */ +#[UniqueEntity('iso_code')] class Currency extends AbstractStructuralDBElement { public const PRICE_SCALE = 5; @@ -60,9 +60,9 @@ class Currency extends AbstractStructuralDBElement /** * @var string the 3-letter ISO code of the currency * @ORM\Column(type="string") - * @Assert\Currency() - * @Groups({"extended", "full", "import"}) */ + #[Assert\Currency] + #[Groups(['extended', 'full', 'import'])] protected string $iso_code = ""; /** @@ -81,15 +81,15 @@ class Currency extends AbstractStructuralDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; /** @var Collection diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index c1d182a2..366f9b81 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -45,57 +45,57 @@ use Symfony\Component\Validator\Constraints as Assert; * }) * @ORM\Entity() * @ORM\HasLifecycleCallbacks() - * @UniqueEntity({"supplierpartnr", "supplier", "part"}) */ +#[UniqueEntity(['supplierpartnr', 'supplier', 'part'])] class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface { use TimestampTrait; /** * @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() * @ORM\OrderBy({"min_discount_quantity" = "ASC"}) - * @Groups({"extended", "full", "import"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full', 'import'])] protected Collection $pricedetails; /** * @var string * @ORM\Column(type="string") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected string $supplierpartnr = ''; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $obsolete = false; /** * @var string * @ORM\Column(type="string") - * @Assert\Url() - * @Groups({"full", "import"}) */ + #[Assert\Url] + #[Groups(['full', 'import'])] protected string $supplier_product_url = ''; /** * @var Part|null * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails") * @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - * @Assert\NotNull() */ + #[Assert\NotNull] protected ?Part $part = null; /** * @var Supplier|null * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails") * @ORM\JoinColumn(name="id_supplier", referencedColumnName="id") - * @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null") - * @Groups({"extended", "full", "import"}) */ + #[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')] + #[Groups(['extended', 'full', 'import'])] protected ?Supplier $supplier = null; public function __construct() diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index 49d01730..b4a0cbc6 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -44,8 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Index(name="pricedetails_idx_min_discount_price_qty", columns={"min_discount_quantity", "price_related_quantity"}), * }) * @ORM\HasLifecycleCallbacks() - * @UniqueEntity(fields={"min_discount_quantity", "orderdetail"}) */ +#[UniqueEntity(fields: ['min_discount_quantity', 'orderdetail'])] class Pricedetail extends AbstractDBElement implements TimeStampableInterface { use TimestampTrait; @@ -56,8 +56,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @var BigDecimal The price related to the detail. (Given in the selected currency) * @ORM\Column(type="big_decimal", precision=11, scale=5) * @BigDecimalPositive() - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected BigDecimal $price; /** @@ -66,24 +66,24 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @ORM\ManyToOne(targetEntity="Currency", inversedBy="pricedetails") * @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true) * @Selectable() - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?Currency $currency = null; /** * @var float * @ORM\Column(type="float") - * @Assert\Positive() - * @Groups({"extended", "full", "import"}) */ + #[Assert\Positive] + #[Groups(['extended', 'full', 'import'])] protected float $price_related_quantity = 1.0; /** * @var float * @ORM\Column(type="float") - * @Assert\Positive() - * @Groups({"extended", "full", "import"}) */ + #[Assert\Positive] + #[Groups(['extended', 'full', 'import'])] protected float $min_discount_quantity = 1.0; /** @@ -96,8 +96,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @var Orderdetail|null * @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails") * @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") - * @Assert\NotNull() */ + #[Assert\NotNull] protected ?Orderdetail $orderdetail = null; public function __construct() diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index ce55b50a..13bc4832 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -57,9 +57,9 @@ class Project extends AbstractStructuralDBElement /** * @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true) - * @Assert\Valid() - * @Groups({"extended", "full"}) */ + #[Assert\Valid] + #[Groups(['extended', 'full'])] protected Collection $bom_entries; /** @@ -70,9 +70,9 @@ class Project extends AbstractStructuralDBElement /** * @var string|null The current status of the project * @ORM\Column(type="string", length=64, nullable=true) - * @Assert\Choice({"draft","planning","in_production","finished","archived"}) - * @Groups({"extended", "full"}) */ + #[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])] + #[Groups(['extended', 'full'])] protected ?string $status = null; @@ -89,8 +89,8 @@ class Project extends AbstractStructuralDBElement /** * @ORM\Column(type="text", nullable=false) - * @Groups({"simple", "extended", "full"}) */ + #[Groups(['simple', 'extended', 'full'])] protected string $description = ''; /** @@ -286,9 +286,7 @@ class Project extends AbstractStructuralDBElement } } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload) { //If this project has subprojects, and these have builds part, they must be included in the BOM diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index a14f5f2d..cc8f5fde 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -40,9 +40,9 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * @ORM\Table("project_bom_entries") * @ORM\HasLifecycleCallbacks() * @ORM\Entity() - * @UniqueEntity(fields={"part", "project"}, message="project.bom_entry.part_already_in_bom") - * @UniqueEntity(fields={"name", "project"}, message="project.bom_entry.name_already_in_bom", ignoreNull=true) */ +#[UniqueEntity(fields: ['part', 'project'], message: 'project.bom_entry.part_already_in_bom')] +#[UniqueEntity(fields: ['name', 'project'], message: 'project.bom_entry.name_already_in_bom', ignoreNull: true)] class ProjectBOMEntry extends AbstractDBElement { use TimestampTrait; @@ -50,8 +50,8 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var float * @ORM\Column(type="float", name="quantity") - * @Assert\Positive() */ + #[Assert\Positive] protected float $quantity; /** @@ -63,11 +63,8 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var string|null An optional name describing this BOM entry (useful for non-part entries) * @ORM\Column(type="string", nullable=true) - * @Assert\Expression( - * "this.getPart() !== null or this.getName() !== null", - * message="validator.project.bom_entry.name_or_part_needed" - * ) */ + #[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')] protected ?string $name = null; /** @@ -93,11 +90,8 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var BigDecimal|null The price of this non-part BOM entry * @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true) - * @Assert\AtLeastOneOf({ - * @BigDecimalPositive(), - * @Assert\IsNull() - * }) */ + #[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])] protected ?BigDecimal $price; /** @@ -269,9 +263,7 @@ class ProjectBOMEntry extends AbstractDBElement return $this->part !== null; } - /** - * @Assert\Callback - */ + #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload): void { //Round quantity to whole numbers, if the part is not a decimal part diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 74a600fe..05c2b205 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -66,30 +66,30 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa /** * @var bool If true all users associated with this group must have enabled some kind of two-factor authentication * @ORM\Column(type="boolean", name="enforce_2fa") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $enforce2FA = false; /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $attachments; /** * @var PermissionData|null * @ValidPermission() * @ORM\Embedded(class="PermissionData", columnPrefix="permissions_") - * @Groups({"full"}) */ + #[Groups(['full'])] protected ?PermissionData $permissions = null; /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) - * @Assert\Valid() */ + #[Assert\Valid] protected Collection $parameters; public function __construct() diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index eba234c4..6dc06455 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -60,8 +60,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface * @ORM\Index(name="user_idx_username", columns={"name"}) * }) * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - * @UniqueEntity("name", message="validator.user.username_already_used") */ +#[UniqueEntity('name', message: 'validator.user.username_already_used')] class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface { @@ -75,16 +75,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var bool Determines if the user is disabled (user can not log in) * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $disabled = false; /** * @var string|null The theme * @ORM\Column(type="string", name="config_theme", nullable=true) * @ValidTheme() - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected ?string $theme = null; /** @@ -106,8 +106,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string A self-description of the user * @ORM\Column(type="text") - * @Groups({"full", "import"}) */ + #[Groups(['full', 'import'])] protected string $aboutMe = ''; /** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once. @@ -134,8 +134,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @ORM\ManyToOne(targetEntity="Group", inversedBy="users") * @ORM\JoinColumn(name="group_id", referencedColumnName="id") * @Selectable() - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?Group $group = null; /** @@ -147,25 +147,25 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string|null The timezone the user prefers * @ORM\Column(type="string", name="config_timezone", nullable=true) - * @Assert\Timezone() - * @Groups({"full", "import"}) */ + #[Assert\Timezone] + #[Groups(['full', 'import'])] protected ?string $timezone = ''; /** * @var string|null The language/locale the user prefers * @ORM\Column(type="string", name="config_language", nullable=true) - * @Assert\Language() - * @Groups({"full", "import"}) */ + #[Assert\Language] + #[Groups(['full', 'import'])] protected ?string $language = ''; /** * @var string|null The email address of the user * @ORM\Column(type="string", length=255, nullable=true) - * @Assert\Email() - * @Groups({"simple", "extended", "full", "import"}) */ + #[Assert\Email] + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $email = ''; /** @@ -177,29 +177,29 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string|null The department the user is working * @ORM\Column(type="string", length=255, nullable=true) - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $department = ''; /** * @var string|null The last name of the User * @ORM\Column(type="string", length=255, nullable=true) - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $last_name = ''; /** * @var string|null The first name of the User * @ORM\Column(type="string", length=255, nullable=true) - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?string $first_name = ''; /** * @var bool True if the user needs to change password after log in * @ORM\Column(type="boolean") - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected bool $need_pw_change = true; /** @@ -210,9 +210,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @ORM\Column(type="string", length=180, unique=true) - * @Assert\NotBlank - * @Assert\Regex("/^[\w\.\+\-\$]+$/", message="user.invalid_username") */ + #[Assert\NotBlank] + #[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')] protected string $name = ''; /** @@ -230,8 +230,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** @var DateTime|null The time when the backup codes were generated * @ORM\Column(type="datetime", nullable=true) - * @Groups({"full"}) */ + #[Groups(['full'])] protected ?DateTime $backupCodesGenerationDate = null; /** @var Collection @@ -253,16 +253,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency") * @ORM\JoinColumn(name="currency_id", referencedColumnName="id") * @Selectable() - * @Groups({"extended", "full", "import"}) */ + #[Groups(['extended', 'full', 'import'])] protected ?Currency $currency; /** * @var PermissionData|null * @ValidPermission() * @ORM\Embedded(class="PermissionData", columnPrefix="permissions_") - * @Groups({"simple", "extended", "full", "import"}) */ + #[Groups(['simple', 'extended', 'full', 'import'])] protected ?PermissionData $permissions = null; /** @@ -274,8 +274,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var bool True if the user was created by a SAML provider (and therefore cannot change its password) * @ORM\Column(type="boolean") - * @Groups({"extended", "full"}) */ + #[Groups(['extended', 'full'])] protected bool $saml_user = false; public function __construct() diff --git a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php b/src/EventSubscriber/LogSystem/LogoutLoggerListener.php index 3b197b38..0c4d0ed5 100644 --- a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php +++ b/src/EventSubscriber/LogSystem/LogoutLoggerListener.php @@ -30,7 +30,7 @@ use Symfony\Component\Security\Http\Event\LogoutEvent; /** * This handler logs to event log, if a user logs out. */ -class LogoutLoggerListener +class LogoutLoggerEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface { protected EventLogger $logger; protected bool $gpdr_compliance; @@ -58,4 +58,11 @@ class LogoutLoggerListener $this->logger->logAndFlush($log); } + /** + * @return array + */ + public static function getSubscribedEvents(): array + { + return [\Symfony\Component\Security\Http\Event\LogoutEvent::class => '']; + } } diff --git a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php index a668828c..73708566 100644 --- a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php +++ b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php @@ -36,10 +36,10 @@ use Symfony\Component\Security\Core\Security; */ final class LogoutDisabledUserSubscriber implements EventSubscriberInterface { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private UrlGeneratorInterface $urlGenerator; - public function __construct(Security $security, UrlGeneratorInterface $urlGenerator) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator) { $this->security = $security; diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php index fb12942b..6c7e61f5 100644 --- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php +++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php @@ -55,10 +55,10 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface * @var string The route the user will redirected to, if he needs to change this password */ public const REDIRECT_TARGET = 'user_settings'; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private HttpUtils $httpUtils; - public function __construct(Security $security, HttpUtils $httpUtils) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, HttpUtils $httpUtils) { $this->security = $security; $this->httpUtils = $httpUtils; diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php index c39d4b37..a6347c26 100644 --- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php +++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php @@ -34,9 +34,9 @@ use Symfony\Component\Security\Core\Security; final class SetUserTimezoneSubscriber implements EventSubscriberInterface { private string $default_timezone; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(string $timezone, Security $security) + public function __construct(string $timezone, \Symfony\Bundle\SecurityBundle\Security $security) { $this->default_timezone = $timezone; $this->security = $security; diff --git a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php index 1d03cb83..551bb8b6 100644 --- a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php +++ b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php @@ -35,12 +35,12 @@ use Symfony\Component\Security\Core\Security; */ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private PermissionSchemaUpdater $permissionSchemaUpdater; private EntityManagerInterface $entityManager; private EventCommentHelper $eventCommentHelper; - public function __construct(Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper) { $this->security = $security; $this->permissionSchemaUpdater = $permissionSchemaUpdater; diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php index 57ba6fed..475eb66e 100644 --- a/src/Form/AdminPages/AttachmentTypeAdminForm.php +++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php @@ -34,7 +34,7 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm { protected FileTypeFilterTools $filterTools; - public function __construct(Security $security, FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) { $this->filterTools = $filterTools; parent::__construct($security, $eventCommentNeededHelper); diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php index 31dd39f0..4e49c784 100644 --- a/src/Form/AdminPages/BaseEntityAdminForm.php +++ b/src/Form/AdminPages/BaseEntityAdminForm.php @@ -44,10 +44,10 @@ use Symfony\Component\Security\Core\Security; class BaseEntityAdminForm extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected EventCommentNeededHelper $eventCommentNeededHelper; - public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper) { $this->security = $security; $this->eventCommentNeededHelper = $eventCommentNeededHelper; diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php index 754d7c66..0ba85c49 100644 --- a/src/Form/AdminPages/CurrencyAdminForm.php +++ b/src/Form/AdminPages/CurrencyAdminForm.php @@ -34,7 +34,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm { private string $default_currency; - public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) { parent::__construct($security, $eventCommentNeededHelper); $this->default_currency = $default_currency; diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php index ded1da2f..bc481a82 100644 --- a/src/Form/AdminPages/ImportType.php +++ b/src/Form/AdminPages/ImportType.php @@ -37,9 +37,9 @@ use Symfony\Component\Security\Core\Security; class ImportType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php index 27ee8287..6eb23785 100644 --- a/src/Form/AdminPages/MassCreationForm.php +++ b/src/Form/AdminPages/MassCreationForm.php @@ -32,9 +32,9 @@ use Symfony\Component\Security\Core\Security; class MassCreationForm extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php index db798db8..ea158484 100644 --- a/src/Form/AdminPages/SupplierForm.php +++ b/src/Form/AdminPages/SupplierForm.php @@ -34,7 +34,7 @@ class SupplierForm extends CompanyForm { protected string $default_currency; - public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) { parent::__construct($security, $eventCommentNeededHelper); $this->default_currency = $default_currency; diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 454f34b0..72098dc4 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -52,12 +52,12 @@ class AttachmentFormType extends AbstractType protected UrlGeneratorInterface $urlGenerator; protected bool $allow_attachments_download; protected string $max_file_size; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected AttachmentSubmitHandler $submitHandler; protected TranslatorInterface $translator; public function __construct(AttachmentManager $attachmentHelper, UrlGeneratorInterface $urlGenerator, - Security $security, AttachmentSubmitHandler $submitHandler, TranslatorInterface $translator, + \Symfony\Bundle\SecurityBundle\Security $security, AttachmentSubmitHandler $submitHandler, TranslatorInterface $translator, bool $allow_attachments_downloads, string $max_file_size) { $this->attachment_helper = $attachmentHelper; diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php index 5af69ce6..78546702 100644 --- a/src/Form/LabelOptionsType.php +++ b/src/Form/LabelOptionsType.php @@ -53,9 +53,9 @@ use Symfony\Component\Security\Core\Security; class LabelOptionsType extends AbstractType { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/LabelSystem/LabelDialogType.php b/src/Form/LabelSystem/LabelDialogType.php index 9bc3dfdf..4427fab1 100644 --- a/src/Form/LabelSystem/LabelDialogType.php +++ b/src/Form/LabelSystem/LabelDialogType.php @@ -52,9 +52,9 @@ use Symfony\Component\Security\Core\Security; class LabelDialogType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php index ece78af5..b904e582 100644 --- a/src/Form/Part/OrderdetailType.php +++ b/src/Form/Part/OrderdetailType.php @@ -40,9 +40,9 @@ use Symfony\Component\Security\Core\Security; class OrderdetailType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php index 141b5eca..f00458d2 100644 --- a/src/Form/Part/PartBaseType.php +++ b/src/Form/Part/PartBaseType.php @@ -52,11 +52,11 @@ use Symfony\Component\Security\Core\Security; class PartBaseType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected UrlGeneratorInterface $urlGenerator; protected EventCommentNeededHelper $event_comment_needed_helper; - public function __construct(Security $security, UrlGeneratorInterface $urlGenerator, EventCommentNeededHelper $event_comment_needed_helper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator, EventCommentNeededHelper $event_comment_needed_helper) { $this->security = $security; $this->urlGenerator = $urlGenerator; diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php index 2c46df1a..e0e3f98c 100644 --- a/src/Form/Part/PartLotType.php +++ b/src/Form/Part/PartLotType.php @@ -38,9 +38,9 @@ use Symfony\Component\Security\Core\Security; class PartLotType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Permissions/PermissionsMapper.php b/src/Form/Permissions/PermissionsMapper.php index c08d2954..9ecf09f7 100644 --- a/src/Form/Permissions/PermissionsMapper.php +++ b/src/Form/Permissions/PermissionsMapper.php @@ -52,7 +52,7 @@ final class PermissionsMapper implements DataMapperInterface * @param mixed $viewData View data of the compound form being initialized * @param FormInterface[]|Traversable $forms A list of {@link FormInterface} instances */ - public function mapDataToForms($viewData, $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { foreach ($forms as $form) { if ($this->inherit) { @@ -99,7 +99,7 @@ final class PermissionsMapper implements DataMapperInterface * @param mixed $viewData The compound form's view data that get mapped * its children model data */ - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { if ($this->inherit) { throw new RuntimeException('The permission type is readonly when it is showing read only data!'); diff --git a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php index 606f23f0..f92cf3a9 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php @@ -27,9 +27,4 @@ class ProjectBOMEntryCollectionType extends AbstractType 'label' => false, ]); } - - public function getBlockPrefix(): string - { - return 'project_bom_entry_collection'; - } } \ No newline at end of file diff --git a/src/Form/ProjectSystem/ProjectBOMEntryType.php b/src/Form/ProjectSystem/ProjectBOMEntryType.php index bac8d679..2350f61d 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryType.php @@ -87,10 +87,4 @@ class ProjectBOMEntryType extends AbstractType 'data_class' => ProjectBOMEntry::class, ]); } - - - public function getBlockPrefix(): string - { - return 'project_bom_entry'; - } } \ No newline at end of file diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 3758bb21..206ce3f0 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -38,9 +38,9 @@ use Symfony\Component\Security\Core\Security; class ProjectBuildType extends AbstractType implements DataMapperInterface { - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index 08cf688c..c78ce55e 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -117,18 +117,13 @@ class PartSelectType extends AbstractType implements DataMapperInterface ]); } - public function getBlockPrefix(): string - { - return 'part_select'; - } - - public function mapDataToForms($data, $forms) + public function mapDataToForms($data, \Traversable $forms) { $form = current(iterator_to_array($forms, false)); $form->setData($data); } - public function mapFormsToData($forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data) { $form = current(iterator_to_array($forms, false)); $data = $form->getData(); diff --git a/src/Form/Type/RichTextEditorType.php b/src/Form/Type/RichTextEditorType.php index a572fa2e..1d076916 100644 --- a/src/Form/Type/RichTextEditorType.php +++ b/src/Form/Type/RichTextEditorType.php @@ -39,11 +39,6 @@ class RichTextEditorType extends AbstractType } - public function getBlockPrefix(): string - { - return 'rich_text_editor'; - } - public function finishView(FormView $view, FormInterface $form, array $options) { $view->vars['attr'] = array_merge($view->vars['attr'], $this->optionsToAttrArray($options)); diff --git a/src/Form/Type/SIUnitType.php b/src/Form/Type/SIUnitType.php index 0cddb2a1..3f40acc9 100644 --- a/src/Form/Type/SIUnitType.php +++ b/src/Form/Type/SIUnitType.php @@ -156,7 +156,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported */ - public function mapDataToForms($viewData, $forms): void + public function mapDataToForms($viewData, \Traversable $forms): void { $forms = iterator_to_array($forms); @@ -207,7 +207,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported */ - public function mapFormsToData($forms, &$viewData): void + public function mapFormsToData(\Traversable $forms, &$viewData): void { //Convert both fields to a single float value. diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php index 06347306..d42ea9d9 100644 --- a/src/Form/UserAdminForm.php +++ b/src/Form/UserAdminForm.php @@ -48,9 +48,9 @@ use Symfony\Component\Validator\Constraints\Length; class UserAdminForm extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(Security $security) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; } diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php index 37f7b7e0..de7017d6 100644 --- a/src/Form/UserSettingsType.php +++ b/src/Form/UserSettingsType.php @@ -44,10 +44,10 @@ use Symfony\Component\Validator\Constraints\File; class UserSettingsType extends AbstractType { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected bool $demo_mode; - public function __construct(Security $security, bool $demo_mode) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, bool $demo_mode) { $this->security = $security; $this->demo_mode = $demo_mode; diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index 987787e0..95d20733 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -45,9 +45,9 @@ use function in_array; class AttachmentVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/LogEntryVoter.php b/src/Security/Voter/LogEntryVoter.php index f05de596..df1033c0 100644 --- a/src/Security/Voter/LogEntryVoter.php +++ b/src/Security/Voter/LogEntryVoter.php @@ -32,9 +32,9 @@ class LogEntryVoter extends ExtendedVoter { public const ALLOWED_OPS = ['read', 'show_details', 'delete']; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/OrderdetailVoter.php b/src/Security/Voter/OrderdetailVoter.php index eaeea11d..6b2ff874 100644 --- a/src/Security/Voter/OrderdetailVoter.php +++ b/src/Security/Voter/OrderdetailVoter.php @@ -49,9 +49,9 @@ use Symfony\Component\Security\Core\Security; class OrderdetailVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index b15afe46..6e38c718 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -41,9 +41,9 @@ use Symfony\Component\Security\Core\Security; class ParameterVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { $this->security = $security; parent::__construct($resolver, $entityManager); diff --git a/src/Security/Voter/PartLotVoter.php b/src/Security/Voter/PartLotVoter.php index 0c70e629..1d495c9a 100644 --- a/src/Security/Voter/PartLotVoter.php +++ b/src/Security/Voter/PartLotVoter.php @@ -49,9 +49,9 @@ use Symfony\Component\Security\Core\Security; class PartLotVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Security/Voter/PricedetailVoter.php b/src/Security/Voter/PricedetailVoter.php index eb4a81aa..8cae7452 100644 --- a/src/Security/Voter/PricedetailVoter.php +++ b/src/Security/Voter/PricedetailVoter.php @@ -49,9 +49,9 @@ use Symfony\Component\Security\Core\Security; class PricedetailVoter extends ExtendedVoter { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); $this->security = $security; diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index c4cfb09d..2d7fd3f3 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -28,7 +28,7 @@ use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; -class StructuralElementDenormalizer implements ContextAwareDenormalizerInterface, CacheableSupportsMethodInterface +class StructuralElementDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, CacheableSupportsMethodInterface { private DenormalizerInterface $normalizer; diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php index f526ac9d..bd8aa7b3 100644 --- a/src/Services/LabelSystem/LabelHTMLGenerator.php +++ b/src/Services/LabelSystem/LabelHTMLGenerator.php @@ -58,10 +58,10 @@ final class LabelHTMLGenerator private BarcodeGenerator $barcodeGenerator; private SandboxedTwigProvider $sandboxedTwigProvider; private string $partdb_title; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, LabelTextReplacer $replacer, Environment $twig, - BarcodeGenerator $barcodeGenerator, SandboxedTwigProvider $sandboxedTwigProvider, Security $security, string $partdb_title) + BarcodeGenerator $barcodeGenerator, SandboxedTwigProvider $sandboxedTwigProvider, \Symfony\Bundle\SecurityBundle\Security $security, string $partdb_title) { $this->twig = $twig; $this->elementTypeNameGenerator = $elementTypeNameGenerator; diff --git a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php index dae87fd4..5fd32a73 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php +++ b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php @@ -54,10 +54,10 @@ use Symfony\Component\Security\Core\Security; final class GlobalProviders implements PlaceholderProviderInterface { private string $partdb_title; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private UrlGeneratorInterface $url_generator; - public function __construct(string $partdb_title, Security $security, UrlGeneratorInterface $url_generator) + public function __construct(string $partdb_title, \Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $url_generator) { $this->partdb_title = $partdb_title; $this->security = $security; diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php index 0216cc3a..dde19edc 100644 --- a/src/Services/LogSystem/EventLogger.php +++ b/src/Services/LogSystem/EventLogger.php @@ -34,11 +34,11 @@ class EventLogger protected array $blacklist; protected array $whitelist; protected EntityManagerInterface $em; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected ConsoleInfoHelper $console_info_helper; public function __construct(int $minimum_log_level, array $blacklist, array $whitelist, EntityManagerInterface $em, - Security $security, ConsoleInfoHelper $console_info_helper) + \Symfony\Bundle\SecurityBundle\Security $security, ConsoleInfoHelper $console_info_helper) { $this->minimum_log_level = $minimum_log_level; $this->blacklist = $blacklist; diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index 3061d2f3..b3cccb0e 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -38,10 +38,10 @@ use Symfony\Component\Security\Core\Security; final class PartsTableActionHandler { private EntityManagerInterface $entityManager; - private Security $security; + private \Symfony\Bundle\SecurityBundle\Security $security; private UrlGeneratorInterface $urlGenerator; - public function __construct(EntityManagerInterface $entityManager, Security $security, UrlGeneratorInterface $urlGenerator) + public function __construct(EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator) { $this->entityManager = $entityManager; $this->security = $security; diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index b146d694..587dfbc7 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -53,11 +53,11 @@ class ToolsTreeBuilder protected UrlGeneratorInterface $urlGenerator; protected UserCacheKeyGenerator $keyGenerator; protected TagAwareCacheInterface $cache; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; public function __construct(TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, - Security $security) + \Symfony\Bundle\SecurityBundle\Security $security) { $this->translator = $translator; $this->urlGenerator = $urlGenerator; diff --git a/src/Services/UserSystem/UserCacheKeyGenerator.php b/src/Services/UserSystem/UserCacheKeyGenerator.php index c7c9e737..dd9e6ccb 100644 --- a/src/Services/UserSystem/UserCacheKeyGenerator.php +++ b/src/Services/UserSystem/UserCacheKeyGenerator.php @@ -32,10 +32,10 @@ use Symfony\Component\Security\Core\Security; */ class UserCacheKeyGenerator { - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected RequestStack $requestStack; - public function __construct(Security $security, RequestStack $requestStack) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, RequestStack $requestStack) { $this->security = $security; $this->requestStack = $requestStack; diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php index fece2852..c2de80e2 100644 --- a/src/Validator/Constraints/NoLockoutValidator.php +++ b/src/Validator/Constraints/NoLockoutValidator.php @@ -35,10 +35,10 @@ class NoLockoutValidator extends ConstraintValidator { protected PermissionManager $resolver; protected array $perm_structure; - protected Security $security; + protected \Symfony\Bundle\SecurityBundle\Security $security; protected EntityManagerInterface $entityManager; - public function __construct(PermissionManager $resolver, Security $security, EntityManagerInterface $entityManager) + public function __construct(PermissionManager $resolver, \Symfony\Bundle\SecurityBundle\Security $security, EntityManagerInterface $entityManager) { $this->resolver = $resolver; $this->perm_structure = $resolver->getPermissionStructure(); From 21fc5545892218612558a3482fc6b86fd52be4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:25:00 +0200 Subject: [PATCH 21/91] Fixed error with LogoutLoggerEventSubscriber --- config/services.yaml | 6 ------ ...utLoggerListener.php => LogoutLoggerEventSubscriber.php} | 0 2 files changed, 6 deletions(-) rename src/EventSubscriber/LogSystem/{LogoutLoggerListener.php => LogoutLoggerEventSubscriber.php} (100%) diff --git a/config/services.yaml b/config/services.yaml index 84b80fdd..cba39569 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -97,12 +97,6 @@ services: $mimeTypes: '@mime_types' $max_upload_size: '%partdb.attachments.max_file_size%' - App\EventSubscriber\LogSystem\LogoutLoggerListener: - tags: - - name: 'kernel.event_listener' - event: 'Symfony\Component\Security\Http\Event\LogoutEvent' - dispatcher: security.event_dispatcher.main - App\Services\LogSystem\EventCommentNeededHelper: arguments: $enforce_change_comments_for: '%partdb.enforce_change_comments_for%' diff --git a/src/EventSubscriber/LogSystem/LogoutLoggerListener.php b/src/EventSubscriber/LogSystem/LogoutLoggerEventSubscriber.php similarity index 100% rename from src/EventSubscriber/LogSystem/LogoutLoggerListener.php rename to src/EventSubscriber/LogSystem/LogoutLoggerEventSubscriber.php From bb1285c35cdd4e43529ee2d2582e8bb3de9992bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:32:04 +0200 Subject: [PATCH 22/91] Remove defaultDescription from commands, as this is now part of the annotation --- src/Command/Attachments/CleanAttachmentsCommand.php | 2 -- src/Command/CheckRequirementsCommand.php | 2 -- src/Command/Currencies/UpdateExchangeRatesCommand.php | 2 -- src/Command/Logs/ShowEventLogCommand.php | 1 - src/Command/Migrations/ConvertBBCodeCommand.php | 2 -- src/Command/Migrations/ImportPartKeeprCommand.php | 2 -- src/Command/User/ConvertToSAMLUserCommand.php | 2 -- src/Command/User/SetPasswordCommand.php | 2 -- src/Command/User/UserEnableCommand.php | 2 -- src/Command/User/UserListCommand.php | 2 -- src/Command/VersionCommand.php | 2 -- 11 files changed, 21 deletions(-) diff --git a/src/Command/Attachments/CleanAttachmentsCommand.php b/src/Command/Attachments/CleanAttachmentsCommand.php index 6004a3eb..aa1750df 100644 --- a/src/Command/Attachments/CleanAttachmentsCommand.php +++ b/src/Command/Attachments/CleanAttachmentsCommand.php @@ -43,8 +43,6 @@ use const DIRECTORY_SEPARATOR; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')] class CleanAttachmentsCommand extends Command { - protected static $defaultDescription = 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).'; - protected AttachmentManager $attachment_helper; protected AttachmentReverseSearch $reverseSearch; protected MimeTypes $mimeTypeGuesser; diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 8bc4c62d..3d7f3a72 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -30,8 +30,6 @@ use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')] class CheckRequirementsCommand extends Command { - protected static $defaultDescription = 'Checks if the requirements Part-DB needs or recommends are fulfilled.'; - protected ContainerBagInterface $params; public function __construct(ContainerBagInterface $params) diff --git a/src/Command/Currencies/UpdateExchangeRatesCommand.php b/src/Command/Currencies/UpdateExchangeRatesCommand.php index 092121b8..13d2e2dc 100644 --- a/src/Command/Currencies/UpdateExchangeRatesCommand.php +++ b/src/Command/Currencies/UpdateExchangeRatesCommand.php @@ -38,8 +38,6 @@ use function strlen; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')] class UpdateExchangeRatesCommand extends Command { - protected static $defaultDescription = 'Updates the currency exchange rates.'; - protected string $base_current; protected EntityManagerInterface $em; protected ExchangeRateUpdater $exchangeRateUpdater; diff --git a/src/Command/Logs/ShowEventLogCommand.php b/src/Command/Logs/ShowEventLogCommand.php index 6f560738..cc02bfd1 100644 --- a/src/Command/Logs/ShowEventLogCommand.php +++ b/src/Command/Logs/ShowEventLogCommand.php @@ -39,7 +39,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')] class ShowEventLogCommand extends Command { - protected static $defaultDescription = 'List the last event log entries.'; protected EntityManagerInterface $entityManager; protected TranslatorInterface $translator; protected ElementTypeNameGenerator $elementTypeNameGenerator; diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php index 4ea3c2c0..f4565805 100644 --- a/src/Command/Migrations/ConvertBBCodeCommand.php +++ b/src/Command/Migrations/ConvertBBCodeCommand.php @@ -59,8 +59,6 @@ class ConvertBBCodeCommand extends Command */ protected const BBCODE_REGEX = '/\\[.+\\].*\\[\\/.+\\]/'; - protected static $defaultDescription = 'Converts BBCode used in old Part-DB versions to newly used Markdown'; - protected EntityManagerInterface $em; protected PropertyAccessorInterface $propertyAccessor; protected BBCodeToMarkdownConverter $converter; diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index b325ca9e..d2c015b9 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -37,8 +37,6 @@ use Symfony\Component\Console\Style\SymfonyStyle; class ImportPartKeeprCommand extends Command { - protected static $defaultDescription = 'Import a PartKeepr database XML dump into Part-DB'; - protected EntityManagerInterface $em; protected MySQLDumpXMLConverter $xml_converter; protected PKDatastructureImporter $datastructureImporter; diff --git a/src/Command/User/ConvertToSAMLUserCommand.php b/src/Command/User/ConvertToSAMLUserCommand.php index 2144dc85..635c9eb3 100644 --- a/src/Command/User/ConvertToSAMLUserCommand.php +++ b/src/Command/User/ConvertToSAMLUserCommand.php @@ -33,8 +33,6 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')] class ConvertToSAMLUserCommand extends Command { - protected static $defaultDescription = 'Converts a local user to a SAML user (and vice versa)'; - protected EntityManagerInterface $entityManager; protected bool $saml_enabled; diff --git a/src/Command/User/SetPasswordCommand.php b/src/Command/User/SetPasswordCommand.php index a1f3d0b9..4a7542e3 100644 --- a/src/Command/User/SetPasswordCommand.php +++ b/src/Command/User/SetPasswordCommand.php @@ -37,8 +37,6 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')] class SetPasswordCommand extends Command { - protected static $defaultDescription = 'Sets the password of a user'; - protected EntityManagerInterface $entityManager; protected UserPasswordHasherInterface $encoder; protected EventDispatcherInterface $eventDispatcher; diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index daae874c..1a4063cd 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -32,8 +32,6 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')] class UserEnableCommand extends Command { - protected static $defaultDescription = 'Enables/Disable the login of one or more users'; - protected EntityManagerInterface $entityManager; public function __construct(EntityManagerInterface $entityManager, string $name = null) diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php index ca8f5364..351c679d 100644 --- a/src/Command/User/UserListCommand.php +++ b/src/Command/User/UserListCommand.php @@ -31,8 +31,6 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:list|users:list', 'Lists all users')] class UserListCommand extends Command { - protected static $defaultDescription = 'Lists all users'; - protected EntityManagerInterface $entityManager; public function __construct(EntityManagerInterface $entityManager) diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php index 0e0408e7..d6a27ae2 100644 --- a/src/Command/VersionCommand.php +++ b/src/Command/VersionCommand.php @@ -30,8 +30,6 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')] class VersionCommand extends Command { - protected static $defaultDescription = 'Shows the currently installed version of Part-DB.'; - protected VersionManagerInterface $versionManager; protected GitVersionInfo $gitVersionInfo; From 0bc4699cdc1febf4068ef4597917c66b1ccb1046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:33:45 +0200 Subject: [PATCH 23/91] Started to move doctrine annotations to attributes (rector automated) --- rector.php | 9 +++- src/Entity/Attachments/Attachment.php | 42 ++++++--------- .../AttachmentContainingDBElement.php | 4 +- src/Entity/Attachments/AttachmentType.php | 40 +++++++-------- .../Attachments/AttachmentTypeAttachment.php | 7 ++- src/Entity/Attachments/CategoryAttachment.php | 7 ++- src/Entity/Attachments/CurrencyAttachment.php | 7 ++- .../Attachments/FootprintAttachment.php | 7 ++- src/Entity/Attachments/GroupAttachment.php | 7 ++- src/Entity/Attachments/LabelAttachment.php | 7 ++- .../Attachments/ManufacturerAttachment.php | 7 ++- .../Attachments/MeasurementUnitAttachment.php | 7 ++- src/Entity/Attachments/PartAttachment.php | 7 ++- src/Entity/Attachments/ProjectAttachment.php | 7 ++- .../Attachments/StorelocationAttachment.php | 7 ++- src/Entity/Attachments/SupplierAttachment.php | 7 ++- src/Entity/Attachments/UserAttachment.php | 7 ++- src/Entity/Base/AbstractCompany.php | 15 +++--- src/Entity/Base/AbstractDBElement.php | 9 ++-- src/Entity/Base/AbstractNamedDBElement.php | 7 ++- .../Base/AbstractPartsContainingDBElement.php | 3 +- .../Base/AbstractStructuralDBElement.php | 8 +-- src/Entity/Base/MasterAttachmentTrait.php | 4 +- src/Entity/LabelSystem/LabelOptions.php | 20 ++++---- src/Entity/LabelSystem/LabelProfile.php | 19 ++++--- .../LogSystem/CollectionElementDeleted.php | 6 +-- .../LogSystem/ConfigChangedLogEntry.php | 4 +- .../LogSystem/DatabaseUpdatedLogEntry.php | 4 +- .../LogSystem/ElementCreatedLogEntry.php | 4 +- .../LogSystem/ElementDeletedLogEntry.php | 4 +- .../LogSystem/ElementEditedLogEntry.php | 4 +- src/Entity/LogSystem/ExceptionLogEntry.php | 4 +- .../LegacyInstockChangedLogEntry.php | 4 +- .../LogSystem/PartStockChangedLogEntry.php | 4 +- .../LogSystem/SecurityEventLogEntry.php | 3 +- src/Entity/LogSystem/UserLoginLogEntry.php | 3 +- src/Entity/LogSystem/UserLogoutLogEntry.php | 4 +- .../LogSystem/UserNotAllowedLogEntry.php | 4 +- src/Entity/Parameters/AbstractParameter.php | 45 ++++++---------- .../Parameters/AttachmentTypeParameter.php | 8 ++- src/Entity/Parameters/CategoryParameter.php | 8 ++- src/Entity/Parameters/CurrencyParameter.php | 7 ++- src/Entity/Parameters/FootprintParameter.php | 8 ++- src/Entity/Parameters/GroupParameter.php | 8 ++- .../Parameters/ManufacturerParameter.php | 8 ++- .../Parameters/MeasurementUnitParameter.php | 8 ++- src/Entity/Parameters/PartParameter.php | 8 ++- src/Entity/Parameters/ProjectParameter.php | 8 ++- .../Parameters/StorelocationParameter.php | 8 ++- src/Entity/Parameters/SupplierParameter.php | 8 ++- src/Entity/Parts/Category.php | 51 ++++++++++--------- src/Entity/Parts/Footprint.php | 39 +++++++------- src/Entity/Parts/Manufacturer.php | 35 +++++++------ src/Entity/Parts/MeasurementUnit.php | 41 ++++++++------- .../PartTraits/AdvancedPropertyTrait.php | 8 +-- .../Parts/PartTraits/BasicPropertyTrait.php | 16 +++--- src/Entity/Parts/PartTraits/InstockTrait.php | 12 ++--- .../Parts/PartTraits/ManufacturerTrait.php | 10 ++-- src/Entity/Parts/PartTraits/OrderTrait.php | 14 ++--- src/Entity/Parts/PartTraits/ProjectTrait.php | 10 ++-- src/Entity/Parts/Storelocation.php | 49 +++++++++--------- src/Entity/Parts/Supplier.php | 45 ++++++++-------- src/Entity/PriceInformations/Currency.php | 39 +++++++------- src/Entity/PriceInformations/Orderdetail.php | 35 ++++++------- src/Entity/PriceInformations/Pricedetail.php | 33 ++++++------ src/Entity/ProjectSystem/Project.php | 45 +++++++--------- src/Entity/ProjectSystem/ProjectBOMEntry.php | 29 +++++------ src/Entity/UserSystem/Group.php | 36 +++++++------ src/Entity/UserSystem/PermissionData.php | 5 +- src/Entity/UserSystem/U2FKey.php | 39 +++++--------- src/Entity/UserSystem/WebauthnKey.php | 24 +++------ .../AttachmentDeleteListener.php | 9 ++-- .../TreeCacheInvalidationListener.php | 8 ++- 73 files changed, 483 insertions(+), 604 deletions(-) diff --git a/rector.php b/rector.php index c8545b90..a70f0ba7 100644 --- a/rector.php +++ b/rector.php @@ -4,6 +4,7 @@ declare(strict_types=1); use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; +use Rector\Doctrine\Set\DoctrineSetList; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Symfony\Set\SymfonyLevelSetList; @@ -25,10 +26,16 @@ return static function (RectorConfig $rectorConfig): void { // define sets of rules $rectorConfig->sets([ + //PHP rules //SetList::CODE_QUALITY, //LevelSetList::UP_TO_PHP_81, + + //Symfony rules SymfonyLevelSetList::UP_TO_SYMFONY_62, - //SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, SymfonySetList::SYMFONY_CODE_QUALITY, + + //Doctrine rules + DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, + DoctrineSetList::DOCTRINE_CODE_QUALITY, ]); }; diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index d33f3a30..7c07a465 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -33,27 +33,17 @@ use LogicException; /** * Class Attachment. - * - * @ORM\Entity(repositoryClass="App\Repository\AttachmentRepository") - * @ORM\Table(name="`attachments`", indexes={ - * @ORM\Index(name="attachments_idx_id_element_id_class_name", columns={"id", "element_id", "class_name"}), - * @ORM\Index(name="attachments_idx_class_name_id", columns={"class_name", "id"}), - * @ORM\Index(name="attachment_name_idx", columns={"name"}), - * @ORM\Index(name="attachment_element_idx", columns={"class_name", "element_id"}) - * }) - * @ORM\InheritanceType("SINGLE_TABLE") - * @ORM\DiscriminatorColumn(name="class_name", type="string") - * @ORM\DiscriminatorMap({ - * "PartDB\Part" = "PartAttachment", "Part" = "PartAttachment", - * "PartDB\Device" = "ProjectAttachment", "Device" = "ProjectAttachment", - * "AttachmentType" = "AttachmentTypeAttachment", "Category" = "CategoryAttachment", - * "Footprint" = "FootprintAttachment", "Manufacturer" = "ManufacturerAttachment", - * "Currency" = "CurrencyAttachment", "Group" = "GroupAttachment", - * "MeasurementUnit" = "MeasurementUnitAttachment", "Storelocation" = "StorelocationAttachment", - * "Supplier" = "SupplierAttachment", "User" = "UserAttachment", "LabelProfile" = "LabelAttachment", - * }) - * @ORM\EntityListeners({"App\EntityListeners\AttachmentDeleteListener"}) */ +#[ORM\Entity(repositoryClass: 'App\Repository\AttachmentRepository')] +#[ORM\InheritanceType('SINGLE_TABLE')] +#[ORM\DiscriminatorColumn(name: 'class_name', type: 'string')] +#[ORM\DiscriminatorMap(['PartDB\Part' => 'PartAttachment', 'Part' => 'PartAttachment', 'PartDB\Device' => 'ProjectAttachment', 'Device' => 'ProjectAttachment', 'AttachmentType' => 'AttachmentTypeAttachment', 'Category' => 'CategoryAttachment', 'Footprint' => 'FootprintAttachment', 'Manufacturer' => 'ManufacturerAttachment', 'Currency' => 'CurrencyAttachment', 'Group' => 'GroupAttachment', 'MeasurementUnit' => 'MeasurementUnitAttachment', 'Storelocation' => 'StorelocationAttachment', 'Supplier' => 'SupplierAttachment', 'User' => 'UserAttachment', 'LabelProfile' => 'LabelAttachment'])] +#[ORM\EntityListeners(['App\EntityListeners\AttachmentDeleteListener'])] +#[ORM\Table(name: '`attachments`')] +#[ORM\Index(name: 'attachments_idx_id_element_id_class_name', columns: ['id', 'element_id', 'class_name'])] +#[ORM\Index(name: 'attachments_idx_class_name_id', columns: ['class_name', 'id'])] +#[ORM\Index(name: 'attachment_name_idx', columns: ['name'])] +#[ORM\Index(name: 'attachment_element_idx', columns: ['class_name', 'element_id'])] abstract class Attachment extends AbstractNamedDBElement { /** @@ -86,22 +76,22 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var string|null the original filename the file had, when the user uploaded it - * @ORM\Column(type="string", nullable=true) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] protected ?string $original_filename = null; /** * @var string The path to the file relative to a placeholder path like %MEDIA% - * @ORM\Column(type="string", name="path") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'path')] protected string $path = ''; /** * @var string the name of this element - * @ORM\Column(type="string") */ #[Assert\NotBlank(message: 'validator.attachment.name_not_blank')] #[Groups(['simple', 'extended', 'full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name = ''; /** @@ -111,17 +101,17 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var bool - * @ORM\Column(type="boolean") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $show_in_table = false; /** * @var AttachmentType|null - * @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type") - * @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false) * @Selectable() */ #[Assert\NotNull(message: 'validator.attachment.must_not_be_null')] + #[ORM\ManyToOne(targetEntity: 'AttachmentType', inversedBy: 'attachments_with_type')] + #[ORM\JoinColumn(name: 'type_id', nullable: false)] protected ?AttachmentType $attachment_type = null; public function __construct() diff --git a/src/Entity/Attachments/AttachmentContainingDBElement.php b/src/Entity/Attachments/AttachmentContainingDBElement.php index 5f592ed2..d2d772e8 100644 --- a/src/Entity/Attachments/AttachmentContainingDBElement.php +++ b/src/Entity/Attachments/AttachmentContainingDBElement.php @@ -31,9 +31,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; -/** - * @ORM\MappedSuperclass() - */ +#[ORM\MappedSuperclass] abstract class AttachmentContainingDBElement extends AbstractNamedDBElement implements HasMasterAttachmentInterface, HasAttachmentsInterface { use MasterAttachmentTrait; diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index a7e3742f..e2614168 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -32,56 +32,52 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. - * - * @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository") - * @ORM\Table(name="`attachment_types`", indexes={ - * @ORM\Index(name="attachment_types_idx_name", columns={"name"}), - * @ORM\Index(name="attachment_types_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\StructuralDBElementRepository')] +#[ORM\Table(name: '`attachment_types`')] +#[ORM\Index(name: 'attachment_types_idx_name', columns: ['name'])] +#[ORM\Index(name: 'attachment_types_idx_parent_name', columns: ['parent_id', 'name'])] class AttachmentType extends AbstractStructuralDBElement { - /** - * @ORM\OneToMany(targetEntity="AttachmentType", mappedBy="parent", cascade={"persist"}) - * @ORM\OrderBy({"name" = "ASC"}) - */ + #[ORM\OneToMany(targetEntity: 'AttachmentType', mappedBy: 'parent', cascade: ['persist'])] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'AttachmentType', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent; /** * @var string - * @ORM\Column(type="text") * @ValidFileFilter */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $filetype_filter = ''; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\AttachmentTypeAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\AttachmentTypeParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** - * @var Collection - * @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachment_type") + * @var \Doctrine\Common\Collections\Collection<\App\Entity\Attachments\Attachment> */ - protected $attachments_with_type; + #[ORM\OneToMany(targetEntity: 'Attachment', mappedBy: 'attachment_type')] + protected \Doctrine\Common\Collections\Collection $attachments_with_type; public function __construct() { + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct(); $this->attachments = new ArrayCollection(); $this->attachments_with_type = new ArrayCollection(); diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php index 8b29d8a1..b6dab86f 100644 --- a/src/Entity/Attachments/AttachmentTypeAttachment.php +++ b/src/Entity/Attachments/AttachmentTypeAttachment.php @@ -27,17 +27,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * A attachment attached to an attachmentType element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class AttachmentTypeAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; /** * @var AttachmentContainingDBElement|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\AttachmentType', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php index 49685f15..e7a54fdd 100644 --- a/src/Entity/Attachments/CategoryAttachment.php +++ b/src/Entity/Attachments/CategoryAttachment.php @@ -28,17 +28,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a category element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class CategoryAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Category::class; /** * @var AttachmentContainingDBElement|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Category', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php index caa595f6..6671bdca 100644 --- a/src/Entity/Attachments/CurrencyAttachment.php +++ b/src/Entity/Attachments/CurrencyAttachment.php @@ -28,17 +28,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a currency element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class CurrencyAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Currency::class; /** * @var Currency|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php index 5bca593b..3fc3e2af 100644 --- a/src/Entity/Attachments/FootprintAttachment.php +++ b/src/Entity/Attachments/FootprintAttachment.php @@ -28,17 +28,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a footprint element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class FootprintAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Footprint::class; /** * @var Footprint|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Footprint', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php index b48ca523..a2d439bf 100644 --- a/src/Entity/Attachments/GroupAttachment.php +++ b/src/Entity/Attachments/GroupAttachment.php @@ -28,18 +28,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a Group element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class GroupAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Group::class; /** * @var Group|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\Group', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/LabelAttachment.php b/src/Entity/Attachments/LabelAttachment.php index a8c09bee..7ff1a191 100644 --- a/src/Entity/Attachments/LabelAttachment.php +++ b/src/Entity/Attachments/LabelAttachment.php @@ -47,18 +47,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * A attachment attached to a user element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class LabelAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = LabelProfile::class; /** * @var LabelProfile the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\LabelSystem\LabelProfile", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\LabelSystem\LabelProfile', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php index ca11d0b3..1d5709dd 100644 --- a/src/Entity/Attachments/ManufacturerAttachment.php +++ b/src/Entity/Attachments/ManufacturerAttachment.php @@ -28,18 +28,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a manufacturer element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class ManufacturerAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; /** * @var Manufacturer|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Manufacturer', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php index 623e0661..ad4fbbc9 100644 --- a/src/Entity/Attachments/MeasurementUnitAttachment.php +++ b/src/Entity/Attachments/MeasurementUnitAttachment.php @@ -29,17 +29,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a measurement unit element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class MeasurementUnitAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; /** * @var Manufacturer|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\MeasurementUnit', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php index 2efb0088..82db5c72 100644 --- a/src/Entity/Attachments/PartAttachment.php +++ b/src/Entity/Attachments/PartAttachment.php @@ -28,17 +28,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * A attachment attached to a part element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class PartAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Part::class; /** * @var Part the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/ProjectAttachment.php b/src/Entity/Attachments/ProjectAttachment.php index f9d3d24e..052996c3 100644 --- a/src/Entity/Attachments/ProjectAttachment.php +++ b/src/Entity/Attachments/ProjectAttachment.php @@ -28,17 +28,16 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * A attachment attached to a device element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class ProjectAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Project::class; /** * @var Project|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php index 95e0136d..b0fc6cb6 100644 --- a/src/Entity/Attachments/StorelocationAttachment.php +++ b/src/Entity/Attachments/StorelocationAttachment.php @@ -28,18 +28,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a measurement unit element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class StorelocationAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Storelocation::class; /** * @var Storelocation|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Storelocation', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php index fffa2e5b..0f611d4c 100644 --- a/src/Entity/Attachments/SupplierAttachment.php +++ b/src/Entity/Attachments/SupplierAttachment.php @@ -28,18 +28,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * A attachment attached to a supplier element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class SupplierAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = Supplier::class; /** * @var Supplier|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php index 67998d8e..8fc9b9df 100644 --- a/src/Entity/Attachments/UserAttachment.php +++ b/src/Entity/Attachments/UserAttachment.php @@ -28,18 +28,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a user element. - * - * @ORM\Entity() */ #[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] class UserAttachment extends Attachment { public const ALLOWED_ELEMENT_CLASS = User::class; /** * @var User|null the element this attachment is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Base/AbstractCompany.php b/src/Entity/Base/AbstractCompany.php index 87acface..f265349a 100644 --- a/src/Entity/Base/AbstractCompany.php +++ b/src/Entity/Base/AbstractCompany.php @@ -29,52 +29,51 @@ use Symfony\Component\Validator\Constraints as Assert; /** * This abstract class is used for companies like suppliers or manufacturers. - * - * @ORM\MappedSuperclass() */ +#[ORM\MappedSuperclass] abstract class AbstractCompany extends AbstractPartsContainingDBElement { /** * @var string The address of the company - * @ORM\Column(type="string") */ #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $address = ''; /** * @var string The phone number of the company - * @ORM\Column(type="string") */ #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $phone_number = ''; /** * @var string The fax number of the company - * @ORM\Column(type="string") */ #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $fax_number = ''; /** * @var string The email address of the company - * @ORM\Column(type="string") */ #[Assert\Email] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $email_address = ''; /** * @var string The website of the company - * @ORM\Column(type="string") */ #[Assert\Url] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $website = ''; /** * @var string - * @ORM\Column(type="string") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $auto_product_url = ''; /******************************************************************************** diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index e2946f4e..ce55c700 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -34,19 +34,18 @@ use Symfony\Component\Serializer\Annotation\Groups; * (except special tables like "internal"...) * Every database table which are managed with this class (or a subclass of it) * must have the table row "id"!! The ID is the unique key to identify the elements. - * - * @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository") */ #[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => 'App\Entity\Attachments\AttachmentType', 'attachment' => 'App\Entity\Attachments\Attachment', 'attachment_type_attachment' => 'App\Entity\Attachments\AttachmentTypeAttachment', 'category_attachment' => 'App\Entity\Attachments\CategoryAttachment', 'currency_attachment' => 'App\Entity\Attachments\CurrencyAttachment', 'footprint_attachment' => 'App\Entity\Attachments\FootprintAttachment', 'group_attachment' => 'App\Entity\Attachments\GroupAttachment', 'label_attachment' => 'App\Entity\Attachments\LabelAttachment', 'manufacturer_attachment' => 'App\Entity\Attachments\ManufacturerAttachment', 'measurement_unit_attachment' => 'App\Entity\Attachments\MeasurementUnitAttachment', 'part_attachment' => 'App\Entity\Attachments\PartAttachment', 'project_attachment' => 'App\Entity\Attachments\ProjectAttachment', 'storelocation_attachment' => 'App\Entity\Attachments\StorelocationAttachment', 'supplier_attachment' => 'App\Entity\Attachments\SupplierAttachment', 'user_attachment' => 'App\Entity\Attachments\UserAttachment', 'category' => 'App\Entity\Parts\Category', 'project' => 'App\Entity\ProjectSystem\Project', 'project_bom_entry' => 'App\Entity\ProjectSystem\ProjectBOMEntry', 'footprint' => 'App\Entity\Parts\Footprint', 'group' => 'App\Entity\UserSystem\Group', 'manufacturer' => 'App\Entity\Parts\Manufacturer', 'orderdetail' => 'App\Entity\PriceInformations\Orderdetail', 'part' => 'App\Entity\Parts\Part', 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => 'App\Entity\Parts\Storelocation', 'part_lot' => 'App\Entity\Parts\PartLot', 'currency' => 'App\Entity\PriceInformations\Currency', 'measurement_unit' => 'App\Entity\Parts\MeasurementUnit', 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => 'App\Entity\Parts\Supplier', 'user' => 'App\Entity\UserSystem\User'])] +#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\DBElementRepository')] abstract class AbstractDBElement implements JsonSerializable { /** @var int|null The Identification number for this part. This value is unique for the element in this table. * Null if the element is not saved to DB yet. - * @ORM\Column(type="integer") - * @ORM\Id() - * @ORM\GeneratedValue() */ #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Id] + #[ORM\GeneratedValue] protected ?int $id = null; public function __clone() diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php index 90ebc91c..4b2b9d9e 100644 --- a/src/Entity/Base/AbstractNamedDBElement.php +++ b/src/Entity/Base/AbstractNamedDBElement.php @@ -30,20 +30,19 @@ use Symfony\Component\Validator\Constraints as Assert; /** * All subclasses of this class have an attribute "name". - * - * @ORM\MappedSuperclass(repositoryClass="App\Repository\NamedDBElement") - * @ORM\HasLifecycleCallbacks() */ +#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\NamedDBElement')] +#[ORM\HasLifecycleCallbacks] abstract class AbstractNamedDBElement extends AbstractDBElement implements NamedElementInterface, TimeStampableInterface { use TimestampTrait; /** * @var string the name of this element - * @ORM\Column(type="string") */ #[Assert\NotBlank] #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name = ''; /****************************************************************************** diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index a4a047ef..7ccb74c3 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -28,9 +28,8 @@ use Symfony\Component\Serializer\Annotation\Groups; /** * Class PartsContainingDBElement. - * - * @ORM\MappedSuperclass(repositoryClass="App\Repository\AbstractPartsContainingRepository") */ +#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\AbstractPartsContainingRepository')] abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement { #[Groups(['full'])] diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 8ce54f0e..484fbaf6 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -43,11 +43,11 @@ use Symfony\Component\Serializer\Annotation\Groups; * It's allowed to have instances of root elements, but if you try to change * an attribute of a root element, you will get an exception! * - * @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository") * - * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) */ #[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')] +#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\StructuralDBElementRepository')] +#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])] abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement { use ParametersTrait; @@ -61,17 +61,17 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement /** * @var string The comment info for this element - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $comment = ''; /** * @var bool If this property is set, this element can not be selected for part properties. * Useful if this element should be used only for grouping, sorting. - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $not_selectable = false; /** diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php index b5e0f29a..f1451e1c 100644 --- a/src/Entity/Base/MasterAttachmentTrait.php +++ b/src/Entity/Base/MasterAttachmentTrait.php @@ -33,10 +33,10 @@ trait MasterAttachmentTrait { /** * @var Attachment|null - * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") - * @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) */ #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] + #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\Attachment')] + #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] protected ?Attachment $master_picture_attachment = null; /** diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index 913aa5b3..19360fb8 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -44,9 +44,7 @@ namespace App\Entity\LabelSystem; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Embeddable() - */ +#[ORM\Embeddable] class LabelOptions { public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93', 'code128']; @@ -57,55 +55,55 @@ class LabelOptions /** * @var float The page size of the label in mm - * @ORM\Column(type="float") */ #[Assert\Positive] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] protected float $width = 50.0; /** * @var float The page size of the label in mm - * @ORM\Column(type="float") */ #[Assert\Positive] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] protected float $height = 30.0; /** * @var string The type of the barcode that should be used in the label (e.g. 'qr') - * @ORM\Column(type="string") */ #[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $barcode_type = 'none'; /** * @var string What image should be shown along the - * @ORM\Column(type="string") */ #[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $picture_type = 'none'; /** * @var string - * @ORM\Column(type="string") */ #[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $supported_element = 'part'; /** * @var string any additional CSS for the label - * @ORM\Column(type="text") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $additional_css = ''; /** @var string The mode that will be used to interpret the lines - * @ORM\Column(type="string") */ #[Assert\Choice(choices: LabelOptions::LINES_MODES)] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $lines_mode = 'html'; /** * @var string - * @ORM\Column(type="text") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $lines = ''; public function getWidth(): float diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php index ccd4087b..8548104b 100644 --- a/src/Entity/LabelSystem/LabelProfile.php +++ b/src/Entity/LabelSystem/LabelProfile.php @@ -48,42 +48,41 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Validator\Constraints as Assert; -/** - * @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository") - * @ORM\Table(name="label_profiles") - * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) - */ #[UniqueEntity(['name', 'options.supported_element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\LabelProfileRepository')] +#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])] +#[ORM\Table(name: 'label_profiles')] class LabelProfile extends AttachmentContainingDBElement { /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\LabelAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\LabelAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** * @var LabelOptions - * @ORM\Embedded(class="LabelOptions") */ #[Assert\Valid] + #[ORM\Embedded(class: 'LabelOptions')] protected LabelOptions $options; /** * @var string The comment info for this element - * @ORM\Column(type="text") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $comment = ''; /** * @var bool determines, if this label profile should be shown in the dropdown quick menu - * @ORM\Column(type="boolean") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $show_in_dropdown = true; public function __construct() { + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct(); $this->options = new LabelOptions(); } diff --git a/src/Entity/LogSystem/CollectionElementDeleted.php b/src/Entity/LogSystem/CollectionElementDeleted.php index 9e646cca..15f23e7f 100644 --- a/src/Entity/LogSystem/CollectionElementDeleted.php +++ b/src/Entity/LogSystem/CollectionElementDeleted.php @@ -84,11 +84,7 @@ use App\Entity\UserSystem\User; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; -/** - * @ORM\Entity() - * This log entry is created when an element is deleted, that is used in a collection of another entity. - * This is needed to signal time travel, that it has to undelete the deleted entity. - */ +#[ORM\Entity] class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventUndoInterface { protected string $typeString = 'collection_element_deleted'; diff --git a/src/Entity/LogSystem/ConfigChangedLogEntry.php b/src/Entity/LogSystem/ConfigChangedLogEntry.php index 543886bf..68f8edf3 100644 --- a/src/Entity/LogSystem/ConfigChangedLogEntry.php +++ b/src/Entity/LogSystem/ConfigChangedLogEntry.php @@ -25,9 +25,7 @@ namespace App\Entity\LogSystem; use App\Exceptions\LogEntryObsoleteException; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class ConfigChangedLogEntry extends AbstractLogEntry { protected string $typeString = 'config_changed'; diff --git a/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php b/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php index 0f85ba11..6e137373 100644 --- a/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php +++ b/src/Entity/LogSystem/DatabaseUpdatedLogEntry.php @@ -24,9 +24,7 @@ namespace App\Entity\LogSystem; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class DatabaseUpdatedLogEntry extends AbstractLogEntry { protected string $typeString = 'database_updated'; diff --git a/src/Entity/LogSystem/ElementCreatedLogEntry.php b/src/Entity/LogSystem/ElementCreatedLogEntry.php index c78e6df0..9cac58b3 100644 --- a/src/Entity/LogSystem/ElementCreatedLogEntry.php +++ b/src/Entity/LogSystem/ElementCreatedLogEntry.php @@ -30,9 +30,7 @@ use App\Entity\UserSystem\User; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentInterface, LogWithEventUndoInterface { protected string $typeString = 'element_created'; diff --git a/src/Entity/LogSystem/ElementDeletedLogEntry.php b/src/Entity/LogSystem/ElementDeletedLogEntry.php index c20bf87c..29ab6a91 100644 --- a/src/Entity/LogSystem/ElementDeletedLogEntry.php +++ b/src/Entity/LogSystem/ElementDeletedLogEntry.php @@ -32,9 +32,7 @@ use App\Entity\UserSystem\User; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInterface, LogWithCommentInterface, LogWithEventUndoInterface { protected string $typeString = 'element_deleted'; diff --git a/src/Entity/LogSystem/ElementEditedLogEntry.php b/src/Entity/LogSystem/ElementEditedLogEntry.php index fb5f2e5c..dab87652 100644 --- a/src/Entity/LogSystem/ElementEditedLogEntry.php +++ b/src/Entity/LogSystem/ElementEditedLogEntry.php @@ -30,9 +30,7 @@ use App\Entity\Contracts\TimeTravelInterface; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterface, LogWithCommentInterface, LogWithEventUndoInterface, LogWithNewDataInterface { protected string $typeString = 'element_edited'; diff --git a/src/Entity/LogSystem/ExceptionLogEntry.php b/src/Entity/LogSystem/ExceptionLogEntry.php index dc9a7f32..e8fb06f9 100644 --- a/src/Entity/LogSystem/ExceptionLogEntry.php +++ b/src/Entity/LogSystem/ExceptionLogEntry.php @@ -25,9 +25,7 @@ namespace App\Entity\LogSystem; use App\Exceptions\LogEntryObsoleteException; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class ExceptionLogEntry extends AbstractLogEntry { protected string $typeString = 'exception'; diff --git a/src/Entity/LogSystem/LegacyInstockChangedLogEntry.php b/src/Entity/LogSystem/LegacyInstockChangedLogEntry.php index 9af3dd69..27f7afe4 100644 --- a/src/Entity/LogSystem/LegacyInstockChangedLogEntry.php +++ b/src/Entity/LogSystem/LegacyInstockChangedLogEntry.php @@ -24,9 +24,7 @@ namespace App\Entity\LogSystem; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class LegacyInstockChangedLogEntry extends AbstractLogEntry { protected string $typeString = 'instock_changed'; diff --git a/src/Entity/LogSystem/PartStockChangedLogEntry.php b/src/Entity/LogSystem/PartStockChangedLogEntry.php index 44852076..5fc755bf 100644 --- a/src/Entity/LogSystem/PartStockChangedLogEntry.php +++ b/src/Entity/LogSystem/PartStockChangedLogEntry.php @@ -23,9 +23,7 @@ namespace App\Entity\LogSystem; use App\Entity\Parts\PartLot; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class PartStockChangedLogEntry extends AbstractLogEntry { public const TYPE_ADD = "add"; diff --git a/src/Entity/LogSystem/SecurityEventLogEntry.php b/src/Entity/LogSystem/SecurityEventLogEntry.php index 2113beb9..2d74f5ea 100644 --- a/src/Entity/LogSystem/SecurityEventLogEntry.php +++ b/src/Entity/LogSystem/SecurityEventLogEntry.php @@ -50,9 +50,8 @@ use Symfony\Component\HttpFoundation\IpUtils; /** * This log entry is created when something security related to a user happens. - * - * @ORM\Entity() */ +#[ORM\Entity] class SecurityEventLogEntry extends AbstractLogEntry { public const SECURITY_TYPE_MAPPING = [ diff --git a/src/Entity/LogSystem/UserLoginLogEntry.php b/src/Entity/LogSystem/UserLoginLogEntry.php index d1acaa6e..166533c4 100644 --- a/src/Entity/LogSystem/UserLoginLogEntry.php +++ b/src/Entity/LogSystem/UserLoginLogEntry.php @@ -27,9 +27,8 @@ use Symfony\Component\HttpFoundation\IpUtils; /** * This log entry is created when a user logs in. - * - * @ORM\Entity() */ +#[ORM\Entity] class UserLoginLogEntry extends AbstractLogEntry { protected string $typeString = 'user_login'; diff --git a/src/Entity/LogSystem/UserLogoutLogEntry.php b/src/Entity/LogSystem/UserLogoutLogEntry.php index 43a98fb6..9fce3069 100644 --- a/src/Entity/LogSystem/UserLogoutLogEntry.php +++ b/src/Entity/LogSystem/UserLogoutLogEntry.php @@ -25,9 +25,7 @@ namespace App\Entity\LogSystem; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\HttpFoundation\IpUtils; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class UserLogoutLogEntry extends AbstractLogEntry { protected string $typeString = 'user_logout'; diff --git a/src/Entity/LogSystem/UserNotAllowedLogEntry.php b/src/Entity/LogSystem/UserNotAllowedLogEntry.php index 5d4e3acd..99fb2492 100644 --- a/src/Entity/LogSystem/UserNotAllowedLogEntry.php +++ b/src/Entity/LogSystem/UserNotAllowedLogEntry.php @@ -24,9 +24,7 @@ namespace App\Entity\LogSystem; use Doctrine\ORM\Mapping as ORM; -/** - * @ORM\Entity() - */ +#[ORM\Entity] class UserNotAllowedLogEntry extends AbstractLogEntry { protected string $typeString = 'user_not_allowed'; diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 134d44aa..b033c0ac 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -51,29 +51,14 @@ use Symfony\Component\Validator\Constraints as Assert; use function sprintf; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - * @ORM\Table("parameters", indexes={ - * @ORM\Index(name="parameter_name_idx", columns={"name"}), - * @ORM\Index(name="parameter_group_idx", columns={"param_group"}), - * @ORM\Index(name="parameter_type_element_idx", columns={"type", "element_id"}) - * }) - * @ORM\InheritanceType("SINGLE_TABLE") - * @ORM\DiscriminatorColumn(name="type", type="smallint") - * @ORM\DiscriminatorMap({ - * 0 = "CategoryParameter", - * 1 = "CurrencyParameter", - * 2 = "ProjectParameter", - * 3 = "FootprintParameter", - * 4 = "GroupParameter", - * 5 = "ManufacturerParameter", - * 6 = "MeasurementUnitParameter", - * 7 = "PartParameter", - * 8 = "StorelocationParameter", - * 9 = "SupplierParameter", - * 10 = "AttachmentTypeParameter" - * }) - */ +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\InheritanceType('SINGLE_TABLE')] +#[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')] +#[ORM\DiscriminatorMap([0 => 'CategoryParameter', 1 => 'CurrencyParameter', 2 => 'ProjectParameter', 3 => 'FootprintParameter', 4 => 'GroupParameter', 5 => 'ManufacturerParameter', 6 => 'MeasurementUnitParameter', 7 => 'PartParameter', 8 => 'StorelocationParameter', 9 => 'SupplierParameter', 10 => 'AttachmentTypeParameter'])] +#[ORM\Table('parameters')] +#[ORM\Index(name: 'parameter_name_idx', columns: ['name'])] +#[ORM\Index(name: 'parameter_group_idx', columns: ['param_group'])] +#[ORM\Index(name: 'parameter_type_element_idx', columns: ['type', 'element_id'])] abstract class AbstractParameter extends AbstractNamedDBElement { /** @@ -83,59 +68,59 @@ abstract class AbstractParameter extends AbstractNamedDBElement /** * @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short - * @ORM\Column(type="string", nullable=false) */ #[Assert\Length(max: 20)] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $symbol = ''; /** * @var float|null the guaranteed minimum value of this property - * @ORM\Column(type="float", nullable=true) */ #[Assert\Type(['float', null])] #[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')] #[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] protected ?float $value_min = null; /** * @var float|null the typical value of this property - * @ORM\Column(type="float", nullable=true) */ #[Assert\Type([null, 'float'])] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] protected ?float $value_typical = null; /** * @var float|null the maximum value of this property - * @ORM\Column(type="float", nullable=true) */ #[Assert\Type(['float', null])] #[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] protected ?float $value_max = null; /** * @var string The unit in which the value values are given (e.g. V) - * @ORM\Column(type="string", nullable=false) */ #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $unit = ''; /** * @var string a text value for the given property - * @ORM\Column(type="string", nullable=false) */ #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $value_text = ''; /** * @var string the group this parameter belongs to - * @ORM\Column(type="string", nullable=false, name="param_group") */ #[Groups(['full'])] #[Groups(['full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'param_group')] protected string $group = ''; /** diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php index 12b05ae7..28f53669 100644 --- a/src/Entity/Parameters/AttachmentTypeParameter.php +++ b/src/Entity/Parameters/AttachmentTypeParameter.php @@ -46,17 +46,15 @@ use App\Entity\Base\AbstractDBElement; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class AttachmentTypeParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; /** * @var AttachmentType the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\AttachmentType', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php index c80004a0..ba71e46f 100644 --- a/src/Entity/Parameters/CategoryParameter.php +++ b/src/Entity/Parameters/CategoryParameter.php @@ -46,17 +46,15 @@ use App\Entity\Parts\Category; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class CategoryParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Category::class; /** * @var Category the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Category', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php index a9f1133e..fc3d6726 100644 --- a/src/Entity/Parameters/CurrencyParameter.php +++ b/src/Entity/Parameters/CurrencyParameter.php @@ -48,18 +48,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * An attachment attached to a category element. - * - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class CurrencyParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Currency::class; /** * @var Currency the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php index be65d737..1f8f517b 100644 --- a/src/Entity/Parameters/FootprintParameter.php +++ b/src/Entity/Parameters/FootprintParameter.php @@ -46,18 +46,16 @@ use App\Entity\Parts\Footprint; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class FootprintParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Footprint::class; /** * @var Footprint the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Footprint', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php index c283e142..0b181929 100644 --- a/src/Entity/Parameters/GroupParameter.php +++ b/src/Entity/Parameters/GroupParameter.php @@ -46,18 +46,16 @@ use App\Entity\UserSystem\Group; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class GroupParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Group::class; /** * @var Group the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\Group', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php index fd990dd2..3fa585cf 100644 --- a/src/Entity/Parameters/ManufacturerParameter.php +++ b/src/Entity/Parameters/ManufacturerParameter.php @@ -46,18 +46,16 @@ use App\Entity\Parts\Manufacturer; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class ManufacturerParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; /** * @var Manufacturer the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Manufacturer', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php index 2dbc94f8..67d20f3f 100644 --- a/src/Entity/Parameters/MeasurementUnitParameter.php +++ b/src/Entity/Parameters/MeasurementUnitParameter.php @@ -46,18 +46,16 @@ use App\Entity\Parts\MeasurementUnit; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class MeasurementUnitParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; /** * @var MeasurementUnit the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\MeasurementUnit', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index 11798919..97494abc 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -46,18 +46,16 @@ use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class PartParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Part::class; /** * @var Part the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php index 362cde04..bda1b59a 100644 --- a/src/Entity/Parameters/ProjectParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -46,18 +46,16 @@ use App\Entity\ProjectSystem\Project; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class ProjectParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Project::class; /** * @var Project the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php index 6b792588..f119f4a7 100644 --- a/src/Entity/Parameters/StorelocationParameter.php +++ b/src/Entity/Parameters/StorelocationParameter.php @@ -46,18 +46,16 @@ use App\Entity\Parts\Storelocation; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class StorelocationParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Storelocation::class; /** * @var Storelocation the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Storelocation', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php index 3281a722..e3087c27 100644 --- a/src/Entity/Parameters/SupplierParameter.php +++ b/src/Entity/Parameters/SupplierParameter.php @@ -46,18 +46,16 @@ use App\Entity\Parts\Supplier; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; -/** - * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") - */ #[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] class SupplierParameter extends AbstractParameter { public const ALLOWED_ELEMENT_CLASS = Supplier::class; /** * @var Supplier the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="parameters") - * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 990a7a1e..56450f11 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -33,99 +33,95 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\CategoryRepository") - * @ORM\Table(name="`categories`", indexes={ - * @ORM\Index(name="category_idx_name", columns={"name"}), - * @ORM\Index(name="category_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\CategoryRepository')] +#[ORM\Table(name: '`categories`')] +#[ORM\Index(name: 'category_idx_name', columns: ['name'])] +#[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])] class Category extends AbstractPartsContainingDBElement { /** - * @ORM\OneToMany(targetEntity="Category", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Category', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Category", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Category', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent = null; /** * @var string - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $partname_hint = ''; /** * @var string - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $partname_regex = ''; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_footprints = false; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_manufacturers = false; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_autodatasheets = false; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disable_properties = false; /** * @var string - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $default_description = ''; /** * @var string - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $default_comment = ''; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] #[Groups(['full'])] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\CategoryAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] #[Groups(['full'])] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\CategoryParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; public function getPartnameHint(): string @@ -247,4 +243,11 @@ class Category extends AbstractPartsContainingDBElement return $this; } + public function __construct() + { + parent::__construct(); + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + } } diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index 2949d6a8..f7c56a79 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -31,48 +31,44 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Footprint. - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\FootprintRepository") - * @ORM\Table("`footprints`", indexes={ - * @ORM\Index(name="footprint_idx_name", columns={"name"}), - * @ORM\Index(name="footprint_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\FootprintRepository')] +#[ORM\Table('`footprints`')] +#[ORM\Index(name: 'footprint_idx_name', columns: ['name'])] +#[ORM\Index(name: 'footprint_idx_parent_name', columns: ['parent_id', 'name'])] class Footprint extends AbstractPartsContainingDBElement { - /** - * @ORM\ManyToOne(targetEntity="Footprint", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Footprint', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?\App\Entity\Base\AbstractStructuralDBElement $parent; /** - * @ORM\OneToMany(targetEntity="Footprint", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Footprint', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\FootprintAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** * @var FootprintAttachment|null - * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\FootprintAttachment") - * @ORM\JoinColumn(name="id_footprint_3d", referencedColumnName="id") */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\FootprintAttachment')] + #[ORM\JoinColumn(name: 'id_footprint_3d')] protected ?FootprintAttachment $footprint_3d = null; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\FootprintParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\FootprintParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /**************************************** @@ -106,4 +102,11 @@ class Footprint extends AbstractPartsContainingDBElement return $this; } + public function __construct() + { + parent::__construct(); + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + } } diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 7e8f75b1..1e56bcfb 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -31,40 +31,43 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Manufacturer. - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\ManufacturerRepository") - * @ORM\Table("`manufacturers`", indexes={ - * @ORM\Index(name="manufacturer_name", columns={"name"}), - * @ORM\Index(name="manufacturer_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\ManufacturerRepository')] +#[ORM\Table('`manufacturers`')] +#[ORM\Index(name: 'manufacturer_name', columns: ['name'])] +#[ORM\Index(name: 'manufacturer_idx_parent_name', columns: ['parent_id', 'name'])] class Manufacturer extends AbstractCompany { - /** - * @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Manufacturer', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?\App\Entity\Base\AbstractStructuralDBElement $parent; /** - * @ORM\OneToMany(targetEntity="Manufacturer", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Manufacturer', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\ManufacturerAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\ManufacturerParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; + public function __construct() + { + parent::__construct(); + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + } } diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 10bfc90d..b36db648 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -34,68 +34,64 @@ use Symfony\Component\Validator\Constraints as Assert; /** * This unit represents the unit in which the amount of parts in stock are measured. * This could be something like N, grams, meters, etc... - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\MeasurementUnitRepository") - * @ORM\Table(name="`measurement_units`", indexes={ - * @ORM\Index(name="unit_idx_name", columns={"name"}), - * @ORM\Index(name="unit_idx_parent_name", columns={"parent_id", "name"}), - * }) */ #[UniqueEntity('unit')] +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\MeasurementUnitRepository')] +#[ORM\Table(name: '`measurement_units`')] +#[ORM\Index(name: 'unit_idx_name', columns: ['name'])] +#[ORM\Index(name: 'unit_idx_parent_name', columns: ['parent_id', 'name'])] class MeasurementUnit extends AbstractPartsContainingDBElement { /** * @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams) * or m (for meters). - * @ORM\Column(type="string", name="unit", nullable=true) */ #[Assert\Length(max: 10)] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'unit', nullable: true)] protected ?string $unit = null; /** * @var bool Determines if the amount value associated with this unit should be treated as integer. * Set to false, to measure continuous sizes likes masses or lengths. - * @ORM\Column(type="boolean", name="is_integer") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'is_integer')] protected bool $is_integer = false; /** * @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.). * Useful for sizes like meters. For this the unit must be set - * @ORM\Column(type="boolean", name="use_si_prefix") */ #[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')] #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'use_si_prefix')] protected bool $use_si_prefix = false; /** - * @ORM\OneToMany(targetEntity="MeasurementUnit", mappedBy="parent", cascade={"persist"}) - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'MeasurementUnit', mappedBy: 'parent', cascade: ['persist'])] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'MeasurementUnit', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?\App\Entity\Base\AbstractStructuralDBElement $parent; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\MeasurementUnitAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\MeasurementUnitParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** @@ -147,4 +143,11 @@ class MeasurementUnit extends AbstractPartsContainingDBElement return $this; } + public function __construct() + { + parent::__construct(); + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + } } diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index 43c0c57d..fe3db50b 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -34,32 +34,32 @@ trait AdvancedPropertyTrait { /** * @var bool Determines if this part entry needs review (for example, because it is work in progress) - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $needs_review = false; /** * @var string a comma separated list of tags, associated with the part - * @ORM\Column(type="text") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $tags = ''; /** * @var float|null how much a single part unit weighs in grams - * @ORM\Column(type="float", nullable=true) */ #[Assert\PositiveOrZero] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] protected ?float $mass = null; /** * @var string|null The internal part number of the part - * @ORM\Column(type="string", length=100, nullable=true, unique=true) */ #[Assert\Length(max: 100)] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100, nullable: true, unique: true)] protected ?string $ipn = null; /** diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php index 6dfc26ec..4d90a307 100644 --- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php @@ -33,49 +33,49 @@ trait BasicPropertyTrait { /** * @var string A text describing what this part does - * @ORM\Column(type="text") */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $description = ''; /** * @var string A comment/note related to this part - * @ORM\Column(type="text") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $comment = ''; /** * @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions) - * @ORM\Column(type="boolean") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $visible = true; /** * @var bool true, if the part is marked as favorite - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $favorite = false; /** * @var Category|null The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping. * Every part must have a category. - * @ORM\ManyToOne(targetEntity="Category") - * @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false) * @Selectable() */ #[Assert\NotNull(message: 'validator.select_valid_category')] #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'Category')] + #[ORM\JoinColumn(name: 'id_category', nullable: false)] protected ?Category $category = null; /** * @var Footprint|null The footprint of this part (e.g. DIP8) - * @ORM\ManyToOne(targetEntity="Footprint") - * @ORM\JoinColumn(name="id_footprint", referencedColumnName="id") * @Selectable() */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'Footprint')] + #[ORM\JoinColumn(name: 'id_footprint')] protected ?Footprint $footprint = null; /** diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index cf1da1e0..152ade10 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -36,28 +36,28 @@ trait InstockTrait { /** * @var Collection|PartLot[] A list of part lots where this part is stored - * @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"amount" = "DESC"}) */ #[Assert\Valid] #[Groups(['extended', 'full', 'import'])] - protected $partLots; + #[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['amount' => 'DESC'])] + protected \Doctrine\Common\Collections\Collection $partLots; /** * @var float The minimum amount of the part that has to be instock, otherwise more is ordered. * Given in the partUnit. - * @ORM\Column(type="float") */ #[Assert\PositiveOrZero] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] protected float $minamount = 0; /** * @var ?MeasurementUnit the unit in which the part's amount is measured - * @ORM\ManyToOne(targetEntity="MeasurementUnit") - * @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true) */ #[Groups(['extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'MeasurementUnit')] + #[ORM\JoinColumn(name: 'id_part_unit')] protected ?MeasurementUnit $partUnit = null; /** diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php index fea580d0..d79a9128 100644 --- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php +++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php @@ -36,34 +36,34 @@ trait ManufacturerTrait { /** * @var Manufacturer|null The manufacturer of this part - * @ORM\ManyToOne(targetEntity="Manufacturer") - * @ORM\JoinColumn(name="id_manufacturer", referencedColumnName="id") * @Selectable() */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'Manufacturer')] + #[ORM\JoinColumn(name: 'id_manufacturer')] protected ?Manufacturer $manufacturer = null; /** * @var string the url to the part on the manufacturer's homepage - * @ORM\Column(type="string") */ #[Assert\Url] #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $manufacturer_product_url = ''; /** * @var string The product number used by the manufacturer. If this is set to "", the name field is used. - * @ORM\Column(type="string") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $manufacturer_product_number = ''; /** * @var string|null The production status of this part. Can be one of the specified ones. - * @ORM\Column(type="string", length=255, nullable=true) */ #[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] protected ?string $manufacturing_status = ''; /** diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index b2feb024..b4e661a8 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -36,30 +36,30 @@ trait OrderTrait { /** * @var Orderdetail[]|Collection the details about how and where you can order this part - * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"supplierpartnr" = "ASC"}) */ #[Assert\Valid] #[Groups(['extended', 'full', 'import'])] - protected $orderdetails; + #[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Orderdetail', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['supplierpartnr' => 'ASC'])] + protected \Doctrine\Common\Collections\Collection $orderdetails; /** * @var int - * @ORM\Column(type="integer") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] protected int $order_quantity = 0; /** * @var bool - * @ORM\Column(type="boolean") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $manual_order = false; /** * @var Orderdetail|null - * @ORM\OneToOne(targetEntity="App\Entity\PriceInformations\Orderdetail") - * @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id") */ + #[ORM\OneToOne(targetEntity: 'App\Entity\PriceInformations\Orderdetail')] + #[ORM\JoinColumn(name: 'order_orderdetails_id')] protected ?Orderdetail $order_orderdetail = null; /** diff --git a/src/Entity/Parts/PartTraits/ProjectTrait.php b/src/Entity/Parts/PartTraits/ProjectTrait.php index e0d646d2..795b5393 100644 --- a/src/Entity/Parts/PartTraits/ProjectTrait.php +++ b/src/Entity/Parts/PartTraits/ProjectTrait.php @@ -10,16 +10,16 @@ use Doctrine\ORM\Mapping as ORM; trait ProjectTrait { /** - * @var Collection $project_bom_entries - * @ORM\OneToMany(targetEntity="App\Entity\ProjectSystem\ProjectBOMEntry", mappedBy="part", cascade={"remove"}, orphanRemoval=true) + * @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries */ - protected $project_bom_entries = []; + #[ORM\OneToMany(targetEntity: 'App\Entity\ProjectSystem\ProjectBOMEntry', mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)] + protected \Doctrine\Common\Collections\Collection $project_bom_entries = []; /** * @var Project|null If a project is set here, then this part is special and represents the builds of a project. - * @ORM\OneToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="build_part") - * @ORM\JoinColumn(nullable=true) */ + #[ORM\OneToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'build_part')] + #[ORM\JoinColumn] protected ?Project $built_project = null; /** diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index 3f18c79e..2249fb00 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -34,82 +34,78 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Store location. - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\StorelocationRepository") - * @ORM\Table("`storelocations`", indexes={ - * @ORM\Index(name="location_idx_name", columns={"name"}), - * @ORM\Index(name="location_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\StorelocationRepository')] +#[ORM\Table('`storelocations`')] +#[ORM\Index(name: 'location_idx_name', columns: ['name'])] +#[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])] class Storelocation extends AbstractPartsContainingDBElement { /** - * @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Storelocation', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Storelocation', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent; /** * @var MeasurementUnit|null The measurement unit, which parts can be stored in here - * @ORM\ManyToOne(targetEntity="MeasurementUnit") - * @ORM\JoinColumn(name="storage_type_id", referencedColumnName="id") */ + #[ORM\ManyToOne(targetEntity: 'MeasurementUnit')] + #[ORM\JoinColumn(name: 'storage_type_id')] protected ?MeasurementUnit $storage_type = null; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\StorelocationParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $is_full = false; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $only_single_part = false; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $limit_to_existing_parts = false; /** * @var User|null The owner of this storage location - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User") - * @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL") */ #[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')] + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User')] + #[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')] protected ?User $owner = null; /** * @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here. - * @ORM\Column(type="boolean", options={"default":false}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] protected bool $part_owner_must_match = false; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\StorelocationAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $attachments; /******************************************************************************** @@ -248,4 +244,11 @@ class Storelocation extends AbstractPartsContainingDBElement return $this; } + public function __construct() + { + parent::__construct(); + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + } } diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index 95fd25fe..65b82fec 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -37,63 +37,60 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Supplier. - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\SupplierRepository") - * @ORM\Table("`suppliers`", indexes={ - * @ORM\Index(name="supplier_idx_name", columns={"name"}), - * @ORM\Index(name="supplier_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\SupplierRepository')] +#[ORM\Table('`suppliers`')] +#[ORM\Index(name: 'supplier_idx_name', columns: ['name'])] +#[ORM\Index(name: 'supplier_idx_parent_name', columns: ['parent_id', 'name'])] class Supplier extends AbstractCompany { /** - * @ORM\OneToMany(targetEntity="Supplier", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Supplier', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Supplier", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Supplier', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent; /** - * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="supplier") + * @var \Doctrine\Common\Collections\Collection|\App\Entity\PriceInformations\Orderdetail[] */ + #[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Orderdetail', mappedBy: 'supplier')] protected Collection $orderdetails; /** * @var Currency|null The currency that should be used by default for order informations with this supplier. * Set to null, to use global base currency. - * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency") - * @ORM\JoinColumn(name="default_currency_id", referencedColumnName="id", nullable=true) * @Selectable() */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency')] + #[ORM\JoinColumn(name: 'default_currency_id')] protected ?Currency $default_currency = null; /** * @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier - * @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5) * @BigDecimalPositiveOrZero() */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(name: 'shipping_costs', nullable: true, type: 'big_decimal', precision: 11, scale: 5)] protected ?BigDecimal $shipping_costs = null; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\SupplierAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\SupplierParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** @@ -146,4 +143,12 @@ class Supplier extends AbstractCompany return $this; } + public function __construct() + { + parent::__construct(); + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->orderdetails = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + } } diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index ee90cdd3..f434c1ff 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -37,14 +37,12 @@ use Symfony\Component\Validator\Constraints as Assert; /** * This entity describes a currency that can be used for price information. - * - * @ORM\Entity() - * @ORM\Table(name="currencies", indexes={ - * @ORM\Index(name="currency_idx_name", columns={"name"}), - * @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}), - * }) */ #[UniqueEntity('iso_code')] +#[ORM\Entity] +#[ORM\Table(name: 'currencies')] +#[ORM\Index(name: 'currency_idx_name', columns: ['name'])] +#[ORM\Index(name: 'currency_idx_parent_name', columns: ['parent_id', 'name'])] class Currency extends AbstractStructuralDBElement { public const PRICE_SCALE = 5; @@ -52,53 +50,52 @@ class Currency extends AbstractStructuralDBElement /** * @var BigDecimal|null The exchange rate between this currency and the base currency * (how many base units the current currency is worth) - * @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true) * @BigDecimalPositive() */ + #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] protected ?BigDecimal $exchange_rate = null; /** * @var string the 3-letter ISO code of the currency - * @ORM\Column(type="string") */ #[Assert\Currency] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $iso_code = ""; - /** - * @ORM\OneToMany(targetEntity="Currency", mappedBy="parent", cascade={"persist"}) - * @ORM\OrderBy({"name" = "ASC"}) - */ + #[ORM\OneToMany(targetEntity: 'Currency', mappedBy: 'parent', cascade: ['persist'])] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Currency", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Currency', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\CurrencyAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\CurrencyParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Pricedetail", mappedBy="currency") */ + #[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Pricedetail', mappedBy: 'currency')] protected Collection $pricedetails; public function __construct() { + $this->children = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); $this->pricedetails = new ArrayCollection(); parent::__construct(); } diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index 366f9b81..9fce1a5f 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -39,63 +39,59 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Orderdetail. - * - * @ORM\Table("`orderdetails`", indexes={ - * @ORM\Index(name="orderdetails_supplier_part_nr", columns={"supplierpartnr"}), - * }) - * @ORM\Entity() - * @ORM\HasLifecycleCallbacks() */ #[UniqueEntity(['supplierpartnr', 'supplier', 'part'])] +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table('`orderdetails`')] +#[ORM\Index(name: 'orderdetails_supplier_part_nr', columns: ['supplierpartnr'])] class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface { use TimestampTrait; - /** - * @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"min_discount_quantity" = "ASC"}) - */ #[Assert\Valid] #[Groups(['extended', 'full', 'import'])] + #[ORM\OneToMany(targetEntity: 'Pricedetail', mappedBy: 'orderdetail', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['min_discount_quantity' => 'ASC'])] protected Collection $pricedetails; /** * @var string - * @ORM\Column(type="string") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $supplierpartnr = ''; /** * @var bool - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $obsolete = false; /** * @var string - * @ORM\Column(type="string") */ #[Assert\Url] #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $supplier_product_url = ''; /** * @var Part|null - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails") - * @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'orderdetails')] + #[ORM\JoinColumn(name: 'part_id', nullable: false, onDelete: 'CASCADE')] protected ?Part $part = null; /** * @var Supplier|null - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails") - * @ORM\JoinColumn(name="id_supplier", referencedColumnName="id") */ #[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')] #[Groups(['extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'orderdetails')] + #[ORM\JoinColumn(name: 'id_supplier')] protected ?Supplier $supplier = null; public function __construct() @@ -119,10 +115,9 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N /** * Helper for updating the timestamp. It is automatically called by doctrine before persisting. - * - * @ORM\PrePersist - * @ORM\PreUpdate */ + #[ORM\PrePersist] + #[ORM\PreUpdate] public function updateTimestamps(): void { $this->lastModified = new DateTime('now'); diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index b4a0cbc6..b9af1e5b 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -37,15 +37,13 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Pricedetail. - * - * @ORM\Entity() - * @ORM\Table("`pricedetails`", indexes={ - * @ORM\Index(name="pricedetails_idx_min_discount", columns={"min_discount_quantity"}), - * @ORM\Index(name="pricedetails_idx_min_discount_price_qty", columns={"min_discount_quantity", "price_related_quantity"}), - * }) - * @ORM\HasLifecycleCallbacks() */ #[UniqueEntity(fields: ['min_discount_quantity', 'orderdetail'])] +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table('`pricedetails`')] +#[ORM\Index(name: 'pricedetails_idx_min_discount', columns: ['min_discount_quantity'])] +#[ORM\Index(name: 'pricedetails_idx_min_discount_price_qty', columns: ['min_discount_quantity', 'price_related_quantity'])] class Pricedetail extends AbstractDBElement implements TimeStampableInterface { use TimestampTrait; @@ -54,50 +52,50 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface /** * @var BigDecimal The price related to the detail. (Given in the selected currency) - * @ORM\Column(type="big_decimal", precision=11, scale=5) * @BigDecimalPositive() */ #[Groups(['extended', 'full'])] + #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5)] protected BigDecimal $price; /** * @var ?Currency The currency used for the current price information. * If this is null, the global base unit is assumed. - * @ORM\ManyToOne(targetEntity="Currency", inversedBy="pricedetails") - * @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true) * @Selectable() */ #[Groups(['extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'Currency', inversedBy: 'pricedetails')] + #[ORM\JoinColumn(name: 'id_currency')] protected ?Currency $currency = null; /** * @var float - * @ORM\Column(type="float") */ #[Assert\Positive] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] protected float $price_related_quantity = 1.0; /** * @var float - * @ORM\Column(type="float") */ #[Assert\Positive] #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] protected float $min_discount_quantity = 1.0; /** * @var bool - * @ORM\Column(type="boolean") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $manual_input = true; /** * @var Orderdetail|null - * @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails") - * @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: 'Orderdetail', inversedBy: 'pricedetails')] + #[ORM\JoinColumn(name: 'orderdetails_id', nullable: false, onDelete: 'CASCADE')] protected ?Orderdetail $orderdetail = null; public function __construct() @@ -115,10 +113,9 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface /** * Helper for updating the timestamp. It is automatically called by doctrine before persisting. - * - * @ORM\PrePersist - * @ORM\PreUpdate */ + #[ORM\PrePersist] + #[ORM\PreUpdate] public function updateTimestamps(): void { $this->lastModified = new DateTime('now'); diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index 13bc4832..a539e6cf 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -36,74 +36,63 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Class AttachmentType. - * - * @ORM\Entity(repositoryClass="App\Repository\Parts\DeviceRepository") - * @ORM\Table(name="projects") */ +#[ORM\Entity(repositoryClass: 'App\Repository\Parts\DeviceRepository')] +#[ORM\Table(name: 'projects')] class Project extends AbstractStructuralDBElement { /** - * @ORM\OneToMany(targetEntity="Project", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Project', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Project", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Project', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent; - /** - * @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true) - */ #[Assert\Valid] #[Groups(['extended', 'full'])] + #[ORM\OneToMany(targetEntity: 'ProjectBOMEntry', mappedBy: 'project', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $bom_entries; - /** - * @ORM\Column(type="integer") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] protected int $order_quantity = 0; /** * @var string|null The current status of the project - * @ORM\Column(type="string", length=64, nullable=true) */ #[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])] #[Groups(['extended', 'full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 64, nullable: true)] protected ?string $status = null; /** * @var Part|null The (optional) part that represents the builds of this project in the stock - * @ORM\OneToOne(targetEntity="App\Entity\Parts\Part", mappedBy="built_project", cascade={"persist"}, orphanRemoval=true) */ + #[ORM\OneToOne(targetEntity: 'App\Entity\Parts\Part', mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)] protected ?Part $build_part = null; - /** - * @ORM\Column(type="boolean") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $order_only_missing_parts = false; - /** - * @ORM\Column(type="text", nullable=false) - */ #[Groups(['simple', 'extended', 'full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $description = ''; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ProjectAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\ProjectAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ProjectParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\ProjectParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /******************************************************************************** @@ -114,6 +103,8 @@ class Project extends AbstractStructuralDBElement public function __construct() { + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct(); $this->bom_entries = new ArrayCollection(); $this->children = new ArrayCollection(); diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index cc8f5fde..04be2862 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -36,70 +36,69 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * The ProjectBOMEntry class represents an entry in a project's BOM. - * - * @ORM\Table("project_bom_entries") - * @ORM\HasLifecycleCallbacks() - * @ORM\Entity() */ #[UniqueEntity(fields: ['part', 'project'], message: 'project.bom_entry.part_already_in_bom')] #[UniqueEntity(fields: ['name', 'project'], message: 'project.bom_entry.name_already_in_bom', ignoreNull: true)] +#[ORM\HasLifecycleCallbacks] +#[ORM\Entity] +#[ORM\Table('project_bom_entries')] class ProjectBOMEntry extends AbstractDBElement { use TimestampTrait; /** * @var float - * @ORM\Column(type="float", name="quantity") */ #[Assert\Positive] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'quantity')] protected float $quantity; /** * @var string A comma separated list of the names, where this parts should be placed - * @ORM\Column(type="text", name="mountnames") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'mountnames')] protected string $mountnames = ''; /** * @var string|null An optional name describing this BOM entry (useful for non-part entries) - * @ORM\Column(type="string", nullable=true) */ #[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] protected ?string $name = null; /** * @var string An optional comment for this BOM entry - * @ORM\Column(type="text") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $comment; /** * @var Project|null - * @ORM\ManyToOne(targetEntity="Project", inversedBy="bom_entries") - * @ORM\JoinColumn(name="id_device", referencedColumnName="id") */ + #[ORM\ManyToOne(targetEntity: 'Project', inversedBy: 'bom_entries')] + #[ORM\JoinColumn(name: 'id_device')] protected ?Project $project = null; /** * @var Part|null The part associated with this - * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="project_bom_entries") - * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=true) */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'project_bom_entries')] + #[ORM\JoinColumn(name: 'id_part')] protected ?Part $part = null; /** * @var BigDecimal|null The price of this non-part BOM entry - * @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true) */ #[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])] + #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] protected ?BigDecimal $price; /** * @var ?Currency The currency for the price of this non-part BOM entry - * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency") - * @ORM\JoinColumn(nullable=true) * @Selectable() */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency')] + #[ORM\JoinColumn] protected ?Currency $price_currency = null; public function __construct() diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 05c2b205..663e9fed 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -35,65 +35,63 @@ use Symfony\Component\Validator\Constraints as Assert; /** * This entity represents a user group. - * - * @ORM\Entity() - * @ORM\Table("`groups`", indexes={ - * @ORM\Index(name="group_idx_name", columns={"name"}), - * @ORM\Index(name="group_idx_parent_name", columns={"parent_id", "name"}), - * }) */ +#[ORM\Entity] +#[ORM\Table('`groups`')] +#[ORM\Index(name: 'group_idx_name', columns: ['name'])] +#[ORM\Index(name: 'group_idx_parent_name', columns: ['parent_id', 'name'])] class Group extends AbstractStructuralDBElement implements HasPermissionsInterface { /** - * @ORM\OneToMany(targetEntity="Group", mappedBy="parent") - * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ + #[ORM\OneToMany(targetEntity: 'Group', mappedBy: 'parent')] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $children; - /** - * @ORM\ManyToOne(targetEntity="Group", inversedBy="children") - * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - */ + #[ORM\ManyToOne(targetEntity: 'Group', inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent; /** - * @ORM\OneToMany(targetEntity="User", mappedBy="group") * @var Collection */ + #[ORM\OneToMany(targetEntity: 'User', mappedBy: 'group')] protected Collection $users; /** * @var bool If true all users associated with this group must have enabled some kind of two-factor authentication - * @ORM\Column(type="boolean", name="enforce_2fa") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'enforce_2fa')] protected bool $enforce2FA = false; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\GroupAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** * @var PermissionData|null * @ValidPermission() - * @ORM\Embedded(class="PermissionData", columnPrefix="permissions_") */ #[Groups(['full'])] + #[ORM\Embedded(class: 'PermissionData', columnPrefix: 'permissions_')] protected ?PermissionData $permissions = null; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\GroupParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\GroupParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; public function __construct() { + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct(); $this->permissions = new PermissionData(); $this->users = new ArrayCollection(); diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index d67ee866..9d6c4cf2 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -25,9 +25,8 @@ use Doctrine\ORM\Mapping as ORM; /** * This class is used to store the permissions of a user. * This has to be an embeddable or otherwise doctrine could not track the changes of the underlying data array (which is serialized to JSON in the database) - * - * @ORM\Embeddable() */ +#[ORM\Embeddable] final class PermissionData implements \JsonSerializable { /** @@ -48,8 +47,8 @@ final class PermissionData implements \JsonSerializable * permission => [ * operation => value, * ] - * @ORM\Column(type="json", name="data") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'data')] protected ?array $data = [ //$ prefixed entries are used for metadata '$ver' => self::CURRENT_SCHEMA_VERSION, //The schema version of the permission data diff --git a/src/Entity/UserSystem/U2FKey.php b/src/Entity/UserSystem/U2FKey.php index 9c1c68a3..8bc86705 100644 --- a/src/Entity/UserSystem/U2FKey.php +++ b/src/Entity/UserSystem/U2FKey.php @@ -26,15 +26,10 @@ use App\Entity\Base\TimestampTrait; use Doctrine\ORM\Mapping as ORM; use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface; -/** - * @ORM\Entity - * @ORM\Table(name="u2f_keys", - * uniqueConstraints={ - * @ORM\UniqueConstraint(name="user_unique",columns={"user_id", - * "key_handle"}) - * }) - * @ORM\HasLifecycleCallbacks() - */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'u2f_keys')] +#[ORM\UniqueConstraint(name: 'user_unique', columns: ['user_id', 'key_handle'])] class U2FKey implements LegacyU2FKeyInterface { use TimestampTrait; @@ -43,50 +38,42 @@ class U2FKey implements LegacyU2FKeyInterface * We have to restrict the length here, as InnoDB only supports key index with max. 767 Bytes. * Max length of keyhandles should be 128. (According to U2F_MAX_KH_SIZE in FIDO example C code). * - * @ORM\Column(type="string", length=128) * * @var string **/ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 128)] public string $keyHandle; /** - * @ORM\Column(type="string") - * * @var string **/ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] public string $publicKey; /** - * @ORM\Column(type="text") - * * @var string **/ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] public string $certificate; /** - * @ORM\Column(type="string") - * * @var int **/ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] public int $counter; - /** - * @ORM\Id - * @ORM\Column(type="integer") - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue] protected int $id; /** - * @ORM\Column(type="string") - * * @var string **/ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="u2fKeys") - **/ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', inversedBy: 'u2fKeys')] protected ?User $user = null; public function getKeyHandle(): string diff --git a/src/Entity/UserSystem/WebauthnKey.php b/src/Entity/UserSystem/WebauthnKey.php index 5d5c654d..fd43ad33 100644 --- a/src/Entity/UserSystem/WebauthnKey.php +++ b/src/Entity/UserSystem/WebauthnKey.php @@ -24,30 +24,22 @@ use App\Entity\Base\TimestampTrait; use Doctrine\ORM\Mapping as ORM; use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource; -/** - * @ORM\Table(name="webauthn_keys") - * @ORM\Entity() - * @ORM\HasLifecycleCallbacks() - */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'webauthn_keys')] class WebauthnKey extends BasePublicKeyCredentialSource { use TimestampTrait; - /** - * @ORM\Id - * @ORM\Column(type="integer") - * @ORM\GeneratedValue(strategy="AUTO") - */ + #[ORM\Id] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\GeneratedValue] protected int $id; - /** - * @ORM\Column(type="string") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name; - /** - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="webauthn_keys") - **/ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', inversedBy: 'webauthn_keys')] protected ?User $user = null; /** diff --git a/src/EntityListeners/AttachmentDeleteListener.php b/src/EntityListeners/AttachmentDeleteListener.php index 84d588c7..430740cb 100644 --- a/src/EntityListeners/AttachmentDeleteListener.php +++ b/src/EntityListeners/AttachmentDeleteListener.php @@ -54,9 +54,8 @@ class AttachmentDeleteListener /** * Removes the file associated with the attachment, if the file associated with the attachment changes. - * - * @PreUpdate */ + #[PreUpdate] public function preUpdateHandler(Attachment $attachment, PreUpdateEventArgs $event): void { if ($event->hasChangedField('path')) { @@ -81,9 +80,8 @@ class AttachmentDeleteListener /** * Ensure that attachments are not used in preview, so that they can be deleted (without integrity violation). - * - * @ORM\PreRemove() */ + #[ORM\PreRemove] public function preRemoveHandler(Attachment $attachment, PreRemoveEventArgs $event): void { //Ensure that the attachment that will be deleted, is not used as preview picture anymore... @@ -109,9 +107,8 @@ class AttachmentDeleteListener /** * Removes the file associated with the attachment, after the attachment was deleted. - * - * @PostRemove */ + #[PostRemove] public function postRemoveHandler(Attachment $attachment, PostRemoveEventArgs $event): void { //Dont delete file if the attachment uses a builtin ressource: diff --git a/src/EntityListeners/TreeCacheInvalidationListener.php b/src/EntityListeners/TreeCacheInvalidationListener.php index 017c8018..6e17fe3f 100644 --- a/src/EntityListeners/TreeCacheInvalidationListener.php +++ b/src/EntityListeners/TreeCacheInvalidationListener.php @@ -44,11 +44,9 @@ class TreeCacheInvalidationListener $this->keyGenerator = $keyGenerator; } - /** - * @ORM\PostUpdate() - * @ORM\PostPersist() - * @ORM\PostRemove() - */ + #[ORM\PostUpdate] + #[ORM\PostPersist] + #[ORM\PostRemove] public function invalidate(AbstractDBElement $element, LifecycleEventArgs $event): void { //If an element was changed, then invalidate all cached trees with this element class From 0837f84a435193cb74f4b1281fc63401db11bac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:51:13 +0200 Subject: [PATCH 24/91] Migrated doctrine annotations to attributes --- src/Entity/Base/TimestampTrait.php | 25 ++--- .../Contracts/TimeStampableInterface.php | 8 +- src/Entity/Contracts/TimeTravelInterface.php | 2 +- src/Entity/LogSystem/AbstractLogEntry.php | 56 ++++------ src/Entity/Parts/Part.php | 38 +++---- src/Entity/Parts/PartLot.php | 45 ++++---- src/Entity/Parts/PartTraits/ProjectTrait.php | 3 +- src/Entity/UserSystem/User.php | 103 ++++++++---------- 8 files changed, 121 insertions(+), 159 deletions(-) diff --git a/src/Entity/Base/TimestampTrait.php b/src/Entity/Base/TimestampTrait.php index c4c74255..9091fe70 100644 --- a/src/Entity/Base/TimestampTrait.php +++ b/src/Entity/Base/TimestampTrait.php @@ -32,26 +32,26 @@ use Symfony\Component\Serializer\Annotation\Groups; trait TimestampTrait { /** - * @var DateTime|null the date when this element was modified the last time - * @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"}) + * @var \DateTimeInterface|null the date when this element was modified the last time */ #[Groups(['extended', 'full'])] - protected ?DateTime $lastModified = null; + #[ORM\Column(name: 'last_modified', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])] + protected ?\DateTimeInterface $lastModified = null; /** - * @var DateTime|null the date when this element was created - * @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"}) + * @var \DateTimeInterface|null the date when this element was created */ #[Groups(['extended', 'full'])] - protected ?DateTime $addedDate = null; + #[ORM\Column(name: 'datetime_added', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])] + protected ?\DateTimeInterface $addedDate = null; /** * Returns the last time when the element was modified. * Returns null if the element was not yet saved to DB yet. * - * @return DateTime|null the time of the last edit + * @return \DateTimeInterface|null the time of the last edit */ - public function getLastModified(): ?DateTime + public function getLastModified(): ?\DateTimeInterface { return $this->lastModified; } @@ -60,19 +60,18 @@ trait TimestampTrait * Returns the date/time when the element was created. * Returns null if the element was not yet saved to DB yet. * - * @return DateTime|null the creation time of the part + * @return \DateTimeInterface|null the creation time of the part */ - public function getAddedDate(): ?DateTime + public function getAddedDate(): ?\DateTimeInterface { return $this->addedDate; } /** * Helper for updating the timestamp. It is automatically called by doctrine before persisting. - * - * @ORM\PrePersist - * @ORM\PreUpdate */ + #[ORM\PrePersist] + #[ORM\PreUpdate] public function updateTimestamps(): void { $this->lastModified = new DateTime('now'); diff --git a/src/Entity/Contracts/TimeStampableInterface.php b/src/Entity/Contracts/TimeStampableInterface.php index e198ae7c..6393d629 100644 --- a/src/Entity/Contracts/TimeStampableInterface.php +++ b/src/Entity/Contracts/TimeStampableInterface.php @@ -30,15 +30,15 @@ interface TimeStampableInterface * Returns the last time when the element was modified. * Returns null if the element was not yet saved to DB yet. * - * @return DateTime|null the time of the last edit + * @return \DateTimeInterface|null the time of the last edit */ - public function getLastModified(): ?DateTime; + public function getLastModified(): ?\DateTimeInterface; /** * Returns the date/time when the element was created. * Returns null if the element was not yet saved to DB yet. * - * @return DateTime|null the creation time of the part + * @return \DateTimeInterface|null the creation time of the part */ - public function getAddedDate(): ?DateTime; + public function getAddedDate(): ?\DateTimeInterface; } diff --git a/src/Entity/Contracts/TimeTravelInterface.php b/src/Entity/Contracts/TimeTravelInterface.php index c756f53e..064f4fec 100644 --- a/src/Entity/Contracts/TimeTravelInterface.php +++ b/src/Entity/Contracts/TimeTravelInterface.php @@ -41,5 +41,5 @@ interface TimeTravelInterface /** * Returns the timestamp associated with this change. */ - public function getTimestamp(): DateTime; + public function getTimestamp(): \DateTimeInterface; } diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index 76b0d746..95bb7b76 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -49,31 +49,15 @@ use Psr\Log\LogLevel; /** * This entity describes an entry in the event log. - * - * @ORM\Entity(repositoryClass="App\Repository\LogEntryRepository") - * @ORM\Table("log", indexes={ - * @ORM\Index(name="log_idx_type", columns={"type"}), - * @ORM\Index(name="log_idx_type_target", columns={"type", "target_type", "target_id"}), - * @ORM\Index(name="log_idx_datetime", columns={"datetime"}), - * }) - * @ORM\InheritanceType("SINGLE_TABLE") - * @ORM\DiscriminatorColumn(name="type", type="smallint") - * @ORM\DiscriminatorMap({ - * 1 = "UserLoginLogEntry", - * 2 = "UserLogoutLogEntry", - * 3 = "UserNotAllowedLogEntry", - * 4 = "ExceptionLogEntry", - * 5 = "ElementDeletedLogEntry", - * 6 = "ElementCreatedLogEntry", - * 7 = "ElementEditedLogEntry", - * 8 = "ConfigChangedLogEntry", - * 9 = "LegacyInstockChangedLogEntry", - * 10 = "DatabaseUpdatedLogEntry", - * 11 = "CollectionElementDeleted", - * 12 = "SecurityEventLogEntry", - * 13 = "PartStockChangedLogEntry", - * }) */ +#[ORM\Entity(repositoryClass: 'App\Repository\LogEntryRepository')] +#[ORM\InheritanceType('SINGLE_TABLE')] +#[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')] +#[ORM\DiscriminatorMap([1 => 'UserLoginLogEntry', 2 => 'UserLogoutLogEntry', 3 => 'UserNotAllowedLogEntry', 4 => 'ExceptionLogEntry', 5 => 'ElementDeletedLogEntry', 6 => 'ElementCreatedLogEntry', 7 => 'ElementEditedLogEntry', 8 => 'ConfigChangedLogEntry', 9 => 'LegacyInstockChangedLogEntry', 10 => 'DatabaseUpdatedLogEntry', 11 => 'CollectionElementDeleted', 12 => 'SecurityEventLogEntry', 13 => 'PartStockChangedLogEntry'])] +#[ORM\Table('log')] +#[ORM\Index(name: 'log_idx_type', columns: ['type'])] +#[ORM\Index(name: 'log_idx_type_target', columns: ['type', 'target_type', 'target_id'])] +#[ORM\Index(name: 'log_idx_datetime', columns: ['datetime'])] abstract class AbstractLogEntry extends AbstractDBElement { public const LEVEL_EMERGENCY = 0; @@ -143,35 +127,35 @@ abstract class AbstractLogEntry extends AbstractDBElement ]; /** @var User|null The user which has caused this log entry - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", fetch="EAGER") - * @ORM\JoinColumn(name="id_user", nullable=true, onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', fetch: 'EAGER')] + #[ORM\JoinColumn(name: 'id_user', onDelete: 'SET NULL')] protected ?User $user = null; /** * @var string The username of the user which has caused this log entry (shown if the user is deleted) - * @ORM\Column(type="string", nullable=false) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $username = ''; - /** @var DateTime The datetime the event associated with this log entry has occured - * @ORM\Column(type="datetime", name="datetime") + /** @var \DateTimeInterface|null The datetime the event associated with this log entry has occured */ - protected ?DateTime $timestamp = null; + #[ORM\Column(name: 'datetime', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] + protected ?\DateTimeInterface $timestamp = null; /** @var int The priority level of the associated level. 0 is highest, 7 lowest - * @ORM\Column(type="tinyint", name="level", nullable=false) */ + #[ORM\Column(type: 'tinyint', name: 'level')] protected int $level; /** @var int The ID of the element targeted by this event - * @ORM\Column(name="target_id", type="integer", nullable=false) */ + #[ORM\Column(name: 'target_id', type: \Doctrine\DBAL\Types\Types::INTEGER)] protected int $target_id = 0; /** @var int The Type of the targeted element - * @ORM\Column(name="target_type", type="smallint", nullable=false) */ + #[ORM\Column(name: 'target_type', type: \Doctrine\DBAL\Types\Types::SMALLINT)] protected int $target_type = 0; /** @var string The type of this log entry, aka the description what has happened. @@ -181,8 +165,8 @@ abstract class AbstractLogEntry extends AbstractDBElement protected string $typeString = 'unknown'; /** @var array The extra data in raw (short form) saved in the DB - * @ORM\Column(name="extra", type="json") */ + #[ORM\Column(name: 'extra', type: \Doctrine\DBAL\Types\Types::JSON)] protected array $extra = []; public function __construct() @@ -264,7 +248,7 @@ abstract class AbstractLogEntry extends AbstractDBElement /** * Returns the timestamp when the event that caused this log entry happened. */ - public function getTimestamp(): DateTime + public function getTimestamp(): \DateTimeInterface { return $this->timestamp; } @@ -274,7 +258,7 @@ abstract class AbstractLogEntry extends AbstractDBElement * * @return $this */ - public function setTimestamp(DateTime $timestamp): self + public function setTimestamp(\DateTimeInterface $timestamp): self { $this->timestamp = $timestamp; diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index c4e9d00a..df127d94 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -47,15 +47,13 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * * The class properties are split over various traits in directory PartTraits. * Otherwise, this class would be too big, to be maintained. - * - * @ORM\Entity(repositoryClass="App\Repository\PartRepository") - * @ORM\Table("`parts`", indexes={ - * @ORM\Index(name="parts_idx_datet_name_last_id_needs", columns={"datetime_added", "name", "last_modified", "id", "needs_review"}), - * @ORM\Index(name="parts_idx_name", columns={"name"}), - * @ORM\Index(name="parts_idx_ipn", columns={"ipn"}), - * }) */ #[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')] +#[ORM\Entity(repositoryClass: 'App\Repository\PartRepository')] +#[ORM\Table('`parts`')] +#[ORM\Index(name: 'parts_idx_datet_name_last_id_needs', columns: ['datetime_added', 'name', 'last_modified', 'id', 'needs_review'])] +#[ORM\Index(name: 'parts_idx_name', columns: ['name'])] +#[ORM\Index(name: 'parts_idx_ipn', columns: ['ipn'])] class Part extends AttachmentContainingDBElement { use AdvancedPropertyTrait; @@ -68,54 +66,44 @@ class Part extends AttachmentContainingDBElement use ProjectTrait; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\PartParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ #[Assert\Valid] #[Groups(['full'])] + #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\PartParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; - /** - * @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"}) - */ - protected ?DateTime $addedDate = null; /** ************************************************************* * Overridden properties * (They are defined here and not in a trait, to avoid conflicts). ****************************************************************/ - /** * @var string The name of this part - * @ORM\Column(type="string") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name = ''; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ #[Assert\Valid] #[Groups(['full'])] + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\PartAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; - /** - * @var DateTime|null the date when this element was modified the last time - * @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"}) - */ - protected ?DateTime $lastModified = null; - /** * @var Attachment|null - * @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment") - * @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true) */ #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] + #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\Attachment')] + #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] protected ?Attachment $master_picture_attachment = null; public function __construct() { + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct(); $this->partLots = new ArrayCollection(); $this->orderdetails = new ArrayCollection(); diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index e8bc4917..eb47581e 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -40,84 +40,83 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * This entity describes a lot where parts can be stored. * It is the connection between a part and its store locations. * - * @ORM\Entity() - * @ORM\Table(name="part_lots", indexes={ - * @ORM\Index(name="part_lots_idx_instock_un_expiration_id_part", columns={"instock_unknown", "expiration_date", "id_part"}), - * @ORM\Index(name="part_lots_idx_needs_refill", columns={"needs_refill"}), - * }) - * @ORM\HasLifecycleCallbacks() * @ValidPartLot() */ +#[ORM\Entity] +#[ORM\HasLifecycleCallbacks] +#[ORM\Table(name: 'part_lots')] +#[ORM\Index(name: 'part_lots_idx_instock_un_expiration_id_part', columns: ['instock_unknown', 'expiration_date', 'id_part'])] +#[ORM\Index(name: 'part_lots_idx_needs_refill', columns: ['needs_refill'])] class PartLot extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface { use TimestampTrait; /** * @var string A short description about this lot, shown in table - * @ORM\Column(type="text") */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $description = ''; /** * @var string a comment stored with this lot - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $comment = ''; /** - * @var ?DateTime Set a time until when the lot must be used. + * @var \DateTimeInterface|null Set a time until when the lot must be used. * Set to null, if the lot can be used indefinitely. - * @ORM\Column(type="datetime", name="expiration_date", nullable=true) */ #[Groups(['extended', 'full', 'import'])] - protected ?DateTime $expiration_date = null; + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)] + protected ?\DateTimeInterface $expiration_date = null; /** * @var Storelocation|null The storelocation of this lot - * @ORM\ManyToOne(targetEntity="Storelocation") - * @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true) * @Selectable() */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'Storelocation')] + #[ORM\JoinColumn(name: 'id_store_location')] protected ?Storelocation $storage_location = null; /** * @var bool If this is set to true, the instock amount is marked as not known - * @ORM\Column(type="boolean") */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $instock_unknown = false; /** * @var float For continuous sizes (length, volume, etc.) the instock is saved here. - * @ORM\Column(type="float") */ #[Assert\PositiveOrZero] #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] protected float $amount = 0.0; /** * @var bool determines if this lot was manually marked for refilling - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $needs_refill = false; /** * @var Part The part that is stored in this lot - * @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots") - * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=false, onDelete="CASCADE") */ #[Assert\NotNull] + #[ORM\ManyToOne(targetEntity: 'Part', inversedBy: 'partLots')] + #[ORM\JoinColumn(name: 'id_part', nullable: false, onDelete: 'CASCADE')] protected Part $part; /** * @var User|null The owner of this part lot - * @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User") - * @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL") */ + #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User')] + #[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')] protected ?User $owner = null; public function __clone() @@ -189,7 +188,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Gets the expiration date for the part lot. Returns null, if no expiration date was set. */ - public function getExpirationDate(): ?DateTime + public function getExpirationDate(): ?\DateTimeInterface { return $this->expiration_date; } @@ -197,11 +196,11 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the expiration date for the part lot. Set to null, if the part lot does not expire. * - * @param DateTime|null $expiration_date + * @param \DateTimeInterface|null $expiration_date * * @return PartLot */ - public function setExpirationDate(?DateTime $expiration_date): self + public function setExpirationDate(?\DateTimeInterface $expiration_date): self { $this->expiration_date = $expiration_date; diff --git a/src/Entity/Parts/PartTraits/ProjectTrait.php b/src/Entity/Parts/PartTraits/ProjectTrait.php index 795b5393..a8a7162c 100644 --- a/src/Entity/Parts/PartTraits/ProjectTrait.php +++ b/src/Entity/Parts/PartTraits/ProjectTrait.php @@ -4,6 +4,7 @@ namespace App\Entity\Parts\PartTraits; use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\ProjectBOMEntry; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; @@ -13,7 +14,7 @@ trait ProjectTrait * @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries */ #[ORM\OneToMany(targetEntity: 'App\Entity\ProjectSystem\ProjectBOMEntry', mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)] - protected \Doctrine\Common\Collections\Collection $project_bom_entries = []; + protected \Doctrine\Common\Collections\Collection $project_bom_entries; /** * @var Project|null If a project is set here, then this part is special and represents the builds of a project. diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 6dc06455..be4998e4 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -54,14 +54,12 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface /** * This entity represents a user, which can log in and have permissions. * Also, this entity is able to save some information about the user, like the names, email-address and other info. - * - * @ORM\Entity(repositoryClass="App\Repository\UserRepository") - * @ORM\Table("`users`", indexes={ - * @ORM\Index(name="user_idx_username", columns={"name"}) - * }) - * @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"}) */ #[UniqueEntity('name', message: 'validator.user.username_already_used')] +#[ORM\Entity(repositoryClass: 'App\Repository\UserRepository')] +#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])] +#[ORM\Table('`users`')] +#[ORM\Index(name: 'user_idx_username', columns: ['name'])] class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface { @@ -74,175 +72,167 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var bool Determines if the user is disabled (user can not log in) - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $disabled = false; /** * @var string|null The theme - * @ORM\Column(type="string", name="config_theme", nullable=true) * @ValidTheme() */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_theme', nullable: true)] protected ?string $theme = null; /** * @var string|null the hash of a token the user must provide when he wants to reset his password - * @ORM\Column(type="string", nullable=true) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] protected ?string $pw_reset_token = null; - /** - * @ORM\Column(type="text", name="config_instock_comment_a") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_a')] protected string $instock_comment_a = ''; - /** - * @ORM\Column(type="text", name="config_instock_comment_w") - */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_w')] protected string $instock_comment_w = ''; /** * @var string A self-description of the user - * @ORM\Column(type="text") */ #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] protected string $aboutMe = ''; /** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once. - * @ORM\Column(type="integer") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] protected int $trustedDeviceCookieVersion = 0; /** * @var string[]|null A list of backup codes that can be used, if the user has no access to its Google Authenticator device - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] protected ?array $backupCodes = []; - /** - * @ORM\Id() - * @ORM\GeneratedValue() - * @ORM\Column(type="integer") - */ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] protected ?int $id = null; /** * @var Group|null the group this user belongs to * DO NOT PUT A fetch eager here! Otherwise, you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions. - * @ORM\ManyToOne(targetEntity="Group", inversedBy="users") - * @ORM\JoinColumn(name="group_id", referencedColumnName="id") * @Selectable() */ #[Groups(['extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'Group', inversedBy: 'users')] + #[ORM\JoinColumn(name: 'group_id')] protected ?Group $group = null; /** * @var string|null The secret used for Google authenticator - * @ORM\Column(name="google_authenticator_secret", type="string", nullable=true) */ + #[ORM\Column(name: 'google_authenticator_secret', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] protected ?string $googleAuthenticatorSecret = null; /** * @var string|null The timezone the user prefers - * @ORM\Column(type="string", name="config_timezone", nullable=true) */ #[Assert\Timezone] #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_timezone', nullable: true)] protected ?string $timezone = ''; /** * @var string|null The language/locale the user prefers - * @ORM\Column(type="string", name="config_language", nullable=true) */ #[Assert\Language] #[Groups(['full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_language', nullable: true)] protected ?string $language = ''; /** * @var string|null The email address of the user - * @ORM\Column(type="string", length=255, nullable=true) */ #[Assert\Email] #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] protected ?string $email = ''; /** * @var bool True if the user wants to show his email address on his (public) profile - * @ORM\Column(type="boolean", options={"default": false}) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] protected bool $show_email_on_profile = false; /** * @var string|null The department the user is working - * @ORM\Column(type="string", length=255, nullable=true) */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] protected ?string $department = ''; /** * @var string|null The last name of the User - * @ORM\Column(type="string", length=255, nullable=true) */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] protected ?string $last_name = ''; /** * @var string|null The first name of the User - * @ORM\Column(type="string", length=255, nullable=true) */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] protected ?string $first_name = ''; /** * @var bool True if the user needs to change password after log in - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full', 'import'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $need_pw_change = true; /** * @var string|null The hashed password - * @ORM\Column(type="string", nullable=true) */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] protected ?string $password = null; - /** - * @ORM\Column(type="string", length=180, unique=true) - */ #[Assert\NotBlank] #[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180, unique: true)] protected string $name = ''; /** * @var array|null - * @ORM\Column(type="json") */ + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] protected ?array $settings = []; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\UserAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) - * @ORM\OrderBy({"name" = "ASC"}) */ + #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\UserAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; - /** @var DateTime|null The time when the backup codes were generated - * @ORM\Column(type="datetime", nullable=true) + /** @var \DateTimeInterface|null The time when the backup codes were generated */ #[Groups(['full'])] - protected ?DateTime $backupCodesGenerationDate = null; + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] + protected ?\DateTimeInterface $backupCodesGenerationDate; /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: 'App\Entity\UserSystem\U2FKey', mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] protected Collection $u2fKeys; /** * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\UserSystem\WebauthnKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true) */ + #[ORM\OneToMany(targetEntity: 'App\Entity\UserSystem\WebauthnKey', mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] protected Collection $webauthn_keys; /** @@ -250,36 +240,37 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * Dont use fetch=EAGER here, this will cause problems with setting the currency setting. * TODO: This is most likely a bug in doctrine/symfony related to the UniqueEntity constraint (it makes a db call). * TODO: Find a way to use fetch EAGER (this improves performance a bit) - * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency") - * @ORM\JoinColumn(name="currency_id", referencedColumnName="id") * @Selectable() */ #[Groups(['extended', 'full', 'import'])] + #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency')] + #[ORM\JoinColumn(name: 'currency_id')] protected ?Currency $currency; /** * @var PermissionData|null * @ValidPermission() - * @ORM\Embedded(class="PermissionData", columnPrefix="permissions_") */ #[Groups(['simple', 'extended', 'full', 'import'])] + #[ORM\Embedded(class: 'PermissionData', columnPrefix: 'permissions_')] protected ?PermissionData $permissions = null; /** - * @var DateTime|null the time until the password reset token is valid - * @ORM\Column(type="datetime", nullable=true, options={"default": null}) + * @var \DateTimeInterface|null the time until the password reset token is valid */ - protected ?DateTime $pw_reset_expires; + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] + protected ?\DateTimeInterface $pw_reset_expires; /** * @var bool True if the user was created by a SAML provider (and therefore cannot change its password) - * @ORM\Column(type="boolean") */ #[Groups(['extended', 'full'])] + #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] protected bool $saml_user = false; public function __construct() { + $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); parent::__construct(); $this->permissions = new PermissionData(); $this->u2fKeys = new ArrayCollection(); @@ -484,7 +475,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Gets the datetime when the password reset token expires. */ - public function getPwResetExpires(): DateTime + public function getPwResetExpires(): \DateTimeInterface { return $this->pw_reset_expires; } @@ -494,7 +485,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * * @return User */ - public function setPwResetExpires(DateTime $pw_reset_expires): self + public function setPwResetExpires(\DateTimeInterface $pw_reset_expires): self { $this->pw_reset_expires = $pw_reset_expires; @@ -876,7 +867,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Return the date when the backup codes were generated. */ - public function getBackupCodesGenerationDate(): ?DateTime + public function getBackupCodesGenerationDate(): ?\DateTimeInterface { return $this->backupCodesGenerationDate; } From 7191ece7a507d28a0f7bf6332d8d78a934c4ba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:55:30 +0200 Subject: [PATCH 25/91] Configure doctrine to use attributes instead of annotations --- config/packages/doctrine.yaml | 2 +- src/Entity/LogSystem/AbstractLogEntry.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 5d255beb..1829473a 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -27,7 +27,7 @@ doctrine: mappings: App: is_bundle: false - type: annotation + type: attribute dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index 95bb7b76..f2ca701c 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -46,18 +46,19 @@ use DateTime; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; use Psr\Log\LogLevel; +use App\Repository\LogEntryRepository; /** * This entity describes an entry in the event log. */ -#[ORM\Entity(repositoryClass: 'App\Repository\LogEntryRepository')] +#[ORM\Entity(repositoryClass: LogEntryRepository::class)] +#[ORM\Table('log')] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')] #[ORM\DiscriminatorMap([1 => 'UserLoginLogEntry', 2 => 'UserLogoutLogEntry', 3 => 'UserNotAllowedLogEntry', 4 => 'ExceptionLogEntry', 5 => 'ElementDeletedLogEntry', 6 => 'ElementCreatedLogEntry', 7 => 'ElementEditedLogEntry', 8 => 'ConfigChangedLogEntry', 9 => 'LegacyInstockChangedLogEntry', 10 => 'DatabaseUpdatedLogEntry', 11 => 'CollectionElementDeleted', 12 => 'SecurityEventLogEntry', 13 => 'PartStockChangedLogEntry'])] -#[ORM\Table('log')] -#[ORM\Index(name: 'log_idx_type', columns: ['type'])] -#[ORM\Index(name: 'log_idx_type_target', columns: ['type', 'target_type', 'target_id'])] -#[ORM\Index(name: 'log_idx_datetime', columns: ['datetime'])] +#[ORM\Index(columns: ['type'], name: 'log_idx_type')] +#[ORM\Index(columns: ['type', 'target_type', 'target_id'], name: 'log_idx_type_target')] +#[ORM\Index(columns: ['datetime'], name: 'log_idx_datetime')] abstract class AbstractLogEntry extends AbstractDBElement { public const LEVEL_EMERGENCY = 0; From 34a65419c7cdb6089698a24cfbcb11851b0cb4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 01:57:49 +0200 Subject: [PATCH 26/91] Use attributes as route provider (instead of annotations) --- config/routes.yaml | 6 ------ config/routes/annotations.yaml | 8 +++++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/config/routes.yaml b/config/routes.yaml index 980c9508..777ade11 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,9 +1,3 @@ -controllers: - resource: - path: ../src/Controller/ - namespace: App\Controller - type: attribute - # Redirect every url without an locale to the locale of the user/the global base locale scan_qr: diff --git a/config/routes/annotations.yaml b/config/routes/annotations.yaml index bd9ea273..72d7c9bc 100644 --- a/config/routes/annotations.yaml +++ b/config/routes/annotations.yaml @@ -1,6 +1,8 @@ controllers: - resource: ../../src/Controller/ - type: annotation + resource: + path: ../../src/Controller/ + namespace: App\Controller + type: attribute prefix: '{_locale}' defaults: @@ -11,4 +13,4 @@ controllers: kernel: resource: ../../src/Kernel.php - type: annotation + type: attribute From 7c03630e2474002df4cfdf2b149b5a78d0c0b6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 02:06:48 +0200 Subject: [PATCH 27/91] Added DB migration to fix compatibility with latest webauthn bundle --- migrations/Version20230417211732.php | 3 -- migrations/Version20230528000149.php | 65 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 migrations/Version20230528000149.php diff --git a/migrations/Version20230417211732.php b/migrations/Version20230417211732.php index c60d7c0b..382f6650 100644 --- a/migrations/Version20230417211732.php +++ b/migrations/Version20230417211732.php @@ -8,9 +8,6 @@ use App\Migration\AbstractMultiPlatformMigration; use Doctrine\DBAL\Schema\Schema; use Doctrine\Migrations\AbstractMigration; -/** - * Auto-generated Migration: Please modify to your needs! - */ final class Version20230417211732 extends AbstractMultiPlatformMigration { public function getDescription(): string diff --git a/migrations/Version20230528000149.php b/migrations/Version20230528000149.php new file mode 100644 index 00000000..05830937 --- /dev/null +++ b/migrations/Version20230528000149.php @@ -0,0 +1,65 @@ +addSql('ALTER TABLE webauthn_keys ADD other_ui LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:array)\''); + } + + public function mySQLDown(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE webauthn_keys DROP other_ui'); + } + + public function sqLiteUp(Schema $schema): void + { + $this->addSql('CREATE TEMPORARY TABLE __temp__webauthn_keys AS SELECT id, user_id, public_key_credential_id, type, transports, attestation_type, trust_path, aaguid, credential_public_key, user_handle, counter, name, last_modified, datetime_added FROM webauthn_keys'); + $this->addSql('DROP TABLE webauthn_keys'); + $this->addSql('CREATE TABLE webauthn_keys (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, public_key_credential_id CLOB NOT NULL --(DC2Type:base64) + , type VARCHAR(255) NOT NULL, transports CLOB NOT NULL --(DC2Type:array) + , attestation_type VARCHAR(255) NOT NULL, trust_path CLOB NOT NULL --(DC2Type:trust_path) + , aaguid CLOB NOT NULL --(DC2Type:aaguid) + , credential_public_key CLOB NOT NULL --(DC2Type:base64) + , user_handle VARCHAR(255) NOT NULL, counter INTEGER NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, other_ui CLOB DEFAULT NULL --(DC2Type:array) + , CONSTRAINT FK_799FD143A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO webauthn_keys (id, user_id, public_key_credential_id, type, transports, attestation_type, trust_path, aaguid, credential_public_key, user_handle, counter, name, last_modified, datetime_added) SELECT id, user_id, public_key_credential_id, type, transports, attestation_type, trust_path, aaguid, credential_public_key, user_handle, counter, name, last_modified, datetime_added FROM __temp__webauthn_keys'); + $this->addSql('DROP TABLE __temp__webauthn_keys'); + $this->addSql('CREATE INDEX IDX_799FD143A76ED395 ON webauthn_keys (user_id)'); + } + + public function sqLiteDown(Schema $schema): void + { + $this->addSql('CREATE TEMPORARY TABLE __temp__webauthn_keys AS SELECT id, user_id, public_key_credential_id, type, transports, attestation_type, trust_path, aaguid, credential_public_key, user_handle, counter, name, last_modified, datetime_added FROM webauthn_keys'); + $this->addSql('DROP TABLE webauthn_keys'); + $this->addSql('CREATE TABLE webauthn_keys (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, public_key_credential_id CLOB NOT NULL -- +(DC2Type:base64) + , type VARCHAR(255) NOT NULL, transports CLOB NOT NULL -- +(DC2Type:array) + , attestation_type VARCHAR(255) NOT NULL, trust_path CLOB NOT NULL -- +(DC2Type:trust_path) + , aaguid CLOB NOT NULL -- +(DC2Type:aaguid) + , credential_public_key CLOB NOT NULL -- +(DC2Type:base64) + , user_handle VARCHAR(255) NOT NULL, counter INTEGER NOT NULL, name VARCHAR(255) NOT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CONSTRAINT FK_799FD143A76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)'); + $this->addSql('INSERT INTO webauthn_keys (id, user_id, public_key_credential_id, type, transports, attestation_type, trust_path, aaguid, credential_public_key, user_handle, counter, name, last_modified, datetime_added) SELECT id, user_id, public_key_credential_id, type, transports, attestation_type, trust_path, aaguid, credential_public_key, user_handle, counter, name, last_modified, datetime_added FROM __temp__webauthn_keys'); + $this->addSql('DROP TABLE __temp__webauthn_keys'); + $this->addSql('CREATE INDEX IDX_799FD143A76ED395 ON webauthn_keys (user_id)'); + } +} From 79ab1a2277e414549f46ddcbdea7d2d8cce24d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 28 May 2023 02:16:40 +0200 Subject: [PATCH 28/91] Fixed various issues inside the tests --- tests/Entity/UserSystem/UserTest.php | 4 ++-- tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php | 4 ++-- tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php | 2 +- tests/Services/ElementTypeNameGeneratorTest.php | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/Entity/UserSystem/UserTest.php b/tests/Entity/UserSystem/UserTest.php index 822e09b0..11837b77 100644 --- a/tests/Entity/UserSystem/UserTest.php +++ b/tests/Entity/UserSystem/UserTest.php @@ -26,7 +26,7 @@ use App\Entity\UserSystem\User; use App\Entity\UserSystem\WebauthnKey; use Doctrine\Common\Collections\Collection; use PHPUnit\Framework\TestCase; -use Ramsey\Uuid\Uuid; +use Symfony\Component\Uid\Uuid; use Webauthn\TrustPath\EmptyTrustPath; class UserTest extends TestCase @@ -133,7 +133,7 @@ class UserTest extends TestCase [], "Test", new EmptyTrustPath(), - Uuid::fromDateTime(new \DateTime()), + Uuid::v4(), "", "", 0 diff --git a/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php b/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php index 5cdca507..8712b310 100644 --- a/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php +++ b/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php @@ -27,7 +27,7 @@ use App\Entity\UserSystem\User; use App\Entity\UserSystem\WebauthnKey; use App\EventSubscriber\UserSystem\PasswordChangeNeededSubscriber; use PHPUnit\Framework\TestCase; -use Ramsey\Uuid\Uuid; +use Symfony\Component\Uid\Uuid; use Webauthn\TrustPath\EmptyTrustPath; class PasswordChangeNeededSubscriberTest extends TestCase @@ -61,7 +61,7 @@ class PasswordChangeNeededSubscriberTest extends TestCase [], "Test", new EmptyTrustPath(), - Uuid::fromDateTime(new \DateTime()), + Uuid::v4(), "", "", 0 diff --git a/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php b/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php index ae4065b6..434527d8 100644 --- a/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php +++ b/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php @@ -22,7 +22,7 @@ namespace App\Tests\Security; use App\Entity\UserSystem\User; use App\Security\EnsureSAMLUserForSAMLLoginChecker; -use Hslavich\OneloginSamlBundle\Security\Http\Authenticator\Token\SamlToken; +use Nbgrp\OneloginSamlBundle\Security\Http\Authenticator\Token\SamlToken; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; diff --git a/tests/Services/ElementTypeNameGeneratorTest.php b/tests/Services/ElementTypeNameGeneratorTest.php index 2fbca494..a8a385b6 100644 --- a/tests/Services/ElementTypeNameGeneratorTest.php +++ b/tests/Services/ElementTypeNameGeneratorTest.php @@ -44,8 +44,7 @@ class ElementTypeNameGeneratorTest extends WebTestCase parent::setUp(); //Get an service instance. - self::bootKernel(); - $this->service = self::$container->get(ElementTypeNameGenerator::class); + $this->service = self::getContainer()->get(ElementTypeNameGenerator::class); } public function testGetLocalizedTypeNameCombination(): void From 4bec8efea16214ba34d6cfcd5748a3feb4d021d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 7 Jun 2023 00:46:03 +0200 Subject: [PATCH 29/91] Make LogoutLoggerEventSubscriber an event listener --- ...entSubscriber.php => LogLogoutEventListener.php} | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) rename src/EventSubscriber/LogSystem/{LogoutLoggerEventSubscriber.php => LogLogoutEventListener.php} (83%) diff --git a/src/EventSubscriber/LogSystem/LogoutLoggerEventSubscriber.php b/src/EventSubscriber/LogSystem/LogLogoutEventListener.php similarity index 83% rename from src/EventSubscriber/LogSystem/LogoutLoggerEventSubscriber.php rename to src/EventSubscriber/LogSystem/LogLogoutEventListener.php index 0c4d0ed5..f9586c76 100644 --- a/src/EventSubscriber/LogSystem/LogoutLoggerEventSubscriber.php +++ b/src/EventSubscriber/LogSystem/LogLogoutEventListener.php @@ -25,12 +25,14 @@ namespace App\EventSubscriber\LogSystem; use App\Entity\LogSystem\UserLogoutLogEntry; use App\Entity\UserSystem\User; use App\Services\LogSystem\EventLogger; +use Symfony\Component\EventDispatcher\Attribute\AsEventListener; use Symfony\Component\Security\Http\Event\LogoutEvent; /** * This handler logs to event log, if a user logs out. */ -class LogoutLoggerEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface +#[AsEventListener] +final class LogLogoutEventListener { protected EventLogger $logger; protected bool $gpdr_compliance; @@ -41,7 +43,7 @@ class LogoutLoggerEventSubscriber implements \Symfony\Component\EventDispatcher\ $this->gpdr_compliance = $gpdr_compliance; } - public function __invoke(LogoutEvent $event) + public function __invoke(LogoutEvent $event): void { $request = $event->getRequest(); $token = $event->getToken(); @@ -58,11 +60,4 @@ class LogoutLoggerEventSubscriber implements \Symfony\Component\EventDispatcher\ $this->logger->logAndFlush($log); } - /** - * @return array - */ - public static function getSubscribedEvents(): array - { - return [\Symfony\Component\Security\Http\Event\LogoutEvent::class => '']; - } } From bcb3ccec9aad24c7b896fccc6de3e021e4fdd353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 7 Jun 2023 00:52:13 +0200 Subject: [PATCH 30/91] Added translation for security key registration error message --- translations/messages.en.xlf | 2594 +++++++++++++++++----------------- 1 file changed, 1300 insertions(+), 1294 deletions(-) diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 8f71e6df..8b029fc5 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -7,7 +7,7 @@ Part-DB1\templates\AdminPages\AttachmentTypeAdmin.html.twig:4 templates\AdminPages\AttachmentTypeAdmin.html.twig:4 - + attachment_type.caption File types for attachments @@ -17,7 +17,7 @@ Part-DB1\templates\AdminPages\AttachmentTypeAdmin.html.twig:12 new - + attachment_type.edit Edit file type @@ -27,7 +27,7 @@ Part-DB1\templates\AdminPages\AttachmentTypeAdmin.html.twig:16 new - + attachment_type.new New file type @@ -46,7 +46,7 @@ templates\base.html.twig:197 templates\base.html.twig:225 - + category.labelp Categories @@ -59,7 +59,7 @@ Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:11 templates\AdminPages\CategoryAdmin.html.twig:8 - + admin.options Options @@ -72,7 +72,7 @@ Part-DB1\templates\AdminPages\CompanyAdminBase.html.twig:15 templates\AdminPages\CategoryAdmin.html.twig:9 - + admin.advanced Advanced @@ -82,7 +82,7 @@ Part-DB1\templates\AdminPages\CategoryAdmin.html.twig:13 new - + category.edit Edit category @@ -92,7 +92,7 @@ Part-DB1\templates\AdminPages\CategoryAdmin.html.twig:17 new - + category.new New category @@ -102,7 +102,7 @@ Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:4 Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:4 - + currency.caption Currency @@ -112,7 +112,7 @@ Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:12 Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:12 - + currency.iso_code.caption ISO code @@ -122,7 +122,7 @@ Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:15 Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:15 - + currency.symbol.caption Currency symbol @@ -132,7 +132,7 @@ Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:29 new - + currency.edit Edit currency @@ -142,7 +142,7 @@ Part-DB1\templates\AdminPages\CurrencyAdmin.html.twig:33 new - + currency.new New currency @@ -153,7 +153,7 @@ Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:4 templates\AdminPages\DeviceAdmin.html.twig:4 - + project.caption Project @@ -163,7 +163,7 @@ Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:8 new - + project.edit Edit project @@ -173,7 +173,7 @@ Part-DB1\templates\AdminPages\DeviceAdmin.html.twig:12 new - + project.new New project @@ -196,7 +196,7 @@ templates\base.html.twig:206 templates\base.html.twig:237 - + search.placeholder Search @@ -212,7 +212,7 @@ templates\base.html.twig:193 templates\base.html.twig:221 - + expandAll Expand All @@ -228,7 +228,7 @@ templates\base.html.twig:194 templates\base.html.twig:222 - + reduceAll Reduce All @@ -240,9 +240,9 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:54 Part-DB1\templates\Parts\info\_sidebar.html.twig:4 - + part.info.timetravel_hint - This is how the part appeared before %timestamp%. <i>Please note that this feature is experimental, so the info may not be correct.</i> + Please note that this feature is experimental, so the info may not be correct.]]> @@ -251,7 +251,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:60 templates\AdminPages\EntityAdminBase.html.twig:42 - + standard.label Properties @@ -262,7 +262,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:61 templates\AdminPages\EntityAdminBase.html.twig:43 - + infos.label Info @@ -273,7 +273,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:63 new - + history.label History @@ -284,7 +284,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:66 templates\AdminPages\EntityAdminBase.html.twig:45 - + export.label Export @@ -295,7 +295,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:68 templates\AdminPages\EntityAdminBase.html.twig:47 - + import_export.label Import / Export @@ -305,7 +305,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:69 Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:69 - + mass_creation.label Mass creation @@ -316,7 +316,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:82 templates\AdminPages\EntityAdminBase.html.twig:59 - + admin.common Common @@ -326,7 +326,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:86 Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:86 - + admin.attachments Attachments @@ -335,7 +335,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:90 - + admin.parameters Parameters @@ -346,7 +346,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:167 templates\AdminPages\EntityAdminBase.html.twig:142 - + export_all.label Export all elements @@ -356,7 +356,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:185 Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:173 - + mass_creation.help Each line will be interpreted as a name of an element, which will be created. You can create nested structures by indentations. @@ -367,7 +367,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:45 templates\AdminPages\EntityAdminBase.html.twig:35 - + edit.caption Edit element "%name" @@ -378,7 +378,7 @@ Part-DB1\templates\AdminPages\EntityAdminBase.html.twig:50 templates\AdminPages\EntityAdminBase.html.twig:37 - + new.caption New element @@ -393,7 +393,7 @@ templates\base.html.twig:199 templates\base.html.twig:227 - + footprint.labelp Footprints @@ -403,7 +403,7 @@ Part-DB1\templates\AdminPages\FootprintAdmin.html.twig:13 new - + footprint.edit Edit footprint @@ -413,7 +413,7 @@ Part-DB1\templates\AdminPages\FootprintAdmin.html.twig:17 new - + footprint.new New footprint @@ -423,7 +423,7 @@ Part-DB1\templates\AdminPages\GroupAdmin.html.twig:4 Part-DB1\templates\AdminPages\GroupAdmin.html.twig:4 - + group.edit.caption Groups @@ -435,7 +435,7 @@ Part-DB1\templates\AdminPages\GroupAdmin.html.twig:9 Part-DB1\templates\AdminPages\UserAdmin.html.twig:16 - + user.edit.permissions Permissions @@ -445,7 +445,7 @@ Part-DB1\templates\AdminPages\GroupAdmin.html.twig:24 new - + group.edit Edit group @@ -455,7 +455,7 @@ Part-DB1\templates\AdminPages\GroupAdmin.html.twig:28 new - + group.new New group @@ -464,7 +464,7 @@ Part-DB1\templates\AdminPages\LabelProfileAdmin.html.twig:4 - + label_profile.caption Label profiles @@ -473,7 +473,7 @@ Part-DB1\templates\AdminPages\LabelProfileAdmin.html.twig:8 - + label_profile.advanced Advanced @@ -482,7 +482,7 @@ Part-DB1\templates\AdminPages\LabelProfileAdmin.html.twig:9 - + label_profile.comment Notes @@ -492,7 +492,7 @@ Part-DB1\templates\AdminPages\LabelProfileAdmin.html.twig:55 new - + label_profile.edit Edit label profile @@ -502,7 +502,7 @@ Part-DB1\templates\AdminPages\LabelProfileAdmin.html.twig:59 new - + label_profile.new New label profile @@ -513,7 +513,7 @@ Part-DB1\templates\AdminPages\ManufacturerAdmin.html.twig:4 templates\AdminPages\ManufacturerAdmin.html.twig:4 - + manufacturer.caption Manufacturers @@ -523,7 +523,7 @@ Part-DB1\templates\AdminPages\ManufacturerAdmin.html.twig:8 new - + manufacturer.edit Edit manufacturer @@ -533,7 +533,7 @@ Part-DB1\templates\AdminPages\ManufacturerAdmin.html.twig:12 new - + manufacturer.new New manufacturer @@ -543,7 +543,7 @@ Part-DB1\templates\AdminPages\MeasurementUnitAdmin.html.twig:4 Part-DB1\templates\AdminPages\MeasurementUnitAdmin.html.twig:4 - + measurement_unit.caption Measurement Unit @@ -558,7 +558,7 @@ templates\base.html.twig:198 templates\base.html.twig:226 - + storelocation.labelp Storage locations @@ -568,7 +568,7 @@ Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:32 new - + storelocation.edit Edit storage location @@ -578,7 +578,7 @@ Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:36 new - + storelocation.new New storage location @@ -589,7 +589,7 @@ Part-DB1\templates\AdminPages\SupplierAdmin.html.twig:4 templates\AdminPages\SupplierAdmin.html.twig:4 - + supplier.caption Suppliers @@ -599,7 +599,7 @@ Part-DB1\templates\AdminPages\SupplierAdmin.html.twig:16 new - + supplier.edit Edit supplier @@ -609,7 +609,7 @@ Part-DB1\templates\AdminPages\SupplierAdmin.html.twig:20 new - + supplier.new New supplier @@ -619,7 +619,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:8 Part-DB1\templates\AdminPages\UserAdmin.html.twig:8 - + user.edit.caption Users @@ -629,7 +629,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:14 Part-DB1\templates\AdminPages\UserAdmin.html.twig:14 - + user.edit.configuration Configuration @@ -639,7 +639,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:15 Part-DB1\templates\AdminPages\UserAdmin.html.twig:15 - + user.edit.password Password @@ -649,7 +649,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:45 Part-DB1\templates\AdminPages\UserAdmin.html.twig:45 - + user.edit.tfa.caption Two-factor authentication @@ -659,7 +659,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:47 Part-DB1\templates\AdminPages\UserAdmin.html.twig:47 - + user.edit.tfa.google_active Authenticator app active @@ -673,7 +673,7 @@ Part-DB1\templates\Users\backup_codes.html.twig:15 Part-DB1\templates\Users\_2fa_settings.html.twig:95 - + tfa_backup.remaining_tokens Remaining backup codes count @@ -687,7 +687,7 @@ Part-DB1\templates\Users\backup_codes.html.twig:17 Part-DB1\templates\Users\_2fa_settings.html.twig:96 - + tfa_backup.generation_date Generation date of the backup codes @@ -699,7 +699,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:53 Part-DB1\templates\AdminPages\UserAdmin.html.twig:60 - + user.edit.tfa.disabled Method not enabled @@ -709,7 +709,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:56 Part-DB1\templates\AdminPages\UserAdmin.html.twig:56 - + user.edit.tfa.u2f_keys_count Active security keys @@ -719,7 +719,7 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:72 Part-DB1\templates\AdminPages\UserAdmin.html.twig:72 - + user.edit.tfa.disable_tfa_title Do you really want to proceed? @@ -729,12 +729,12 @@ Part-DB1\templates\AdminPages\UserAdmin.html.twig:72 Part-DB1\templates\AdminPages\UserAdmin.html.twig:72 - + user.edit.tfa.disable_tfa_message - This will disable <b>all active two-factor authentication methods of the user</b> and delete the <b>backup codes</b>! -<br> -The user will have to set up all two-factor authentication methods again and print new backup codes! <br><br> -<b>Only do this if you are absolutely sure about the identity of the user (seeking help), otherwise the account could be compromised by an attacker!</b> + all active two-factor authentication methods of the user and delete the backup codes! +
+The user will have to set up all two-factor authentication methods again and print new backup codes!

+Only do this if you are absolutely sure about the identity of the user (seeking help), otherwise the account could be compromised by an attacker!]]>
@@ -742,7 +742,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\UserAdmin.html.twig:73 Part-DB1\templates\AdminPages\UserAdmin.html.twig:73 - + user.edit.tfa.disable_tfa.btn Disable all two-factor authentication methods @@ -752,7 +752,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\UserAdmin.html.twig:85 new - + user.edit Edit user @@ -762,7 +762,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\UserAdmin.html.twig:89 new - + user.new New user @@ -775,7 +775,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\Parts\edit\_attachments.html.twig:4 Part-DB1\templates\Parts\info\_attachments_info.html.twig:63 - + attachment.delete Delete @@ -789,7 +789,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\Parts\edit\_attachments.html.twig:38 Part-DB1\src\DataTables\AttachmentDataTable.php:159 - + attachment.external External @@ -801,7 +801,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\_attachments.html.twig:47 Part-DB1\templates\Parts\edit\_attachments.html.twig:45 - + attachment.preview.alt Attachment thumbnail @@ -815,7 +815,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\Parts\edit\_attachments.html.twig:48 Part-DB1\templates\Parts\info\_attachments_info.html.twig:45 - + attachment.view View @@ -831,7 +831,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\Parts\info\_attachments_info.html.twig:38 Part-DB1\src\DataTables\AttachmentDataTable.php:166 - + attachment.file_not_found File not found @@ -843,7 +843,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\Parts\info\_attachments_info.html.twig:48 Part-DB1\templates\Parts\edit\_attachments.html.twig:62 - + attachment.secure Private attachment @@ -855,7 +855,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\_attachments.html.twig:77 Part-DB1\templates\Parts\edit\_attachments.html.twig:75 - + attachment.create Add attachment @@ -869,7 +869,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\Parts\edit\_attachments.html.twig:80 Part-DB1\templates\Parts\edit\_lots.html.twig:33 - + part_lot.edit.delete.confirm Do you really want to delete this stock? This can not be undone! @@ -880,7 +880,7 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\_delete_form.html.twig:2 templates\AdminPages\_delete_form.html.twig:2 - + entity.delete.confirm_title You really want to delete %name%? @@ -891,11 +891,11 @@ The user will have to set up all two-factor authentication methods again and pri Part-DB1\templates\AdminPages\_delete_form.html.twig:3 templates\AdminPages\_delete_form.html.twig:3 - + entity.delete.message - This can not be undone! -<br> -Sub elements will be moved upwards. + +Sub elements will be moved upwards.]]> @@ -904,7 +904,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_delete_form.html.twig:11 templates\AdminPages\_delete_form.html.twig:9 - + entity.delete Delete element @@ -919,7 +919,7 @@ Sub elements will be moved upwards. Part-DB1\src\Form\Part\PartBaseType.php:267 new - + edit.log_comment Change comment @@ -930,7 +930,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_delete_form.html.twig:24 templates\AdminPages\_delete_form.html.twig:12 - + entity.delete.recursive Delete recursive (all sub elements) @@ -939,7 +939,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_duplicate.html.twig:3 - + entity.duplicate Duplicate element @@ -953,7 +953,7 @@ Sub elements will be moved upwards. templates\AdminPages\_export_form.html.twig:4 src\Form\ImportType.php:67 - + export.format File format @@ -964,7 +964,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_export_form.html.twig:16 templates\AdminPages\_export_form.html.twig:16 - + export.level Verbosity level @@ -975,7 +975,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_export_form.html.twig:19 templates\AdminPages\_export_form.html.twig:19 - + export.level.simple Simple @@ -986,7 +986,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_export_form.html.twig:20 templates\AdminPages\_export_form.html.twig:20 - + export.level.extended Extended @@ -997,7 +997,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_export_form.html.twig:21 templates\AdminPages\_export_form.html.twig:21 - + export.level.full Full @@ -1008,7 +1008,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_export_form.html.twig:31 templates\AdminPages\_export_form.html.twig:31 - + export.include_children Include children elements in export @@ -1019,7 +1019,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_export_form.html.twig:39 templates\AdminPages\_export_form.html.twig:39 - + export.btn Export @@ -1038,7 +1038,7 @@ Sub elements will be moved upwards. templates\Parts\edit_part_info.html.twig:12 templates\Parts\show_part_info.html.twig:11 - + id.label ID @@ -1062,7 +1062,7 @@ Sub elements will be moved upwards. templates\AdminPages\EntityAdminBase.html.twig:101 templates\Parts\show_part_info.html.twig:248 - + createdAt Created At @@ -1080,7 +1080,7 @@ Sub elements will be moved upwards. templates\AdminPages\EntityAdminBase.html.twig:114 templates\Parts\show_part_info.html.twig:263 - + lastModified Last modified @@ -1090,7 +1090,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_info.html.twig:38 Part-DB1\templates\AdminPages\_info.html.twig:38 - + entity.info.parts_count Number of parts with this element @@ -1101,7 +1101,7 @@ Sub elements will be moved upwards. Part-DB1\templates\helper.twig:125 Part-DB1\templates\Parts\edit\_specifications.html.twig:6 - + specifications.property Parameter @@ -1111,7 +1111,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:7 Part-DB1\templates\Parts\edit\_specifications.html.twig:7 - + specifications.symbol Symbol @@ -1121,7 +1121,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:8 Part-DB1\templates\Parts\edit\_specifications.html.twig:8 - + specifications.value_min Min. @@ -1131,7 +1131,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:9 Part-DB1\templates\Parts\edit\_specifications.html.twig:9 - + specifications.value_typ Typ. @@ -1141,7 +1141,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:10 Part-DB1\templates\Parts\edit\_specifications.html.twig:10 - + specifications.value_max Max. @@ -1151,7 +1151,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:11 Part-DB1\templates\Parts\edit\_specifications.html.twig:11 - + specifications.unit Unit @@ -1161,7 +1161,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:12 Part-DB1\templates\Parts\edit\_specifications.html.twig:12 - + specifications.text Text @@ -1171,7 +1171,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:13 Part-DB1\templates\Parts\edit\_specifications.html.twig:13 - + specifications.group Group @@ -1181,7 +1181,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:26 Part-DB1\templates\Parts\edit\_specifications.html.twig:26 - + specification.create New Parameter @@ -1191,7 +1191,7 @@ Sub elements will be moved upwards. Part-DB1\templates\AdminPages\_parameters.html.twig:31 Part-DB1\templates\Parts\edit\_specifications.html.twig:31 - + parameter.delete.confirm Do you really want to delete this parameter? @@ -1201,7 +1201,7 @@ Sub elements will be moved upwards. Part-DB1\templates\attachment_list.html.twig:3 Part-DB1\templates\attachment_list.html.twig:3 - + attachment.list.title Attachments list @@ -1215,7 +1215,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LogSystem\_log_table.html.twig:8 Part-DB1\templates\Parts\lists\_parts_list.html.twig:6 - + part_list.loading.caption Loading @@ -1229,7 +1229,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LogSystem\_log_table.html.twig:9 Part-DB1\templates\Parts\lists\_parts_list.html.twig:7 - + part_list.loading.message This can take a moment. If this message do not disappear, try to reload the page. @@ -1240,7 +1240,7 @@ Sub elements will be moved upwards. Part-DB1\templates\base.html.twig:68 templates\base.html.twig:246 - + vendor.base.javascript_hint Please activate Javascript to use all features! @@ -1250,7 +1250,7 @@ Sub elements will be moved upwards. Part-DB1\templates\base.html.twig:73 Part-DB1\templates\base.html.twig:73 - + sidebar.big.toggle Show/Hide sidebar @@ -1261,7 +1261,7 @@ Sub elements will be moved upwards. Part-DB1\templates\base.html.twig:95 templates\base.html.twig:271 - + loading.caption Loading: @@ -1272,7 +1272,7 @@ Sub elements will be moved upwards. Part-DB1\templates\base.html.twig:96 templates\base.html.twig:272 - + loading.message This can take a while. If this messages stays for a long time, try to reload the page. @@ -1283,7 +1283,7 @@ Sub elements will be moved upwards. Part-DB1\templates\base.html.twig:101 templates\base.html.twig:277 - + loading.bar Loading... @@ -1294,7 +1294,7 @@ Sub elements will be moved upwards. Part-DB1\templates\base.html.twig:112 templates\base.html.twig:288 - + back_to_top Back to page's top @@ -1304,7 +1304,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Form\permissionLayout.html.twig:35 Part-DB1\templates\Form\permissionLayout.html.twig:35 - + permission.edit.permission Permissions @@ -1314,7 +1314,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Form\permissionLayout.html.twig:36 Part-DB1\templates\Form\permissionLayout.html.twig:36 - + permission.edit.value Value @@ -1324,7 +1324,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Form\permissionLayout.html.twig:53 Part-DB1\templates\Form\permissionLayout.html.twig:53 - + permission.legend.title Explanation of the states: @@ -1334,7 +1334,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Form\permissionLayout.html.twig:57 Part-DB1\templates\Form\permissionLayout.html.twig:57 - + permission.legend.disallow Forbidden @@ -1344,7 +1344,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Form\permissionLayout.html.twig:61 Part-DB1\templates\Form\permissionLayout.html.twig:61 - + permission.legend.allow Allowed @@ -1354,7 +1354,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Form\permissionLayout.html.twig:65 Part-DB1\templates\Form\permissionLayout.html.twig:65 - + permission.legend.inherit Inherit from (parent) group @@ -1364,7 +1364,7 @@ Sub elements will be moved upwards. Part-DB1\templates\helper.twig:3 Part-DB1\templates\helper.twig:3 - + bool.true True @@ -1374,7 +1374,7 @@ Sub elements will be moved upwards. Part-DB1\templates\helper.twig:5 Part-DB1\templates\helper.twig:5 - + bool.false False @@ -1384,7 +1384,7 @@ Sub elements will be moved upwards. Part-DB1\templates\helper.twig:92 Part-DB1\templates\helper.twig:87 - + Yes Yes @@ -1394,7 +1394,7 @@ Sub elements will be moved upwards. Part-DB1\templates\helper.twig:94 Part-DB1\templates\helper.twig:89 - + No No @@ -1403,7 +1403,7 @@ Sub elements will be moved upwards. Part-DB1\templates\helper.twig:126 - + specifications.value Value @@ -1414,7 +1414,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:7 templates\homepage.html.twig:7 - + version.caption Version @@ -1425,7 +1425,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:22 templates\homepage.html.twig:19 - + homepage.license License information @@ -1436,7 +1436,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:31 templates\homepage.html.twig:28 - + homepage.github.caption Project page @@ -1447,9 +1447,9 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:31 templates\homepage.html.twig:28 - + homepage.github.text - Source, downloads, bug reports, to-do-list etc. can be found on <a href="%href%" class="link-external" target="_blank">GitHub project page</a> + GitHub project page]]> @@ -1458,7 +1458,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:32 templates\homepage.html.twig:29 - + homepage.help.caption Help @@ -1469,9 +1469,9 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:32 templates\homepage.html.twig:29 - + homepage.help.text - Help and tips can be found in Wiki the <a href="%href%" class="link-external" target="_blank">GitHub page</a> + GitHub page]]> @@ -1480,7 +1480,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:33 templates\homepage.html.twig:30 - + homepage.forum.caption Forum @@ -1491,7 +1491,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:36 templates\homepage.html.twig:33 - + homepage.basedOn Based on the original Part-DB by @@ -1502,7 +1502,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:39 templates\homepage.html.twig:36 - + homepage.others and others @@ -1513,7 +1513,7 @@ Sub elements will be moved upwards. Part-DB1\templates\homepage.html.twig:45 new - + homepage.last_activity Last activity @@ -1523,7 +1523,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:3 Part-DB1\templates\LabelSystem\dialog.html.twig:6 - + label_generator.title Label generator @@ -1532,7 +1532,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:16 - + label_generator.common Common @@ -1541,7 +1541,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:20 - + label_generator.advanced Advanced @@ -1550,7 +1550,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:24 - + label_generator.profiles Profiles @@ -1559,7 +1559,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:58 - + label_generator.selected_profile Currently selected profile @@ -1568,7 +1568,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:62 - + label_generator.edit_profile Edit profile @@ -1577,7 +1577,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:75 - + label_generator.load_profile Load profile @@ -1586,7 +1586,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dialog.html.twig:102 - + label_generator.download Download @@ -1596,7 +1596,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dropdown_macro.html.twig:3 Part-DB1\templates\LabelSystem\dropdown_macro.html.twig:5 - + label_generator.label_btn Generate label @@ -1605,7 +1605,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\dropdown_macro.html.twig:20 - + label_generator.label_empty New empty label @@ -1614,7 +1614,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\Scanner\dialog.html.twig:3 - + label_scanner.title Label scanner @@ -1623,7 +1623,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\Scanner\dialog.html.twig:7 - + label_scanner.no_cam_found.title No webcam found @@ -1632,7 +1632,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\Scanner\dialog.html.twig:7 - + label_scanner.no_cam_found.text You need a webcam and give permission to use the scanner function. You can input the barcode code manually below. @@ -1641,7 +1641,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LabelSystem\Scanner\dialog.html.twig:27 - + label_scanner.source_select Select source @@ -1651,7 +1651,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LogSystem\log_list.html.twig:3 Part-DB1\templates\LogSystem\log_list.html.twig:3 - + log.list.title System log @@ -1662,7 +1662,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LogSystem\_log_table.html.twig:1 new - + log.undo.confirm_title Really undo change / revert to timestamp? @@ -1673,7 +1673,7 @@ Sub elements will be moved upwards. Part-DB1\templates\LogSystem\_log_table.html.twig:2 new - + log.undo.confirm_message Do you really want to undo the given change / reset the element to the given timestamp? @@ -1683,7 +1683,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\base.html.twig:24 Part-DB1\templates\mail\base.html.twig:24 - + mail.footer.email_sent_by This email was sent automatically by @@ -1693,7 +1693,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\base.html.twig:24 Part-DB1\templates\mail\base.html.twig:24 - + mail.footer.dont_reply Do not answer to this email. @@ -1703,7 +1703,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:6 Part-DB1\templates\mail\pw_reset.html.twig:6 - + email.hi %name% Hi %name% @@ -1713,7 +1713,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:7 Part-DB1\templates\mail\pw_reset.html.twig:7 - + email.pw_reset.message somebody (hopefully you) requested a reset of your password. If this request was not made by you, ignore this mail. @@ -1723,7 +1723,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:9 Part-DB1\templates\mail\pw_reset.html.twig:9 - + email.pw_reset.button Click here to reset password @@ -1733,9 +1733,9 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:11 Part-DB1\templates\mail\pw_reset.html.twig:11 - + email.pw_reset.fallback - If this does not work for you, go to <a href="%url%">%url%</a> and enter the following info + %url% and enter the following info]]> @@ -1743,7 +1743,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:16 Part-DB1\templates\mail\pw_reset.html.twig:16 - + email.pw_reset.username Username @@ -1753,7 +1753,7 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:19 Part-DB1\templates\mail\pw_reset.html.twig:19 - + email.pw_reset.token Token @@ -1763,9 +1763,9 @@ Sub elements will be moved upwards. Part-DB1\templates\mail\pw_reset.html.twig:24 Part-DB1\templates\mail\pw_reset.html.twig:24 - + email.pw_reset.valid_unit %date% - The reset token will be valid until <i>%date%</i>. + %date%.]]> @@ -1775,7 +1775,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:78 Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:58 - + orderdetail.delete Delete @@ -1785,7 +1785,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:39 Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:39 - + pricedetails.edit.min_qty Minimum discount quantity @@ -1795,7 +1795,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:40 Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:40 - + pricedetails.edit.price Price @@ -1805,7 +1805,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:41 Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:41 - + pricedetails.edit.price_qty for amount @@ -1815,7 +1815,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:54 Part-DB1\templates\Parts\edit\edit_form_styles.html.twig:54 - + pricedetail.create Add price @@ -1826,7 +1826,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:4 templates\Parts\edit_part_info.html.twig:4 - + part.edit.title Edit part @@ -1837,7 +1837,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:9 templates\Parts\edit_part_info.html.twig:9 - + part.edit.card_title Edit part @@ -1847,7 +1847,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:22 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:22 - + part.edit.tab.common Common @@ -1857,7 +1857,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:28 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:28 - + part.edit.tab.manufacturer Manufacturer @@ -1867,7 +1867,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:34 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:34 - + part.edit.tab.advanced Advanced @@ -1877,7 +1877,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:40 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:40 - + part.edit.tab.part_lots Stocks @@ -1887,7 +1887,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:46 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:46 - + part.edit.tab.attachments Attachments @@ -1897,7 +1897,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:52 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:52 - + part.edit.tab.orderdetails Purchase information @@ -1906,7 +1906,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:58 - + part.edit.tab.specifications Parameters @@ -1916,7 +1916,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\edit_part_info.html.twig:64 Part-DB1\templates\Parts\edit\edit_part_info.html.twig:58 - + part.edit.tab.comment Notes @@ -1927,7 +1927,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\new_part.html.twig:8 templates\Parts\new_part.html.twig:8 - + part.new.card_title Create new part @@ -1937,7 +1937,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\_lots.html.twig:5 Part-DB1\templates\Parts\edit\_lots.html.twig:5 - + part_lot.delete Delete @@ -1947,7 +1947,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\_lots.html.twig:28 Part-DB1\templates\Parts\edit\_lots.html.twig:28 - + part_lot.create Add stock @@ -1957,7 +1957,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\_orderdetails.html.twig:13 Part-DB1\templates\Parts\edit\_orderdetails.html.twig:13 - + orderdetail.create Add distributor @@ -1967,7 +1967,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\_orderdetails.html.twig:18 Part-DB1\templates\Parts\edit\_orderdetails.html.twig:18 - + pricedetails.edit.delete.confirm Do you really want to delete this price? This can not be undone. @@ -1977,7 +1977,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\edit\_orderdetails.html.twig:62 Part-DB1\templates\Parts\edit\_orderdetails.html.twig:61 - + orderdetails.edit.delete.confirm Do you really want to delete this distributor info? This can not be undone! @@ -1991,7 +1991,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:4 templates\Parts\show_part_info.html.twig:9 - + part.info.title Detail info for part @@ -2001,7 +2001,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\show_part_info.html.twig:47 Part-DB1\templates\Parts\info\show_part_info.html.twig:47 - + part.part_lots.label Stocks @@ -2016,7 +2016,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:74 src\Form\PartType.php:86 - + comment.label Notes @@ -2025,7 +2025,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\show_part_info.html.twig:64 - + part.info.specifications Parameters @@ -2036,7 +2036,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\show_part_info.html.twig:64 templates\Parts\show_part_info.html.twig:82 - + attachment.labelp Attachments @@ -2047,7 +2047,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\show_part_info.html.twig:71 templates\Parts\show_part_info.html.twig:88 - + vendor.partinfo.shopping_infos Shopping information @@ -2058,7 +2058,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\show_part_info.html.twig:78 templates\Parts\show_part_info.html.twig:94 - + vendor.partinfo.history History @@ -2077,7 +2077,7 @@ Sub elements will be moved upwards. templates\base.html.twig:231 templates\Parts\show_part_info.html.twig:100 - + tools.label Tools @@ -2087,7 +2087,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\show_part_info.html.twig:103 Part-DB1\templates\Parts\info\show_part_info.html.twig:90 - + extended_info.label Extended info @@ -2097,7 +2097,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_attachments_info.html.twig:7 Part-DB1\templates\Parts\info\_attachments_info.html.twig:7 - + attachment.name Name @@ -2107,7 +2107,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_attachments_info.html.twig:8 Part-DB1\templates\Parts\info\_attachments_info.html.twig:8 - + attachment.attachment_type Attachment Type @@ -2117,7 +2117,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_attachments_info.html.twig:9 Part-DB1\templates\Parts\info\_attachments_info.html.twig:9 - + attachment.file_name File name @@ -2127,7 +2127,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_attachments_info.html.twig:10 Part-DB1\templates\Parts\info\_attachments_info.html.twig:10 - + attachment.file_size File size @@ -2136,7 +2136,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_attachments_info.html.twig:54 - + attachment.preview Preview picture @@ -2146,7 +2146,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_attachments_info.html.twig:67 Part-DB1\templates\Parts\info\_attachments_info.html.twig:50 - + attachment.download Download @@ -2157,7 +2157,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_extended_infos.html.twig:11 new - + user.creating_user User who created this part @@ -2171,7 +2171,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_extended_infos.html.twig:28 Part-DB1\templates\Parts\info\_extended_infos.html.twig:50 - + Unknown Unknown @@ -2184,7 +2184,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_extended_infos.html.twig:30 new - + accessDenied Access Denied @@ -2195,7 +2195,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_extended_infos.html.twig:26 new - + user.last_editing_user User who edited this part last @@ -2205,7 +2205,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_extended_infos.html.twig:41 Part-DB1\templates\Parts\info\_extended_infos.html.twig:41 - + part.isFavorite Favorite @@ -2215,7 +2215,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_extended_infos.html.twig:46 Part-DB1\templates\Parts\info\_extended_infos.html.twig:46 - + part.minOrderAmount Minimum order amount @@ -2232,7 +2232,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:24 src\Form\PartType.php:80 - + manufacturer.label Manufacturer @@ -2244,7 +2244,7 @@ Sub elements will be moved upwards. templates\base.html.twig:54 src\Form\PartType.php:62 - + name.label Name @@ -2255,7 +2255,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_main_infos.html.twig:27 new - + part.back_to_info Back to current version @@ -2270,7 +2270,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:31 src\Form\PartType.php:65 - + description.label Description @@ -2287,7 +2287,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:32 src\Form\PartType.php:74 - + category.label Category @@ -2299,7 +2299,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:42 src\Form\PartType.php:69 - + instock.label Instock @@ -2311,7 +2311,7 @@ Sub elements will be moved upwards. templates\Parts\show_part_info.html.twig:44 src\Form\PartType.php:72 - + mininstock.label Minimum Instock @@ -2327,7 +2327,7 @@ Sub elements will be moved upwards. templates\base.html.twig:73 templates\Parts\show_part_info.html.twig:47 - + footprint.label Footprint @@ -2340,7 +2340,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_main_infos.html.twig:60 templates\Parts\show_part_info.html.twig:51 - + part.avg_price.label Average Price @@ -2350,7 +2350,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:5 Part-DB1\templates\Parts\info\_order_infos.html.twig:5 - + part.supplier.name Name @@ -2360,7 +2360,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:6 Part-DB1\templates\Parts\info\_order_infos.html.twig:6 - + part.supplier.partnr Partnr. @@ -2370,7 +2370,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:28 Part-DB1\templates\Parts\info\_order_infos.html.twig:28 - + part.order.minamount Minimum amount @@ -2380,7 +2380,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:29 Part-DB1\templates\Parts\info\_order_infos.html.twig:29 - + part.order.price Price @@ -2390,7 +2390,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:31 Part-DB1\templates\Parts\info\_order_infos.html.twig:31 - + part.order.single_price Unit Price @@ -2400,7 +2400,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:71 Part-DB1\templates\Parts\info\_order_infos.html.twig:71 - + edit.caption_short Edit @@ -2410,7 +2410,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_order_infos.html.twig:72 Part-DB1\templates\Parts\info\_order_infos.html.twig:72 - + delete.caption Delete @@ -2420,7 +2420,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:7 Part-DB1\templates\Parts\info\_part_lots.html.twig:6 - + part_lots.description Description @@ -2430,7 +2430,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:8 Part-DB1\templates\Parts\info\_part_lots.html.twig:7 - + part_lots.storage_location Storage location @@ -2440,7 +2440,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:9 Part-DB1\templates\Parts\info\_part_lots.html.twig:8 - + part_lots.amount Amount @@ -2450,7 +2450,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:24 Part-DB1\templates\Parts\info\_part_lots.html.twig:22 - + part_lots.location_unknown Storage location unknown @@ -2460,7 +2460,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:31 Part-DB1\templates\Parts\info\_part_lots.html.twig:29 - + part_lots.instock_unknown Amount unknown @@ -2470,7 +2470,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:40 Part-DB1\templates\Parts\info\_part_lots.html.twig:38 - + part_lots.expiration_date Expiration date @@ -2480,7 +2480,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:48 Part-DB1\templates\Parts\info\_part_lots.html.twig:46 - + part_lots.is_expired Expired @@ -2490,7 +2490,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_part_lots.html.twig:55 Part-DB1\templates\Parts\info\_part_lots.html.twig:53 - + part_lots.need_refill Needs refill @@ -2500,7 +2500,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_picture.html.twig:15 Part-DB1\templates\Parts\info\_picture.html.twig:15 - + part.info.prev_picture Previous picture @@ -2510,7 +2510,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_picture.html.twig:19 Part-DB1\templates\Parts\info\_picture.html.twig:19 - + part.info.next_picture Next picture @@ -2520,7 +2520,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_sidebar.html.twig:21 Part-DB1\templates\Parts\info\_sidebar.html.twig:21 - + part.mass.tooltip Mass @@ -2530,7 +2530,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_sidebar.html.twig:30 Part-DB1\templates\Parts\info\_sidebar.html.twig:30 - + part.needs_review.badge Needs review @@ -2540,7 +2540,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_sidebar.html.twig:39 Part-DB1\templates\Parts\info\_sidebar.html.twig:39 - + part.favorite.badge Favorite @@ -2550,7 +2550,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_sidebar.html.twig:47 Part-DB1\templates\Parts\info\_sidebar.html.twig:47 - + part.obsolete.badge No longer available @@ -2559,7 +2559,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_specifications.html.twig:10 - + parameters.extracted_from_description Automatically extracted from description @@ -2568,7 +2568,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_specifications.html.twig:15 - + parameters.auto_extracted_from_comment Automatically extracted from notes @@ -2579,7 +2579,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_tools.html.twig:4 templates\Parts\show_part_info.html.twig:125 - + part.edit.btn Edit part @@ -2590,7 +2590,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_tools.html.twig:14 templates\Parts\show_part_info.html.twig:135 - + part.clone.btn Clone part @@ -2601,7 +2601,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_action_bar.html.twig:4 templates\Parts\show_part_info.html.twig:143 - + part.create.btn Create new part @@ -2611,7 +2611,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_tools.html.twig:31 Part-DB1\templates\Parts\info\_tools.html.twig:29 - + part.delete.confirm_title Do you really want to delete this part? @@ -2621,7 +2621,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_tools.html.twig:32 Part-DB1\templates\Parts\info\_tools.html.twig:30 - + part.delete.message This part and any associated information (like attachments, price information, etc.) will be deleted. This can not be undone! @@ -2631,7 +2631,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\info\_tools.html.twig:39 Part-DB1\templates\Parts\info\_tools.html.twig:37 - + part.delete Delete part @@ -2641,7 +2641,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\all_list.html.twig:4 Part-DB1\templates\Parts\lists\all_list.html.twig:4 - + parts_list.all.title All parts @@ -2651,7 +2651,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\category_list.html.twig:4 Part-DB1\templates\Parts\lists\category_list.html.twig:4 - + parts_list.category.title Parts with category @@ -2661,7 +2661,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\footprint_list.html.twig:4 Part-DB1\templates\Parts\lists\footprint_list.html.twig:4 - + parts_list.footprint.title Parts with footprint @@ -2671,7 +2671,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\manufacturer_list.html.twig:4 Part-DB1\templates\Parts\lists\manufacturer_list.html.twig:4 - + parts_list.manufacturer.title Parts with manufacturer @@ -2681,7 +2681,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\search_list.html.twig:4 Part-DB1\templates\Parts\lists\search_list.html.twig:4 - + parts_list.search.title Search Parts @@ -2691,7 +2691,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\store_location_list.html.twig:4 Part-DB1\templates\Parts\lists\store_location_list.html.twig:4 - + parts_list.storelocation.title Parts with storage locations @@ -2701,7 +2701,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\supplier_list.html.twig:4 Part-DB1\templates\Parts\lists\supplier_list.html.twig:4 - + parts_list.supplier.title Parts with supplier @@ -2711,7 +2711,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\tags_list.html.twig:4 Part-DB1\templates\Parts\lists\tags_list.html.twig:4 - + parts_list.tags.title Parts with tag @@ -2721,7 +2721,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:22 Part-DB1\templates\Parts\lists\_info_card.html.twig:17 - + entity.info.common.tab Common @@ -2731,7 +2731,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:26 Part-DB1\templates\Parts\lists\_info_card.html.twig:20 - + entity.info.statistics.tab Statistics @@ -2740,7 +2740,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:31 - + entity.info.attachments.tab Attachments @@ -2749,7 +2749,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:37 - + entity.info.parameters.tab Parameters @@ -2759,7 +2759,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:54 Part-DB1\templates\Parts\lists\_info_card.html.twig:30 - + entity.info.name Name @@ -2771,7 +2771,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:34 Part-DB1\templates\Parts\lists\_info_card.html.twig:67 - + entity.info.parent Parent @@ -2781,7 +2781,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:70 Part-DB1\templates\Parts\lists\_info_card.html.twig:46 - + entity.edit.btn Edit @@ -2791,7 +2791,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Parts\lists\_info_card.html.twig:92 Part-DB1\templates\Parts\lists\_info_card.html.twig:63 - + entity.info.children_count Count of children elements @@ -2803,7 +2803,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\2fa_base_form.html.twig:3 Part-DB1\templates\security\2fa_base_form.html.twig:5 - + tfa.check.title Two-factor authentication needed @@ -2813,7 +2813,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\2fa_base_form.html.twig:39 Part-DB1\templates\security\2fa_base_form.html.twig:39 - + tfa.code.trusted_pc This is a trusted computer (if this is enabled, no further two-factor queries are performed on this computer) @@ -2825,7 +2825,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\2fa_base_form.html.twig:52 Part-DB1\templates\security\login.html.twig:58 - + login.btn Login @@ -2839,7 +2839,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_login.html.twig:13 Part-DB1\templates\_navbar.html.twig:40 - + user.logout Logout @@ -2849,7 +2849,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\2fa_form.html.twig:6 Part-DB1\templates\security\2fa_form.html.twig:6 - + tfa.check.code.label Authenticator app code @@ -2859,7 +2859,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\2fa_form.html.twig:10 Part-DB1\templates\security\2fa_form.html.twig:10 - + tfa.check.code.help Enter the 6-digit code from your Authenticator App or one of your backup codes if the Authenticator is not available. @@ -2870,7 +2870,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:3 templates\security\login.html.twig:3 - + login.title Login @@ -2881,7 +2881,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:7 templates\security\login.html.twig:7 - + login.card_title Login @@ -2892,7 +2892,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:31 templates\security\login.html.twig:31 - + login.username.label Username @@ -2903,7 +2903,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:34 templates\security\login.html.twig:34 - + login.username.placeholder Username @@ -2914,7 +2914,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:38 templates\security\login.html.twig:38 - + login.password.label Password @@ -2925,7 +2925,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:40 templates\security\login.html.twig:40 - + login.password.placeholder Password @@ -2936,7 +2936,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:50 templates\security\login.html.twig:50 - + login.rememberme Remember me (should not be used on shared computers) @@ -2946,7 +2946,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\login.html.twig:64 Part-DB1\templates\security\login.html.twig:64 - + pw_reset.password_forget Forgot username/password? @@ -2956,7 +2956,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\pw_reset_new_pw.html.twig:5 Part-DB1\templates\security\pw_reset_new_pw.html.twig:5 - + pw_reset.new_pw.header.title Set new password @@ -2966,7 +2966,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\pw_reset_request.html.twig:5 Part-DB1\templates\security\pw_reset_request.html.twig:5 - + pw_reset.request.header.title Request a new password @@ -2978,7 +2978,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_login.html.twig:7 Part-DB1\templates\security\U2F\u2f_register.html.twig:10 - + tfa_u2f.http_warning You are accessing this page using the insecure HTTP method, so U2F will most likely not work (Bad Request error message). Ask an administrator to set up the secure HTTPS method if you want to use security keys. @@ -2990,7 +2990,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_login.html.twig:10 Part-DB1\templates\security\U2F\u2f_register.html.twig:22 - + r_u2f_two_factor.pressbutton Please plug in your security key and press its button! @@ -3000,7 +3000,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_register.html.twig:3 Part-DB1\templates\security\U2F\u2f_register.html.twig:3 - + tfa_u2f.add_key.title Add security key @@ -3012,7 +3012,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_register.html.twig:6 Part-DB1\templates\Users\_2fa_settings.html.twig:111 - + tfa_u2f.explanation With the help of a U2F/FIDO compatible security key (e.g. YubiKey or NitroKey), user-friendly and secure two-factor authentication can be achieved. The security keys can be registered here, and if two-factor verification is required, the key only needs to be inserted via USB or typed against the device via NFC. @@ -3022,7 +3022,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_register.html.twig:7 Part-DB1\templates\security\U2F\u2f_register.html.twig:7 - + tfa_u2f.add_key.backup_hint To ensure access even if the key is lost, it is recommended to register a second key as backup and store it in a safe place! @@ -3032,7 +3032,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_register.html.twig:16 Part-DB1\templates\security\U2F\u2f_register.html.twig:16 - + r_u2f_two_factor.name Shown key name (e.g. Backup) @@ -3042,7 +3042,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_register.html.twig:19 Part-DB1\templates\security\U2F\u2f_register.html.twig:19 - + tfa_u2f.add_key.add_button Add security key @@ -3052,7 +3052,7 @@ Sub elements will be moved upwards. Part-DB1\templates\security\U2F\u2f_register.html.twig:27 Part-DB1\templates\security\U2F\u2f_register.html.twig:27 - + tfa_u2f.add_key.back_to_settings Back to settings @@ -3065,7 +3065,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:8 new - + statistics.title Statistics @@ -3076,7 +3076,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:14 new - + statistics.parts Parts @@ -3087,7 +3087,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:19 new - + statistics.data_structures Data structures @@ -3098,7 +3098,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:24 new - + statistics.attachments Attachments @@ -3113,7 +3113,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:104 new - + statistics.property Property @@ -3128,7 +3128,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:105 new - + statistics.value Value @@ -3139,7 +3139,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:40 new - + statistics.distinct_parts_count Number of distinct parts @@ -3150,7 +3150,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:44 new - + statistics.parts_instock_sum Sum of all part instocks @@ -3161,7 +3161,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:48 new - + statistics.parts_with_price Number of parts with price information @@ -3172,7 +3172,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:65 new - + statistics.categories_count Number of categories @@ -3183,7 +3183,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:69 new - + statistics.footprints_count Number of footprints @@ -3194,7 +3194,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:73 new - + statistics.manufacturers_count Number of manufacturers @@ -3205,7 +3205,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:77 new - + statistics.storelocations_count Number of storelocations @@ -3216,7 +3216,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:81 new - + statistics.suppliers_count Number of suppliers @@ -3227,7 +3227,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:85 new - + statistics.currencies_count Number of currencies @@ -3238,7 +3238,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:89 new - + statistics.measurement_units_count Number of measurement units @@ -3249,7 +3249,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:93 new - + statistics.devices_count Number of projects @@ -3260,7 +3260,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:110 new - + statistics.attachment_types_count Number of attachment types @@ -3271,7 +3271,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:114 new - + statistics.all_attachments_count Number of all attachments @@ -3282,7 +3282,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:118 new - + statistics.user_uploaded_attachments_count Number of user uploaded attachments @@ -3293,7 +3293,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:122 new - + statistics.private_attachments_count Number of private attachments @@ -3304,7 +3304,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Statistics\statistics.html.twig:126 new - + statistics.external_attachments_count Number of external attachments (URL) @@ -3316,7 +3316,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:3 Part-DB1\templates\Users\backup_codes.html.twig:9 - + tfa_backup.codes.title Backup codes @@ -3326,7 +3326,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:12 Part-DB1\templates\Users\backup_codes.html.twig:12 - + tfa_backup.codes.explanation Print out these codes and keep them in a safe place! @@ -3336,7 +3336,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:13 Part-DB1\templates\Users\backup_codes.html.twig:13 - + tfa_backup.codes.help If you no longer have access to your device with the Authenticator App (lost smartphone, data loss, etc.) you can use one of these codes to access your account and possibly set up a new Authenticator App. Each of these codes can be used once, it is recommended to delete used codes. Anyone with access to these codes can potentially access your account, so keep them in a safe place. @@ -3346,7 +3346,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:16 Part-DB1\templates\Users\backup_codes.html.twig:16 - + tfa_backup.username Username @@ -3356,7 +3356,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:29 Part-DB1\templates\Users\backup_codes.html.twig:29 - + tfa_backup.codes.page_generated_on Page generated on %date% @@ -3366,7 +3366,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:32 Part-DB1\templates\Users\backup_codes.html.twig:32 - + tfa_backup.codes.print Print @@ -3376,7 +3376,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\backup_codes.html.twig:35 Part-DB1\templates\Users\backup_codes.html.twig:35 - + tfa_backup.codes.copy_clipboard Copy to clipboard @@ -3393,7 +3393,7 @@ Sub elements will be moved upwards. templates\Users\user_info.html.twig:3 templates\Users\user_info.html.twig:6 - + user.info.label User information @@ -3407,7 +3407,7 @@ Sub elements will be moved upwards. templates\Users\user_info.html.twig:18 src\Form\UserSettingsType.php:32 - + user.firstName.label First name @@ -3421,7 +3421,7 @@ Sub elements will be moved upwards. templates\Users\user_info.html.twig:24 src\Form\UserSettingsType.php:35 - + user.lastName.label Last name @@ -3435,7 +3435,7 @@ Sub elements will be moved upwards. templates\Users\user_info.html.twig:30 src\Form\UserSettingsType.php:41 - + user.email.label Email @@ -3449,7 +3449,7 @@ Sub elements will be moved upwards. templates\Users\user_info.html.twig:37 src\Form\UserSettingsType.php:38 - + user.department.label Department @@ -3463,7 +3463,7 @@ Sub elements will be moved upwards. templates\Users\user_info.html.twig:47 src\Form\UserSettingsType.php:30 - + user.username.label User name @@ -3476,7 +3476,7 @@ Sub elements will be moved upwards. Part-DB1\src\Services\ElementTypeNameGenerator.php:93 templates\Users\user_info.html.twig:53 - + group.label Group: @@ -3486,7 +3486,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\user_info.html.twig:67 Part-DB1\templates\Users\user_info.html.twig:67 - + user.permissions Permissions @@ -3503,7 +3503,7 @@ Sub elements will be moved upwards. templates\Users\user_settings.html.twig:3 templates\Users\user_settings.html.twig:6 - + user.settings.label User settings @@ -3514,7 +3514,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\user_settings.html.twig:18 templates\Users\user_settings.html.twig:14 - + user_settings.data.label Personal data @@ -3525,7 +3525,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\user_settings.html.twig:22 templates\Users\user_settings.html.twig:18 - + user_settings.configuration.label Configuration @@ -3536,7 +3536,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\user_settings.html.twig:55 templates\Users\user_settings.html.twig:48 - + user.settings.change_pw Change password @@ -3546,7 +3546,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:6 Part-DB1\templates\Users\_2fa_settings.html.twig:6 - + user.settings.2fa_settings Two-Factor Authentication @@ -3556,7 +3556,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:13 Part-DB1\templates\Users\_2fa_settings.html.twig:13 - + tfa.settings.google.tab Authenticator app @@ -3566,7 +3566,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:17 Part-DB1\templates\Users\_2fa_settings.html.twig:17 - + tfa.settings.bakup.tab Backup codes @@ -3576,7 +3576,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:21 Part-DB1\templates\Users\_2fa_settings.html.twig:21 - + tfa.settings.u2f.tab Security keys (U2F) @@ -3586,7 +3586,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:25 Part-DB1\templates\Users\_2fa_settings.html.twig:25 - + tfa.settings.trustedDevices.tab Trusted devices @@ -3596,7 +3596,7 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:33 Part-DB1\templates\Users\_2fa_settings.html.twig:33 - + tfa_google.disable.confirm_title Do you really want to disable the Authenticator App? @@ -3606,10 +3606,10 @@ Sub elements will be moved upwards. Part-DB1\templates\Users\_2fa_settings.html.twig:33 Part-DB1\templates\Users\_2fa_settings.html.twig:33 - + tfa_google.disable.confirm_message - If you disable the Authenticator App, all backup codes will be deleted, so you may need to reprint them.<br> -Also note that without two-factor authentication your account is not as well protected against attackers! + +Also note that without two-factor authentication your account is not as well protected against attackers!]]> @@ -3617,7 +3617,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:39 Part-DB1\templates\Users\_2fa_settings.html.twig:39 - + tfa_google.disabled_message Authenticator app deactivated! @@ -3627,9 +3627,9 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:48 Part-DB1\templates\Users\_2fa_settings.html.twig:48 - + tfa_google.step.download - Download an authenticator app (e.g. <a class="link-external" target="_blank" href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2">Google Authenticator</a> oder <a class="link-external" target="_blank" href="https://play.google.com/store/apps/details?id=org.fedorahosted.freeotp">FreeOTP Authenticator</a>) + Google Authenticator oder FreeOTP Authenticator)]]> @@ -3637,7 +3637,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:49 Part-DB1\templates\Users\_2fa_settings.html.twig:49 - + tfa_google.step.scan Scan the adjoining QR Code with the app or enter the data manually @@ -3647,7 +3647,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:50 Part-DB1\templates\Users\_2fa_settings.html.twig:50 - + tfa_google.step.input_code Enter the generated code in the field below and confirm @@ -3657,7 +3657,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:51 Part-DB1\templates\Users\_2fa_settings.html.twig:51 - + tfa_google.step.download_backup Print out your backup codes and store them in a safe place @@ -3667,7 +3667,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:58 Part-DB1\templates\Users\_2fa_settings.html.twig:58 - + tfa_google.manual_setup Manual setup @@ -3677,7 +3677,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:62 Part-DB1\templates\Users\_2fa_settings.html.twig:62 - + tfa_google.manual_setup.type Type @@ -3687,7 +3687,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:63 Part-DB1\templates\Users\_2fa_settings.html.twig:63 - + tfa_google.manual_setup.username Username @@ -3697,7 +3697,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:64 Part-DB1\templates\Users\_2fa_settings.html.twig:64 - + tfa_google.manual_setup.secret Secret @@ -3707,7 +3707,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:65 Part-DB1\templates\Users\_2fa_settings.html.twig:65 - + tfa_google.manual_setup.digit_count Digit count @@ -3717,7 +3717,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:74 Part-DB1\templates\Users\_2fa_settings.html.twig:74 - + tfa_google.enabled_message Authenticator App enabled @@ -3727,7 +3727,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:83 Part-DB1\templates\Users\_2fa_settings.html.twig:83 - + tfa_backup.disabled Backup codes disabled. Setup authenticator app to enable backup codes. @@ -3739,7 +3739,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:84 Part-DB1\templates\Users\_2fa_settings.html.twig:92 - + tfa_backup.explanation You can use these backup codes to access your account even if you lose the device with the Authenticator App. Print out the codes and keep them in a safe place. @@ -3749,7 +3749,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:88 Part-DB1\templates\Users\_2fa_settings.html.twig:88 - + tfa_backup.reset_codes.confirm_title Really reset codes? @@ -3759,7 +3759,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:88 Part-DB1\templates\Users\_2fa_settings.html.twig:88 - + tfa_backup.reset_codes.confirm_message This will delete all previous codes and generate a set of new codes. This cannot be undone. Remember to print out the new codes and store them in a safe place! @@ -3769,7 +3769,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:91 Part-DB1\templates\Users\_2fa_settings.html.twig:91 - + tfa_backup.enabled Backup codes enabled @@ -3779,7 +3779,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:99 Part-DB1\templates\Users\_2fa_settings.html.twig:99 - + tfa_backup.show_codes Show backup codes @@ -3789,7 +3789,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:114 Part-DB1\templates\Users\_2fa_settings.html.twig:114 - + tfa_u2f.table_caption Registered security keys @@ -3799,7 +3799,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:115 Part-DB1\templates\Users\_2fa_settings.html.twig:115 - + tfa_u2f.delete_u2f.confirm_title Really remove this security key? @@ -3809,7 +3809,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:116 Part-DB1\templates\Users\_2fa_settings.html.twig:116 - + tfa_u2f.delete_u2f.confirm_message If you remove this key, then no more login with this key will be possible. If no security keys remain, two-factor authentication will be disabled. @@ -3819,7 +3819,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:123 Part-DB1\templates\Users\_2fa_settings.html.twig:123 - + tfa_u2f.keys.name Key name @@ -3829,7 +3829,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:124 Part-DB1\templates\Users\_2fa_settings.html.twig:124 - + tfa_u2f.keys.added_date Registration date @@ -3839,7 +3839,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:134 Part-DB1\templates\Users\_2fa_settings.html.twig:134 - + tfa_u2f.key_delete Delete key @@ -3849,7 +3849,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:141 Part-DB1\templates\Users\_2fa_settings.html.twig:141 - + tfa_u2f.no_keys_registered No keys registered yet. @@ -3859,7 +3859,7 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:144 Part-DB1\templates\Users\_2fa_settings.html.twig:144 - + tfa_u2f.add_new_key Register new security key @@ -3869,10 +3869,10 @@ Also note that without two-factor authentication your account is not as well pro Part-DB1\templates\Users\_2fa_settings.html.twig:148 Part-DB1\templates\Users\_2fa_settings.html.twig:148 - + tfa_trustedDevices.explanation - When checking the second factor, the current computer can be marked as trustworthy, so no more two-factor checks on this computer are needed. -If you have done this incorrectly or if a computer is no longer trusted, you can reset the status of <i>all </i>computers here. + all computers here.]]> @@ -3880,7 +3880,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\Users\_2fa_settings.html.twig:149 Part-DB1\templates\Users\_2fa_settings.html.twig:149 - + tfa_trustedDevices.invalidate.confirm_title Really remove all trusted computers? @@ -3890,7 +3890,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\Users\_2fa_settings.html.twig:150 Part-DB1\templates\Users\_2fa_settings.html.twig:150 - + tfa_trustedDevices.invalidate.confirm_message You will have to perform two-factor authentication again on all computers. Make sure you have your two-factor device at hand. @@ -3900,7 +3900,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\Users\_2fa_settings.html.twig:154 Part-DB1\templates\Users\_2fa_settings.html.twig:154 - + tfa_trustedDevices.invalidate.btn Reset trusted devices @@ -3911,7 +3911,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar.html.twig:4 templates\base.html.twig:29 - + sidebar.toggle Toggle Sidebar @@ -3920,7 +3920,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar.html.twig:22 - + navbar.scanner.link Scanner @@ -3931,7 +3931,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar.html.twig:36 templates\base.html.twig:97 - + user.loggedin.label Logged in as @@ -3942,7 +3942,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar.html.twig:42 templates\base.html.twig:103 - + user.login Login @@ -3952,7 +3952,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar.html.twig:50 Part-DB1\templates\_navbar.html.twig:48 - + ui.toggle_darkmode Darkmode @@ -3966,7 +3966,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:106 src\Form\UserSettingsType.php:44 - + user.language_select Switch Language @@ -3977,7 +3977,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar_search.html.twig:4 templates\base.html.twig:49 - + search.options.label Search options @@ -3986,7 +3986,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar_search.html.twig:23 - + tags.label Tags @@ -4001,7 +4001,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\Parts\show_part_info.html.twig:36 src\Form\PartType.php:77 - + storelocation.label Storage location @@ -4012,7 +4012,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar_search.html.twig:31 templates\base.html.twig:65 - + ordernumber.label.short supplier partnr. @@ -4025,7 +4025,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:89 templates\base.html.twig:67 - + supplier.label Supplier @@ -4036,7 +4036,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar_search.html.twig:52 templates\base.html.twig:75 - + search.deactivateBarcode Deact. Barcode @@ -4047,7 +4047,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar_search.html.twig:56 templates\base.html.twig:77 - + search.regexmatching Reg.Ex. Matching @@ -4057,7 +4057,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\_navbar_search.html.twig:68 Part-DB1\templates\_navbar_search.html.twig:62 - + search.submit Go! @@ -4073,7 +4073,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:202 templates\base.html.twig:230 - + project.labelp Projects @@ -4086,7 +4086,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:192 templates\base.html.twig:220 - + actions Actions @@ -4099,7 +4099,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:196 templates\base.html.twig:224 - + datasource Data source @@ -4112,7 +4112,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:200 templates\base.html.twig:228 - + manufacturer.labelp Manufacturers @@ -4125,7 +4125,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:201 templates\base.html.twig:229 - + supplier.labelp Suppliers @@ -4141,7 +4141,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\PartController.php:173 Part-DB1\src\Controller\PartController.php:268 - + attachment.download_failed Download of the external attachment failed. @@ -4151,7 +4151,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\AdminPages\BaseAdminController.php:222 Part-DB1\src\Controller\AdminPages\BaseAdminController.php:190 - + entity.edit_flash Changes saved successful. @@ -4161,7 +4161,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\AdminPages\BaseAdminController.php:231 Part-DB1\src\Controller\AdminPages\BaseAdminController.php:196 - + entity.edit_flash.invalid Can not save changed. Please check your input! @@ -4171,7 +4171,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\AdminPages\BaseAdminController.php:302 Part-DB1\src\Controller\AdminPages\BaseAdminController.php:252 - + entity.created_flash Element created. @@ -4181,7 +4181,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\AdminPages\BaseAdminController.php:308 Part-DB1\src\Controller\AdminPages\BaseAdminController.php:258 - + entity.created_flash.invalid Could not create element. Please check your input! @@ -4192,7 +4192,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\AdminPages\BaseAdminController.php:352 src\Controller\BaseAdminController.php:154 - + attachment_type.deleted Element deleted! @@ -4208,7 +4208,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:150 Part-DB1\src\Controller\UserSettingsController.php:182 - + csfr_invalid CSFR Token invalid. Please reload this page or contact an administrator if this message stays. @@ -4217,7 +4217,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LabelController.php:125 - + label_generator.no_entities_found No entities matching the range found. @@ -4228,7 +4228,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:154 new - + log.undo.target_not_found Target element could not be found in DB! @@ -4239,7 +4239,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:160 new - + log.undo.revert_success Reverted to timestamp successfully. @@ -4250,7 +4250,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:180 new - + log.undo.element_undelete_success Undeleted element successfully. @@ -4261,7 +4261,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:182 new - + log.undo.element_element_already_undeleted Element was already undeleted! @@ -4272,7 +4272,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:189 new - + log.undo.element_delete_success Element deleted successfully. @@ -4283,7 +4283,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:191 new - + log.undo.element.element_already_delted Element was already deleted! @@ -4294,7 +4294,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:198 new - + log.undo.element_change_undone Change undone successfully! @@ -4305,7 +4305,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:200 new - + log.undo.do_undelete_before You have to undelete the element before you can undo this change! @@ -4316,7 +4316,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\LogController.php:203 new - + log.undo.log_type_invalid This log entry can not be undone! @@ -4327,7 +4327,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\PartController.php:182 src\Controller\PartController.php:80 - + part.edited_flash Saved changes! @@ -4337,7 +4337,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\PartController.php:186 Part-DB1\src\Controller\PartController.php:186 - + part.edited_flash.invalid Error during saving: Please check your inputs! @@ -4347,7 +4347,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\PartController.php:216 Part-DB1\src\Controller\PartController.php:219 - + part.deleted Part deleted successful. @@ -4360,7 +4360,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can src\Controller\PartController.php:113 src\Controller\PartController.php:142 - + part.created_flash Part created! @@ -4370,7 +4370,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\PartController.php:308 Part-DB1\src\Controller\PartController.php:283 - + part.created_flash.invalid Error during creation: Please check your inputs! @@ -4380,7 +4380,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\ScanController.php:68 Part-DB1\src\Controller\ScanController.php:90 - + scan.qr_not_found No element found for the given barcode. @@ -4389,7 +4389,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\ScanController.php:71 - + scan.format_unknown Format unknown! @@ -4398,7 +4398,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\ScanController.php:86 - + scan.qr_success Element found. @@ -4408,7 +4408,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\SecurityController.php:114 Part-DB1\src\Controller\SecurityController.php:109 - + pw_reset.user_or_email Username / Email @@ -4418,7 +4418,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\SecurityController.php:131 Part-DB1\src\Controller\SecurityController.php:126 - + pw_reset.request.success Reset request was successful! Please check your emails for further instructions. @@ -4428,7 +4428,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\SecurityController.php:162 Part-DB1\src\Controller\SecurityController.php:160 - + pw_reset.username Username @@ -4438,7 +4438,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\SecurityController.php:165 Part-DB1\src\Controller\SecurityController.php:163 - + pw_reset.token Token @@ -4448,7 +4448,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\SecurityController.php:194 Part-DB1\src\Controller\SecurityController.php:192 - + pw_reset.new_pw.error Username or Token invalid! Please check your input. @@ -4458,7 +4458,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\SecurityController.php:196 Part-DB1\src\Controller\SecurityController.php:194 - + pw_reset.new_pw.success Password was reset successfully. You can now login with your new password. @@ -4468,7 +4468,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserController.php:107 Part-DB1\src\Controller\UserController.php:99 - + user.edit.reset_success All two-factor authentication methods were successfully disabled. @@ -4478,7 +4478,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:101 Part-DB1\src\Controller\UserSettingsController.php:92 - + tfa_backup.no_codes_enabled No backup codes enabled! @@ -4488,7 +4488,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:138 Part-DB1\src\Controller\UserSettingsController.php:132 - + tfa_u2f.u2f_delete.not_existing No security key with this ID is existing. @@ -4498,7 +4498,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:145 Part-DB1\src\Controller\UserSettingsController.php:139 - + tfa_u2f.u2f_delete.access_denied You can not delete the security keys of other users! @@ -4508,7 +4508,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:153 Part-DB1\src\Controller\UserSettingsController.php:147 - + tfa.u2f.u2f_delete.success Security key successfully removed. @@ -4518,7 +4518,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:188 Part-DB1\src\Controller\UserSettingsController.php:180 - + tfa_trustedDevice.invalidate.success Trusted devices successfully reset. @@ -4529,7 +4529,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:226 src\Controller\UserController.php:98 - + user.settings.saved_flash Settings saved! @@ -4540,7 +4540,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:288 src\Controller\UserController.php:130 - + user.settings.pw_changed_flash Password changed! @@ -4550,7 +4550,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:317 Part-DB1\src\Controller\UserSettingsController.php:306 - + user.settings.2fa.google.activated Authenticator App successfully activated. @@ -4560,7 +4560,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:328 Part-DB1\src\Controller\UserSettingsController.php:315 - + user.settings.2fa.google.disabled Authenticator App successfully deactivated. @@ -4570,7 +4570,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Controller\UserSettingsController.php:346 Part-DB1\src\Controller\UserSettingsController.php:332 - + user.settings.2fa.backup_codes.regenerated New backup codes successfully generated. @@ -4580,7 +4580,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\AttachmentDataTable.php:148 Part-DB1\src\DataTables\AttachmentDataTable.php:148 - + attachment.table.filename File name @@ -4590,7 +4590,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\AttachmentDataTable.php:153 Part-DB1\src\DataTables\AttachmentDataTable.php:153 - + attachment.table.filesize File size @@ -4610,7 +4610,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:193 Part-DB1\src\DataTables\PartsDataTable.php:200 - + true true @@ -4632,7 +4632,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:201 Part-DB1\src\Form\Type\SIUnitType.php:139 - + false false @@ -4642,7 +4642,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\Column\LogEntryTargetColumn.php:128 Part-DB1\src\DataTables\Column\LogEntryTargetColumn.php:119 - + log.target_deleted deleted @@ -4653,7 +4653,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\Column\RevertLogColumn.php:60 new - + log.undo.undelete Undelete element @@ -4664,7 +4664,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\Column\RevertLogColumn.php:66 new - + log.undo.undo Undo change @@ -4675,7 +4675,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\Column\RevertLogColumn.php:86 new - + log.undo.revert Revert element to this timestamp @@ -4685,7 +4685,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:173 Part-DB1\src\DataTables\LogDataTable.php:161 - + log.id ID @@ -4695,7 +4695,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:178 Part-DB1\src\DataTables\LogDataTable.php:166 - + log.timestamp Timestamp @@ -4705,7 +4705,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:183 Part-DB1\src\DataTables\LogDataTable.php:171 - + log.type Event @@ -4715,7 +4715,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:191 Part-DB1\src\DataTables\LogDataTable.php:179 - + log.level Level @@ -4725,7 +4725,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:200 Part-DB1\src\DataTables\LogDataTable.php:188 - + log.user User @@ -4735,7 +4735,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:213 Part-DB1\src\DataTables\LogDataTable.php:201 - + log.target_type Target type @@ -4745,7 +4745,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:226 Part-DB1\src\DataTables\LogDataTable.php:214 - + log.target Target @@ -4756,7 +4756,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\LogDataTable.php:218 new - + log.extra Extra @@ -4766,7 +4766,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:168 Part-DB1\src\DataTables\PartsDataTable.php:116 - + part.table.name Name @@ -4776,7 +4776,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:178 Part-DB1\src\DataTables\PartsDataTable.php:126 - + part.table.id Id @@ -4786,7 +4786,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:182 Part-DB1\src\DataTables\PartsDataTable.php:130 - + part.table.description Description @@ -4796,7 +4796,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:185 Part-DB1\src\DataTables\PartsDataTable.php:133 - + part.table.category Category @@ -4806,7 +4806,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:190 Part-DB1\src\DataTables\PartsDataTable.php:138 - + part.table.footprint Footprint @@ -4816,7 +4816,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:194 Part-DB1\src\DataTables\PartsDataTable.php:142 - + part.table.manufacturer Manufacturer @@ -4826,7 +4826,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:197 Part-DB1\src\DataTables\PartsDataTable.php:145 - + part.table.storeLocations Storage locations @@ -4836,7 +4836,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:216 Part-DB1\src\DataTables\PartsDataTable.php:164 - + part.table.amount Amount @@ -4846,7 +4846,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:224 Part-DB1\src\DataTables\PartsDataTable.php:172 - + part.table.minamount Min. Amount @@ -4856,7 +4856,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:232 Part-DB1\src\DataTables\PartsDataTable.php:180 - + part.table.partUnit Measurement Unit @@ -4866,7 +4866,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:236 Part-DB1\src\DataTables\PartsDataTable.php:184 - + part.table.addedDate Created at @@ -4876,7 +4876,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:240 Part-DB1\src\DataTables\PartsDataTable.php:188 - + part.table.lastModified Last modified @@ -4886,7 +4886,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:244 Part-DB1\src\DataTables\PartsDataTable.php:192 - + part.table.needsReview Needs review @@ -4896,7 +4896,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:251 Part-DB1\src\DataTables\PartsDataTable.php:199 - + part.table.favorite Favorite @@ -4906,7 +4906,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:258 Part-DB1\src\DataTables\PartsDataTable.php:206 - + part.table.manufacturingStatus Status @@ -4920,7 +4920,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:210 Part-DB1\src\Form\Part\PartBaseType.php:88 - + m_status.unknown Unknown @@ -4932,7 +4932,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:211 Part-DB1\src\Form\Part\PartBaseType.php:88 - + m_status.announced Announced @@ -4944,7 +4944,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:212 Part-DB1\src\Form\Part\PartBaseType.php:88 - + m_status.active Active @@ -4956,7 +4956,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:213 Part-DB1\src\Form\Part\PartBaseType.php:88 - + m_status.nrfnd Not recommended for new designs @@ -4968,7 +4968,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:214 Part-DB1\src\Form\Part\PartBaseType.php:88 - + m_status.eol End of life @@ -4980,7 +4980,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:215 Part-DB1\src\Form\Part\PartBaseType.php:88 - + m_status.discontinued Discontinued @@ -4990,7 +4990,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:271 Part-DB1\src\DataTables\PartsDataTable.php:219 - + part.table.mpn MPN @@ -5000,7 +5000,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:275 Part-DB1\src\DataTables\PartsDataTable.php:223 - + part.table.mass Mass @@ -5010,7 +5010,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:279 Part-DB1\src\DataTables\PartsDataTable.php:227 - + part.table.tags Tags @@ -5020,7 +5020,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\DataTables\PartsDataTable.php:283 Part-DB1\src\DataTables\PartsDataTable.php:231 - + part.table.attachments Attachments @@ -5030,7 +5030,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\EventSubscriber\UserSystem\LoginSuccessSubscriber.php:82 Part-DB1\src\EventSubscriber\LoginSuccessListener.php:82 - + flash.login_successful Login successful @@ -5041,7 +5041,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:77 src\Form\ImportType.php:68 - + JSON JSON @@ -5052,7 +5052,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:77 src\Form\ImportType.php:68 - + XML XML @@ -5063,7 +5063,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:77 src\Form\ImportType.php:68 - + CSV CSV @@ -5074,7 +5074,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:77 src\Form\ImportType.php:68 - + YAML YAML @@ -5084,7 +5084,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:124 Part-DB1\src\Form\AdminPages\ImportType.php:124 - + import.abort_on_validation.help When this option is activated, the whole import process is aborted if invalid data is detected. If not selected, the invalid data is ignored and the importer will try to import the other elements. @@ -5095,7 +5095,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:86 src\Form\ImportType.php:70 - + import.csv_separator CSV separator @@ -5106,7 +5106,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:93 src\Form\ImportType.php:72 - + parent.label Parent element @@ -5117,7 +5117,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:101 src\Form\ImportType.php:75 - + import.file File @@ -5128,7 +5128,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:111 src\Form\ImportType.php:78 - + import.preserve_children Preserve child elements on import @@ -5139,7 +5139,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:120 src\Form\ImportType.php:80 - + import.abort_on_validation Abort on invalid data @@ -5150,7 +5150,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AdminPages\ImportType.php:132 src\Form\ImportType.php:85 - + import.btn Import @@ -5160,7 +5160,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:113 Part-DB1\src\Form\AttachmentFormType.php:109 - + attachment.edit.secure_file.help An attachment marked private can only be accessed by authenticated users with the proper permission. If this is activated no thumbnails are generated and access to file is less performant. @@ -5170,7 +5170,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:127 Part-DB1\src\Form\AttachmentFormType.php:123 - + attachment.edit.url.help You can specify an URL to an external file here, or input an keyword which is used to search in built-in resources (e.g. footprints) @@ -5180,7 +5180,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:82 Part-DB1\src\Form\AttachmentFormType.php:79 - + attachment.edit.name Name @@ -5190,7 +5190,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:85 Part-DB1\src\Form\AttachmentFormType.php:82 - + attachment.edit.attachment_type Attachment type @@ -5200,7 +5200,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:94 Part-DB1\src\Form\AttachmentFormType.php:91 - + attachment.edit.show_in_table Show in table @@ -5210,7 +5210,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:105 Part-DB1\src\Form\AttachmentFormType.php:102 - + attachment.edit.secure_file Private attachment @@ -5220,7 +5220,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:119 Part-DB1\src\Form\AttachmentFormType.php:115 - + attachment.edit.url URL @@ -5230,7 +5230,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:133 Part-DB1\src\Form\AttachmentFormType.php:129 - + attachment.edit.download_url Download external file @@ -5240,7 +5240,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\AttachmentFormType.php:146 Part-DB1\src\Form\AttachmentFormType.php:142 - + attachment.edit.file Upload file @@ -5250,7 +5250,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:68 Part-DB1\src\Services\ElementTypeNameGenerator.php:86 - + part.label Part @@ -5260,7 +5260,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:68 Part-DB1\src\Services\ElementTypeNameGenerator.php:87 - + part_lot.label Part lot @@ -5269,7 +5269,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:78 - + label_options.barcode_type.none None @@ -5278,7 +5278,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:78 - + label_options.barcode_type.qr QR Code (recommended) @@ -5287,7 +5287,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:78 - + label_options.barcode_type.code128 Code 128 (recommended) @@ -5296,7 +5296,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:78 - + label_options.barcode_type.code39 Code 39 (recommended) @@ -5305,7 +5305,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:78 - + label_options.barcode_type.code93 Code 93 @@ -5314,7 +5314,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:78 - + label_options.barcode_type.datamatrix Datamatrix @@ -5323,7 +5323,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:122 - + label_options.lines_mode.html Placeholders @@ -5332,7 +5332,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:122 - + label.options.lines_mode.twig Twig @@ -5341,16 +5341,16 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:126 - + label_options.lines_mode.help - If you select Twig here, the content field is interpreted as Twig template. See <a href="https://twig.symfony.com/doc/3.x/templates.html">Twig documentation</a> and <a href="https://docs.part-db.de/usage/labels.html#twig-mode">Wiki</a> for more information. + Twig documentation and Wiki for more information.]]> Part-DB1\src\Form\LabelOptionsType.php:47 - + label_options.page_size.label Label size @@ -5359,7 +5359,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:66 - + label_options.supported_elements.label Target type @@ -5368,7 +5368,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:75 - + label_options.barcode_type.label Barcode @@ -5377,7 +5377,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:102 - + label_profile.lines.label Content @@ -5386,7 +5386,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:111 - + label_options.additional_css.label Additional styles (CSS) @@ -5395,7 +5395,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:120 - + label_options.lines_mode.label Parser mode @@ -5404,7 +5404,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:51 - + label_options.width.placeholder Width @@ -5413,7 +5413,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelOptionsType.php:60 - + label_options.height.placeholder Height @@ -5422,7 +5422,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelSystem\LabelDialogType.php:49 - + label_generator.target_id.range_hint You can specify multiple IDs (e.g. 1,2,3) and/or a range (1-3) here to generate labels for multiple elements at once. @@ -5431,7 +5431,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelSystem\LabelDialogType.php:46 - + label_generator.target_id.label Target IDs @@ -5440,7 +5440,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelSystem\LabelDialogType.php:59 - + label_generator.update Update @@ -5449,7 +5449,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelSystem\ScanDialogType.php:36 - + scan_dialog.input Input @@ -5458,7 +5458,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\LabelSystem\ScanDialogType.php:44 - + scan_dialog.submit Submit @@ -5467,7 +5467,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:41 - + parameters.name.placeholder e.g. DC Current Gain @@ -5476,7 +5476,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:50 - + parameters.symbol.placeholder e.g. h_{FE} @@ -5485,7 +5485,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:60 - + parameters.text.placeholder e.g. Test conditions @@ -5494,7 +5494,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:71 - + parameters.max.placeholder e.g. 350 @@ -5503,7 +5503,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:82 - + parameters.min.placeholder e.g. 100 @@ -5512,7 +5512,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:93 - + parameters.typical.placeholder e.g. 200 @@ -5521,7 +5521,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:103 - + parameters.unit.placeholder e.g. V @@ -5530,7 +5530,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\ParameterType.php:114 - + parameter.group.placeholder e.g. Technical Specifications @@ -5540,7 +5540,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\OrderdetailType.php:72 Part-DB1\src\Form\Part\OrderdetailType.php:75 - + orderdetails.edit.supplierpartnr Supplier part number @@ -5550,7 +5550,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\OrderdetailType.php:81 Part-DB1\src\Form\Part\OrderdetailType.php:84 - + orderdetails.edit.supplier Supplier @@ -5560,7 +5560,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\OrderdetailType.php:87 Part-DB1\src\Form\Part\OrderdetailType.php:90 - + orderdetails.edit.url Link to offer @@ -5570,7 +5570,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\OrderdetailType.php:93 Part-DB1\src\Form\Part\OrderdetailType.php:96 - + orderdetails.edit.obsolete No longer available @@ -5580,7 +5580,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\OrderdetailType.php:75 Part-DB1\src\Form\Part\OrderdetailType.php:78 - + orderdetails.edit.supplierpartnr.placeholder e.g. BC 547 @@ -5590,7 +5590,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:101 Part-DB1\src\Form\Part\PartBaseType.php:99 - + part.edit.name Name @@ -5600,7 +5600,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:109 Part-DB1\src\Form\Part\PartBaseType.php:107 - + part.edit.description Description @@ -5610,7 +5610,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:120 Part-DB1\src\Form\Part\PartBaseType.php:118 - + part.edit.mininstock Minimum stock @@ -5620,7 +5620,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:129 Part-DB1\src\Form\Part\PartBaseType.php:127 - + part.edit.category Category @@ -5630,7 +5630,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:135 Part-DB1\src\Form\Part\PartBaseType.php:133 - + part.edit.footprint Footprint @@ -5640,7 +5640,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:142 Part-DB1\src\Form\Part\PartBaseType.php:140 - + part.edit.tags Tags @@ -5650,7 +5650,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:154 Part-DB1\src\Form\Part\PartBaseType.php:152 - + part.edit.manufacturer.label Manufacturer @@ -5660,7 +5660,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:161 Part-DB1\src\Form\Part\PartBaseType.php:159 - + part.edit.manufacturer_url.label Link to product page @@ -5670,7 +5670,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:167 Part-DB1\src\Form\Part\PartBaseType.php:165 - + part.edit.mpn Manufacturer part number @@ -5680,7 +5680,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:173 Part-DB1\src\Form\Part\PartBaseType.php:171 - + part.edit.manufacturing_status Manufacturing status @@ -5690,7 +5690,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:181 Part-DB1\src\Form\Part\PartBaseType.php:179 - + part.edit.needs_review Needs review @@ -5700,7 +5700,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:189 Part-DB1\src\Form\Part\PartBaseType.php:187 - + part.edit.is_favorite Favorite @@ -5710,7 +5710,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:197 Part-DB1\src\Form\Part\PartBaseType.php:195 - + part.edit.mass Mass @@ -5720,7 +5720,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:203 Part-DB1\src\Form\Part\PartBaseType.php:201 - + part.edit.partUnit Measuring unit @@ -5730,7 +5730,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:212 Part-DB1\src\Form\Part\PartBaseType.php:210 - + part.edit.comment Notes @@ -5740,7 +5740,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:250 Part-DB1\src\Form\Part\PartBaseType.php:246 - + part.edit.master_attachment Preview image @@ -5751,7 +5751,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:276 src\Form\PartType.php:91 - + part.edit.save Save changes @@ -5762,7 +5762,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:277 src\Form\PartType.php:92 - + part.edit.reset Reset changes @@ -5772,7 +5772,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:105 Part-DB1\src\Form\Part\PartBaseType.php:103 - + part.edit.name.placeholder e.g. BC547 @@ -5782,7 +5782,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:115 Part-DB1\src\Form\Part\PartBaseType.php:113 - + part.edit.description.placeholder e.g. NPN 45V, 0,1A, 0,5W @@ -5792,7 +5792,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartBaseType.php:123 Part-DB1\src\Form\Part\PartBaseType.php:121 - + part.editmininstock.placeholder e.g. 1 @@ -5802,7 +5802,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:69 Part-DB1\src\Form\Part\PartLotType.php:69 - + part_lot.edit.description Description @@ -5812,7 +5812,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:78 Part-DB1\src\Form\Part\PartLotType.php:78 - + part_lot.edit.location Storage location @@ -5822,7 +5822,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:89 Part-DB1\src\Form\Part\PartLotType.php:89 - + part_lot.edit.amount Amount @@ -5832,7 +5832,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:98 Part-DB1\src\Form\Part\PartLotType.php:97 - + part_lot.edit.instock_unknown Amount unknown @@ -5842,7 +5842,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:109 Part-DB1\src\Form\Part\PartLotType.php:108 - + part_lot.edit.needs_refill Needs refill @@ -5852,7 +5852,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:120 Part-DB1\src\Form\Part\PartLotType.php:119 - + part_lot.edit.expiration_date Expiration date @@ -5862,7 +5862,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Part\PartLotType.php:128 Part-DB1\src\Form\Part\PartLotType.php:125 - + part_lot.edit.comment Notes @@ -5872,7 +5872,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Permissions\PermissionsType.php:99 Part-DB1\src\Form\Permissions\PermissionsType.php:99 - + perm.group.other Miscellaneous @@ -5882,7 +5882,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\TFAGoogleSettingsType.php:97 Part-DB1\src\Form\TFAGoogleSettingsType.php:97 - + tfa_google.enable Enable authenticator app @@ -5892,7 +5892,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\TFAGoogleSettingsType.php:101 Part-DB1\src\Form\TFAGoogleSettingsType.php:101 - + tfa_google.disable Deactivate authenticator app @@ -5902,7 +5902,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\TFAGoogleSettingsType.php:74 Part-DB1\src\Form\TFAGoogleSettingsType.php:74 - + google_confirmation Confirmation code @@ -5913,7 +5913,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\UserSettingsType.php:108 src\Form\UserSettingsType.php:46 - + user.timezone.label Timezone @@ -5923,7 +5923,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\UserSettingsType.php:133 Part-DB1\src\Form\UserSettingsType.php:132 - + user.currency.label Preferred currency @@ -5934,7 +5934,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\UserSettingsType.php:139 src\Form\UserSettingsType.php:53 - + save Apply changes @@ -5945,7 +5945,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\UserSettingsType.php:140 src\Form\UserSettingsType.php:54 - + reset Discard changes @@ -5956,7 +5956,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\UserSettingsType.php:104 src\Form\UserSettingsType.php:45 - + user_settings.language.placeholder Serverwide language @@ -5967,7 +5967,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\UserSettingsType.php:115 src\Form\UserSettingsType.php:48 - + user_settings.timezone.placeholder Serverwide Timezone @@ -5977,7 +5977,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:79 Part-DB1\src\Services\ElementTypeNameGenerator.php:79 - + attachment.label Attachment @@ -5987,7 +5987,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:81 Part-DB1\src\Services\ElementTypeNameGenerator.php:81 - + attachment_type.label Attachment type @@ -5997,7 +5997,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:82 Part-DB1\src\Services\ElementTypeNameGenerator.php:82 - + project.label Project @@ -6007,7 +6007,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:85 Part-DB1\src\Services\ElementTypeNameGenerator.php:85 - + measurement_unit.label Measurement unit @@ -6017,7 +6017,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:90 Part-DB1\src\Services\ElementTypeNameGenerator.php:90 - + currency.label Currency @@ -6027,7 +6027,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:91 Part-DB1\src\Services\ElementTypeNameGenerator.php:91 - + orderdetail.label Order detail @@ -6037,7 +6037,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:92 Part-DB1\src\Services\ElementTypeNameGenerator.php:92 - + pricedetail.label Price detail @@ -6047,7 +6047,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:94 Part-DB1\src\Services\ElementTypeNameGenerator.php:94 - + user.label User @@ -6056,7 +6056,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:95 - + parameter.label Parameter @@ -6065,7 +6065,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\ElementTypeNameGenerator.php:96 - + label_profile.label Label profile @@ -6076,7 +6076,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\LogSystem\LogEntryExtraFormatter.php:161 new - + log.element_deleted.old_name.unknown Unknown @@ -6086,7 +6086,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\MarkdownParser.php:73 Part-DB1\src\Services\MarkdownParser.php:73 - + markdown.loading Loading markdown. If this message does not disappear, try to reload the page. @@ -6096,7 +6096,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\PasswordResetManager.php:98 Part-DB1\src\Services\PasswordResetManager.php:98 - + pw_reset.email.subject Password reset for your Part-DB account @@ -6105,7 +6105,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:108 - + tree.tools.tools Tools @@ -6116,7 +6116,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:107 src\Services\ToolsTreeBuilder.php:74 - + tree.tools.edit Edit @@ -6127,7 +6127,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:108 src\Services\ToolsTreeBuilder.php:81 - + tree.tools.show Show @@ -6137,7 +6137,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:111 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:109 - + tree.tools.system System @@ -6146,7 +6146,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:123 - + tree.tools.tools.label_dialog Label generator @@ -6155,7 +6155,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:130 - + tree.tools.tools.label_scanner Scanner @@ -6166,7 +6166,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:126 src\Services\ToolsTreeBuilder.php:62 - + tree.tools.edit.attachment_types Attachment types @@ -6177,7 +6177,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:132 src\Services\ToolsTreeBuilder.php:64 - + tree.tools.edit.categories Categories @@ -6188,7 +6188,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:138 src\Services\ToolsTreeBuilder.php:66 - + tree.tools.edit.projects Projects @@ -6199,7 +6199,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:144 src\Services\ToolsTreeBuilder.php:68 - + tree.tools.edit.suppliers Suppliers @@ -6210,7 +6210,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:150 src\Services\ToolsTreeBuilder.php:70 - + tree.tools.edit.manufacturer Manufacturers @@ -6220,7 +6220,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:179 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:156 - + tree.tools.edit.storelocation Storage locations @@ -6230,7 +6230,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:185 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:162 - + tree.tools.edit.footprint Footprints @@ -6240,7 +6240,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:191 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:168 - + tree.tools.edit.currency Currencies @@ -6250,7 +6250,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:197 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:174 - + tree.tools.edit.measurement_unit Measurement Unit @@ -6259,7 +6259,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 - + tree.tools.edit.label_profile Label profiles @@ -6269,7 +6269,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:209 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:180 - + tree.tools.edit.part New part @@ -6280,7 +6280,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:197 src\Services\ToolsTreeBuilder.php:77 - + tree.tools.show.all_parts Show all parts @@ -6290,7 +6290,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:232 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 - + tree.tools.show.all_attachments Attachments @@ -6301,7 +6301,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:210 new - + tree.tools.show.statistics Statistics @@ -6311,7 +6311,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:258 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:229 - + tree.tools.system.users Users @@ -6321,7 +6321,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:264 Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:235 - + tree.tools.system.groups Groups @@ -6332,7 +6332,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:242 new - + tree.tools.system.event_log Event log @@ -6343,7 +6343,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Services\Trees\TreeViewGenerator.php:95 src\Services\TreeBuilder.php:124 - + entity.tree.new New Element @@ -6353,7 +6353,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\Parts\info\_attachments_info.html.twig:34 obsolete - + attachment.external_file External file @@ -6363,7 +6363,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\templates\Parts\info\_attachments_info.html.twig:62 obsolete - + attachment.edit Edit @@ -6374,7 +6374,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can templates\base.html.twig:88 obsolete - + barcode.scan Scan Barcode @@ -6385,7 +6385,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can src\Form\UserSettingsType.php:49 obsolete - + user.theme.label Theme @@ -6396,7 +6396,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can src\Form\UserSettingsType.php:50 obsolete - + user_settings.theme.placeholder Serverwide Theme @@ -6406,7 +6406,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Type\SIUnitType.php:141 obsolete - + M M @@ -6416,14 +6416,14 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Type\SIUnitType.php:141 obsolete - + k k - + @@ -6432,7 +6432,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Type\SIUnitType.php:141 obsolete - + m m @@ -6442,7 +6442,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Part-DB1\src\Form\Type\SIUnitType.php:141 obsolete - + µ µ @@ -6453,7 +6453,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.user_login.ip IP @@ -6467,7 +6467,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.undo_mode.undo Change undone @@ -6481,7 +6481,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.undo_mode.revert Element reverted @@ -6492,7 +6492,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.element_created.original_instock Old instock @@ -6503,7 +6503,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.element_deleted.old_name Old name @@ -6514,7 +6514,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.element_edited.changed_fields Changed fields @@ -6525,7 +6525,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.instock_changed.comment Comment @@ -6536,7 +6536,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can new obsolete - + log.collection_deleted.deleted Deleted element: @@ -6547,7 +6547,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + go.exclamation Go! @@ -6558,7 +6558,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + language.english English @@ -6569,7 +6569,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + language.german German @@ -6579,7 +6579,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + flash.password_change_needed Password change needed! @@ -6589,7 +6589,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment.table.type Attachment type @@ -6599,7 +6599,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment.table.element Associated element @@ -6609,7 +6609,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment.edit.isPicture Picture? @@ -6619,7 +6619,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment.edit.is3DModel 3D model? @@ -6629,7 +6629,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment.edit.isBuiltin Builtin? @@ -6639,7 +6639,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.default_comment.placeholder e.g. useful for switching @@ -6649,7 +6649,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + tfa_backup.regenerate_codes Generate new backup codes @@ -6659,7 +6659,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.noneofitschild.self A element can not be its own parent. @@ -6669,7 +6669,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.noneofitschild.children The parent can not be one of the children of itself. @@ -6679,7 +6679,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.part_lot.location_full.no_increasment The storage location was marked as full, so you can not increase the instock amount. (New amount max. {{ old_amount }}) @@ -6689,7 +6689,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.part_lot.location_full The storage location was marked as full, so you can not add a new part to it. @@ -6699,7 +6699,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.part_lot.only_existing The storage location was marked as "only existing", so you can not add new part to it. @@ -6709,7 +6709,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.part_lot.single_part The storage location was marked as "single part", so you can not add a new part to it. @@ -6719,7 +6719,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + m_status.active.help The part is currently and in the foreseeable future in production @@ -6729,7 +6729,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + m_status.announced.help The part was announced but is not available yet. @@ -6739,7 +6739,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + m_status.discontinued.help The part is discontinued and not produced anymore. @@ -6749,7 +6749,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + m_status.eol.help The product has reached its end-of-life and the production will be stopped soon. @@ -6759,7 +6759,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + m_status.nrfnd.help The part is currently in production but is not recommended for new designs. @@ -6769,7 +6769,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + m_status.unknown.help The manufacturing status of the part is not known. @@ -6779,7 +6779,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + flash.success Success @@ -6789,7 +6789,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + flash.error Error @@ -6799,7 +6799,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + flash.warning Warning @@ -6809,7 +6809,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + flash.notice Notice @@ -6819,7 +6819,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + flash.info Info @@ -6829,7 +6829,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + validator.noLockout You can not withdraw yourself the "change permission" permission, to prevent that you lockout yourself accidentally. @@ -6839,7 +6839,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment_type.edit.filetype_filter Allowed file extensions @@ -6849,7 +6849,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment_type.edit.filetype_filter.help You can specify a comma separated list of file extension or mime types, which an uploaded file must have when assigned to this attachment type. To allow all supported image files, you can use image/*. @@ -6859,7 +6859,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + attachment_type.edit.filetype_filter.placeholder e.g. .txt, application/pdf, image/* @@ -6870,7 +6870,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + part.name.placeholder e.g. BC547 @@ -6880,7 +6880,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + entity.edit.not_selectable Not selectable @@ -6890,7 +6890,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + entity.edit.not_selectable.help If this option is activated, this element can not be assigned to a part property. Useful if this element is just used for grouping. @@ -6900,7 +6900,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + bbcode.hint You can use BBCode here (e.g. [b]Bold[/b]) @@ -6910,7 +6910,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + entity.create Create element @@ -6920,7 +6920,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + entity.edit.save Save @@ -6930,7 +6930,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_footprints Disable footprints @@ -6940,7 +6940,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_footprints.help If this option is activated, the footprint property is disabled for all parts with this category. @@ -6950,7 +6950,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_manufacturers Disable manufacturers @@ -6960,7 +6960,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_manufacturers.help If this option is activated, the manufacturer property is disabled for all parts with this category. @@ -6970,7 +6970,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_autodatasheets Disable automatic datasheet links @@ -6980,7 +6980,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_autodatasheets.help If this option is activated, no automatic links to datasheets are created for parts with this category. @@ -6990,7 +6990,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_properties Disable properties @@ -7000,7 +7000,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.disable_properties.help If this option is activated, the part properties are disabled for parts with this category. @@ -7010,7 +7010,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.partname_hint Part name hint @@ -7020,7 +7020,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.partname_hint.placeholder e.g. 100nF @@ -7030,7 +7030,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.partname_regex Name filter @@ -7040,7 +7040,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.default_description Default description @@ -7050,7 +7050,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.default_description.placeholder e.g. Capacitor, 10mm x 10mm, SMD @@ -7060,7 +7060,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + category.edit.default_comment Default notes @@ -7070,7 +7070,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + company.edit.address Address @@ -7080,7 +7080,7 @@ If you have done this incorrectly or if a computer is no longer trusted, you can obsolete obsolete - + company.edit.address.placeholder e.g. Examplestreet 314 Exampletown @@ -7091,7 +7091,7 @@ Exampletown obsolete obsolete - + company.edit.phone_number Phone number @@ -7101,7 +7101,7 @@ Exampletown obsolete obsolete - + company.edit.phone_number.placeholder +49 12345 6789 @@ -7111,7 +7111,7 @@ Exampletown obsolete obsolete - + company.edit.fax_number Fax number @@ -7121,7 +7121,7 @@ Exampletown obsolete obsolete - + company.edit.email Email @@ -7131,7 +7131,7 @@ Exampletown obsolete obsolete - + company.edit.email.placeholder e.g. contact@foo.bar @@ -7141,7 +7141,7 @@ Exampletown obsolete obsolete - + company.edit.website Website @@ -7151,7 +7151,7 @@ Exampletown obsolete obsolete - + company.edit.website.placeholder https://www.foo.bar @@ -7161,7 +7161,7 @@ Exampletown obsolete obsolete - + company.edit.auto_product_url Product URL @@ -7171,7 +7171,7 @@ Exampletown obsolete obsolete - + company.edit.auto_product_url.help This field is used to determine a link to the part on the company page. %PARTNUMBER% will be replaced with the order number. @@ -7181,7 +7181,7 @@ Exampletown obsolete obsolete - + company.edit.auto_product_url.placeholder https://foo.bar/product/%PARTNUMBER% @@ -7191,7 +7191,7 @@ Exampletown obsolete obsolete - + currency.edit.iso_code ISO code @@ -7201,7 +7201,7 @@ Exampletown obsolete obsolete - + currency.edit.exchange_rate Exchange rate @@ -7211,7 +7211,7 @@ Exampletown obsolete obsolete - + footprint.edit.3d_model 3D model @@ -7221,7 +7221,7 @@ Exampletown obsolete obsolete - + mass_creation.lines Input @@ -7231,7 +7231,7 @@ Exampletown obsolete obsolete - + mass_creation.lines.placeholder Element 1 Element 1.1 @@ -7246,7 +7246,7 @@ Element 3 obsolete obsolete - + entity.mass_creation.btn Create @@ -7256,7 +7256,7 @@ Element 3 obsolete obsolete - + measurement_unit.edit.is_integer Is integer @@ -7266,7 +7266,7 @@ Element 3 obsolete obsolete - + measurement_unit.edit.is_integer.help If this option is activated, all values with this unit will be rounded to whole numbers. @@ -7276,7 +7276,7 @@ Element 3 obsolete obsolete - + measurement_unit.edit.use_si_prefix Use SI prefix @@ -7286,7 +7286,7 @@ Element 3 obsolete obsolete - + measurement_unit.edit.use_si_prefix.help If this option is activated, values are outputted with SI prefixes (e.g. 1,2kg instead of 1200g) @@ -7296,7 +7296,7 @@ Element 3 obsolete obsolete - + measurement_unit.edit.unit_symbol Unit symbol @@ -7306,7 +7306,7 @@ Element 3 obsolete obsolete - + measurement_unit.edit.unit_symbol.placeholder e.g. m @@ -7316,7 +7316,7 @@ Element 3 obsolete obsolete - + storelocation.edit.is_full.label Storelocation full @@ -7326,7 +7326,7 @@ Element 3 obsolete obsolete - + storelocation.edit.is_full.help If this option is selected, it is neither possible to add new parts to this storelocation or to increase the amount of existing parts. @@ -7336,7 +7336,7 @@ Element 3 obsolete obsolete - + storelocation.limit_to_existing.label Limit to existing parts @@ -7346,7 +7346,7 @@ Element 3 obsolete obsolete - + storelocation.limit_to_existing.help If this option is activated, it is not possible to add new parts to this storelocation, but the amount of existing parts can be increased. @@ -7356,7 +7356,7 @@ Element 3 obsolete obsolete - + storelocation.only_single_part.label Only single part @@ -7366,7 +7366,7 @@ Element 3 obsolete obsolete - + storelocation.only_single_part.help If this option is activated, only a single part (with every amount) can be assigned to this storage location. Useful for small SMD boxes or feeders. @@ -7376,7 +7376,7 @@ Element 3 obsolete obsolete - + storelocation.storage_type.label Storage type @@ -7386,7 +7386,7 @@ Element 3 obsolete obsolete - + storelocation.storage_type.help You can select a measurement unit here, which a part must have to be able to be assigned to this storage location @@ -7396,7 +7396,7 @@ Element 3 obsolete obsolete - + supplier.edit.default_currency Default currency @@ -7406,7 +7406,7 @@ Element 3 obsolete obsolete - + supplier.shipping_costs.label Shipping Costs @@ -7416,7 +7416,7 @@ Element 3 obsolete obsolete - + user.username.placeholder e.g. j.doe @@ -7426,7 +7426,7 @@ Element 3 obsolete obsolete - + user.firstName.placeholder e.g John @@ -7436,7 +7436,7 @@ Element 3 obsolete obsolete - + user.lastName.placeholder e.g. Doe @@ -7446,7 +7446,7 @@ Element 3 obsolete obsolete - + user.email.placeholder j.doe@ecorp.com @@ -7456,7 +7456,7 @@ Element 3 obsolete obsolete - + user.department.placeholder e.g. Development @@ -7466,7 +7466,7 @@ Element 3 obsolete obsolete - + user.settings.pw_new.label New password @@ -7476,7 +7476,7 @@ Element 3 obsolete obsolete - + user.settings.pw_confirm.label Confirm new password @@ -7486,7 +7486,7 @@ Element 3 obsolete obsolete - + user.edit.needs_pw_change User needs to change password @@ -7496,7 +7496,7 @@ Element 3 obsolete obsolete - + user.edit.user_disabled User disabled (no login possible) @@ -7506,7 +7506,7 @@ Element 3 obsolete obsolete - + user.create Create user @@ -7516,7 +7516,7 @@ Element 3 obsolete obsolete - + user.edit.save Save @@ -7526,7 +7526,7 @@ Element 3 obsolete obsolete - + entity.edit.reset Discard changes @@ -7537,7 +7537,7 @@ Element 3 obsolete obsolete - + part.withdraw.caption: Withdraw parts: @@ -7548,7 +7548,7 @@ Element 3 obsolete obsolete - + part.withdraw.btn Withdraw @@ -7559,7 +7559,7 @@ Element 3 obsolete obsolete - + part.withdraw.comment: Comment/Purpose @@ -7570,7 +7570,7 @@ Element 3 obsolete obsolete - + part.add.caption Add parts @@ -7581,7 +7581,7 @@ Element 3 obsolete obsolete - + part.add.btn Add @@ -7592,7 +7592,7 @@ Element 3 obsolete obsolete - + part.add.comment Comment/Purpose @@ -7603,7 +7603,7 @@ Element 3 obsolete obsolete - + admin.comment Notes @@ -7614,7 +7614,7 @@ Element 3 obsolete obsolete - + manufacturer_url.label Manufacturer link @@ -7625,7 +7625,7 @@ Element 3 obsolete obsolete - + part.description.placeholder e.g. NPN 45V 0,1A 0,5W @@ -7636,7 +7636,7 @@ Element 3 obsolete obsolete - + part.instock.placeholder e.g. 10 @@ -7647,7 +7647,7 @@ Element 3 obsolete obsolete - + part.mininstock.placeholder e.g. 5 @@ -7657,7 +7657,7 @@ Element 3 obsolete obsolete - + homepage.basedOn Based on work of @@ -7667,7 +7667,7 @@ Element 3 obsolete obsolete - + homepage.others and others @@ -7677,7 +7677,7 @@ Element 3 obsolete obsolete - + part.order.price_per Price per @@ -7687,7 +7687,7 @@ Element 3 obsolete obsolete - + part.withdraw.caption Withdraw parts @@ -7697,7 +7697,7 @@ Element 3 obsolete obsolete - + datatable.datatable.lengthMenu _MENU_ @@ -7707,7 +7707,7 @@ Element 3 obsolete obsolete - + perm.group.parts Parts @@ -7717,7 +7717,7 @@ Element 3 obsolete obsolete - + perm.group.structures Data structures @@ -7727,7 +7727,7 @@ Element 3 obsolete obsolete - + perm.group.system System @@ -7737,7 +7737,7 @@ Element 3 obsolete obsolete - + perm.parts Parts @@ -7747,7 +7747,7 @@ Element 3 obsolete obsolete - + perm.read View @@ -7757,7 +7757,7 @@ Element 3 obsolete obsolete - + perm.edit Edit @@ -7767,7 +7767,7 @@ Element 3 obsolete obsolete - + perm.create Create @@ -7777,7 +7777,7 @@ Element 3 obsolete obsolete - + perm.part.move Change category @@ -7787,7 +7787,7 @@ Element 3 obsolete obsolete - + perm.delete Delete @@ -7797,7 +7797,7 @@ Element 3 obsolete obsolete - + perm.part.search Search @@ -7807,7 +7807,7 @@ Element 3 obsolete obsolete - + perm.part.all_parts List all parts @@ -7817,7 +7817,7 @@ Element 3 obsolete obsolete - + perm.part.no_price_parts List parts without price info @@ -7827,7 +7827,7 @@ Element 3 obsolete obsolete - + perm.part.obsolete_parts List obsolete parts @@ -7837,7 +7837,7 @@ Element 3 obsolete obsolete - + perm.part.unknown_instock_parts Show parts with unknown instock @@ -7847,7 +7847,7 @@ Element 3 obsolete obsolete - + perm.part.change_favorite Change favorite status @@ -7857,7 +7857,7 @@ Element 3 obsolete obsolete - + perm.part.show_favorite List favorite parts @@ -7867,7 +7867,7 @@ Element 3 obsolete obsolete - + perm.part.show_last_edit_parts Show last edited/added parts @@ -7877,7 +7877,7 @@ Element 3 obsolete obsolete - + perm.part.show_users Show last modifying user @@ -7887,7 +7887,7 @@ Element 3 obsolete obsolete - + perm.part.show_history Show history @@ -7897,7 +7897,7 @@ Element 3 obsolete obsolete - + perm.part.name Name @@ -7907,7 +7907,7 @@ Element 3 obsolete obsolete - + perm.part.description Description @@ -7917,7 +7917,7 @@ Element 3 obsolete obsolete - + perm.part.instock Instock @@ -7927,7 +7927,7 @@ Element 3 obsolete obsolete - + perm.part.mininstock Minimum instock @@ -7937,7 +7937,7 @@ Element 3 obsolete obsolete - + perm.part.comment Notes @@ -7947,7 +7947,7 @@ Element 3 obsolete obsolete - + perm.part.storelocation Storelocation @@ -7957,7 +7957,7 @@ Element 3 obsolete obsolete - + perm.part.manufacturer Manufacturer @@ -7967,7 +7967,7 @@ Element 3 obsolete obsolete - + perm.part.orderdetails Order information @@ -7977,7 +7977,7 @@ Element 3 obsolete obsolete - + perm.part.prices Prices @@ -7987,7 +7987,7 @@ Element 3 obsolete obsolete - + perm.part.attachments File attachments @@ -7997,7 +7997,7 @@ Element 3 obsolete obsolete - + perm.part.order Orders @@ -8007,7 +8007,7 @@ Element 3 obsolete obsolete - + perm.storelocations Storelocations @@ -8017,7 +8017,7 @@ Element 3 obsolete obsolete - + perm.move Move @@ -8027,7 +8027,7 @@ Element 3 obsolete obsolete - + perm.list_parts List parts @@ -8037,7 +8037,7 @@ Element 3 obsolete obsolete - + perm.part.footprints Footprints @@ -8047,7 +8047,7 @@ Element 3 obsolete obsolete - + perm.part.categories Categories @@ -8057,7 +8057,7 @@ Element 3 obsolete obsolete - + perm.part.supplier Suppliers @@ -8067,7 +8067,7 @@ Element 3 obsolete obsolete - + perm.part.manufacturers Manufacturers @@ -8077,7 +8077,7 @@ Element 3 obsolete obsolete - + perm.projects Projects @@ -8087,7 +8087,7 @@ Element 3 obsolete obsolete - + perm.part.attachment_types Attachment types @@ -8097,7 +8097,7 @@ Element 3 obsolete obsolete - + perm.tools.import Import @@ -8107,7 +8107,7 @@ Element 3 obsolete obsolete - + perm.tools.labels Labels @@ -8117,7 +8117,7 @@ Element 3 obsolete obsolete - + perm.tools.calculator Resistor calculator @@ -8127,7 +8127,7 @@ Element 3 obsolete obsolete - + perm.tools.footprints Footprints @@ -8137,7 +8137,7 @@ Element 3 obsolete obsolete - + perm.tools.ic_logos IC logos @@ -8147,7 +8147,7 @@ Element 3 obsolete obsolete - + perm.tools.statistics Statistics @@ -8157,7 +8157,7 @@ Element 3 obsolete obsolete - + perm.edit_permissions Edit permissions @@ -8167,7 +8167,7 @@ Element 3 obsolete obsolete - + perm.users.edit_user_name Edit user name @@ -8177,7 +8177,7 @@ Element 3 obsolete obsolete - + perm.users.edit_change_group Change group @@ -8187,7 +8187,7 @@ Element 3 obsolete obsolete - + perm.users.edit_infos Edit info @@ -8197,7 +8197,7 @@ Element 3 obsolete obsolete - + perm.users.edit_permissions Edit permissions @@ -8207,7 +8207,7 @@ Element 3 obsolete obsolete - + perm.users.set_password Set password @@ -8217,7 +8217,7 @@ Element 3 obsolete obsolete - + perm.users.change_user_settings Change user settings @@ -8227,7 +8227,7 @@ Element 3 obsolete obsolete - + perm.database.see_status Show status @@ -8237,7 +8237,7 @@ Element 3 obsolete obsolete - + perm.database.update_db Update DB @@ -8247,7 +8247,7 @@ Element 3 obsolete obsolete - + perm.database.read_db_settings Read DB settings @@ -8257,7 +8257,7 @@ Element 3 obsolete obsolete - + perm.database.write_db_settings Write DB settings @@ -8267,7 +8267,7 @@ Element 3 obsolete obsolete - + perm.config.read_config Read config @@ -8277,7 +8277,7 @@ Element 3 obsolete obsolete - + perm.config.edit_config Edit config @@ -8287,7 +8287,7 @@ Element 3 obsolete obsolete - + perm.config.server_info Server info @@ -8297,7 +8297,7 @@ Element 3 obsolete obsolete - + perm.config.use_debug Use debug tools @@ -8307,7 +8307,7 @@ Element 3 obsolete obsolete - + perm.show_logs Show logs @@ -8317,7 +8317,7 @@ Element 3 obsolete obsolete - + perm.delete_logs Delete logs @@ -8327,7 +8327,7 @@ Element 3 obsolete obsolete - + perm.self.edit_infos Edit info @@ -8337,7 +8337,7 @@ Element 3 obsolete obsolete - + perm.self.edit_username Edit username @@ -8347,7 +8347,7 @@ Element 3 obsolete obsolete - + perm.self.show_permissions View permissions @@ -8357,7 +8357,7 @@ Element 3 obsolete obsolete - + perm.self.show_logs Show own log entries @@ -8367,7 +8367,7 @@ Element 3 obsolete obsolete - + perm.self.create_labels Create labels @@ -8377,7 +8377,7 @@ Element 3 obsolete obsolete - + perm.self.edit_options Edit options @@ -8387,7 +8387,7 @@ Element 3 obsolete obsolete - + perm.self.delete_profiles Delete profiles @@ -8397,7 +8397,7 @@ Element 3 obsolete obsolete - + perm.self.edit_profiles Edit profiles @@ -8407,7 +8407,7 @@ Element 3 obsolete obsolete - + perm.part.tools Tools @@ -8417,7 +8417,7 @@ Element 3 obsolete obsolete - + perm.groups Groups @@ -8427,7 +8427,7 @@ Element 3 obsolete obsolete - + perm.users Users @@ -8437,7 +8437,7 @@ Element 3 obsolete obsolete - + perm.database Database @@ -8447,7 +8447,7 @@ Element 3 obsolete obsolete - + perm.config Configuration @@ -8457,7 +8457,7 @@ Element 3 obsolete obsolete - + perm.system System @@ -8467,7 +8467,7 @@ Element 3 obsolete obsolete - + perm.self Own user @@ -8477,7 +8477,7 @@ Element 3 obsolete obsolete - + perm.labels Labels @@ -8487,7 +8487,7 @@ Element 3 obsolete obsolete - + perm.part.category Category @@ -8497,7 +8497,7 @@ Element 3 obsolete obsolete - + perm.part.minamount Minimum amount @@ -8507,7 +8507,7 @@ Element 3 obsolete obsolete - + perm.part.footprint Footprint @@ -8517,7 +8517,7 @@ Element 3 obsolete obsolete - + perm.part.mpn MPN @@ -8527,7 +8527,7 @@ Element 3 obsolete obsolete - + perm.part.status Manufacturing status @@ -8537,7 +8537,7 @@ Element 3 obsolete obsolete - + perm.part.tags Tags @@ -8547,7 +8547,7 @@ Element 3 obsolete obsolete - + perm.part.unit Part unit @@ -8557,7 +8557,7 @@ Element 3 obsolete obsolete - + perm.part.mass Mass @@ -8567,7 +8567,7 @@ Element 3 obsolete obsolete - + perm.part.lots Part lots @@ -8577,7 +8577,7 @@ Element 3 obsolete obsolete - + perm.show_users Show last modifying user @@ -8587,7 +8587,7 @@ Element 3 obsolete obsolete - + perm.currencies Currencies @@ -8597,7 +8597,7 @@ Element 3 obsolete obsolete - + perm.measurement_units Measurement unit @@ -8607,7 +8607,7 @@ Element 3 obsolete obsolete - + user.settings.pw_old.label Old password @@ -8617,7 +8617,7 @@ Element 3 obsolete obsolete - + pw_reset.submit Reset password @@ -8627,7 +8627,7 @@ Element 3 obsolete obsolete - + u2f_two_factor Security key (U2F) @@ -8637,13 +8637,13 @@ Element 3 obsolete obsolete - + google Google - + tfa.provider.webauthn_two_factor_provider Security key @@ -8653,7 +8653,7 @@ Element 3 obsolete obsolete - + tfa.provider.google Authenticator app @@ -8663,7 +8663,7 @@ Element 3 obsolete obsolete - + Login successful Login successful @@ -8673,7 +8673,7 @@ Element 3 obsolete obsolete - + log.type.exception Unhandled exception (obsolete) @@ -8683,7 +8683,7 @@ Element 3 obsolete obsolete - + log.type.user_login User login @@ -8693,7 +8693,7 @@ Element 3 obsolete obsolete - + log.type.user_logout User logout @@ -8703,7 +8703,7 @@ Element 3 obsolete obsolete - + log.type.unknown Unknown @@ -8713,7 +8713,7 @@ Element 3 obsolete obsolete - + log.type.element_created Element created @@ -8723,7 +8723,7 @@ Element 3 obsolete obsolete - + log.type.element_edited Element edited @@ -8733,7 +8733,7 @@ Element 3 obsolete obsolete - + log.type.element_deleted Element deleted @@ -8743,7 +8743,7 @@ Element 3 obsolete obsolete - + log.type.database_updated Database updated @@ -8752,7 +8752,7 @@ Element 3 obsolete - + perm.revert_elements Revert element @@ -8761,7 +8761,7 @@ Element 3 obsolete - + perm.show_history Show history @@ -8770,7 +8770,7 @@ Element 3 obsolete - + perm.tools.lastActivity Show last activity @@ -8779,7 +8779,7 @@ Element 3 obsolete - + perm.tools.timeTravel Show old element versions (time travel) @@ -8788,7 +8788,7 @@ Element 3 obsolete - + log.type. __log.type. @@ -8797,7 +8797,7 @@ Element 3 obsolete - + tfa_u2f.key_added_successful Security key added successfully. @@ -8806,7 +8806,7 @@ Element 3 obsolete - + Username Username @@ -8815,7 +8815,7 @@ Element 3 obsolete - + log.type.security.google_disabled Authenticator App disabled @@ -8824,7 +8824,7 @@ Element 3 obsolete - + log.type.security.u2f_removed Security key removed @@ -8833,7 +8833,7 @@ Element 3 obsolete - + log.type.security.u2f_added Security key added @@ -8842,7 +8842,7 @@ Element 3 obsolete - + log.type.security.backup_keys_reset Backup keys regenerated @@ -8851,7 +8851,7 @@ Element 3 obsolete - + log.type.security.google_enabled Authenticator App enabled @@ -8860,7 +8860,7 @@ Element 3 obsolete - + log.type.security.password_changed Password changed @@ -8869,7 +8869,7 @@ Element 3 obsolete - + log.type.security.trusted_device_reset Trusted devices resetted @@ -8878,7 +8878,7 @@ Element 3 obsolete - + log.type.collection_element_deleted Element of Collection deleted @@ -8887,7 +8887,7 @@ Element 3 obsolete - + log.type.security.password_reset Password reset @@ -8896,7 +8896,7 @@ Element 3 obsolete - + log.type.security.2fa_admin_reset Two Factor Reset by Administrator @@ -8905,7 +8905,7 @@ Element 3 obsolete - + log.type.user_not_allowed Unauthorized access attempt @@ -8914,7 +8914,7 @@ Element 3 obsolete - + log.database_updated.success Success @@ -8923,7 +8923,7 @@ Element 3 obsolete - + label_options.barcode_type.2D 2D @@ -8932,7 +8932,7 @@ Element 3 obsolete - + label_options.barcode_type.1D 1D @@ -8941,7 +8941,7 @@ Element 3 obsolete - + perm.part.parameters Parameters @@ -8950,7 +8950,7 @@ Element 3 obsolete - + perm.attachment_show_private View private attachments @@ -8959,7 +8959,7 @@ Element 3 obsolete - + perm.tools.label_scanner Label scanner @@ -8968,7 +8968,7 @@ Element 3 obsolete - + perm.self.read_profiles Read profiles @@ -8977,7 +8977,7 @@ Element 3 obsolete - + perm.self.create_profiles Create profiles @@ -8986,2452 +8986,2458 @@ Element 3 obsolete - + perm.labels.use_twig Use twig mode - + label_profile.showInDropdown Show in quick select - + group.edit.enforce_2fa Enforce Two-factor authentication (2FA) - + group.edit.enforce_2fa.help If this option is enabled, every direct member of this group, has to configure at least one second-factor for authentication. Recommended for administrative groups with much permissions. - + selectpicker.empty Nothing selected - + selectpicker.nothing_selected Nothing selected - + entity.delete.must_not_contain_parts Element "%PATH%" still contains parts! You have to move the parts, to be able to delete this element. - + entity.delete.must_not_contain_attachments Attachment type still contains attachments. Change their type, to be able to delete this attachment type. - + entity.delete.must_not_contain_prices Currency still contains price details. You have to change their currency to be able to delete this element. - + entity.delete.must_not_contain_users Users still uses this group! Change their group, to be able to delete this group. - + part.table.edit Edit - + part.table.edit.title Edit part - + part_list.action.action.title Select action - + part_list.action.action.group.favorite Favorite status - + part_list.action.action.favorite Favorite - + part_list.action.action.unfavorite Unfavorite - + part_list.action.action.group.change_field Change field - + part_list.action.action.change_category Change category - + part_list.action.action.change_footprint Change footprint - + part_list.action.action.change_manufacturer Change manufacturer - + part_list.action.action.change_unit Change part unit - + part_list.action.action.delete Delete - + part_list.action.submit Submit - + part_list.action.part_count %count% parts selected! - + company.edit.quick.website Open website - + company.edit.quick.email Send email - + company.edit.quick.phone Call phone - + company.edit.quick.fax Send fax - + company.fax_number.placeholder e.g. +49 1234 567890 - + part.edit.save_and_clone Save and clone - + validator.file_ext_not_allowed File extension not allowed for this attachment type. - + tools.reel_calc.title SMD Reel calculator - + tools.reel_calc.inner_dia Inner diameter - + tools.reel_calc.outer_dia Outer diameter - + tools.reel_calc.tape_thick Tape thickness - + tools.reel_calc.part_distance Part distance - + tools.reel_calc.update Update - + tools.reel_calc.parts_per_meter Parts per meter - + tools.reel_calc.result_length Tape length - + tools.reel_calc.result_amount Approx. parts count - + tools.reel_calc.outer_greater_inner_error Error: Outer diameter must be greater than inner diameter! - + tools.reel_calc.missing_values.error Please fill in all values! - + tools.reel_calc.load_preset Load preset - + tools.reel_calc.explanation This calculator gives you an estimation, how many parts are remaining on an SMD reel. Measure the noted the dimensions on the reel (or use some of the presets) and click "Update" to get an result. - + perm.tools.reel_calculator SMD Reel calculator - + tree.tools.tools.reel_calculator SMD Reel calculator - + user.pw_change_needed.flash Your password needs to be changed! Please set a new password. - + tree.root_node.text Root node - + part_list.action.select_null Empty element - + part_list.action.delete-title Do you really want to delete these parts? - + part_list.action.delete-message These parts and any associated information (like attachments, price information, etc.) will be deleted. This can not be undone! - + part.table.actions.success Actions finished successfully. - + attachment.edit.delete.confirm Do you really want to delete this attachment? - + filter.text_constraint.value.operator.EQ Is - + filter.text_constraint.value.operator.NEQ Is not - + filter.text_constraint.value.operator.STARTS Starts with - + filter.text_constraint.value.operator.CONTAINS Contains - + filter.text_constraint.value.operator.ENDS Ends with - + filter.text_constraint.value.operator.LIKE LIKE pattern - + filter.text_constraint.value.operator.REGEX Regular expression - + filter.number_constraint.value.operator.BETWEEN Between - + filter.number_constraint.AND and - + filter.entity_constraint.operator.EQ Is (excluding children) - + filter.entity_constraint.operator.NEQ Is not (excluding children) - + filter.entity_constraint.operator.INCLUDING_CHILDREN Is (including children) - + filter.entity_constraint.operator.EXCLUDING_CHILDREN Is not (excluding children) - + part.filter.dbId Database ID - + filter.tags_constraint.operator.ANY Any of the tags - + filter.tags_constraint.operator.ALL All the tags - + filter.tags_constraint.operator.NONE None of the tags - + part.filter.lot_count Number of lots - + part.filter.attachments_count Number of attachments - + part.filter.orderdetails_count Number of orderdetails - + part.filter.lotExpirationDate Lot expiration date - + part.filter.lotNeedsRefill Any lot needs refill - + part.filter.lotUnknwonAmount Any lot has unknown amount - + part.filter.attachmentName Attachment name - + filter.choice_constraint.operator.ANY Any of - + filter.choice_constraint.operator.NONE None of - + part.filter.amount_sum Total amount - + filter.submit Update - + filter.discard Discard changes - + filter.clear_filters Clear all filters - + filter.title Filter - + filter.parameter_value_constraint.operator.= Typ. Value = - + filter.parameter_value_constraint.operator.!= Typ. Value != - + filter.parameter_value_constraint.operator.< - Typ. Value < + - + filter.parameter_value_constraint.operator.> - Typ. Value > + ]]> - + filter.parameter_value_constraint.operator.<= - Typ. Value <= + - + filter.parameter_value_constraint.operator.>= - Typ. Value >= + =]]> - + filter.parameter_value_constraint.operator.BETWEEN Typ. Value is between - + filter.parameter_value_constraint.operator.IN_RANGE In Value range - + filter.parameter_value_constraint.operator.NOT_IN_RANGE Not in Value range - + filter.parameter_value_constraint.operator.GREATER_THAN_RANGE Greater than Value range - + filter.parameter_value_constraint.operator.GREATER_EQUAL_RANGE Greater equal than Value range - + filter.parameter_value_constraint.operator.LESS_THAN_RANGE Less than Value range - + filter.parameter_value_constraint.operator.LESS_EQUAL_RANGE Less equal than Value range - + filter.parameter_value_constraint.operator.RANGE_IN_RANGE Range is completely in Value range - + filter.parameter_value_constraint.operator.RANGE_INTERSECT_RANGE Range intersects Value range - + filter.text_constraint.value No value set - + filter.number_constraint.value1 No value set - + filter.number_constraint.value2 Maximum value - + filter.datetime_constraint.value1 No datetime set - + filter.datetime_constraint.value2 Maximum datetime - + filter.constraint.add Add constraint - + part.filter.parameters_count Number of parameters - + part.filter.lotDescription Lot description - + parts_list.search.searching_for - Searching parts with keyword <b>%keyword%</b> + %keyword%]]> - + parts_list.search_options.caption Enabled search options - + attachment.table.element_type Associated element type - + log.level.debug Debug - + log.level.info Info - + log.level.notice Notice - + log.level.warning Warning - + log.level.error Error - + log.level.critical Critical - + log.level.alert Alert - + log.level.emergency Emergency - + log.type.security Security related event - + log.type.instock_changed [LEGACY] Instock changed - + log.target_id Target element ID - + entity.info.parts_count_recursive Number of parts with this element or its sub elements - + tools.server_infos.title Server info - + permission.preset.read_only Read-Only - + permission.preset.read_only.desc Only allow read operations on data - + permission.preset.all_inherit Inherit all - + permission.preset.all_inherit.desc Set all permissions to Inherit - + permission.preset.all_forbid Forbid all - + permission.preset.all_forbid.desc Set all permissions to Forbid - + permission.preset.all_allow Allow all - + permission.preset.all_allow.desc Set all permissions to allow - + perm.server_infos Server info - + permission.preset.editor Editor - + permission.preset.editor.desc Allow changing parts and data structures - + permission.preset.admin Admin - + permission.preset.admin.desc Allow administrative actions - + permission.preset.button Apply preset - + perm.attachments.show_private Show private attachments - + perm.attachments.list_attachments Show list of all attachments - + user.edit.permission_success Permission preset applied successfully. Check if the new permissions fit your needs. - + perm.group.data Data - + part_list.action.action.group.needs_review Needs Review - + part_list.action.action.set_needs_review Set Needs Review Status - + part_list.action.action.unset_needs_review Unset Needs Review Status - + part.edit.ipn Internal Part Number (IPN) - + part.ipn.not_defined Not defined - + part.table.ipn IPN - + currency.edit.update_rate Retrieve exchange rate - + currency.edit.exchange_rate_update.unsupported_currency The currency is unsupported by the exchange rate provider. Check your exchange rate provider configuration. - + currency.edit.exchange_rate_update.generic_error Unable to retrieve the exchange rate. Check your exchange rate provider configuration. - + currency.edit.exchange_rate_updated.success Retrieved the exchange rate successfully. - + project.bom.quantity BOM Qty. - + project.bom.mountnames Mount names - + project.bom.name Name - + project.bom.comment Notes - + project.bom.part Part - + project.bom.add_entry Add entry - + part_list.action.group.projects Projects - + part_list.action.projects.add_to_project Add parts to project - + project.bom.delete.confirm Do you really want to delete this BOM entry? - + project.add_parts_to_project Add parts to project BOM - + part.info.add_part_to_project Add this part to a project - + project_bom_entry.label BOM entry - + project.edit.status Project status - + project.status.draft Draft - + project.status.planning Planning - + project.status.in_production In production - + project.status.finished Finished - + project.status.archived Archived - + part.new_build_part.error.build_part_already_exists The project already has a build part! - + project.edit.associated_build_part Associated builds part - + project.edit.associated_build_part.add Add builds part - + project.edit.associated_build.hint This part represents the builds of this project, which are stored somewhere. - + part.info.projectBuildPart.hint This part represents the builds of the following project and is associated with it - + part.is_build_part Is project builds part - + project.info.title Project info - + project.info.bom_entries_count BOM entries - + project.info.sub_projects_count Subprojects - + project.info.bom_add_parts Add BOM entries - + project.info.info.label Info - + project.info.sub_projects.label Subprojects - + project.bom.price Price - + part.info.withdraw_modal.title.withdraw Withdraw parts from lot - + part.info.withdraw_modal.title.add Add parts to lot - + part.info.withdraw_modal.title.move Move parts from lot to another lot - + part.info.withdraw_modal.amount Amount - + part.info.withdraw_modal.move_to Move to - + part.info.withdraw_modal.comment Comment - + part.info.withdraw_modal.comment.hint You can set a comment here describing why you are doing this operation (e.g. for what you need the parts). This info will be saved in the log. - + modal.close Close - + modal.submit Submit - + part.withdraw.success Added/Moved/Withdrawn parts successfully. - + perm.parts_stock Parts Stock - + perm.parts_stock.withdraw Withdraw parts from stock - + perm.parts_stock.add Add parts to stock - + perm.parts_stock.move Move parts between lots - + user.permissions_schema_updated The permission schema of your user were upgraded to the latest version. - + log.type.part_stock_changed Part Stock changed - + log.part_stock_changed.withdraw Stock withdrawn - + log.part_stock_changed.add Stock added - + log.part_stock_changed.move Stock moved - + log.part_stock_changed.comment Comment - + log.part_stock_changed.change Change - + log.part_stock_changed.move_target Move target - + tools.builtin_footprints_viewer.title Builtin footprint image gallery - + tools.builtin_footprints_viewer.hint This gallery lists all available built-in footprint images. If you want to use them in an attachment, type in the name (or a keyword) in the path field of the attachment and select the image from the dropdown select. - + tools.ic_logos.title IC logos - + part_list.action.group.labels Labels - + part_list.action.projects.generate_label Generate labels (for parts) - + part_list.action.projects.generate_label_lot Generate labels (for part lots) - + part_list.action.generate_label.empty Empty label - + project.info.builds.label Build - + project.builds.build_not_possible Build not possible: Parts not stocked - + project.builds.following_bom_entries_miss_instock The following parts have not enough stock to build this project at least once: - + project.builds.stocked stocked - + project.builds.needed needed - + project.builds.build_possible Build possible - + project.builds.number_of_builds_possible - You have enough stocked to build <b>%max_builds%</b> builds of this project. + %max_builds% builds of this project.]]> - + project.builds.check_project_status - The current project status is <b>"%project_status%"</b>. You should check if you really want to build the project with this status! + "%project_status%". You should check if you really want to build the project with this status!]]> - + project.builds.following_bom_entries_miss_instock_n You do not have enough parts stocked to build this project %number_of_builds% times. The following parts have missing instock: - + project.build.flash.invalid_input Can not build project. Check input! - + project.build.required_qty Required quantity - + project.build.btn_build Build - + project.build.help Choose from which part lots the stock to build this project should be taken (and in which amount). Check the checkbox for each BOM Entry, when you are finished withdrawing the parts, or use the top checkbox to check all boxes at once. - + project.build.buildsPartLot.new_lot Create new lot - + project.build.add_builds_to_builds_part Add builds to project builds part - + project.build.builds_part_lot Target lot - + project.builds.number_of_builds Build amount - + project.builds.no_stocked_builds Number of stocked builds - + user.change_avatar.label Change profile picture - + user_settings.change_avatar.label Change profile picture - + user_settings.remove_avatar.label Remove profile picture - + part.edit.name.category_hint Hint from category - + category.edit.partname_regex.placeholder e.g "/Capacitor \d+ nF/i" - + category.edit.partname_regex.help A PCRE-compatible regular expression, which a part name have to match. - + entity.select.add_hint - Use -> to create nested structures, e.g. "Node 1->Node 1.1" + to create nested structures, e.g. "Node 1->Node 1.1"]]> - + entity.select.group.new_not_added_to_DB New (not added to DB yet) - + part.edit.save_and_new Save and create new empty part - + homepage.first_steps.title First steps - + homepage.first_steps.introduction - Your database is still empty. You might want to read the <a href="%url%">documentation</a> or start to creating the following data structures: + documentation or start to creating the following data structures:]]> - + homepage.first_steps.create_part - Or you can directly <a href="%url%">create a new part</a>. + create a new part.]]> - + homepage.first_steps.hide_hint This box will hide as soon as you have created your first part. - + homepage.forum.text - For questions about Part-DB use the <a href="%href%" class="link-external" target="_blank">discussion forum</a> + discussion forum]]> - + log.element_edited.changed_fields.category Category - + log.element_edited.changed_fields.footprint Footprint - + log.element_edited.changed_fields.manufacturer Manufacturer - + log.element_edited.changed_fields.value_typical typ. value - + log.element_edited.changed_fields.pw_reset_expires Password reset - + log.element_edited.changed_fields.comment Notes - + log.element_edited.changed_fields.supplierpartnr Supplier part number - + log.element_edited.changed_fields.supplier_product_url Link to offer - + log.element_edited.changed_fields.price Price - + log.element_edited.changed_fields.min_discount_quantity Minimum discount amount - + log.element_edited.changed_fields.original_filename Original filename - + log.element_edited.changed_fields.path Filepath - + log.element_edited.changed_fields.description Description - + log.element_edited.changed_fields.manufacturing_status Manufacturing status - + log.element_edited.changed_fields.options.barcode_type Barcode type - + log.element_edited.changed_fields.status Status - + log.element_edited.changed_fields.quantity BOM Qty. - + log.element_edited.changed_fields.mountnames Mountnames - + log.element_edited.changed_fields.name Name - + log.element_edited.changed_fields.part Part - + log.element_edited.changed_fields.price_currency Currency of price - + log.element_edited.changed_fields.partname_hint Part name hint - + log.element_edited.changed_fields.partname_regex Name filter - + log.element_edited.changed_fields.disable_footprints Disable footprints - + log.element_edited.changed_fields.disable_manufacturers Disable manufacturers - + log.element_edited.changed_fields.disable_autodatasheets Disable automatic datasheet links - + log.element_edited.changed_fields.disable_properties Disable properties - + log.element_edited.changed_fields.default_description Default description - + log.element_edited.changed_fields.default_comment Default notes - + log.element_edited.changed_fields.filetype_filter Allowed file extensions - + log.element_edited.changed_fields.not_selectable Not selected - + log.element_edited.changed_fields.parent Parent element - + log.element_edited.changed_fields.shipping_costs Shipping costs - + log.element_edited.changed_fields.default_currency Default currency - + log.element_edited.changed_fields.address Address - + log.element_edited.changed_fields.phone_number Phone number - + log.element_edited.changed_fields.fax_number Fax number - + log.element_edited.changed_fields.email_address Email - + log.element_edited.changed_fields.website Website - + log.element_edited.changed_fields.auto_product_url Product URL - + log.element_edited.changed_fields.is_full Storelocation full - + log.element_edited.changed_fields.limit_to_existing_parts Limit to existing parts - + log.element_edited.changed_fields.only_single_part Only single part - + log.element_edited.changed_fields.storage_type Storage type - + log.element_edited.changed_fields.footprint_3d 3D model - + log.element_edited.changed_fields.master_picture_attachment Preview image - + log.element_edited.changed_fields.exchange_rate Exchange rate - + log.element_edited.changed_fields.iso_code Exchange rate - + log.element_edited.changed_fields.unit Unit symbol - + log.element_edited.changed_fields.is_integer Is integer - + log.element_edited.changed_fields.use_si_prefix Use SI prefix - + log.element_edited.changed_fields.options.width Width - + log.element_edited.changed_fields.options.height Height - + log.element_edited.changed_fields.options.supported_element Target type - + log.element_edited.changed_fields.options.additional_css Additional styles (CSS) - + log.element_edited.changed_fields.options.lines Content - + log.element_edited.changed_fields.permissions.data Permissions - + log.element_edited.changed_fields.disabled Disabled - + log.element_edited.changed_fields.theme Theme - + log.element_edited.changed_fields.timezone Timezone - + log.element_edited.changed_fields.language Language - + log.element_edited.changed_fields.email Email - + log.element_edited.changed_fields.department Department - + log.element_edited.changed_fields.last_name Last name - + log.element_edited.changed_fields.first_name First name - + log.element_edited.changed_fields.group Group - + log.element_edited.changed_fields.currency Preferred currency - + log.element_edited.changed_fields.enforce2FA Enforce 2FA - + log.element_edited.changed_fields.symbol Symbol - + log.element_edited.changed_fields.value_min Min. value - + log.element_edited.changed_fields.value_max Max. value - + log.element_edited.changed_fields.value_text Text value - + log.element_edited.changed_fields.show_in_table Show in table - + log.element_edited.changed_fields.attachment_type Show in table - + log.element_edited.changed_fields.needs_review Needs review - + log.element_edited.changed_fields.tags Tags - + log.element_edited.changed_fields.mass Mass - + log.element_edited.changed_fields.ipn IPN - + log.element_edited.changed_fields.favorite Favorite - + log.element_edited.changed_fields.minamount Minimum stock - + log.element_edited.changed_fields.manufacturer_product_url Link to product page - + log.element_edited.changed_fields.manufacturer_product_number MPN - + log.element_edited.changed_fields.partUnit Measuring Unit - + log.element_edited.changed_fields.expiration_date Expiration date - + log.element_edited.changed_fields.amount Amount - + log.element_edited.changed_fields.storage_location Storage location - + attachment.max_file_size Maximum file size - + user.saml_user SSO / SAML user - + user.saml_user.pw_change_hint Your user uses single sign-on (SSO). You can not change the password and 2FA settings here. Configure them on your central SSO provider instead! - + login.sso_saml_login Single Sign-On Login (SSO) - + login.local_login_hint The form below is only for log in with a local user. If you want to log in via single sign-on, press the button above. - + part_list.action.action.export Export parts - + part_list.action.export_json Export to JSON - + part_list.action.export_csv Export to CSV - + part_list.action.export_yaml Export to YAML - + part_list.action.export_xml Export to XML - + parts.import.title Import parts - + parts.import.errors.title Import violations - + parts.import.flash.error Errors during import. This is most likely caused by some invalid data. - + parts.import.format.auto Automatic (based on file extension) - + parts.import.flash.error.unknown_format Could not determine the format from the given file! - + parts.import.flash.error.invalid_file File invalid / malformatted. Please check that you have selected the right format! - + parts.import.part_category.label Category override - + parts.import.part_category.help If you select a value here, all imported parts will be assigned to this category. No matter what was set in the data. - + import.create_unknown_datastructures Create unknown datastructures - + import.create_unknown_datastructures.help If this is selected, datastructures (like categories, footprints, etc.) which does not exist in the database yet, will be automatically created. If this is not selected, only existing data structures will be used, and if no matching data structure is found, the part will get assigned nothing - + import.path_delimiter Path delimiter - + import.path_delimiter.help The delimiter used to mark different levels in data structure pathes like category, footprint, etc. - + parts.import.help_documentation - See the <a href="%link%">documentation</a> for more information on the file format. + documentation for more information on the file format.]]> - + parts.import.help You can import parts from existing files with this tool. The parts will be directly written to database, so please check your file beforehand for correct content before uploading it here. - + parts.import.flash.success Part import successful! - + parts.import.errors.imported_entities Imported parts - + perm.import Import data - + parts.import.part_needs_review.label Mark all imported parts as "Needs review" - + parts.import.part_needs_review.help If this option is selected, then all parts will be marked as "Needs review", no matter what was set in the data. - + project.bom_import.flash.success Imported %count% BOM entries successfully. - + project.bom_import.type Type - + project.bom_import.type.kicad_pcbnew KiCAD Pcbnew BOM (CSV file) - + project.bom_import.clear_existing_bom Clear existing BOM entries before importing - + project.bom_import.clear_existing_bom.help Selecting this option will remove all existing BOM entries in the project and overwrite them with the imported BOM file! - + project.bom_import.flash.invalid_file File could not be imported. Please check that you have selected the right file type. Error message: %message% - + project.bom_import.flash.invalid_entries Validation error! Please check your data! - + project.import_bom Import BOM for project - + project.edit.bom.import_bom Import BOM - + measurement_unit.new New Measurement Unit - + measurement_unit.edit Edit Measurement Unit - + user.aboutMe.label About Me - + storelocation.owner.label Owner - + storelocation.part_owner_must_match.label Part Lot owner must match storage location owner - + part_lot.owner Owner - + part_lot.owner.help Only the owner can withdraw or add stock to this lot. - + log.element_edited.changed_fields.owner Owner - + log.element_edited.changed_fields.instock_unknown Amount unknown - + log.element_edited.changed_fields.needs_refill Refill needed - + part.withdraw.access_denied Not allowed to do the desired action. Please check your permissions and the owner of the part lots. - + part.info.amount.less_than_desired Less than desired - + log.cli_user CLI user - + log.element_edited.changed_fields.part_owner_must_match Part owner must match storage location owner - + part.filter.lessThanDesired - In stock less than desired (total amount < min. amount) + - + part.filter.lotOwner Lot owner - + user.show_email_on_profile.label Show email on public profile page - + log.details.title Log details - + log.user_login.login_from_ip Login from IP address - + log.user_login.ip_anonymize_hint If the last digits of the IP address are missing, then the GPDR mode is enabled, in which IP addresses are anynomized. - + log.user_not_allowed.unauthorized_access_attempt_to Unauthorized access attempt to page - + log.user_not_allowed.hint The request was blocked. No action should be required. - + log.no_comment No comment - + log.element_changed.field Field - + log.element_changed.data_before Data before change - + error_table.error An error occured during your request. - + part.table.invalid_regex Invalid regular expression (regex) - + log.element_changed.data_after Data after change - + log.element_changed.diff Difference - + log.undo.undo.short Undo - + log.undo.revert.short Revert to this timestamp - + log.view_version View version - + log.undo.undelete.short Undelete - + log.element_edited.changed_fields.id ID - + log.element_edited.changed_fields.id_owner Owner - + log.element_edited.changed_fields.parent_id Parent - + log.details.delete_entry Delete log entry - + log.delete.message.title Do you really want to delete the log entry? - + log.delete.message If this is an element history entry, this breaks the element history! This can lead to unexpected results when using the time travel function. - + log.collection_deleted.on_collection on Collection - + log.element_edited.changed_fields.attachments Attachments + + + tfa_u2f.add_key.registration_error + An error occurred during the registration of the security key. Try again or use another security key! + + From b7573a40d76d2181a9b0c1f6983da1a0b9b8dc1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 13:14:45 +0200 Subject: [PATCH 31/91] Fixed webauthn two factor authentication --- assets/js/webauthn_tfa.js | 20 ++++++++---- composer.json | 10 ++---- composer.lock | 67 +++++++++++++++++++++++---------------- 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/assets/js/webauthn_tfa.js b/assets/js/webauthn_tfa.js index a2e00595..4d54efc0 100644 --- a/assets/js/webauthn_tfa.js +++ b/assets/js/webauthn_tfa.js @@ -21,8 +21,13 @@ class WebauthnTFA { -// Decodes a Base64Url string - _base64UrlDecode = (input) => { + _b64UrlSafeEncode = (str) => { + const b64 = btoa(str); + return b64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); + } + + // Decodes a Base64Url string + _b64UrlSafeDecode = (input) => { input = input .replace(/-/g, '+') .replace(/_/g, '/'); @@ -39,13 +44,16 @@ class WebauthnTFA { }; // Converts an array of bytes into a Base64Url string - _arrayToBase64String = (a) => btoa(String.fromCharCode(...a)); + _arrayToBase64String = (a) => { + const str = String.fromCharCode(...a); + return this._b64UrlSafeEncode(str); + } // Prepares the public key options object returned by the Webauthn Framework _preparePublicKeyOptions = publicKey => { //Convert challenge from Base64Url string to Uint8Array publicKey.challenge = Uint8Array.from( - this._base64UrlDecode(publicKey.challenge), + this._b64UrlSafeDecode(publicKey.challenge), c => c.charCodeAt(0) ); @@ -67,7 +75,7 @@ class WebauthnTFA { return { ...data, id: Uint8Array.from( - this._base64UrlDecode(data.id), + this._b64UrlSafeDecode(data.id), c => c.charCodeAt(0) ), }; @@ -81,7 +89,7 @@ class WebauthnTFA { return { ...data, id: Uint8Array.from( - this._base64UrlDecode(data.id), + this._b64UrlSafeDecode(data.id), c => c.charCodeAt(0) ), }; diff --git a/composer.json b/composer.json index 49d3625f..078ebaaf 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "florianv/swap": "^4.0", "florianv/swap-bundle": "dev-master", "gregwar/captcha-bundle": "^2.1.0", - "jbtronics/2fa-webauthn": "dev-master", + "jbtronics/2fa-webauthn": "^v2.0.0", "jfcherng/php-diff": "^6.14", "league/csv": "^9.8.0", "league/html-to-markdown": "^5.0.1", @@ -154,11 +154,5 @@ "allow-contrib": false, "require": "6.2.*" } - }, - "repositories": [ - { - "type": "git", - "url": "https://github.com/jbtronics/2fa-webauthn.git" - } - ] + } } diff --git a/composer.lock b/composer.lock index bb395bfb..480b6da2 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": "b0d4bf26f478ca8451e65e618de7bde7", + "content-hash": "fa0dafb8fc42546d15378323ee9b6fb0", "packages": [ { "name": "beberlei/assert", @@ -2454,31 +2454,39 @@ }, { "name": "jbtronics/2fa-webauthn", - "version": "dev-master", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/jbtronics/2fa-webauthn.git", - "reference": "ef886b0654766a6adb1e027ed1b3b57a3cbb9c5a" + "reference": "807ae06ccbc73a17983ea80b5a2e4cc78c07f8ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jbtronics/2fa-webauthn/zipball/807ae06ccbc73a17983ea80b5a2e4cc78c07f8ad", + "reference": "807ae06ccbc73a17983ea80b5a2e4cc78c07f8ad", + "shasum": "" }, "require": { "ext-json": "*", "nyholm/psr7": "^1.5", - "php": "^7.4.0|^8.0", - "scheb/2fa-bundle": "^5.0.0|^6.0.0", - "symfony/framework-bundle": "^5.0|^6.0", + "php": "^8.1", + "scheb/2fa-bundle": "^6.0.0", + "symfony/framework-bundle": "^6.0", "symfony/psr-http-message-bridge": "^2.1", - "web-auth/webauthn-lib": "^3.3|^4.0" + "symfony/uid": "^6.0", + "web-auth/webauthn-lib": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.5", + "roave/security-advisories": "dev-latest" }, - "default-branch": true, "type": "symfony-bundle", "autoload": { "psr-4": { "Jbtronics\\TFAWebauthn\\": "src/" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2497,7 +2505,11 @@ "two-factor-authentication", "webauthn" ], - "time": "2023-05-27T18:21:46+00:00" + "support": { + "issues": "https://github.com/jbtronics/2fa-webauthn/issues", + "source": "https://github.com/jbtronics/2fa-webauthn/tree/v2.0.0" + }, + "time": "2023-06-11T11:09:45+00:00" }, { "name": "jfcherng/php-color-output", @@ -5555,23 +5567,23 @@ }, { "name": "s9e/text-formatter", - "version": "2.13.1", + "version": "2.14.0", "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "bbd9e34e9c30d5daeb780f115fe69cd81dd9c352" + "reference": "48a2f3a3fb18af8d78330204732a3369441c4060" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/bbd9e34e9c30d5daeb780f115fe69cd81dd9c352", - "reference": "bbd9e34e9c30d5daeb780f115fe69cd81dd9c352", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/48a2f3a3fb18af8d78330204732a3369441c4060", + "reference": "48a2f3a3fb18af8d78330204732a3369441c4060", "shasum": "" }, "require": { "ext-dom": "*", "ext-filter": "*", "lib-pcre": ">=8.13", - "php": ">=7.4", + "php": "^8.0", "s9e/regexp-builder": "^1.4", "s9e/sweetdom": "^2.0" }, @@ -5591,7 +5603,7 @@ }, "type": "library", "extra": { - "version": "2.13.1" + "version": "2.14.0" }, "autoload": { "psr-4": { @@ -5623,9 +5635,9 @@ ], "support": { "issues": "https://github.com/s9e/TextFormatter/issues", - "source": "https://github.com/s9e/TextFormatter/tree/2.13.1" + "source": "https://github.com/s9e/TextFormatter/tree/2.14.0" }, - "time": "2023-02-11T00:18:05+00:00" + "time": "2023-06-08T07:19:50+00:00" }, { "name": "sabberworm/php-css-parser", @@ -15582,16 +15594,16 @@ }, { "name": "symfony/maker-bundle", - "version": "v1.48.0", + "version": "v1.49.0", "source": { "type": "git", "url": "https://github.com/symfony/maker-bundle.git", - "reference": "2e428e8432e9879187672fe08f1cc335e2a31dd6" + "reference": "ce1d424f76bbb377f1956cc7641e8e2eafe81cde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/2e428e8432e9879187672fe08f1cc335e2a31dd6", - "reference": "2e428e8432e9879187672fe08f1cc335e2a31dd6", + "url": "https://api.github.com/repos/symfony/maker-bundle/zipball/ce1d424f76bbb377f1956cc7641e8e2eafe81cde", + "reference": "ce1d424f76bbb377f1956cc7641e8e2eafe81cde", "shasum": "" }, "require": { @@ -15605,7 +15617,8 @@ "symfony/filesystem": "^5.4.7|^6.0", "symfony/finder": "^5.4.3|^6.0", "symfony/framework-bundle": "^5.4.7|^6.0", - "symfony/http-kernel": "^5.4.7|^6.0" + "symfony/http-kernel": "^5.4.7|^6.0", + "symfony/process": "^5.4.7|^6.0" }, "conflict": { "doctrine/doctrine-bundle": "<2.4", @@ -15617,9 +15630,8 @@ "doctrine/doctrine-bundle": "^2.4", "doctrine/orm": "^2.10.0", "symfony/http-client": "^5.4.7|^6.0", - "symfony/phpunit-bridge": "^5.4.7|^6.0", + "symfony/phpunit-bridge": "^5.4.17|^6.0", "symfony/polyfill-php80": "^1.16.0", - "symfony/process": "^5.4.7|^6.0", "symfony/security-core": "^5.4.7|^6.0", "symfony/yaml": "^5.4.3|^6.0", "twig/twig": "^2.0|^3.0" @@ -15655,7 +15667,7 @@ ], "support": { "issues": "https://github.com/symfony/maker-bundle/issues", - "source": "https://github.com/symfony/maker-bundle/tree/v1.48.0" + "source": "https://github.com/symfony/maker-bundle/tree/v1.49.0" }, "funding": [ { @@ -15671,7 +15683,7 @@ "type": "tidelift" } ], - "time": "2022-11-14T10:48:46+00:00" + "time": "2023-06-07T13:10:14+00:00" }, { "name": "symfony/phpunit-bridge", @@ -16005,7 +16017,6 @@ "minimum-stability": "stable", "stability-flags": { "florianv/swap-bundle": 20, - "jbtronics/2fa-webauthn": 20, "roave/security-advisories": 20 }, "prefer-stable": false, From 8c430a3af0d610e8cc687ba39c5caf7c2be7f971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 13:42:45 +0200 Subject: [PATCH 32/91] Fixed tests --- src/Entity/UserSystem/User.php | 2 +- src/Security/EnsureSAMLUserForSAMLLoginChecker.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index be4998e4..a2fa7b11 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -222,7 +222,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe */ #[Groups(['full'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] - protected ?\DateTimeInterface $backupCodesGenerationDate; + protected ?\DateTimeInterface $backupCodesGenerationDate = null; /** @var Collection */ diff --git a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php index bba13c01..583760c1 100644 --- a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php +++ b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php @@ -21,10 +21,9 @@ namespace App\Security; use App\Entity\UserSystem\User; -use Hslavich\OneloginSamlBundle\Security\Http\Authenticator\Token\SamlToken; +use Nbgrp\OneloginSamlBundle\Security\Http\Authenticator\Token\SamlToken; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; -use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; use Symfony\Contracts\Translation\TranslatorInterface; From 8d4b8b02b8c314617f95dfee14219fa400cfebce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 13:46:24 +0200 Subject: [PATCH 33/91] Upgraded to symfony 6.3 --- composer.json | 48 +-- composer.lock | 1093 +++++++++++++++++++++++++------------------------ 2 files changed, 593 insertions(+), 548 deletions(-) diff --git a/composer.json b/composer.json index 078ebaaf..88ffa898 100644 --- a/composer.json +++ b/composer.json @@ -46,32 +46,32 @@ "shivas/versioning-bundle": "^4.0", "spatie/db-dumper": "^3.3.1", "symfony/apache-pack": "^1.0", - "symfony/asset": "6.2.*", - "symfony/console": "6.2.*", - "symfony/dotenv": "6.2.*", - "symfony/expression-language": "6.2.*", + "symfony/asset": "6.3.*", + "symfony/console": "6.3.*", + "symfony/dotenv": "6.3.*", + "symfony/expression-language": "6.3.*", "symfony/flex": "^1.1", - "symfony/form": "6.2.*", - "symfony/framework-bundle": "6.2.*", - "symfony/http-client": "6.2.*", - "symfony/http-kernel": "6.2.*", - "symfony/mailer": "6.2.*", + "symfony/form": "6.3.*", + "symfony/framework-bundle": "6.3.*", + "symfony/http-client": "6.3.*", + "symfony/http-kernel": "6.3.*", + "symfony/mailer": "6.3.*", "symfony/monolog-bundle": "^3.1", - "symfony/process": "6.2.*", - "symfony/property-access": "6.2.*", - "symfony/property-info": "6.2.*", - "symfony/proxy-manager-bridge": "6.2.*", - "symfony/rate-limiter": "6.2.*", - "symfony/runtime": "6.2.*", - "symfony/security-bundle": "6.2.*", - "symfony/serializer": "6.2.*", - "symfony/translation": "6.2.*", - "symfony/twig-bundle": "6.2.*", + "symfony/process": "6.3.*", + "symfony/property-access": "6.3.*", + "symfony/property-info": "6.3.*", + "symfony/proxy-manager-bridge": "6.3.*", + "symfony/rate-limiter": "6.3.*", + "symfony/runtime": "6.3.*", + "symfony/security-bundle": "6.3.*", + "symfony/serializer": "6.3.*", + "symfony/translation": "6.3.*", + "symfony/twig-bundle": "6.3.*", "symfony/ux-turbo": "^2.0", - "symfony/validator": "6.2.*", - "symfony/web-link": "6.2.*", + "symfony/validator": "6.3.*", + "symfony/web-link": "6.3.*", "symfony/webpack-encore-bundle": "^1.1", - "symfony/yaml": "6.2.*", + "symfony/yaml": "6.3.*", "tecnickcom/tc-lib-barcode": "^1.15", "twig/cssinliner-extra": "^3.0", "twig/extra-bundle": "^3.0", @@ -97,7 +97,7 @@ "symfony/css-selector": "^5.2", "symfony/debug-bundle": "^5.2", "symfony/maker-bundle": "^1.13", - "symfony/phpunit-bridge": "6.2.*", + "symfony/phpunit-bridge": "6.3.*", "symfony/stopwatch": "^5.2", "symfony/web-profiler-bundle": "^5.2", "symplify/easy-coding-standard": "^11.0", @@ -152,7 +152,7 @@ "extra": { "symfony": { "allow-contrib": false, - "require": "6.2.*" + "require": "6.3.*" } } } diff --git a/composer.lock b/composer.lock index 480b6da2..534c7064 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": "fa0dafb8fc42546d15378323ee9b6fb0", + "content-hash": "e6a210fb5441cc3dd4b0cfa325503fc4", "packages": [ { "name": "beberlei/assert", @@ -6492,16 +6492,16 @@ }, { "name": "symfony/asset", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "223df790e684ecc7bc37323c2d1e265129ca02de" + "reference": "b77a4cc8e266b7e0db688de740f9ee7253aa411c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/223df790e684ecc7bc37323c2d1e265129ca02de", - "reference": "223df790e684ecc7bc37323c2d1e265129ca02de", + "url": "https://api.github.com/repos/symfony/asset/zipball/b77a4cc8e266b7e0db688de740f9ee7253aa411c", + "reference": "b77a4cc8e266b7e0db688de740f9ee7253aa411c", "shasum": "" }, "require": { @@ -6515,9 +6515,6 @@ "symfony/http-foundation": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0" }, - "suggest": { - "symfony/http-foundation": "" - }, "type": "library", "autoload": { "psr-4": { @@ -6544,7 +6541,7 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v6.2.7" + "source": "https://github.com/symfony/asset/tree/v6.3.0" }, "funding": [ { @@ -6560,28 +6557,28 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-04-21T14:41:17+00:00" }, { "name": "symfony/cache", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "1ce7ed8e7ca6948892b6a3a52bb60cf2b04f7c94" + "reference": "357bf04b1380f71e40b2d6592dbf7f2a948ca6b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/1ce7ed8e7ca6948892b6a3a52bb60cf2b04f7c94", - "reference": "1ce7ed8e7ca6948892b6a3a52bb60cf2b04f7c94", + "url": "https://api.github.com/repos/symfony/cache/zipball/357bf04b1380f71e40b2d6592dbf7f2a948ca6b1", + "reference": "357bf04b1380f71e40b2d6592dbf7f2a948ca6b1", "shasum": "" }, "require": { "php": ">=8.1", "psr/cache": "^2.0|^3.0", "psr/log": "^1.1|^2|^3", - "symfony/cache-contracts": "^1.1.7|^2|^3", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/cache-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/var-exporter": "^6.2.10" }, "conflict": { @@ -6598,7 +6595,7 @@ "require-dev": { "cache/integration-tests": "dev-master", "doctrine/dbal": "^2.13.1|^3.0", - "predis/predis": "^1.1", + "predis/predis": "^1.1|^2.0", "psr/simple-cache": "^1.0|^2.0|^3.0", "symfony/config": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", @@ -6640,7 +6637,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.2.10" + "source": "https://github.com/symfony/cache/tree/v6.3.0" }, "funding": [ { @@ -6656,7 +6653,7 @@ "type": "tidelift" } ], - "time": "2023-04-21T15:42:15+00:00" + "time": "2023-05-10T09:21:01+00:00" }, { "name": "symfony/cache-contracts", @@ -6735,38 +6732,109 @@ "time": "2023-05-23T14:45:45+00:00" }, { - "name": "symfony/config", - "version": "v6.2.7", + "name": "symfony/clock", + "version": "v6.3.0", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "249271da6f545d6579e0663374f8249a80be2893" + "url": "https://github.com/symfony/clock.git", + "reference": "ccae3a2f1eb48a2515c84b8d456679fe3d79c9ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/249271da6f545d6579e0663374f8249a80be2893", - "reference": "249271da6f545d6579e0663374f8249a80be2893", + "url": "https://api.github.com/repos/symfony/clock/zipball/ccae3a2f1eb48a2515c84b8d456679fe3d79c9ea", + "reference": "ccae3a2f1eb48a2515c84b8d456679fe3d79c9ea", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/now.php" + ], + "psr-4": { + "Symfony\\Component\\Clock\\": "" + }, + "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": "Decouples applications from the system clock", + "homepage": "https://symfony.com", + "keywords": [ + "clock", + "psr20", + "time" + ], + "support": { + "source": "https://github.com/symfony/clock/tree/v6.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-02-21T10:58:00+00:00" + }, + { + "name": "symfony/config", + "version": "v6.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "a5e00dec161b08c946a2c16eed02adbeedf827ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/a5e00dec161b08c946a2c16eed02adbeedf827ae", + "reference": "a5e00dec161b08c946a2c16eed02adbeedf827ae", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/filesystem": "^5.4|^6.0", "symfony/polyfill-ctype": "~1.8" }, "conflict": { - "symfony/finder": "<5.4" + "symfony/finder": "<5.4", + "symfony/service-contracts": "<2.5" }, "require-dev": { "symfony/event-dispatcher": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", "symfony/messenger": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, "type": "library", "autoload": { "psr-4": { @@ -6793,7 +6861,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.2.7" + "source": "https://github.com/symfony/config/tree/v6.3.0" }, "funding": [ { @@ -6809,27 +6877,27 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-04-25T10:46:17+00:00" }, { "name": "symfony/console", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5aa03db8ef0a5457c316ec580e69562d97734c77" + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5aa03db8ef0a5457c316ec580e69562d97734c77", - "reference": "5aa03db8ef0a5457c316ec580e69562d97734c77", + "url": "https://api.github.com/repos/symfony/console/zipball/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -6851,12 +6919,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -6889,7 +6951,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.11" + "source": "https://github.com/symfony/console/tree/v6.3.0" }, "funding": [ { @@ -6905,7 +6967,7 @@ "type": "tidelift" } ], - "time": "2023-05-26T08:16:21+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/css-selector", @@ -6975,30 +7037,30 @@ }, { "name": "symfony/dependency-injection", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "2dff40fdc5ff1647c5561eb8e4fe574bc58c849d" + "reference": "ebf5f9c5bb5c21d75ab74995ce5e26c3fbbda44d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/2dff40fdc5ff1647c5561eb8e4fe574bc58c849d", - "reference": "2dff40fdc5ff1647c5561eb8e4fe574bc58c849d", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ebf5f9c5bb5c21d75ab74995ce5e26c3fbbda44d", + "reference": "ebf5f9c5bb5c21d75ab74995ce5e26c3fbbda44d", "shasum": "" }, "require": { "php": ">=8.1", "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/service-contracts": "^1.1.6|^2.0|^3.0", - "symfony/var-exporter": "^6.2.7" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.2.10" }, "conflict": { "ext-psr": "<1.1|>=2", "symfony/config": "<6.1", "symfony/finder": "<5.4", - "symfony/proxy-manager-bridge": "<6.2", + "symfony/proxy-manager-bridge": "<6.3", "symfony/yaml": "<5.4" }, "provide": { @@ -7010,12 +7072,6 @@ "symfony/expression-language": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/yaml": "" - }, "type": "library", "autoload": { "psr-4": { @@ -7042,7 +7098,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.2.11" + "source": "https://github.com/symfony/dependency-injection/tree/v6.3.0" }, "funding": [ { @@ -7058,7 +7114,7 @@ "type": "tidelift" } ], - "time": "2023-05-05T15:52:57+00:00" + "time": "2023-05-30T17:12:32+00:00" }, { "name": "symfony/deprecation-contracts", @@ -7129,35 +7185,38 @@ }, { "name": "symfony/doctrine-bridge", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/doctrine-bridge.git", - "reference": "db48a583e5e38e152af8a60c2677c8de76367701" + "reference": "501d0c8dc627d2f6ad6185920d4db74477a98e75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/db48a583e5e38e152af8a60c2677c8de76367701", - "reference": "db48a583e5e38e152af8a60c2677c8de76367701", + "url": "https://api.github.com/repos/symfony/doctrine-bridge/zipball/501d0c8dc627d2f6ad6185920d4db74477a98e75", + "reference": "501d0c8dc627d2f6ad6185920d4db74477a98e75", "shasum": "" }, "require": { "doctrine/event-manager": "^1.2|^2", "doctrine/persistence": "^2|^3", "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "conflict": { + "doctrine/annotations": "<1.13.1", "doctrine/dbal": "<2.13.1", "doctrine/lexer": "<1.1", - "doctrine/orm": "<2.7.4", + "doctrine/orm": "<2.12", "symfony/cache": "<5.4", - "symfony/dependency-injection": "<5.4", + "symfony/dependency-injection": "<6.2", "symfony/form": "<5.4.21|>=6,<6.2.7", + "symfony/http-foundation": "<6.3", "symfony/http-kernel": "<6.2", + "symfony/lock": "<6.3", "symfony/messenger": "<5.4", "symfony/property-info": "<5.4", "symfony/security-bundle": "<5.4", @@ -7165,19 +7224,20 @@ "symfony/validator": "<5.4" }, "require-dev": { - "doctrine/annotations": "^1.10.4|^2", + "doctrine/annotations": "^1.13.1|^2", "doctrine/collections": "^1.0|^2.0", "doctrine/data-fixtures": "^1.1", "doctrine/dbal": "^2.13.1|^3.0", - "doctrine/orm": "^2.7.4", + "doctrine/orm": "^2.12", "psr/log": "^1|^2|^3", "symfony/cache": "^5.4|^6.0", "symfony/config": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", + "symfony/dependency-injection": "^6.2", "symfony/doctrine-messenger": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/form": "^5.4.21|^6.2.7", - "symfony/http-kernel": "^6.2", + "symfony/http-kernel": "^6.3", + "symfony/lock": "^6.3", "symfony/messenger": "^5.4|^6.0", "symfony/property-access": "^5.4|^6.0", "symfony/property-info": "^5.4|^6.0", @@ -7189,14 +7249,6 @@ "symfony/validator": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "doctrine/data-fixtures": "", - "doctrine/dbal": "", - "doctrine/orm": "", - "symfony/form": "", - "symfony/property-info": "", - "symfony/validator": "" - }, "type": "symfony-bridge", "autoload": { "psr-4": { @@ -7223,7 +7275,7 @@ "description": "Provides integration for Doctrine with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/doctrine-bridge/tree/v6.2.11" + "source": "https://github.com/symfony/doctrine-bridge/tree/v6.3.0" }, "funding": [ { @@ -7239,20 +7291,20 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:08:43+00:00" + "time": "2023-05-25T13:09:35+00:00" }, { "name": "symfony/dotenv", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "4481aa45be7a11d2335c1d5b5bbe2f0c6199b105" + "reference": "ceadb434fe2a6763a03d2d110441745834f3dd1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/4481aa45be7a11d2335c1d5b5bbe2f0c6199b105", - "reference": "4481aa45be7a11d2335c1d5b5bbe2f0c6199b105", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/ceadb434fe2a6763a03d2d110441745834f3dd1e", + "reference": "ceadb434fe2a6763a03d2d110441745834f3dd1e", "shasum": "" }, "require": { @@ -7297,7 +7349,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.2.8" + "source": "https://github.com/symfony/dotenv/tree/v6.3.0" }, "funding": [ { @@ -7313,20 +7365,20 @@ "type": "tidelift" } ], - "time": "2023-03-10T10:06:03+00:00" + "time": "2023-04-21T14:41:17+00:00" }, { "name": "symfony/error-handler", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "e847ba47e7a8f9708082990cb40ab4ff0440a11e" + "reference": "99d2d814a6351461af350ead4d963bd67451236f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/e847ba47e7a8f9708082990cb40ab4ff0440a11e", - "reference": "e847ba47e7a8f9708082990cb40ab4ff0440a11e", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/99d2d814a6351461af350ead4d963bd67451236f", + "reference": "99d2d814a6351461af350ead4d963bd67451236f", "shasum": "" }, "require": { @@ -7334,8 +7386,11 @@ "psr/log": "^1|^2|^3", "symfony/var-dumper": "^5.4|^6.0" }, + "conflict": { + "symfony/deprecation-contracts": "<2.5" + }, "require-dev": { - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-kernel": "^5.4|^6.0", "symfony/serializer": "^5.4|^6.0" }, @@ -7368,7 +7423,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.2.11" + "source": "https://github.com/symfony/error-handler/tree/v6.3.0" }, "funding": [ { @@ -7384,28 +7439,29 @@ "type": "tidelift" } ], - "time": "2023-05-05T11:55:01+00:00" + "time": "2023-05-10T12:03:13+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339" + "reference": "3af8ac1a3f98f6dbc55e10ae59c9e44bfc38dfaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/04046f35fd7d72f9646e721fc2ecb8f9c67d3339", - "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3af8ac1a3f98f6dbc55e10ae59c9e44bfc38dfaa", + "reference": "3af8ac1a3f98f6dbc55e10ae59c9e44bfc38dfaa", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2|^3" + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<5.4" + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" }, "provide": { "psr/event-dispatcher-implementation": "1.0", @@ -7418,13 +7474,9 @@ "symfony/error-handler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/stopwatch": "^5.4|^6.0" }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, "type": "library", "autoload": { "psr-4": { @@ -7451,7 +7503,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/v6.2.8" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.0" }, "funding": [ { @@ -7467,7 +7519,7 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-04-21T14:41:17+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -7547,22 +7599,23 @@ }, { "name": "symfony/expression-language", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/expression-language.git", - "reference": "83e1fee4c018aa60bcbbecd585a2c54af6aca905" + "reference": "6d560c4c80e7e328708efd923f93ad67e6a0c1c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/83e1fee4c018aa60bcbbecd585a2c54af6aca905", - "reference": "83e1fee4c018aa60bcbbecd585a2c54af6aca905", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/6d560c4c80e7e328708efd923f93ad67e6a0c1c0", + "reference": "6d560c4c80e7e328708efd923f93ad67e6a0c1c0", "shasum": "" }, "require": { "php": ">=8.1", "symfony/cache": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -7590,7 +7643,7 @@ "description": "Provides an engine that can compile and evaluate expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/expression-language/tree/v6.2.7" + "source": "https://github.com/symfony/expression-language/tree/v6.3.0" }, "funding": [ { @@ -7606,20 +7659,20 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:57:23+00:00" + "time": "2023-04-28T16:05:33+00:00" }, { "name": "symfony/filesystem", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894" + "reference": "97b698e1d77d356304def77a8d0cd73090b359ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/fd588debf7d1bc16a2c84b4b3b71145d9946b894", - "reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/97b698e1d77d356304def77a8d0cd73090b359ea", + "reference": "97b698e1d77d356304def77a8d0cd73090b359ea", "shasum": "" }, "require": { @@ -7653,7 +7706,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.2.10" + "source": "https://github.com/symfony/filesystem/tree/v6.3.0" }, "funding": [ { @@ -7669,20 +7722,20 @@ "type": "tidelift" } ], - "time": "2023-04-18T13:46:08+00:00" + "time": "2023-05-30T17:12:32+00:00" }, { "name": "symfony/finder", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" + "reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", - "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", + "url": "https://api.github.com/repos/symfony/finder/zipball/d9b01ba073c44cef617c7907ce2419f8d00d75e2", + "reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2", "shasum": "" }, "require": { @@ -7717,7 +7770,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.2.7" + "source": "https://github.com/symfony/finder/tree/v6.3.0" }, "funding": [ { @@ -7733,7 +7786,7 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:57:23+00:00" + "time": "2023-04-02T01:25:41+00:00" }, { "name": "symfony/flex", @@ -7802,28 +7855,28 @@ }, { "name": "symfony/form", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "494e21cc84781e7557682617e7ef80f598da20dc" + "reference": "59e7c5afef32b9ff735e83e5fc74d63044833a2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/494e21cc84781e7557682617e7ef80f598da20dc", - "reference": "494e21cc84781e7557682617e7ef80f598da20dc", + "url": "https://api.github.com/repos/symfony/form/zipball/59e7c5afef32b9ff735e83e5fc74d63044833a2b", + "reference": "59e7c5afef32b9ff735e83e5fc74d63044833a2b", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/options-resolver": "^5.4|^6.0", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-icu": "^1.21", "symfony/polyfill-mbstring": "~1.0", "symfony/property-access": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "conflict": { "symfony/console": "<5.4", @@ -7833,8 +7886,8 @@ "symfony/framework-bundle": "<5.4", "symfony/http-kernel": "<5.4", "symfony/translation": "<5.4", - "symfony/translation-contracts": "<1.1.7", - "symfony/twig-bridge": "<5.4.21|>=6,<6.2.7" + "symfony/translation-contracts": "<2.5", + "symfony/twig-bridge": "<6.3" }, "require-dev": { "doctrine/collections": "^1.0|^2.0", @@ -7853,12 +7906,6 @@ "symfony/validator": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "symfony/security-core": "For hashing users passwords.", - "symfony/security-csrf": "For protecting forms against CSRF attacks.", - "symfony/twig-bridge": "For templating with Twig.", - "symfony/validator": "For form validation." - }, "type": "library", "autoload": { "psr-4": { @@ -7885,7 +7932,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v6.2.11" + "source": "https://github.com/symfony/form/tree/v6.3.0" }, "funding": [ { @@ -7901,20 +7948,20 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:08:43+00:00" + "time": "2023-05-25T13:09:35+00:00" }, { "name": "symfony/framework-bundle", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "c02f2298d03ab083d4036cf18b151d131a113ccd" + "reference": "4e082c10ae0c8b80e329024ebc60815fcc4206ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/c02f2298d03ab083d4036cf18b151d131a113ccd", - "reference": "c02f2298d03ab083d4036cf18b151d131a113ccd", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/4e082c10ae0c8b80e329024ebc60815fcc4206ff", + "reference": "4e082c10ae0c8b80e329024ebc60815fcc4206ff", "shasum": "" }, "require": { @@ -7923,14 +7970,14 @@ "php": ">=8.1", "symfony/cache": "^5.4|^6.0", "symfony/config": "^6.1", - "symfony/dependency-injection": "^6.2.8", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/dependency-injection": "^6.3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/error-handler": "^6.1", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/filesystem": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-foundation": "^6.2.11", - "symfony/http-kernel": "^6.2.1", + "symfony/http-foundation": "^6.3", + "symfony/http-kernel": "^6.3", "symfony/polyfill-mbstring": "~1.0", "symfony/routing": "^5.4|^6.0" }, @@ -7940,25 +7987,26 @@ "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", "symfony/asset": "<5.4", + "symfony/clock": "<6.3", "symfony/console": "<5.4", - "symfony/dom-crawler": "<5.4", + "symfony/dom-crawler": "<6.3", "symfony/dotenv": "<5.4", "symfony/form": "<5.4", - "symfony/http-client": "<5.4", + "symfony/http-client": "<6.3", "symfony/lock": "<5.4", "symfony/mailer": "<5.4", - "symfony/messenger": "<6.2", + "symfony/messenger": "<6.3", "symfony/mime": "<6.2", "symfony/property-access": "<5.4", "symfony/property-info": "<5.4", "symfony/security-core": "<5.4", "symfony/security-csrf": "<5.4", - "symfony/serializer": "<6.1", + "symfony/serializer": "<6.3", "symfony/stopwatch": "<5.4", "symfony/translation": "<6.2.8", "symfony/twig-bridge": "<5.4", "symfony/twig-bundle": "<5.4", - "symfony/validator": "<5.4", + "symfony/validator": "<6.3", "symfony/web-profiler-bundle": "<5.4", "symfony/workflow": "<5.4" }, @@ -7967,48 +8015,41 @@ "doctrine/persistence": "^1.3|^2|^3", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "symfony/asset": "^5.4|^6.0", + "symfony/asset-mapper": "^6.3", "symfony/browser-kit": "^5.4|^6.0", + "symfony/clock": "^6.2", "symfony/console": "^5.4.9|^6.0.9", "symfony/css-selector": "^5.4|^6.0", - "symfony/dom-crawler": "^5.4|^6.0", + "symfony/dom-crawler": "^6.3", "symfony/dotenv": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/form": "^5.4|^6.0", "symfony/html-sanitizer": "^6.1", - "symfony/http-client": "^5.4|^6.0", + "symfony/http-client": "^6.3", "symfony/lock": "^5.4|^6.0", "symfony/mailer": "^5.4|^6.0", - "symfony/messenger": "^6.2", + "symfony/messenger": "^6.3", "symfony/mime": "^6.2", "symfony/notifier": "^5.4|^6.0", "symfony/polyfill-intl-icu": "~1.0", "symfony/process": "^5.4|^6.0", "symfony/property-info": "^5.4|^6.0", "symfony/rate-limiter": "^5.4|^6.0", + "symfony/scheduler": "^6.3", "symfony/security-bundle": "^5.4|^6.0", "symfony/semaphore": "^5.4|^6.0", - "symfony/serializer": "^6.1", + "symfony/serializer": "^6.3", "symfony/stopwatch": "^5.4|^6.0", "symfony/string": "^5.4|^6.0", "symfony/translation": "^6.2.8", "symfony/twig-bundle": "^5.4|^6.0", "symfony/uid": "^5.4|^6.0", - "symfony/validator": "^5.4|^6.0", + "symfony/validator": "^6.3", "symfony/web-link": "^5.4|^6.0", "symfony/workflow": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0", "twig/twig": "^2.10|^3.0" }, - "suggest": { - "ext-apcu": "For best performance of the system caches", - "symfony/console": "For using the console commands", - "symfony/form": "For using forms", - "symfony/property-info": "For using the property_info service", - "symfony/serializer": "For using the serializer service", - "symfony/validator": "For using validation", - "symfony/web-link": "For using web links, features such as preloading, prefetching or prerendering", - "symfony/yaml": "For using the debug:config and lint:yaml commands" - }, "type": "symfony-bundle", "autoload": { "psr-4": { @@ -8035,7 +8076,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v6.2.11" + "source": "https://github.com/symfony/framework-bundle/tree/v6.3.0" }, "funding": [ { @@ -8051,28 +8092,32 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:08:43+00:00" + "time": "2023-05-30T15:24:33+00:00" }, { "name": "symfony/http-client", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "39f679c12648cc43bd9f0db12cc69b82041b91a1" + "reference": "b2f892c91e4e02a939edddeb7ef452522d10a424" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/39f679c12648cc43bd9f0db12cc69b82041b91a1", - "reference": "39f679c12648cc43bd9f0db12cc69b82041b91a1", + "url": "https://api.github.com/repos/symfony/http-client/zipball/b2f892c91e4e02a939edddeb7ef452522d10a424", + "reference": "b2f892c91e4e02a939edddeb7ef452522d10a424", "shasum": "" }, "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-client-contracts": "^3", - "symfony/service-contracts": "^1.0|^2|^3" + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "php-http/discovery": "<1.15", + "symfony/http-foundation": "<6.3" }, "provide": { "php-http/async-client-implementation": "*", @@ -8088,7 +8133,6 @@ "guzzlehttp/promises": "^1.4", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", - "php-http/message-factory": "^1.0", "psr/http-client": "^1.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0", @@ -8124,7 +8168,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.2.11" + "source": "https://github.com/symfony/http-client/tree/v6.3.0" }, "funding": [ { @@ -8140,7 +8184,7 @@ "type": "tidelift" } ], - "time": "2023-05-12T08:48:34+00:00" + "time": "2023-05-12T08:49:48+00:00" }, { "name": "symfony/http-client-contracts", @@ -8222,28 +8266,30 @@ }, { "name": "symfony/http-foundation", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "df27f4191a4292d01fd062296e09cbc8b657cb57" + "reference": "718a97ed430d34e5c568ea2c44eab708c6efbefb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/df27f4191a4292d01fd062296e09cbc8b657cb57", - "reference": "df27f4191a4292d01fd062296e09cbc8b657cb57", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/718a97ed430d34e5c568ea2c44eab708c6efbefb", + "reference": "718a97ed430d34e5c568ea2c44eab708c6efbefb", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" }, "conflict": { "symfony/cache": "<6.2" }, "require-dev": { - "predis/predis": "~1.0", + "doctrine/dbal": "^2.13.1|^3.0", + "predis/predis": "^1.1|^2.0", "symfony/cache": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", @@ -8251,9 +8297,6 @@ "symfony/mime": "^5.4|^6.0", "symfony/rate-limiter": "^5.2|^6.0" }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, "type": "library", "autoload": { "psr-4": { @@ -8280,7 +8323,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.2.11" + "source": "https://github.com/symfony/http-foundation/tree/v6.3.0" }, "funding": [ { @@ -8296,29 +8339,29 @@ "type": "tidelift" } ], - "time": "2023-05-19T12:39:53+00:00" + "time": "2023-05-19T12:46:45+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "954a1a3b178309b216261eedc735c079709e4ab3" + "reference": "241973f3dd900620b1ca052fe409144f11aea748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/954a1a3b178309b216261eedc735c079709e4ab3", - "reference": "954a1a3b178309b216261eedc735c079709e4ab3", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/241973f3dd900620b1ca052fe409144f11aea748", + "reference": "241973f3dd900620b1ca052fe409144f11aea748", "shasum": "" }, "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/error-handler": "^6.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/error-handler": "^6.3", "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/http-foundation": "^5.4.21|^6.2.7", + "symfony/http-foundation": "^6.2.7", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -8326,15 +8369,18 @@ "symfony/cache": "<5.4", "symfony/config": "<6.1", "symfony/console": "<5.4", - "symfony/dependency-injection": "<6.2", + "symfony/dependency-injection": "<6.3", "symfony/doctrine-bridge": "<5.4", "symfony/form": "<5.4", "symfony/http-client": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/mailer": "<5.4", "symfony/messenger": "<5.4", "symfony/translation": "<5.4", + "symfony/translation-contracts": "<2.5", "symfony/twig-bridge": "<5.4", "symfony/validator": "<5.4", + "symfony/var-dumper": "<6.3", "twig/twig": "<2.13" }, "provide": { @@ -8343,29 +8389,27 @@ "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "symfony/browser-kit": "^5.4|^6.0", + "symfony/clock": "^6.2", "symfony/config": "^6.1", "symfony/console": "^5.4|^6.0", "symfony/css-selector": "^5.4|^6.0", - "symfony/dependency-injection": "^6.2", + "symfony/dependency-injection": "^6.3", "symfony/dom-crawler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2|^3", + "symfony/http-client-contracts": "^2.5|^3", "symfony/process": "^5.4|^6.0", + "symfony/property-access": "^5.4.5|^6.0.5", "symfony/routing": "^5.4|^6.0", + "symfony/serializer": "^6.3", "symfony/stopwatch": "^5.4|^6.0", "symfony/translation": "^5.4|^6.0", - "symfony/translation-contracts": "^1.1|^2|^3", + "symfony/translation-contracts": "^2.5|^3", "symfony/uid": "^5.4|^6.0", + "symfony/validator": "^6.3", "symfony/var-exporter": "^6.2", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, "type": "library", "autoload": { "psr-4": { @@ -8392,7 +8436,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.2.11" + "source": "https://github.com/symfony/http-kernel/tree/v6.3.0" }, "funding": [ { @@ -8408,20 +8452,20 @@ "type": "tidelift" } ], - "time": "2023-05-27T21:12:52+00:00" + "time": "2023-05-30T19:03:32+00:00" }, { "name": "symfony/intl", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "860c99e53149d22df1900d3aefdaeb17adb7669d" + "reference": "49c7d14fc0465813e85b7cbbda49844af208d95a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/860c99e53149d22df1900d3aefdaeb17adb7669d", - "reference": "860c99e53149d22df1900d3aefdaeb17adb7669d", + "url": "https://api.github.com/repos/symfony/intl/zipball/49c7d14fc0465813e85b7cbbda49844af208d95a", + "reference": "49c7d14fc0465813e85b7cbbda49844af208d95a", "shasum": "" }, "require": { @@ -8473,7 +8517,7 @@ "localization" ], "support": { - "source": "https://github.com/symfony/intl/tree/v6.2.10" + "source": "https://github.com/symfony/intl/tree/v6.3.0" }, "funding": [ { @@ -8489,20 +8533,20 @@ "type": "tidelift" } ], - "time": "2023-04-14T16:23:31+00:00" + "time": "2023-04-24T14:22:26+00:00" }, { "name": "symfony/mailer", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "bfcfa015c67e19c6fdb7ca6fe70700af1e740a17" + "reference": "7b03d9be1dea29bfec0a6c7b603f5072a4c97435" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/bfcfa015c67e19c6fdb7ca6fe70700af1e740a17", - "reference": "bfcfa015c67e19c6fdb7ca6fe70700af1e740a17", + "url": "https://api.github.com/repos/symfony/mailer/zipball/7b03d9be1dea29bfec0a6c7b603f5072a4c97435", + "reference": "7b03d9be1dea29bfec0a6c7b603f5072a4c97435", "shasum": "" }, "require": { @@ -8512,9 +8556,10 @@ "psr/log": "^1|^2|^3", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/mime": "^6.2", - "symfony/service-contracts": "^1.1|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "conflict": { + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", "symfony/messenger": "<6.2", "symfony/mime": "<6.2", @@ -8552,7 +8597,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.2.8" + "source": "https://github.com/symfony/mailer/tree/v6.3.0" }, "funding": [ { @@ -8568,20 +8613,20 @@ "type": "tidelift" } ], - "time": "2023-03-14T15:00:05+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/mime", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "b6c137fc53a9f7c4c951cd3f362b3734c7a97723" + "reference": "7b5d2121858cd6efbed778abce9cfdd7ab1f62ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/b6c137fc53a9f7c4c951cd3f362b3734c7a97723", - "reference": "b6c137fc53a9f7c4c951cd3f362b3734c7a97723", + "url": "https://api.github.com/repos/symfony/mime/zipball/7b5d2121858cd6efbed778abce9cfdd7ab1f62ad", + "reference": "7b5d2121858cd6efbed778abce9cfdd7ab1f62ad", "shasum": "" }, "require": { @@ -8635,7 +8680,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.2.10" + "source": "https://github.com/symfony/mime/tree/v6.3.0" }, "funding": [ { @@ -8651,27 +8696,27 @@ "type": "tidelift" } ], - "time": "2023-04-19T09:54:16+00:00" + "time": "2023-04-28T15:57:00+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "34700f2e5c7e9eae78f8e59fc02399dd8f110cae" + "reference": "d45a22a6cca0a0a2a60171bdf137d9001ac5531b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/34700f2e5c7e9eae78f8e59fc02399dd8f110cae", - "reference": "34700f2e5c7e9eae78f8e59fc02399dd8f110cae", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/d45a22a6cca0a0a2a60171bdf137d9001ac5531b", + "reference": "d45a22a6cca0a0a2a60171bdf137d9001ac5531b", "shasum": "" }, "require": { "monolog/monolog": "^1.25.1|^2|^3", "php": ">=8.1", "symfony/http-kernel": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "conflict": { "symfony/console": "<5.4", @@ -8687,11 +8732,6 @@ "symfony/security-core": "^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "symfony/console": "For the possibility to show log messages in console commands depending on verbosity settings.", - "symfony/http-kernel": "For using the debugging handlers together with the response life cycle of the HTTP kernel.", - "symfony/var-dumper": "For using the debugging handlers like the console handler or the log server handler." - }, "type": "symfony-bridge", "autoload": { "psr-4": { @@ -8718,7 +8758,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v6.2.8" + "source": "https://github.com/symfony/monolog-bridge/tree/v6.3.0" }, "funding": [ { @@ -8734,7 +8774,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T16:20:02+00:00" + "time": "2023-04-24T14:22:26+00:00" }, { "name": "symfony/monolog-bundle", @@ -8819,21 +8859,21 @@ }, { "name": "symfony/options-resolver", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629" + "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/aa0e85b53bbb2b4951960efd61d295907eacd629", - "reference": "aa0e85b53bbb2b4951960efd61d295907eacd629", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/a10f19f5198d589d5c33333cffe98dc9820332dd", + "reference": "a10f19f5198d589d5c33333cffe98dc9820332dd", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3" + "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -8866,7 +8906,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v6.2.7" + "source": "https://github.com/symfony/options-resolver/tree/v6.3.0" }, "funding": [ { @@ -8882,20 +8922,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-05-12T14:21:09+00:00" }, { "name": "symfony/password-hasher", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/password-hasher.git", - "reference": "67820d8570bf1c2c2cd87cb76d9d12a9d52ab808" + "reference": "d23ad221989e6b8278d050cabfd7b569eee84590" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/password-hasher/zipball/67820d8570bf1c2c2cd87cb76d9d12a9d52ab808", - "reference": "67820d8570bf1c2c2cd87cb76d9d12a9d52ab808", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/d23ad221989e6b8278d050cabfd7b569eee84590", + "reference": "d23ad221989e6b8278d050cabfd7b569eee84590", "shasum": "" }, "require": { @@ -8938,7 +8978,7 @@ "password" ], "support": { - "source": "https://github.com/symfony/password-hasher/tree/v6.2.7" + "source": "https://github.com/symfony/password-hasher/tree/v6.3.0" }, "funding": [ { @@ -8954,7 +8994,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-02-14T09:04:20+00:00" }, { "name": "symfony/polyfill-ctype", @@ -9619,6 +9659,83 @@ ], "time": "2022-11-03T14:55:06+00:00" }, + { + "name": "symfony/polyfill-php83", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/508c652ba3ccf69f8c97f251534f229791b52a57", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-php80": "^1.14" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + } + }, + "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 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.27.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": "2022-11-03T14:55:06+00:00" + }, { "name": "symfony/polyfill-uuid", "version": "v1.27.0", @@ -9703,16 +9820,16 @@ }, { "name": "symfony/process", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c" + "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/97ae9721bead9d1a39b5650e2f4b7834b93b539c", - "reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c", + "url": "https://api.github.com/repos/symfony/process/zipball/8741e3ed7fe2e91ec099e02446fb86667a0f1628", + "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628", "shasum": "" }, "require": { @@ -9744,7 +9861,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.2.11" + "source": "https://github.com/symfony/process/tree/v6.3.0" }, "funding": [ { @@ -9760,33 +9877,30 @@ "type": "tidelift" } ], - "time": "2023-05-19T07:42:48+00:00" + "time": "2023-05-19T08:06:44+00:00" }, { "name": "symfony/property-access", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "77442a960c3bc2cacc3d1cd300908a31a2eb30ad" + "reference": "db9358571ce63f09c439c2fee6c12e5b090b69ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/77442a960c3bc2cacc3d1cd300908a31a2eb30ad", - "reference": "77442a960c3bc2cacc3d1cd300908a31a2eb30ad", + "url": "https://api.github.com/repos/symfony/property-access/zipball/db9358571ce63f09c439c2fee6c12e5b090b69ac", + "reference": "db9358571ce63f09c439c2fee6c12e5b090b69ac", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/property-info": "^5.4|^6.0" }, "require-dev": { "symfony/cache": "^5.4|^6.0" }, - "suggest": { - "psr/cache-implementation": "To cache access methods." - }, "type": "library", "autoload": { "psr-4": { @@ -9824,7 +9938,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v6.2.11" + "source": "https://github.com/symfony/property-access/tree/v6.3.0" }, "funding": [ { @@ -9840,20 +9954,20 @@ "type": "tidelift" } ], - "time": "2023-05-09T22:46:35+00:00" + "time": "2023-05-19T08:06:44+00:00" }, { "name": "symfony/property-info", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "ee0a0de5a6866c15af8495b2534d650b388bdeca" + "reference": "7f3a03716112269741fe2a809f8f791a371d1fcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/ee0a0de5a6866c15af8495b2534d650b388bdeca", - "reference": "ee0a0de5a6866c15af8495b2534d650b388bdeca", + "url": "https://api.github.com/repos/symfony/property-info/zipball/7f3a03716112269741fe2a809f8f791a371d1fcd", + "reference": "7f3a03716112269741fe2a809f8f791a371d1fcd", "shasum": "" }, "require": { @@ -9873,12 +9987,6 @@ "symfony/dependency-injection": "^5.4|^6.0", "symfony/serializer": "^5.4|^6.0" }, - "suggest": { - "phpdocumentor/reflection-docblock": "To use the PHPDoc", - "psr/cache-implementation": "To cache results", - "symfony/doctrine-bridge": "To use Doctrine metadata", - "symfony/serializer": "To use Serializer metadata" - }, "type": "library", "autoload": { "psr-4": { @@ -9913,7 +10021,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v6.2.11" + "source": "https://github.com/symfony/property-info/tree/v6.3.0" }, "funding": [ { @@ -9929,26 +10037,27 @@ "type": "tidelift" } ], - "time": "2023-05-19T07:42:48+00:00" + "time": "2023-05-19T08:06:44+00:00" }, { "name": "symfony/proxy-manager-bridge", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "534119513ce1d06faa6d55b6717f237e980b4e91" + "reference": "7ba2ac62c88d7c3460d41f04ceba5fc3b9071a39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/534119513ce1d06faa6d55b6717f237e980b4e91", - "reference": "534119513ce1d06faa6d55b6717f237e980b4e91", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/7ba2ac62c88d7c3460d41f04ceba5fc3b9071a39", + "reference": "7ba2ac62c88d7c3460d41f04ceba5fc3b9071a39", "shasum": "" }, "require": { "friendsofphp/proxy-manager-lts": "^1.0.2", "php": ">=8.1", - "symfony/dependency-injection": "^6.2" + "symfony/dependency-injection": "^6.3", + "symfony/deprecation-contracts": "^2.5|^3" }, "require-dev": { "symfony/config": "^6.1" @@ -9979,7 +10088,7 @@ "description": "Provides integration for ProxyManager with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/proxy-manager-bridge/tree/v6.2.7" + "source": "https://github.com/symfony/proxy-manager-bridge/tree/v6.3.0" }, "funding": [ { @@ -9995,7 +10104,7 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:57:23+00:00" + "time": "2023-05-26T07:49:33+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -10087,16 +10196,16 @@ }, { "name": "symfony/rate-limiter", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/rate-limiter.git", - "reference": "e82784d6a8d64a33f44a8acfd703327a32831533" + "reference": "a8aff626821721a3b2e64dbda6a3f1ee7bab6d80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/rate-limiter/zipball/e82784d6a8d64a33f44a8acfd703327a32831533", - "reference": "e82784d6a8d64a33f44a8acfd703327a32831533", + "url": "https://api.github.com/repos/symfony/rate-limiter/zipball/a8aff626821721a3b2e64dbda6a3f1ee7bab6d80", + "reference": "a8aff626821721a3b2e64dbda6a3f1ee7bab6d80", "shasum": "" }, "require": { @@ -10107,9 +10216,6 @@ "psr/cache": "^1.0|^2.0|^3.0", "symfony/lock": "^5.4|^6.0" }, - "suggest": { - "symfony/lock": "For preventing race conditions in rate limiters" - }, "type": "library", "autoload": { "psr-4": { @@ -10140,7 +10246,7 @@ "rate-limiter" ], "support": { - "source": "https://github.com/symfony/rate-limiter/tree/v6.2.7" + "source": "https://github.com/symfony/rate-limiter/tree/v6.3.0" }, "funding": [ { @@ -10156,20 +10262,20 @@ "type": "tidelift" } ], - "time": "2023-02-24T10:42:00+00:00" + "time": "2023-04-24T14:22:26+00:00" }, { "name": "symfony/routing", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "69062e2823f03b82265d73a966999660f0e1e404" + "reference": "827f59fdc67eecfc4dfff81f9c93bf4d98f0c89b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/69062e2823f03b82265d73a966999660f0e1e404", - "reference": "69062e2823f03b82265d73a966999660f0e1e404", + "url": "https://api.github.com/repos/symfony/routing/zipball/827f59fdc67eecfc4dfff81f9c93bf4d98f0c89b", + "reference": "827f59fdc67eecfc4dfff81f9c93bf4d98f0c89b", "shasum": "" }, "require": { @@ -10190,12 +10296,6 @@ "symfony/http-foundation": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, "type": "library", "autoload": { "psr-4": { @@ -10228,7 +10328,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.2.8" + "source": "https://github.com/symfony/routing/tree/v6.3.0" }, "funding": [ { @@ -10244,20 +10344,20 @@ "type": "tidelift" } ], - "time": "2023-03-14T15:00:05+00:00" + "time": "2023-04-28T15:57:00+00:00" }, { "name": "symfony/runtime", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/runtime.git", - "reference": "f8b0751b33888329be8f8f0481bb81d279ec4157" + "reference": "d998ab9da99e2ebca719dee00e8469996deeec53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/runtime/zipball/f8b0751b33888329be8f8f0481bb81d279ec4157", - "reference": "f8b0751b33888329be8f8f0481bb81d279ec4157", + "url": "https://api.github.com/repos/symfony/runtime/zipball/d998ab9da99e2ebca719dee00e8469996deeec53", + "reference": "d998ab9da99e2ebca719dee00e8469996deeec53", "shasum": "" }, "require": { @@ -10307,7 +10407,7 @@ "runtime" ], "support": { - "source": "https://github.com/symfony/runtime/tree/v6.2.8" + "source": "https://github.com/symfony/runtime/tree/v6.3.0" }, "funding": [ { @@ -10323,26 +10423,27 @@ "type": "tidelift" } ], - "time": "2023-03-14T15:48:35+00:00" + "time": "2023-03-14T15:56:29+00:00" }, { "name": "symfony/security-bundle", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "43faa9bc3c7ee7e97ffa53320947a074971d159b" + "reference": "4d18f4cdb71e6f6ec1cf2c6b0349642e762b812f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/43faa9bc3c7ee7e97ffa53320947a074971d159b", - "reference": "43faa9bc3c7ee7e97ffa53320947a074971d159b", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/4d18f4cdb71e6f6ec1cf2c6b0349642e762b812f", + "reference": "4d18f4cdb71e6f6ec1cf2c6b0349642e762b812f", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", "ext-xml": "*", "php": ">=8.1", + "symfony/clock": "^6.3", "symfony/config": "^6.1", "symfony/dependency-injection": "^6.2", "symfony/event-dispatcher": "^5.4|^6.0", @@ -10351,12 +10452,13 @@ "symfony/password-hasher": "^5.4|^6.0", "symfony/security-core": "^6.2", "symfony/security-csrf": "^5.4|^6.0", - "symfony/security-http": "^6.2.10" + "symfony/security-http": "^6.3" }, "conflict": { "symfony/browser-kit": "<5.4", "symfony/console": "<5.4", - "symfony/framework-bundle": "<5.4", + "symfony/framework-bundle": "<6.3", + "symfony/http-client": "<5.4", "symfony/ldap": "<5.4", "symfony/twig-bundle": "<5.4" }, @@ -10369,7 +10471,7 @@ "symfony/dom-crawler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/form": "^5.4|^6.0", - "symfony/framework-bundle": "^5.4|^6.0", + "symfony/framework-bundle": "^6.3", "symfony/ldap": "^5.4|^6.0", "symfony/process": "^5.4|^6.0", "symfony/rate-limiter": "^5.4|^6.0", @@ -10379,7 +10481,13 @@ "symfony/twig-bundle": "^5.4|^6.0", "symfony/validator": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0", - "twig/twig": "^2.13|^3.0.4" + "twig/twig": "^2.13|^3.0.4", + "web-token/jwt-checker": "^3.1", + "web-token/jwt-signature-algorithm-ecdsa": "^3.1", + "web-token/jwt-signature-algorithm-eddsa": "^3.1", + "web-token/jwt-signature-algorithm-hmac": "^3.1", + "web-token/jwt-signature-algorithm-none": "^3.1", + "web-token/jwt-signature-algorithm-rsa": "^3.1" }, "type": "symfony-bundle", "autoload": { @@ -10407,7 +10515,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v6.2.11" + "source": "https://github.com/symfony/security-bundle/tree/v6.3.0" }, "funding": [ { @@ -10423,27 +10531,27 @@ "type": "tidelift" } ], - "time": "2023-05-26T15:38:40+00:00" + "time": "2023-05-30T19:01:06+00:00" }, { "name": "symfony/security-core", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "c141337bc7451f9a9e464733f1e536bf38d1d2fb" + "reference": "9cb74232e978be1440d2bb7daf91eb40a9363890" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/c141337bc7451f9a9e464733f1e536bf38d1d2fb", - "reference": "c141337bc7451f9a9e464733f1e536bf38d1d2fb", + "url": "https://api.github.com/repos/symfony/security-core/zipball/9cb74232e978be1440d2bb7daf91eb40a9363890", + "reference": "9cb74232e978be1440d2bb7daf91eb40a9363890", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^1.1|^2|^3", + "symfony/event-dispatcher-contracts": "^2.5|^3", "symfony/password-hasher": "^5.4|^6.0", - "symfony/service-contracts": "^1.1.6|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "conflict": { "symfony/event-dispatcher": "<5.4", @@ -10461,17 +10569,10 @@ "symfony/expression-language": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", "symfony/ldap": "^5.4|^6.0", + "symfony/string": "^5.4|^6.0", "symfony/translation": "^5.4|^6.0", "symfony/validator": "^5.4|^6.0" }, - "suggest": { - "psr/container-implementation": "To instantiate the Security class", - "symfony/event-dispatcher": "", - "symfony/expression-language": "For using the expression voter", - "symfony/http-foundation": "", - "symfony/ldap": "For using LDAP integration", - "symfony/validator": "For using the user password constraint" - }, "type": "library", "autoload": { "psr-4": { @@ -10498,7 +10599,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v6.2.8" + "source": "https://github.com/symfony/security-core/tree/v6.3.0" }, "funding": [ { @@ -10514,20 +10615,20 @@ "type": "tidelift" } ], - "time": "2023-03-10T10:06:03+00:00" + "time": "2023-04-28T15:57:00+00:00" }, { "name": "symfony/security-csrf", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "6cce7efdce68e0670d2f19acebc21dcd0798e333" + "reference": "1f505c9060bde692eb37718c78a91d95d9abeeec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/6cce7efdce68e0670d2f19acebc21dcd0798e333", - "reference": "6cce7efdce68e0670d2f19acebc21dcd0798e333", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/1f505c9060bde692eb37718c78a91d95d9abeeec", + "reference": "1f505c9060bde692eb37718c78a91d95d9abeeec", "shasum": "" }, "require": { @@ -10540,9 +10641,6 @@ "require-dev": { "symfony/http-foundation": "^5.4|^6.0" }, - "suggest": { - "symfony/http-foundation": "For using the class SessionTokenStorage." - }, "type": "library", "autoload": { "psr-4": { @@ -10569,7 +10667,7 @@ "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-csrf/tree/v6.2.7" + "source": "https://github.com/symfony/security-csrf/tree/v6.3.0" }, "funding": [ { @@ -10585,48 +10683,50 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:57:23+00:00" + "time": "2023-04-21T14:41:17+00:00" }, { "name": "symfony/security-http", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "ef5d875c6d0d141c7247fab24bd55a94e02b8478" + "reference": "7f35dd7df8336fd55bdb0a950e52632c7e5fa43f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/ef5d875c6d0d141c7247fab24bd55a94e02b8478", - "reference": "ef5d875c6d0d141c7247fab24bd55a94e02b8478", + "url": "https://api.github.com/repos/symfony/security-http/zipball/7f35dd7df8336fd55bdb0a950e52632c7e5fa43f", + "reference": "7f35dd7df8336fd55bdb0a950e52632c7e5fa43f", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-foundation": "^5.4|^6.0", - "symfony/http-kernel": "^6.2", + "symfony/http-kernel": "^6.3", "symfony/polyfill-mbstring": "~1.0", "symfony/property-access": "^5.4|^6.0", - "symfony/security-core": "~6.0.19|~6.1.11|^6.2.5" + "symfony/security-core": "^6.3" }, "conflict": { + "symfony/clock": "<6.3", "symfony/event-dispatcher": "<5.4.9|>=6,<6.0.9", + "symfony/http-client-contracts": "<3.0", "symfony/security-bundle": "<5.4", "symfony/security-csrf": "<5.4" }, "require-dev": { "psr/log": "^1|^2|^3", "symfony/cache": "^5.4|^6.0", + "symfony/clock": "^6.3", "symfony/expression-language": "^5.4|^6.0", + "symfony/http-client-contracts": "^3.0", "symfony/rate-limiter": "^5.4|^6.0", "symfony/routing": "^5.4|^6.0", "symfony/security-csrf": "^5.4|^6.0", - "symfony/translation": "^5.4|^6.0" - }, - "suggest": { - "symfony/routing": "For using the HttpUtils class to create sub-requests, redirect the user, and match URLs", - "symfony/security-csrf": "For using tokens to protect authentication/logout attempts" + "symfony/translation": "^5.4|^6.0", + "web-token/jwt-checker": "^3.1", + "web-token/jwt-signature-algorithm-ecdsa": "^3.1" }, "type": "library", "autoload": { @@ -10654,7 +10754,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v6.2.11" + "source": "https://github.com/symfony/security-http/tree/v6.3.0" }, "funding": [ { @@ -10670,20 +10770,20 @@ "type": "tidelift" } ], - "time": "2023-05-19T15:58:23+00:00" + "time": "2023-05-30T19:01:06+00:00" }, { "name": "symfony/serializer", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "7777df2b00dd2f3ee332b4b000c4b21743df64b7" + "reference": "990e724240d32c0110a853675f8560bb2bf25dcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/7777df2b00dd2f3ee332b4b000c4b21743df64b7", - "reference": "7777df2b00dd2f3ee332b4b000c4b21743df64b7", + "url": "https://api.github.com/repos/symfony/serializer/zipball/990e724240d32c0110a853675f8560bb2bf25dcf", + "reference": "990e724240d32c0110a853675f8560bb2bf25dcf", "shasum": "" }, "require": { @@ -10705,6 +10805,7 @@ "phpdocumentor/reflection-docblock": "^3.2|^4.0|^5.0", "symfony/cache": "^5.4|^6.0", "symfony/config": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/error-handler": "^5.4|^6.0", "symfony/filesystem": "^5.4|^6.0", @@ -10720,15 +10821,6 @@ "symfony/var-exporter": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "psr/cache-implementation": "For using the metadata cache.", - "symfony/config": "For using the XML mapping loader.", - "symfony/mime": "For using a MIME type guesser within the DataUriNormalizer.", - "symfony/property-access": "For using the ObjectNormalizer.", - "symfony/property-info": "To deserialize relations.", - "symfony/var-exporter": "For using the metadata compiler.", - "symfony/yaml": "For using the default YAML mapping loader." - }, "type": "library", "autoload": { "psr-4": { @@ -10755,7 +10847,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v6.2.11" + "source": "https://github.com/symfony/serializer/tree/v6.3.0" }, "funding": [ { @@ -10771,7 +10863,7 @@ "type": "tidelift" } ], - "time": "2023-05-19T07:59:25+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/service-contracts", @@ -10987,16 +11079,16 @@ }, { "name": "symfony/string", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", "shasum": "" }, "require": { @@ -11007,13 +11099,13 @@ "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/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -11053,7 +11145,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.0" }, "funding": [ { @@ -11069,32 +11161,34 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-03-21T21:06:29+00:00" }, { "name": "symfony/translation", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "64113df3e8b009f92fad63014f4ec647e65bc927" + "reference": "f72b2cba8f79dd9d536f534f76874b58ad37876f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/64113df3e8b009f92fad63014f4ec647e65bc927", - "reference": "64113df3e8b009f92fad63014f4ec647e65bc927", + "url": "https://api.github.com/repos/symfony/translation/zipball/f72b2cba8f79dd9d536f534f76874b58ad37876f", + "reference": "f72b2cba8f79dd9d536f534f76874b58ad37876f", "shasum": "" }, "require": { "php": ">=8.1", "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" }, @@ -11108,20 +11202,14 @@ "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/routing": "^5.4|^6.0", - "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "nikic/php-parser": "To use PhpAstExtractor", - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, "type": "library", "autoload": { "files": [ @@ -11151,7 +11239,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.2.11" + "source": "https://github.com/symfony/translation/tree/v6.3.0" }, "funding": [ { @@ -11167,7 +11255,7 @@ "type": "tidelift" } ], - "time": "2023-05-19T12:37:14+00:00" + "time": "2023-05-19T12:46:45+00:00" }, { "name": "symfony/translation-contracts", @@ -11249,28 +11337,28 @@ }, { "name": "symfony/twig-bridge", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927" + "reference": "67a33c71062d7d931fe9a8cb7be79cca986a6c09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927", - "reference": "30e3ad6ae749b2d2700ecf9b4a1a9d5c96b18927", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/67a33c71062d7d931fe9a8cb7be79cca986a6c09", + "reference": "67a33c71062d7d931fe9a8cb7be79cca986a6c09", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/translation-contracts": "^1.1|^2|^3", + "symfony/translation-contracts": "^2.5|^3", "twig/twig": "^2.13|^3.0.4" }, "conflict": { "phpdocumentor/reflection-docblock": "<3.2.2", "phpdocumentor/type-resolver": "<1.4.0", "symfony/console": "<5.4", - "symfony/form": "<6.2.7", + "symfony/form": "<6.3", "symfony/http-foundation": "<5.4", "symfony/http-kernel": "<6.2", "symfony/mime": "<6.2", @@ -11283,11 +11371,12 @@ "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", "symfony/asset": "^5.4|^6.0", + "symfony/asset-mapper": "^6.3", "symfony/console": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/form": "^6.2.7", + "symfony/form": "^6.3", "symfony/html-sanitizer": "^6.1", "symfony/http-foundation": "^5.4|^6.0", "symfony/http-kernel": "^6.2", @@ -11302,7 +11391,7 @@ "symfony/security-http": "^5.4|^6.0", "symfony/serializer": "^6.2", "symfony/stopwatch": "^5.4|^6.0", - "symfony/translation": "^5.4|^6.0", + "symfony/translation": "^6.1", "symfony/web-link": "^5.4|^6.0", "symfony/workflow": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0", @@ -11310,23 +11399,6 @@ "twig/inky-extra": "^2.12|^3", "twig/markdown-extra": "^2.12|^3" }, - "suggest": { - "symfony/asset": "For using the AssetExtension", - "symfony/expression-language": "For using the ExpressionExtension", - "symfony/finder": "", - "symfony/form": "For using the FormExtension", - "symfony/html-sanitizer": "For using the HtmlSanitizerExtension", - "symfony/http-kernel": "For using the HttpKernelExtension", - "symfony/routing": "For using the RoutingExtension", - "symfony/security-core": "For using the SecurityExtension", - "symfony/security-csrf": "For using the CsrfExtension", - "symfony/security-http": "For using the LogoutUrlExtension", - "symfony/stopwatch": "For using the StopwatchExtension", - "symfony/translation": "For using the TranslationExtension", - "symfony/var-dumper": "For using the DumpExtension", - "symfony/web-link": "For using the WebLinkExtension", - "symfony/yaml": "For using the YamlExtension" - }, "type": "symfony-bridge", "autoload": { "psr-4": { @@ -11353,7 +11425,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v6.2.8" + "source": "https://github.com/symfony/twig-bridge/tree/v6.3.0" }, "funding": [ { @@ -11369,20 +11441,20 @@ "type": "tidelift" } ], - "time": "2023-03-31T09:14:44+00:00" + "time": "2023-05-29T13:12:36+00:00" }, { "name": "symfony/twig-bundle", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "8bb562655c6ae4b8fae9cf72077591f38b961566" + "reference": "d0cd4d1675c0582d27c2e8bb0dc27c0303d8e3ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/8bb562655c6ae4b8fae9cf72077591f38b961566", - "reference": "8bb562655c6ae4b8fae9cf72077591f38b961566", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/d0cd4d1675c0582d27c2e8bb0dc27c0303d8e3ea", + "reference": "d0cd4d1675c0582d27c2e8bb0dc27c0303d8e3ea", "shasum": "" }, "require": { @@ -11392,7 +11464,7 @@ "symfony/dependency-injection": "^6.1", "symfony/http-foundation": "^5.4|^6.0", "symfony/http-kernel": "^6.2", - "symfony/twig-bridge": "^6.2", + "symfony/twig-bridge": "^6.3", "twig/twig": "^2.13|^3.0.4" }, "conflict": { @@ -11438,7 +11510,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v6.2.7" + "source": "https://github.com/symfony/twig-bundle/tree/v6.3.0" }, "funding": [ { @@ -11454,20 +11526,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-05-06T09:53:41+00:00" }, { "name": "symfony/uid", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0" + "reference": "01b0f20b1351d997711c56f1638f7a8c3061e384" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0", - "reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0", + "url": "https://api.github.com/repos/symfony/uid/zipball/01b0f20b1351d997711c56f1638f7a8c3061e384", + "reference": "01b0f20b1351d997711c56f1638f7a8c3061e384", "shasum": "" }, "require": { @@ -11512,7 +11584,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v6.2.7" + "source": "https://github.com/symfony/uid/tree/v6.3.0" }, "funding": [ { @@ -11528,7 +11600,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-04-08T07:25:02+00:00" }, { "name": "symfony/ux-turbo", @@ -11628,24 +11700,25 @@ }, { "name": "symfony/validator", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "14998e41b1e65e15cbe23466e5a5c2edd8ad3584" + "reference": "b18c05b5f52e0428688191da3a856b64c7a022db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/14998e41b1e65e15cbe23466e5a5c2edd8ad3584", - "reference": "14998e41b1e65e15cbe23466e5a5c2edd8ad3584", + "url": "https://api.github.com/repos/symfony/validator/zipball/b18c05b5f52e0428688191da3a856b64c7a022db", + "reference": "b18c05b5f52e0428688191da3a856b64c7a022db", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1|^2|^3" + "symfony/polyfill-php83": "^1.27", + "symfony/translation-contracts": "^2.5|^3" }, "conflict": { "doctrine/annotations": "<1.13", @@ -11677,18 +11750,6 @@ "symfony/translation": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "egulias/email-validator": "Strict (RFC compliant) email validation", - "psr/cache-implementation": "For using the mapping cache.", - "symfony/config": "", - "symfony/expression-language": "For using the Expression validator and the ExpressionLanguageSyntax constraints", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For accessing properties within comparison constraints", - "symfony/property-info": "To automatically add NotNull and Type constraints", - "symfony/translation": "For translating validation errors.", - "symfony/yaml": "" - }, "type": "library", "autoload": { "psr-4": { @@ -11715,7 +11776,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.2.11" + "source": "https://github.com/symfony/validator/tree/v6.3.0" }, "funding": [ { @@ -11731,20 +11792,20 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:08:43+00:00" + "time": "2023-05-25T13:09:35+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "7d10f2a5a452bda385692fc7d38cd6eccfebe756" + "reference": "6acdcd5c122074ee9f7b051e4fb177025c277a0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7d10f2a5a452bda385692fc7d38cd6eccfebe756", - "reference": "7d10f2a5a452bda385692fc7d38cd6eccfebe756", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6acdcd5c122074ee9f7b051e4fb177025c277a0e", + "reference": "6acdcd5c122074ee9f7b051e4fb177025c277a0e", "shasum": "" }, "require": { @@ -11761,11 +11822,6 @@ "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "bin": [ "Resources/bin/var-dump-server" ], @@ -11802,7 +11858,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.2.11" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.0" }, "funding": [ { @@ -11818,20 +11874,20 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:08:43+00:00" + "time": "2023-05-25T13:09:35+00:00" }, { "name": "symfony/var-exporter", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "9a07920c2058bafee921ce4d90aeef2193837d63" + "reference": "db5416d04269f2827d8c54331ba4cfa42620d350" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/9a07920c2058bafee921ce4d90aeef2193837d63", - "reference": "9a07920c2058bafee921ce4d90aeef2193837d63", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/db5416d04269f2827d8c54331ba4cfa42620d350", + "reference": "db5416d04269f2827d8c54331ba4cfa42620d350", "shasum": "" }, "require": { @@ -11876,7 +11932,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.2.10" + "source": "https://github.com/symfony/var-exporter/tree/v6.3.0" }, "funding": [ { @@ -11892,20 +11948,20 @@ "type": "tidelift" } ], - "time": "2023-04-21T08:33:05+00:00" + "time": "2023-04-21T08:48:44+00:00" }, { "name": "symfony/web-link", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/web-link.git", - "reference": "410aac2034608ac661cdca1968e3c56d4164abc8" + "reference": "0989ca617d0703cdca501a245f10e194ff22315b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-link/zipball/410aac2034608ac661cdca1968e3c56d4164abc8", - "reference": "410aac2034608ac661cdca1968e3c56d4164abc8", + "url": "https://api.github.com/repos/symfony/web-link/zipball/0989ca617d0703cdca501a245f10e194ff22315b", + "reference": "0989ca617d0703cdca501a245f10e194ff22315b", "shasum": "" }, "require": { @@ -11921,9 +11977,6 @@ "require-dev": { "symfony/http-kernel": "^5.4|^6.0" }, - "suggest": { - "symfony/http-kernel": "" - }, "type": "library", "autoload": { "psr-4": { @@ -11962,7 +12015,7 @@ "push" ], "support": { - "source": "https://github.com/symfony/web-link/tree/v6.2.7" + "source": "https://github.com/symfony/web-link/tree/v6.3.0" }, "funding": [ { @@ -11978,7 +12031,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-04-21T14:41:17+00:00" }, { "name": "symfony/webpack-encore-bundle", @@ -12055,16 +12108,16 @@ }, { "name": "symfony/yaml", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "61916f3861b1e9705b18cfde723921a71dd1559d" + "reference": "a9a8337aa641ef2aa39c3e028f9107ec391e5927" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/61916f3861b1e9705b18cfde723921a71dd1559d", - "reference": "61916f3861b1e9705b18cfde723921a71dd1559d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a9a8337aa641ef2aa39c3e028f9107ec391e5927", + "reference": "a9a8337aa641ef2aa39c3e028f9107ec391e5927", "shasum": "" }, "require": { @@ -12077,9 +12130,6 @@ "require-dev": { "symfony/console": "^5.4|^6.0" }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "bin": [ "Resources/bin/yaml-lint" ], @@ -12109,7 +12159,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.2.10" + "source": "https://github.com/symfony/yaml/tree/v6.3.0" }, "funding": [ { @@ -12125,7 +12175,7 @@ "type": "tidelift" } ], - "time": "2023-04-28T13:25:36+00:00" + "time": "2023-04-28T13:28:14+00:00" }, { "name": "tecnickcom/tc-lib-barcode", @@ -15524,16 +15574,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v6.2.9", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "328bc3795059651d2d4e462e8febdf7ec2d7a626" + "reference": "2611ec97006953c3b21ac9f3c52a6a252483e637" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/328bc3795059651d2d4e462e8febdf7ec2d7a626", - "reference": "328bc3795059651d2d4e462e8febdf7ec2d7a626", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2611ec97006953c3b21ac9f3c52a6a252483e637", + "reference": "2611ec97006953c3b21ac9f3c52a6a252483e637", "shasum": "" }, "require": { @@ -15545,9 +15595,6 @@ "require-dev": { "symfony/css-selector": "^5.4|^6.0" }, - "suggest": { - "symfony/css-selector": "" - }, "type": "library", "autoload": { "psr-4": { @@ -15574,7 +15621,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v6.2.9" + "source": "https://github.com/symfony/dom-crawler/tree/v6.3.0" }, "funding": [ { @@ -15590,7 +15637,7 @@ "type": "tidelift" } ], - "time": "2023-04-11T16:03:19+00:00" + "time": "2023-04-28T16:05:33+00:00" }, { "name": "symfony/maker-bundle", @@ -15687,16 +15734,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "552950db2919421ad917e29e76d1999a2a31a8e3" + "reference": "f8d75b4d9bf7243979b2c2e5e6cd73f03e10579f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/552950db2919421ad917e29e76d1999a2a31a8e3", - "reference": "552950db2919421ad917e29e76d1999a2a31a8e3", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/f8d75b4d9bf7243979b2c2e5e6cd73f03e10579f", + "reference": "f8d75b4d9bf7243979b2c2e5e6cd73f03e10579f", "shasum": "" }, "require": { @@ -15706,11 +15753,9 @@ "phpunit/phpunit": "<7.5|9.1.2" }, "require-dev": { - "symfony/deprecation-contracts": "^2.1|^3.0", - "symfony/error-handler": "^5.4|^6.0" - }, - "suggest": { - "symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/error-handler": "^5.4|^6.0", + "symfony/polyfill-php81": "^1.27" }, "bin": [ "bin/simple-phpunit" @@ -15750,7 +15795,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v6.2.10" + "source": "https://github.com/symfony/phpunit-bridge/tree/v6.3.0" }, "funding": [ { @@ -15766,7 +15811,7 @@ "type": "tidelift" } ], - "time": "2023-04-18T13:46:08+00:00" + "time": "2023-05-30T09:01:24+00:00" }, { "name": "symfony/web-profiler-bundle", From affed459dfd92a8c75567a9157253e49a7da4964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 13:49:21 +0200 Subject: [PATCH 34/91] Updated recipe of doctrine/doctrine-bundle --- config/packages/doctrine.yaml | 2 ++ symfony.lock | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 1829473a..5adb0922 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -22,6 +22,8 @@ doctrine: orm: auto_generate_proxy_classes: true enable_lazy_ghost_objects: true + report_fields_where_declared: true + validate_xml_mapping: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: true mappings: diff --git a/symfony.lock b/symfony.lock index 71772436..9315c04f 100644 --- a/symfony.lock +++ b/symfony.lock @@ -75,12 +75,12 @@ "version": "v0.5.3" }, "doctrine/doctrine-bundle": { - "version": "2.9", + "version": "2.10", "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "2.8", - "ref": "67961f095352f829a24c035639b3d0d3378ffbf2" + "version": "2.10", + "ref": "f0d8c9a4da17815830aac0d63e153a940ae176bb" }, "files": [ "config/packages/doctrine.yaml", From dc6a67c2f0c12644ba786d2273fdc55a9b05f2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 14:01:09 +0200 Subject: [PATCH 35/91] Made the ALLOWED_ELEMENT_CLASS protected so we can apply rector Its bad style to override a public const in a child class --- src/Entity/Attachments/Attachment.php | 12 +++++++++++- src/Entity/Parameters/AbstractParameter.php | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 7c07a465..bc3f52b8 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -71,8 +71,9 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses. + * */ - public const ALLOWED_ELEMENT_CLASS = ''; + protected const ALLOWED_ELEMENT_CLASS = ''; /** * @var string|null the original filename the file had, when the user uploaded it @@ -463,4 +464,13 @@ abstract class Attachment extends AbstractNamedDBElement return (bool) filter_var($string, FILTER_VALIDATE_URL); } + + /** + * Returns the class of the element that is allowed to be associated with this attachment. + * @return string + */ + public function getElementClass(): string + { + return static::ALLOWED_ELEMENT_CLASS; + } } diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index b033c0ac..be918d00 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -64,7 +64,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement /** * @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses. */ - public const ALLOWED_ELEMENT_CLASS = ''; + protected const ALLOWED_ELEMENT_CLASS = ''; /** * @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short @@ -400,4 +400,13 @@ abstract class AbstractParameter extends AbstractNamedDBElement return $str; } + + /** + * Returns the class of the element that is allowed to be associated with this attachment. + * @return string + */ + public function getElementClass(): string + { + return static::ALLOWED_ELEMENT_CLASS; + } } From 7ee01d9a0594bf2883c364dd89915fd3416ec2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 14:15:46 +0200 Subject: [PATCH 36/91] Applied rector with PHP8.1 migration rules --- rector.php | 4 +- .../Attachments/CleanAttachmentsCommand.php | 12 +- src/Command/BackupCommand.php | 21 +--- src/Command/CheckRequirementsCommand.php | 89 +++++++++------ .../Currencies/UpdateExchangeRatesCommand.php | 18 +-- src/Command/Logs/ShowEventLogCommand.php | 23 +--- .../Migrations/ConvertBBCodeCommand.php | 16 +-- .../Migrations/ImportPartKeeprCommand.php | 19 +--- src/Command/User/ConvertToSAMLUserCommand.php | 7 +- src/Command/User/SetPasswordCommand.php | 12 +- .../User/UpgradePermissionsSchemaCommand.php | 20 +--- src/Command/User/UserEnableCommand.php | 12 +- src/Command/User/UserListCommand.php | 8 +- src/Command/User/UsersPermissionsCommand.php | 18 +-- src/Command/VersionCommand.php | 7 +- .../AdminPages/BaseAdminController.php | 107 ++++++------------ .../AdminPages/CurrencyController.php | 6 +- .../AdminPages/ManufacturerController.php | 3 - src/Controller/HomepageController.php | 9 +- src/Controller/LabelController.php | 28 +---- src/Controller/LogController.php | 13 +-- src/Controller/PartController.php | 32 +++--- src/Controller/PartImportExportController.php | 19 +--- src/Controller/PartListsController.php | 43 +------ src/Controller/ProjectController.php | 19 +--- src/Controller/RedirectController.php | 9 +- src/Controller/ScanController.php | 13 +-- src/Controller/SecurityController.php | 13 +-- src/Controller/SelectAPIController.php | 25 +--- src/Controller/ToolsController.php | 20 +--- src/Controller/TreeController.php | 5 +- src/Controller/TypeaheadController.php | 64 +++-------- src/Controller/UserController.php | 2 +- src/Controller/UserSettingsController.php | 36 ++---- .../WebauthnKeyRegistrationController.php | 7 +- src/DataFixtures/DataStructureFixtures.php | 5 +- src/DataFixtures/GroupFixtures.php | 14 +-- src/DataFixtures/LabelProfileFixtures.php | 5 +- src/DataFixtures/PartFixtures.php | 5 +- src/DataFixtures/UserFixtures.php | 7 +- src/DataTables/AttachmentDataTable.php | 43 +++---- src/DataTables/Column/EntityColumn.php | 51 ++++----- .../Column/LocaleDateTimeColumn.php | 1 - src/DataTables/Column/LogEntryExtraColumn.php | 7 +- .../Column/LogEntryTargetColumn.php | 5 +- src/DataTables/Column/MarkdownColumn.php | 5 +- .../Column/PartAttachmentsColumn.php | 13 +-- src/DataTables/Column/PrettyBoolColumn.php | 5 +- src/DataTables/Column/RevertLogColumn.php | 11 +- src/DataTables/Column/SIUnitNumberColumn.php | 5 +- src/DataTables/Column/TagsColumn.php | 9 +- src/DataTables/ErrorDataTable.php | 8 +- src/DataTables/Filters/AttachmentFilter.php | 21 ---- .../Filters/CompoundFilterTrait.php | 2 - .../Constraints/AbstractConstraint.php | 11 +- .../Filters/Constraints/BooleanConstraint.php | 10 +- .../Filters/Constraints/ChoiceConstraint.php | 10 +- .../Filters/Constraints/EntityConstraint.php | 40 +------ .../Filters/Constraints/FilterTrait.php | 10 +- .../Constraints/InstanceOfConstraint.php | 6 +- .../Filters/Constraints/NumberConstraint.php | 61 ++++------ .../Constraints/Part/ParameterConstraint.php | 27 ----- .../Part/ParameterValueConstraint.php | 8 +- .../Constraints/Part/TagsConstraint.php | 26 ++--- .../Filters/Constraints/TextConstraint.php | 29 ++--- src/DataTables/Filters/LogFilter.php | 17 +-- src/DataTables/Filters/PartFilter.php | 81 ------------- src/DataTables/Filters/PartSearchFilter.php | 104 +---------------- .../Helpers/PartDataTableHelper.php | 17 +-- src/DataTables/LogDataTable.php | 64 ++++------- src/DataTables/PartsDataTable.php | 42 ++----- src/DataTables/ProjectBomEntriesDataTable.php | 24 ++-- .../Purger/ResetAutoIncrementORMPurger.php | 44 +++---- src/Doctrine/SQLiteRegexExtension.php | 2 +- src/Doctrine/Types/BigDecimalType.php | 4 +- src/Doctrine/Types/UTCDateTimeType.php | 4 +- src/Entity/Attachments/Attachment.php | 12 +- src/Entity/Attachments/AttachmentType.php | 8 +- .../Attachments/AttachmentTypeAttachment.php | 4 +- src/Entity/Attachments/CategoryAttachment.php | 4 +- src/Entity/Attachments/CurrencyAttachment.php | 4 +- .../Attachments/FootprintAttachment.php | 4 +- src/Entity/Attachments/GroupAttachment.php | 4 +- src/Entity/Attachments/LabelAttachment.php | 4 +- .../Attachments/ManufacturerAttachment.php | 4 +- .../Attachments/MeasurementUnitAttachment.php | 4 +- src/Entity/Attachments/PartAttachment.php | 4 +- src/Entity/Attachments/ProjectAttachment.php | 4 +- .../Attachments/StorelocationAttachment.php | 4 +- src/Entity/Attachments/SupplierAttachment.php | 4 +- src/Entity/Attachments/UserAttachment.php | 4 +- src/Entity/Base/AbstractDBElement.php | 4 +- src/Entity/Base/AbstractNamedDBElement.php | 4 +- .../Base/AbstractPartsContainingDBElement.php | 2 +- .../Base/AbstractStructuralDBElement.php | 21 ++-- src/Entity/Base/MasterAttachmentTrait.php | 2 +- src/Entity/LabelSystem/LabelOptions.php | 32 +----- src/Entity/LabelSystem/LabelProfile.php | 8 +- src/Entity/LogSystem/AbstractLogEntry.php | 26 ++--- .../LogSystem/CollectionElementDeleted.php | 6 +- .../LogSystem/PartStockChangedLogEntry.php | 50 +++----- .../LogSystem/SecurityEventLogEntry.php | 2 +- src/Entity/Parameters/AbstractParameter.php | 5 +- .../Parameters/AttachmentTypeParameter.php | 6 +- src/Entity/Parameters/CategoryParameter.php | 6 +- src/Entity/Parameters/CurrencyParameter.php | 6 +- src/Entity/Parameters/FootprintParameter.php | 6 +- src/Entity/Parameters/GroupParameter.php | 6 +- .../Parameters/ManufacturerParameter.php | 6 +- .../Parameters/MeasurementUnitParameter.php | 6 +- src/Entity/Parameters/PartParameter.php | 6 +- src/Entity/Parameters/ProjectParameter.php | 6 +- .../Parameters/StorelocationParameter.php | 6 +- src/Entity/Parameters/SupplierParameter.php | 6 +- src/Entity/Parts/Category.php | 30 +---- src/Entity/Parts/Footprint.php | 13 +-- src/Entity/Parts/Manufacturer.php | 8 +- src/Entity/Parts/MeasurementUnit.php | 19 +--- src/Entity/Parts/Part.php | 22 ++-- src/Entity/Parts/PartLot.php | 36 ++---- .../PartTraits/AdvancedPropertyTrait.php | 1 - src/Entity/Parts/PartTraits/InstockTrait.php | 2 - src/Entity/Parts/PartTraits/OrderTrait.php | 8 +- src/Entity/Parts/PartTraits/ProjectTrait.php | 5 +- src/Entity/Parts/Storelocation.php | 28 +---- src/Entity/Parts/Supplier.php | 18 ++- src/Entity/PriceInformations/Currency.php | 21 ++-- src/Entity/PriceInformations/Orderdetail.php | 25 +--- src/Entity/PriceInformations/Pricedetail.php | 8 +- src/Entity/ProjectSystem/Project.php | 30 ++--- src/Entity/ProjectSystem/ProjectBOMEntry.php | 66 ++--------- src/Entity/UserSystem/Group.php | 8 +- src/Entity/UserSystem/PermissionData.php | 38 +------ src/Entity/UserSystem/U2FKey.php | 2 +- src/Entity/UserSystem/User.php | 51 ++------- src/Entity/UserSystem/WebauthnKey.php | 19 +--- .../AttachmentDeleteListener.php | 15 +-- .../TreeCacheInvalidationListener.php | 11 +- .../LogSystem/EventLoggerSubscriber.php | 37 ++---- .../LogSystem/LogAccessDeniedSubscriber.php | 5 +- .../LogSystem/LogDBMigrationSubscriber.php | 9 +- .../LogSystem/LogLogoutEventListener.php | 18 +-- .../SecurityEventLoggerSubscriber.php | 11 +- src/EventSubscriber/SetMailFromSubscriber.php | 7 +- .../SymfonyDebugToolbarSubscriber.php | 5 +- .../UserSystem/LoginSuccessSubscriber.php | 11 +- .../LogoutDisabledUserSubscriber.php | 8 +- .../PasswordChangeNeededSubscriber.php | 8 +- .../UserSystem/SetUserTimezoneSubscriber.php | 7 +- .../UpgradePermissionsSchemaSubscriber.php | 13 +-- src/Events/SecurityEvent.php | 5 +- src/Events/SecurityEvents.php | 18 +-- src/Exceptions/InvalidRegexException.php | 12 +- .../AdminPages/AttachmentTypeAdminForm.php | 13 +-- src/Form/AdminPages/BaseEntityAdminForm.php | 9 +- src/Form/AdminPages/CurrencyAdminForm.php | 5 +- src/Form/AdminPages/ImportType.php | 5 +- src/Form/AdminPages/MassCreationForm.php | 5 +- src/Form/AdminPages/SupplierForm.php | 5 +- src/Form/AttachmentFormType.php | 19 +--- src/Form/CollectionTypeExtension.php | 11 +- .../Constraints/InstanceOfConstraintType.php | 5 +- .../Constraints/TagsConstraintType.php | 5 +- src/Form/LabelOptionsType.php | 7 +- src/Form/LabelSystem/LabelDialogType.php | 5 +- src/Form/Part/OrderdetailType.php | 7 +- src/Form/Part/PartBaseType.php | 9 +- src/Form/Part/PartLotType.php | 5 +- src/Form/Permissions/PermissionGroupType.php | 8 +- src/Form/Permissions/PermissionType.php | 12 +- src/Form/Permissions/PermissionsMapper.php | 7 +- src/Form/Permissions/PermissionsType.php | 4 +- src/Form/ProjectSystem/ProjectBuildType.php | 9 +- src/Form/Type/CurrencyEntityType.php | 11 +- .../Helper/StructuralEntityChoiceHelper.php | 51 ++------- .../Helper/StructuralEntityChoiceLoader.php | 9 +- src/Form/Type/MasterPictureAttachmentType.php | 38 +++---- src/Form/Type/PartLotSelectType.php | 16 +-- src/Form/Type/PartSelectType.php | 22 +--- src/Form/Type/RichTextEditorType.php | 19 ++-- src/Form/Type/SIUnitType.php | 9 +- src/Form/Type/StructuralEntityType.php | 45 ++------ src/Form/Type/ThemeChoiceType.php | 9 +- src/Form/Type/TriStateCheckboxType.php | 18 +-- src/Form/Type/UserSelectType.php | 6 +- src/Form/UserAdminForm.php | 5 +- src/Form/UserSettingsType.php | 7 +- src/Helpers/Projects/ProjectBuildRequest.php | 40 ++----- src/Helpers/Trees/TreeViewNode.php | 30 +---- .../AbstractMultiPlatformMigration.php | 45 +++----- .../AbstractPartsContainingRepository.php | 3 - src/Repository/DBElementRepository.php | 4 +- src/Repository/LabelProfileRepository.php | 5 +- src/Repository/LogEntryRepository.php | 11 +- src/Repository/ParameterRepository.php | 2 - .../StructuralDBElementRepository.php | 8 +- src/Repository/UserRepository.php | 4 +- .../EnsureSAMLUserForSAMLLoginChecker.php | 12 +- src/Security/SamlUserFactory.php | 23 +--- src/Security/UserChecker.php | 5 +- src/Security/Voter/AttachmentVoter.php | 30 ++--- src/Security/Voter/ExtendedVoter.php | 11 +- src/Security/Voter/LogEntryVoter.php | 7 +- src/Security/Voter/OrderdetailVoter.php | 32 ++---- src/Security/Voter/ParameterVoter.php | 40 ++----- src/Security/Voter/PartLotVoter.php | 32 ++---- src/Security/Voter/PartVoter.php | 2 +- src/Security/Voter/PricedetailVoter.php | 32 ++---- src/Security/Voter/StructureVoter.php | 6 +- src/Serializer/PartNormalizer.php | 13 +-- .../StructuralElementDenormalizer.php | 9 +- .../StructuralElementFromNameDenormalizer.php | 9 +- .../StructuralElementNormalizer.php | 5 +- .../Attachments/AttachmentManager.php | 5 +- .../Attachments/AttachmentPathResolver.php | 13 +-- .../Attachments/AttachmentReverseSearch.php | 12 +- .../Attachments/AttachmentSubmitHandler.php | 50 +++----- .../Attachments/AttachmentURLGenerator.php | 20 +--- .../Attachments/BuiltinAttachmentsFinder.php | 10 +- .../Attachments/FileTypeFilterTools.php | 7 +- .../Attachments/PartPreviewGenerator.php | 23 ++-- src/Services/CustomEnvVarProcessor.php | 2 +- src/Services/ElementTypeNameGenerator.php | 31 ++--- src/Services/EntityURLGenerator.php | 57 ++++------ src/Services/Formatters/AmountFormatter.php | 9 +- src/Services/Formatters/MarkdownParser.php | 5 +- src/Services/Formatters/MoneyFormatter.php | 8 +- src/Services/Formatters/SIFormatter.php | 6 +- .../ImportExportSystem/BOMImporter.php | 19 +--- .../ImportExportSystem/EntityExporter.php | 9 +- .../ImportExportSystem/EntityImporter.php | 32 ++---- .../PKDatastructureImporter.php | 14 +-- .../PartKeeprImporter/PKImportHelper.php | 9 +- .../PartKeeprImporter/PKImportHelperTrait.php | 19 +--- .../PartKeeprImporter/PKOptionalImporter.php | 6 +- .../PartKeeprImporter/PKPartImporter.php | 20 +--- src/Services/LabelSystem/BarcodeGenerator.php | 25 ++-- .../Barcodes/BarcodeContentGenerator.php | 11 +- .../Barcodes/BarcodeRedirector.php | 9 +- .../LabelExampleElementsGenerator.php | 16 +-- src/Services/LabelSystem/LabelGenerator.php | 5 +- .../LabelSystem/LabelHTMLGenerator.php | 20 +--- .../LabelProfileDropdownHelper.php | 9 +- .../LabelSystem/LabelTextReplacer.php | 9 +- .../AbstractDBElementProvider.php | 5 +- .../PlaceholderProviders/BarcodeProvider.php | 11 +- .../PlaceholderProviders/GlobalProviders.php | 9 +- .../PlaceholderProviders/PartLotProvider.php | 17 +-- .../PlaceholderProviders/PartProvider.php | 23 ++-- .../StorelocationProvider.php | 4 +- .../StructuralDBElementProvider.php | 4 +- .../LabelSystem/SandboxedTwigProvider.php | 5 +- src/Services/LogSystem/EventCommentHelper.php | 9 +- .../LogSystem/EventCommentNeededHelper.php | 9 +- src/Services/LogSystem/EventLogger.php | 45 ++------ src/Services/LogSystem/EventUndoHelper.php | 10 +- src/Services/LogSystem/LogDataFormatter.php | 22 +--- src/Services/LogSystem/LogDiffFormatter.php | 3 +- .../LogSystem/LogEntryExtraFormatter.php | 8 +- src/Services/LogSystem/LogLevelHelper.php | 51 +++------ src/Services/LogSystem/LogTargetHelper.php | 17 +-- src/Services/LogSystem/TimeTravel.php | 21 ++-- src/Services/Misc/DBInfoHelper.php | 13 +-- src/Services/Misc/RangeParser.php | 2 +- .../Parameters/ParameterExtractor.php | 4 +- .../Parts/PartLotWithdrawAddHelper.php | 27 +---- .../Parts/PartsTableActionHandler.php | 32 ++---- src/Services/Parts/PricedetailHelper.php | 20 ++-- .../ProjectSystem/ProjectBuildHelper.php | 20 +--- .../ProjectSystem/ProjectBuildPartHelper.php | 2 - src/Services/Tools/ExchangeRateUpdater.php | 7 +- src/Services/Tools/StatisticsHelper.php | 4 +- src/Services/Tools/TagFinder.php | 7 +- .../PermissionExtractor.php | 2 +- src/Services/Trees/NodesListBuilder.php | 13 +-- src/Services/Trees/SidebarTreeUpdater.php | 11 +- .../StructuralElementRecursionHelper.php | 5 +- src/Services/Trees/ToolsTreeBuilder.php | 18 +-- src/Services/Trees/TreeViewGenerator.php | 28 +---- .../UserSystem/PasswordResetManager.php | 16 +-- src/Services/UserSystem/PermissionManager.php | 29 +---- .../UserSystem/PermissionPresetsHelper.php | 18 ++- .../UserSystem/PermissionSchemaUpdater.php | 12 +- .../UserSystem/TFA/BackupCodeGenerator.php | 5 +- .../UserSystem/TFA/BackupCodeManager.php | 5 +- src/Services/UserSystem/UserAvatarHelper.php | 36 ++---- .../UserSystem/UserCacheKeyGenerator.php | 11 +- src/Twig/AttachmentExtension.php | 11 +- src/Twig/BarcodeExtension.php | 2 +- src/Twig/EntityExtension.php | 27 ++--- src/Twig/FormatExtension.php | 25 +--- src/Twig/LogExtension.php | 11 +- src/Twig/MiscExtension.php | 5 +- .../Sandbox/InheritanceSecurityPolicy.php | 16 +-- src/Twig/TwigCoreExtension.php | 15 +-- src/Twig/UserExtension.php | 8 +- .../Constraints/Misc/ValidRangeValidator.php | 5 +- .../Constraints/NoLockoutValidator.php | 12 +- .../Constraints/ValidFileFilterValidator.php | 5 +- .../ValidGoogleAuthCodeValidator.php | 5 +- .../Constraints/ValidPartLotValidator.php | 7 +- .../Constraints/ValidPermissionValidator.php | 4 +- .../Constraints/ValidThemeValidator.php | 5 +- 303 files changed, 1228 insertions(+), 3465 deletions(-) diff --git a/rector.php b/rector.php index a70f0ba7..04ab0e5a 100644 --- a/rector.php +++ b/rector.php @@ -27,8 +27,8 @@ return static function (RectorConfig $rectorConfig): void { // define sets of rules $rectorConfig->sets([ //PHP rules - //SetList::CODE_QUALITY, - //LevelSetList::UP_TO_PHP_81, + SetList::CODE_QUALITY, + LevelSetList::UP_TO_PHP_81, //Symfony rules SymfonyLevelSetList::UP_TO_SYMFONY_62, diff --git a/src/Command/Attachments/CleanAttachmentsCommand.php b/src/Command/Attachments/CleanAttachmentsCommand.php index aa1750df..d0e37825 100644 --- a/src/Command/Attachments/CleanAttachmentsCommand.php +++ b/src/Command/Attachments/CleanAttachmentsCommand.php @@ -43,16 +43,10 @@ use const DIRECTORY_SEPARATOR; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')] class CleanAttachmentsCommand extends Command { - protected AttachmentManager $attachment_helper; - protected AttachmentReverseSearch $reverseSearch; protected MimeTypes $mimeTypeGuesser; - protected AttachmentPathResolver $pathResolver; - public function __construct(AttachmentManager $attachmentHelper, AttachmentReverseSearch $reverseSearch, AttachmentPathResolver $pathResolver) + public function __construct(protected AttachmentManager $attachment_helper, protected AttachmentReverseSearch $reverseSearch, protected AttachmentPathResolver $pathResolver) { - $this->attachment_helper = $attachmentHelper; - $this->pathResolver = $pathResolver; - $this->reverseSearch = $reverseSearch; $this->mimeTypeGuesser = new MimeTypes(); parent::__construct(); } @@ -88,7 +82,7 @@ class CleanAttachmentsCommand extends Command foreach ($finder as $file) { //If not attachment object uses this file, print it - if (0 === count($this->reverseSearch->findAttachmentsByFile($file))) { + if ([] === $this->reverseSearch->findAttachmentsByFile($file)) { $file_list[] = $file; $table->addRow([ $fs->makePathRelative($file->getPathname(), $mediaPath), @@ -98,7 +92,7 @@ class CleanAttachmentsCommand extends Command } } - if (count($file_list) > 0) { + if ($file_list !== []) { $table->render(); $continue = $io->confirm(sprintf('Found %d abandoned files. Do you want to delete them? This can not be undone!', count($file_list)), false); diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php index dc248126..ccc5763e 100644 --- a/src/Command/BackupCommand.php +++ b/src/Command/BackupCommand.php @@ -19,14 +19,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:backup', 'Backup the files and the database of Part-DB')] class BackupCommand extends Command { - private string $project_dir; - private EntityManagerInterface $entityManager; - - public function __construct(string $project_dir, EntityManagerInterface $entityManager) + public function __construct(private readonly string $project_dir, private readonly EntityManagerInterface $entityManager) { - $this->project_dir = $project_dir; - $this->entityManager = $entityManager; - parent::__construct(); } @@ -69,13 +63,10 @@ class BackupCommand extends Command $io->info('Backup Part-DB to '.$output_filepath); //Check if the file already exists - if (file_exists($output_filepath)) { - //Then ask the user, if he wants to overwrite the file - if (!$io->confirm('The file '.realpath($output_filepath).' already exists. Do you want to overwrite it?', false)) { - $io->error('Backup aborted!'); - - return Command::FAILURE; - } + //Then ask the user, if he wants to overwrite the file + if (file_exists($output_filepath) && !$io->confirm('The file '.realpath($output_filepath).' already exists. Do you want to overwrite it?', false)) { + $io->error('Backup aborted!'); + return Command::FAILURE; } $io->note('Starting backup...'); @@ -113,8 +104,6 @@ class BackupCommand extends Command /** * Constructs the MySQL PDO DSN. * Taken from https://github.com/doctrine/dbal/blob/3.5.x/src/Driver/PDO/MySQL/Driver.php - * - * @param array $params */ private function configureDumper(array $params, DbDumper $dumper): void { diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 3d7f3a72..38f599e3 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -30,11 +30,8 @@ use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')] class CheckRequirementsCommand extends Command { - protected ContainerBagInterface $params; - - public function __construct(ContainerBagInterface $params) + public function __construct(protected ContainerBagInterface $params) { - $this->params = $params; parent::__construct(); } @@ -66,40 +63,48 @@ class CheckRequirementsCommand extends Command protected function checkPHP(SymfonyStyle $io, $only_issues = false): void { //Check PHP versions - $io->isVerbose() && $io->comment('Checking PHP version...'); + if ($io->isVerbose()) { + $io->comment('Checking PHP version...'); + } //We recommend PHP 8.2, but 8.1 is the minimum if (PHP_VERSION_ID < 80200) { $io->warning('You are using PHP '. PHP_VERSION .'. This will work, but a newer version is recommended.'); - } else { - !$only_issues && $io->success('PHP version is sufficient.'); + } elseif (!$only_issues) { + $io->success('PHP version is sufficient.'); } //Check if opcache is enabled - $io->isVerbose() && $io->comment('Checking Opcache...'); + if ($io->isVerbose()) { + $io->comment('Checking Opcache...'); + } $opcache_enabled = ini_get('opcache.enable') === '1'; if (!$opcache_enabled) { $io->warning('Opcache is not enabled. This will work, but performance will be better with opcache enabled. Set opcache.enable=1 in your php.ini to enable it'); - } else { - !$only_issues && $io->success('Opcache is enabled.'); + } elseif (!$only_issues) { + $io->success('Opcache is enabled.'); } //Check if opcache is configured correctly - $io->isVerbose() && $io->comment('Checking Opcache configuration...'); + if ($io->isVerbose()) { + $io->comment('Checking Opcache configuration...'); + } if ($opcache_enabled && (ini_get('opcache.memory_consumption') < 256 || ini_get('opcache.max_accelerated_files') < 20000)) { $io->warning('Opcache configuration can be improved. See https://symfony.com/doc/current/performance.html for more info.'); - } else { - !$only_issues && $io->success('Opcache configuration is already performance optimized.'); + } elseif (!$only_issues) { + $io->success('Opcache configuration is already performance optimized.'); } } protected function checkPartDBConfig(SymfonyStyle $io, $only_issues = false): void { //Check if APP_ENV is set to prod - $io->isVerbose() && $io->comment('Checking debug mode...'); - if($this->params->get('kernel.debug')) { + if ($io->isVerbose()) { + $io->comment('Checking debug mode...'); + } + if ($this->params->get('kernel.debug')) { $io->warning('You have activated debug mode, this is will leak informations in a production environment.'); - } else { - !$only_issues && $io->success('Debug mode disabled.'); + } elseif (!$only_issues) { + $io->success('Debug mode disabled.'); } } @@ -108,61 +113,71 @@ class CheckRequirementsCommand extends Command { //Get all installed PHP extensions $extensions = get_loaded_extensions(); - $io->isVerbose() && $io->comment('Your PHP installation has '. count($extensions) .' extensions installed: '. implode(', ', $extensions)); + if ($io->isVerbose()) { + $io->comment('Your PHP installation has '. count($extensions) .' extensions installed: '. implode(', ', $extensions)); + } $db_drivers_count = 0; if(!in_array('pdo_mysql', $extensions)) { $io->error('pdo_mysql is not installed. You will not be able to use MySQL databases.'); } else { - !$only_issues && $io->success('PHP extension pdo_mysql is installed.'); + if (!$only_issues) { + $io->success('PHP extension pdo_mysql is installed.'); + } $db_drivers_count++; } if(!in_array('pdo_sqlite', $extensions)) { $io->error('pdo_sqlite is not installed. You will not be able to use SQLite. databases'); } else { - !$only_issues && $io->success('PHP extension pdo_sqlite is installed.'); + if (!$only_issues) { + $io->success('PHP extension pdo_sqlite is installed.'); + } $db_drivers_count++; } - $io->isVerbose() && $io->comment('You have '. $db_drivers_count .' database drivers installed.'); + if ($io->isVerbose()) { + $io->comment('You have '. $db_drivers_count .' database drivers installed.'); + } if ($db_drivers_count === 0) { $io->error('You have no database drivers installed. You have to install at least one database driver!'); } - if(!in_array('curl', $extensions)) { + if (!in_array('curl', $extensions)) { $io->warning('curl extension is not installed. Install curl extension for better performance'); - } else { - !$only_issues && $io->success('PHP extension curl is installed.'); + } elseif (!$only_issues) { + $io->success('PHP extension curl is installed.'); } $gd_installed = in_array('gd', $extensions); - if(!$gd_installed) { + if (!$gd_installed) { $io->error('GD is not installed. GD is required for image processing.'); - } else { - !$only_issues && $io->success('PHP extension GD is installed.'); + } elseif (!$only_issues) { + $io->success('PHP extension GD is installed.'); } //Check if GD has jpeg support - $io->isVerbose() && $io->comment('Checking if GD has jpeg support...'); + if ($io->isVerbose()) { + $io->comment('Checking if GD has jpeg support...'); + } if ($gd_installed) { $gd_info = gd_info(); - if($gd_info['JPEG Support'] === false) { + if ($gd_info['JPEG Support'] === false) { $io->warning('Your GD does not have jpeg support. You will not be able to generate thumbnails of jpeg images.'); - } else { - !$only_issues && $io->success('GD has jpeg support.'); + } elseif (!$only_issues) { + $io->success('GD has jpeg support.'); } - if($gd_info['PNG Support'] === false) { + if ($gd_info['PNG Support'] === false) { $io->warning('Your GD does not have png support. You will not be able to generate thumbnails of png images.'); - } else { - !$only_issues && $io->success('GD has png support.'); + } elseif (!$only_issues) { + $io->success('GD has png support.'); } - if($gd_info['WebP Support'] === false) { + if ($gd_info['WebP Support'] === false) { $io->warning('Your GD does not have WebP support. You will not be able to generate thumbnails of WebP images.'); - } else { - !$only_issues && $io->success('GD has WebP support.'); + } elseif (!$only_issues) { + $io->success('GD has WebP support.'); } } diff --git a/src/Command/Currencies/UpdateExchangeRatesCommand.php b/src/Command/Currencies/UpdateExchangeRatesCommand.php index 13d2e2dc..4a6b88f1 100644 --- a/src/Command/Currencies/UpdateExchangeRatesCommand.php +++ b/src/Command/Currencies/UpdateExchangeRatesCommand.php @@ -38,18 +38,8 @@ use function strlen; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')] class UpdateExchangeRatesCommand extends Command { - protected string $base_current; - protected EntityManagerInterface $em; - protected ExchangeRateUpdater $exchangeRateUpdater; - - public function __construct(string $base_current, EntityManagerInterface $entityManager, ExchangeRateUpdater $exchangeRateUpdater) + public function __construct(protected string $base_current, protected EntityManagerInterface $em, protected ExchangeRateUpdater $exchangeRateUpdater) { - //$this->swap = $swap; - $this->base_current = $base_current; - - $this->em = $entityManager; - $this->exchangeRateUpdater = $exchangeRateUpdater; - parent::__construct(); } @@ -75,11 +65,7 @@ class UpdateExchangeRatesCommand extends Command $iso_code = $input->getArgument('iso_code'); $repo = $this->em->getRepository(Currency::class); - if (!empty($iso_code)) { - $candidates = $repo->findBy(['iso_code' => $iso_code]); - } else { - $candidates = $repo->findAll(); - } + $candidates = empty($iso_code) ? $repo->findAll() : $repo->findBy(['iso_code' => $iso_code]); $success_counter = 0; diff --git a/src/Command/Logs/ShowEventLogCommand.php b/src/Command/Logs/ShowEventLogCommand.php index cc02bfd1..0fc78d46 100644 --- a/src/Command/Logs/ShowEventLogCommand.php +++ b/src/Command/Logs/ShowEventLogCommand.php @@ -39,20 +39,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')] class ShowEventLogCommand extends Command { - protected EntityManagerInterface $entityManager; - protected TranslatorInterface $translator; - protected ElementTypeNameGenerator $elementTypeNameGenerator; protected LogEntryRepository $repo; - protected LogEntryExtraFormatter $formatter; - public function __construct(EntityManagerInterface $entityManager, - TranslatorInterface $translator, ElementTypeNameGenerator $elementTypeNameGenerator, LogEntryExtraFormatter $formatter) + public function __construct(protected EntityManagerInterface $entityManager, + protected TranslatorInterface $translator, protected ElementTypeNameGenerator $elementTypeNameGenerator, protected LogEntryExtraFormatter $formatter) { - $this->entityManager = $entityManager; - $this->translator = $translator; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; - $this->formatter = $formatter; - $this->repo = $this->entityManager->getRepository(AbstractLogEntry::class); parent::__construct(); } @@ -145,14 +136,12 @@ class ShowEventLogCommand extends Command $target_class = $this->elementTypeNameGenerator->getLocalizedTypeLabel($entry->getTargetClass()); } - if ($entry->getUser()) { + if ($entry->getUser() instanceof \App\Entity\UserSystem\User) { $user = $entry->getUser()->getFullName(true); + } elseif ($entry->isCLIEntry()) { + $user = $entry->getCLIUsername() . ' [CLI]'; } else { - if ($entry->isCLIEntry()) { - $user = $entry->getCLIUsername() . ' [CLI]'; - } else { - $user = $entry->getUsername() . ' [deleted]'; - } + $user = $entry->getUsername() . ' [deleted]'; } $row = [ diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php index f4565805..50e5b011 100644 --- a/src/Command/Migrations/ConvertBBCodeCommand.php +++ b/src/Command/Migrations/ConvertBBCodeCommand.php @@ -58,16 +58,10 @@ class ConvertBBCodeCommand extends Command * @var string The regex (performed in PHP) used to check if a property really contains BBCODE */ protected const BBCODE_REGEX = '/\\[.+\\].*\\[\\/.+\\]/'; - - protected EntityManagerInterface $em; - protected PropertyAccessorInterface $propertyAccessor; protected BBCodeToMarkdownConverter $converter; - public function __construct(EntityManagerInterface $entityManager, PropertyAccessorInterface $propertyAccessor) + public function __construct(protected EntityManagerInterface $em, protected PropertyAccessorInterface $propertyAccessor) { - $this->em = $entityManager; - $this->propertyAccessor = $propertyAccessor; - $this->converter = new BBCodeToMarkdownConverter(); parent::__construct(); @@ -126,25 +120,25 @@ class ConvertBBCodeCommand extends Command //Fetch resulting classes $results = $qb->getQuery()->getResult(); - $io->note(sprintf('Found %d entities, that need to be converted!', count($results))); + $io->note(sprintf('Found %d entities, that need to be converted!', is_countable($results) ? count($results) : 0)); //In verbose mode print the names of the entities foreach ($results as $result) { /** @var AbstractNamedDBElement $result */ $io->writeln( - 'Convert entity: '.$result->getName().' ('.get_class($result).': '.$result->getID().')', + 'Convert entity: '.$result->getName().' ('.$result::class.': '.$result->getID().')', OutputInterface::VERBOSITY_VERBOSE ); foreach ($properties as $property) { //Retrieve bbcode from entity $bbcode = $this->propertyAccessor->getValue($result, $property); //Check if the current property really contains BBCode - if (!preg_match(static::BBCODE_REGEX, $bbcode)) { + if (!preg_match(static::BBCODE_REGEX, (string) $bbcode)) { continue; } $io->writeln( 'BBCode (old): ' - .str_replace('\n', ' ', substr($bbcode, 0, 255)), + .str_replace('\n', ' ', substr((string) $bbcode, 0, 255)), OutputInterface::VERBOSITY_VERY_VERBOSE ); $markdown = $this->converter->convert($bbcode); diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index d2c015b9..1ba2e8db 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -37,24 +37,11 @@ use Symfony\Component\Console\Style\SymfonyStyle; class ImportPartKeeprCommand extends Command { - protected EntityManagerInterface $em; - protected MySQLDumpXMLConverter $xml_converter; - protected PKDatastructureImporter $datastructureImporter; - protected PKImportHelper $importHelper; - protected PKPartImporter $partImporter; - protected PKOptionalImporter $optionalImporter; - - public function __construct(EntityManagerInterface $em, MySQLDumpXMLConverter $xml_converter, - PKDatastructureImporter $datastructureImporter, PKPartImporter $partImporter, PKImportHelper $importHelper, - PKOptionalImporter $optionalImporter) + public function __construct(protected EntityManagerInterface $em, protected MySQLDumpXMLConverter $xml_converter, + protected PKDatastructureImporter $datastructureImporter, protected PKPartImporter $partImporter, protected PKImportHelper $importHelper, + protected PKOptionalImporter $optionalImporter) { parent::__construct(self::$defaultName); - $this->em = $em; - $this->datastructureImporter = $datastructureImporter; - $this->importHelper = $importHelper; - $this->partImporter = $partImporter; - $this->xml_converter = $xml_converter; - $this->optionalImporter = $optionalImporter; } protected function configure() diff --git a/src/Command/User/ConvertToSAMLUserCommand.php b/src/Command/User/ConvertToSAMLUserCommand.php index 635c9eb3..4461bb58 100644 --- a/src/Command/User/ConvertToSAMLUserCommand.php +++ b/src/Command/User/ConvertToSAMLUserCommand.php @@ -33,14 +33,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')] class ConvertToSAMLUserCommand extends Command { - protected EntityManagerInterface $entityManager; - protected bool $saml_enabled; - - public function __construct(EntityManagerInterface $entityManager, bool $saml_enabled) + public function __construct(protected EntityManagerInterface $entityManager, protected bool $saml_enabled) { parent::__construct(); - $this->entityManager = $entityManager; - $this->saml_enabled = $saml_enabled; } protected function configure(): void diff --git a/src/Command/User/SetPasswordCommand.php b/src/Command/User/SetPasswordCommand.php index 4a7542e3..90f045b5 100644 --- a/src/Command/User/SetPasswordCommand.php +++ b/src/Command/User/SetPasswordCommand.php @@ -37,16 +37,8 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')] class SetPasswordCommand extends Command { - protected EntityManagerInterface $entityManager; - protected UserPasswordHasherInterface $encoder; - protected EventDispatcherInterface $eventDispatcher; - - public function __construct(EntityManagerInterface $entityManager, UserPasswordHasherInterface $passwordEncoder, EventDispatcherInterface $eventDispatcher) + public function __construct(protected EntityManagerInterface $entityManager, protected UserPasswordHasherInterface $encoder, protected EventDispatcherInterface $eventDispatcher) { - $this->entityManager = $entityManager; - $this->encoder = $passwordEncoder; - $this->eventDispatcher = $eventDispatcher; - parent::__construct(); } @@ -64,7 +56,7 @@ class SetPasswordCommand extends Command $user = $this->entityManager->getRepository(User::class)->findByEmailOrName($user_name); - if (!$user) { + if (!$user instanceof \App\Entity\UserSystem\User) { $io->error(sprintf('No user with the given username %s found in the database!', $user_name)); return \Symfony\Component\Console\Command\Command::FAILURE; diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index 94d65c67..219ddb2f 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -34,17 +34,9 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:upgrade-permissions-schema', '(Manually) upgrades the permissions schema of all users to the latest version.')] final class UpgradePermissionsSchemaCommand extends Command { - private PermissionSchemaUpdater $permissionSchemaUpdater; - private EntityManagerInterface $em; - private EventCommentHelper $eventCommentHelper; - - public function __construct(PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper) + public function __construct(private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $em, private readonly EventCommentHelper $eventCommentHelper) { parent::__construct(self::$defaultName); - - $this->permissionSchemaUpdater = $permissionSchemaUpdater; - $this->eventCommentHelper = $eventCommentHelper; - $this->em = $entityManager; } protected function configure(): void @@ -79,7 +71,7 @@ final class UpgradePermissionsSchemaCommand extends Command } $io->info('Found '. count($groups_to_upgrade) .' groups and '. count($users_to_upgrade) .' users that need an update.'); - if (empty($groups_to_upgrade) && empty($users_to_upgrade)) { + if ($groups_to_upgrade === [] && $users_to_upgrade === []) { $io->success('All users and group permissions schemas are up-to-date. No update needed.'); return \Symfony\Component\Console\Command\Command::SUCCESS; @@ -87,14 +79,10 @@ final class UpgradePermissionsSchemaCommand extends Command //List all users and groups that need an update $io->section('Groups that need an update:'); - $io->listing(array_map(static function (Group $group) { - return $group->getName() . ' (ID: '. $group->getID() .', Current version: ' . $group->getPermissions()->getSchemaVersion() . ')'; - }, $groups_to_upgrade)); + $io->listing(array_map(static fn(Group $group): string => $group->getName() . ' (ID: '. $group->getID() .', Current version: ' . $group->getPermissions()->getSchemaVersion() . ')', $groups_to_upgrade)); $io->section('Users that need an update:'); - $io->listing(array_map(static function (User $user) { - return $user->getUsername() . ' (ID: '. $user->getID() .', Current version: ' . $user->getPermissions()->getSchemaVersion() . ')'; - }, $users_to_upgrade)); + $io->listing(array_map(static fn(User $user): string => $user->getUsername() . ' (ID: '. $user->getID() .', Current version: ' . $user->getPermissions()->getSchemaVersion() . ')', $users_to_upgrade)); if(!$io->confirm('Continue with the update?', false)) { $io->warning('Update aborted.'); diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index 1a4063cd..ddb43513 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -32,12 +32,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')] class UserEnableCommand extends Command { - protected EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager, string $name = null) + public function __construct(protected EntityManagerInterface $entityManager, string $name = null) { - $this->entityManager = $entityManager; - parent::__construct($name); } @@ -70,7 +66,7 @@ class UserEnableCommand extends Command } else { //Otherwise, fetch the users from DB foreach ($usernames as $username) { $user = $repo->findByEmailOrName($username); - if ($user === null) { + if (!$user instanceof \App\Entity\UserSystem\User) { $io->error('No user found with username: '.$username); return self::FAILURE; } @@ -84,9 +80,7 @@ class UserEnableCommand extends Command $io->note('The following users will be enabled:'); } $io->table(['Username', 'Enabled/Disabled'], - array_map(static function(User $user) { - return [$user->getFullName(true), $user->isDisabled() ? 'Disabled' : 'Enabled']; - }, $users)); + array_map(static fn(User $user) => [$user->getFullName(true), $user->isDisabled() ? 'Disabled' : 'Enabled'], $users)); if(!$io->confirm('Do you want to continue?')) { $io->warning('Aborting!'); diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php index 351c679d..8a2265fd 100644 --- a/src/Command/User/UserListCommand.php +++ b/src/Command/User/UserListCommand.php @@ -31,12 +31,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:list|users:list', 'Lists all users')] class UserListCommand extends Command { - protected EntityManagerInterface $entityManager; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; - parent::__construct(); } @@ -83,7 +79,7 @@ class UserListCommand extends Command $user->getUsername(), $user->getFullName(), $user->getEmail(), - $user->getGroup() !== null ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group', + $user->getGroup() instanceof \App\Entity\UserSystem\Group ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group', $user->isDisabled() ? 'Yes' : 'No', $user->isSAMLUser() ? 'SAML' : 'Local', ]); diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php index f01bcedb..6be134ed 100644 --- a/src/Command/User/UsersPermissionsCommand.php +++ b/src/Command/User/UsersPermissionsCommand.php @@ -37,17 +37,11 @@ use Symfony\Contracts\Translation\TranslatorInterface; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:permissions|partdb:user:permissions', 'View and edit the permissions of a given user')] class UsersPermissionsCommand extends Command { - protected EntityManagerInterface $entityManager; protected UserRepository $userRepository; - protected PermissionManager $permissionResolver; - protected TranslatorInterface $translator; - public function __construct(EntityManagerInterface $entityManager, PermissionManager $permissionResolver, TranslatorInterface $translator) + public function __construct(protected EntityManagerInterface $entityManager, protected PermissionManager $permissionResolver, protected TranslatorInterface $translator) { - $this->entityManager = $entityManager; $this->userRepository = $entityManager->getRepository(User::class); - $this->permissionResolver = $permissionResolver; - $this->translator = $translator; parent::__construct(self::$defaultName); } @@ -71,7 +65,7 @@ class UsersPermissionsCommand extends Command //Find user $io->note('Finding user with username: ' . $username); $user = $this->userRepository->findByEmailOrName($username); - if ($user === null) { + if (!$user instanceof \App\Entity\UserSystem\User) { $io->error('No user found with username: ' . $username); return Command::FAILURE; } @@ -100,7 +94,7 @@ class UsersPermissionsCommand extends Command $new_value_str = $io->ask('Enter the new value for the permission (A = allow, D = disallow, I = inherit)'); - switch (strtolower($new_value_str)) { + switch (strtolower((string) $new_value_str)) { case 'a': case 'allow': $new_value = true; @@ -207,11 +201,11 @@ class UsersPermissionsCommand extends Command if ($permission_value === true) { return 'Allow'; - } else if ($permission_value === false) { + } elseif ($permission_value === false) { return 'Disallow'; - } else if ($permission_value === null && !$inherit) { + } elseif ($permission_value === null && !$inherit) { return 'Inherit'; - } else if ($permission_value === null && $inherit) { + } elseif ($permission_value === null && $inherit) { return 'Disallow (Inherited)'; } diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php index d6a27ae2..feecc6ee 100644 --- a/src/Command/VersionCommand.php +++ b/src/Command/VersionCommand.php @@ -30,13 +30,8 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[\Symfony\Component\Console\Attribute\AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')] class VersionCommand extends Command { - protected VersionManagerInterface $versionManager; - protected GitVersionInfo $gitVersionInfo; - - public function __construct(VersionManagerInterface $versionManager, GitVersionInfo $gitVersionInfo) + public function __construct(protected VersionManagerInterface $versionManager, protected GitVersionInfo $gitVersionInfo) { - $this->versionManager = $versionManager; - $this->gitVersionInfo = $gitVersionInfo; parent::__construct(); } diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index 65a17668..8aaaf6f1 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -72,29 +72,16 @@ abstract class BaseAdminController extends AbstractController protected string $route_base = ''; protected string $attachment_class = ''; protected ?string $parameter_class = ''; - - protected UserPasswordHasherInterface $passwordEncoder; - protected TranslatorInterface $translator; - protected AttachmentSubmitHandler $attachmentSubmitHandler; - protected EventCommentHelper $commentHelper; - - protected HistoryHelper $historyHelper; - protected TimeTravel $timeTravel; - protected DataTableFactory $dataTableFactory; /** * @var EventDispatcher|EventDispatcherInterface */ protected $eventDispatcher; - protected LabelGenerator $labelGenerator; - protected LabelExampleElementsGenerator $barcodeExampleGenerator; - protected EntityManagerInterface $entityManager; - - public function __construct(TranslatorInterface $translator, UserPasswordHasherInterface $passwordEncoder, - AttachmentSubmitHandler $attachmentSubmitHandler, - EventCommentHelper $commentHelper, HistoryHelper $historyHelper, TimeTravel $timeTravel, - DataTableFactory $dataTableFactory, EventDispatcherInterface $eventDispatcher, LabelExampleElementsGenerator $barcodeExampleGenerator, - LabelGenerator $labelGenerator, EntityManagerInterface $entityManager) + public function __construct(protected TranslatorInterface $translator, protected UserPasswordHasherInterface $passwordEncoder, + protected AttachmentSubmitHandler $attachmentSubmitHandler, + protected EventCommentHelper $commentHelper, protected HistoryHelper $historyHelper, protected TimeTravel $timeTravel, + protected DataTableFactory $dataTableFactory, EventDispatcherInterface $eventDispatcher, protected LabelExampleElementsGenerator $barcodeExampleGenerator, + protected LabelGenerator $labelGenerator, protected EntityManagerInterface $entityManager) { if ('' === $this->entity_class || '' === $this->form_class || '' === $this->twig_template || '' === $this->route_base) { throw new InvalidArgumentException('You have to override the $entity_class, $form_class, $route_base and $twig_template value in your subclasss!'); @@ -107,18 +94,7 @@ abstract class BaseAdminController extends AbstractController if ('' === $this->parameter_class || ($this->parameter_class && !is_a($this->parameter_class, AbstractParameter::class, true))) { throw new InvalidArgumentException('You have to override the $parameter_class value with a valid Parameter class in your subclass!'); } - - $this->translator = $translator; - $this->passwordEncoder = $passwordEncoder; - $this->attachmentSubmitHandler = $attachmentSubmitHandler; - $this->commentHelper = $commentHelper; - $this->historyHelper = $historyHelper; - $this->timeTravel = $timeTravel; - $this->dataTableFactory = $dataTableFactory; $this->eventDispatcher = $eventDispatcher; - $this->barcodeExampleGenerator = $barcodeExampleGenerator; - $this->labelGenerator = $labelGenerator; - $this->entityManager = $entityManager; } protected function revertElementIfNeeded(AbstractDBElement $entity, ?string $timestamp): ?DateTime @@ -177,7 +153,7 @@ abstract class BaseAdminController extends AbstractController $form_options = [ 'attachment_class' => $this->attachment_class, 'parameter_class' => $this->parameter_class, - 'disabled' => null !== $timeTravel_timestamp, + 'disabled' => $timeTravel_timestamp instanceof \DateTime, ]; //Disable editing of options, if user is not allowed to use twig... @@ -269,13 +245,7 @@ abstract class BaseAdminController extends AbstractController protected function _new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AbstractNamedDBElement $entity = null) { - if (null === $entity) { - /** @var AbstractStructuralDBElement|User $new_entity */ - $new_entity = new $this->entity_class(); - } else { - /** @var AbstractStructuralDBElement|User $new_entity */ - $new_entity = clone $entity; - } + $new_entity = $entity instanceof \App\Entity\Base\AbstractNamedDBElement ? clone $entity : new $this->entity_class(); $this->denyAccessUnlessGranted('read', $new_entity); @@ -287,42 +257,37 @@ abstract class BaseAdminController extends AbstractController $form->handleRequest($request); - if ($form->isSubmitted() && $form->isValid()) { - //Perform additional actions - if ($this->additionalActionNew($form, $new_entity)) { - //Upload passed files - $attachments = $form['attachments']; - foreach ($attachments as $attachment) { - /** @var FormInterface $attachment */ - $options = [ - 'secure_attachment' => $attachment['secureFile']->getData(), - 'download_url' => $attachment['downloadURL']->getData(), - ]; + //Perform additional actions + if ($form->isSubmitted() && $form->isValid() && $this->additionalActionNew($form, $new_entity)) { + //Upload passed files + $attachments = $form['attachments']; + foreach ($attachments as $attachment) { + /** @var FormInterface $attachment */ + $options = [ + 'secure_attachment' => $attachment['secureFile']->getData(), + 'download_url' => $attachment['downloadURL']->getData(), + ]; - try { - $this->attachmentSubmitHandler->handleFormSubmit( - $attachment->getData(), - $attachment['file']->getData(), - $options - ); - } catch (AttachmentDownloadException $attachmentDownloadException) { - $this->addFlash( - 'error', - $this->translator->trans( - 'attachment.download_failed' - ).' '.$attachmentDownloadException->getMessage() - ); - } + try { + $this->attachmentSubmitHandler->handleFormSubmit( + $attachment->getData(), + $attachment['file']->getData(), + $options + ); + } catch (AttachmentDownloadException $attachmentDownloadException) { + $this->addFlash( + 'error', + $this->translator->trans( + 'attachment.download_failed' + ).' '.$attachmentDownloadException->getMessage() + ); } - - $this->commentHelper->setMessage($form['log_comment']->getData()); - - $em->persist($new_entity); - $em->flush(); - $this->addFlash('success', 'entity.created_flash'); - - return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]); } + $this->commentHelper->setMessage($form['log_comment']->getData()); + $em->persist($new_entity); + $em->flush(); + $this->addFlash('success', 'entity.created_flash'); + return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]); } if ($form->isSubmitted() && !$form->isValid()) { @@ -369,7 +334,7 @@ abstract class BaseAdminController extends AbstractController } } } - catch (UnexpectedValueException $e) { + catch (UnexpectedValueException) { $this->addFlash('error', 'parts.import.flash.error.invalid_file'); } } diff --git a/src/Controller/AdminPages/CurrencyController.php b/src/Controller/AdminPages/CurrencyController.php index d607c792..18d449fd 100644 --- a/src/Controller/AdminPages/CurrencyController.php +++ b/src/Controller/AdminPages/CurrencyController.php @@ -64,8 +64,6 @@ class CurrencyController extends BaseAdminController protected string $attachment_class = CurrencyAttachment::class; protected ?string $parameter_class = CurrencyParameter::class; - protected ExchangeRateUpdater $exchangeRateUpdater; - public function __construct( TranslatorInterface $translator, UserPasswordHasherInterface $passwordEncoder, @@ -78,10 +76,8 @@ class CurrencyController extends BaseAdminController LabelExampleElementsGenerator $barcodeExampleGenerator, LabelGenerator $labelGenerator, EntityManagerInterface $entityManager, - ExchangeRateUpdater $exchangeRateUpdater + protected ExchangeRateUpdater $exchangeRateUpdater ) { - $this->exchangeRateUpdater = $exchangeRateUpdater; - parent::__construct( $translator, $passwordEncoder, diff --git a/src/Controller/AdminPages/ManufacturerController.php b/src/Controller/AdminPages/ManufacturerController.php index 09311e25..c6db73ee 100644 --- a/src/Controller/AdminPages/ManufacturerController.php +++ b/src/Controller/AdminPages/ManufacturerController.php @@ -45,9 +45,6 @@ class ManufacturerController extends BaseAdminController protected string $attachment_class = ManufacturerAttachment::class; protected ?string $parameter_class = ManufacturerParameter::class; - /** - * @return RedirectResponse - */ #[Route(path: '/{id}', name: 'manufacturer_delete', methods: ['DELETE'])] public function delete(Request $request, Manufacturer $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { diff --git a/src/Controller/HomepageController.php b/src/Controller/HomepageController.php index fe3025e9..45b80113 100644 --- a/src/Controller/HomepageController.php +++ b/src/Controller/HomepageController.php @@ -37,15 +37,8 @@ use Symfony\Contracts\Cache\CacheInterface; class HomepageController extends AbstractController { - protected CacheInterface $cache; - protected KernelInterface $kernel; - protected DataTableFactory $dataTable; - - public function __construct(CacheInterface $cache, KernelInterface $kernel, DataTableFactory $dataTable) + public function __construct(protected CacheInterface $cache, protected KernelInterface $kernel, protected DataTableFactory $dataTable) { - $this->cache = $cache; - $this->kernel = $kernel; - $this->dataTable = $dataTable; } public function getBanner(): string diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php index 02b44112..d74376ec 100644 --- a/src/Controller/LabelController.php +++ b/src/Controller/LabelController.php @@ -62,20 +62,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; #[Route(path: '/label')] class LabelController extends AbstractController { - protected LabelGenerator $labelGenerator; - protected EntityManagerInterface $em; - protected ElementTypeNameGenerator $elementTypeNameGenerator; - protected RangeParser $rangeParser; - protected TranslatorInterface $translator; - - public function __construct(LabelGenerator $labelGenerator, EntityManagerInterface $em, ElementTypeNameGenerator $elementTypeNameGenerator, - RangeParser $rangeParser, TranslatorInterface $translator) + public function __construct(protected LabelGenerator $labelGenerator, protected EntityManagerInterface $em, protected ElementTypeNameGenerator $elementTypeNameGenerator, protected RangeParser $rangeParser, protected TranslatorInterface $translator) { - $this->labelGenerator = $labelGenerator; - $this->em = $em; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; - $this->rangeParser = $rangeParser; - $this->translator = $translator; } #[Route(path: '/dialog', name: 'label_dialog')] @@ -85,15 +73,11 @@ class LabelController extends AbstractController $this->denyAccessUnlessGranted('@labels.create_labels'); //If we inherit a LabelProfile, the user need to have access to it... - if (null !== $profile) { + if ($profile instanceof \App\Entity\LabelSystem\LabelProfile) { $this->denyAccessUnlessGranted('read', $profile); } - if ($profile) { - $label_options = $profile->getOptions(); - } else { - $label_options = new LabelOptions(); - } + $label_options = $profile instanceof \App\Entity\LabelSystem\LabelProfile ? $profile->getOptions() : new LabelOptions(); //We have to disable the options, if twig mode is selected and user is not allowed to use it. $disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig'); @@ -107,7 +91,7 @@ class LabelController extends AbstractController $target_id = $request->query->get('target_id', null); $generate = $request->query->getBoolean('generate', false); - if (null === $profile && is_string($target_type)) { + if (!$profile instanceof \App\Entity\LabelSystem\LabelProfile && is_string($target_type)) { $label_options->setSupportedElement($target_type); } if (is_string($target_id)) { @@ -124,10 +108,10 @@ class LabelController extends AbstractController $filename = 'invalid.pdf'; //Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set - if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && null !== $profile)) { + if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile instanceof \App\Entity\LabelSystem\LabelProfile)) { $target_id = (string) $form->get('target_id')->getData(); $targets = $this->findObjects($form_options->getSupportedElement(), $target_id); - if (!empty($targets)) { + if ($targets !== []) { try { $pdf_data = $this->labelGenerator->generateLabel($form_options, $targets); $filename = $this->getLabelName($targets[0], $profile); diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index 28d7cbac..2c6b6625 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -52,20 +52,13 @@ use Symfony\Component\Routing\Annotation\Route; #[Route(path: '/log')] class LogController extends AbstractController { - protected EntityManagerInterface $entityManager; - protected TimeTravel $timeTravel; protected DBElementRepository $dbRepository; - public function __construct(EntityManagerInterface $entityManager, TimeTravel $timeTravel) + public function __construct(protected EntityManagerInterface $entityManager, protected TimeTravel $timeTravel) { - $this->entityManager = $entityManager; - $this->timeTravel = $timeTravel; $this->dbRepository = $entityManager->getRepository(AbstractDBElement::class); } - /** - * @return Response - */ #[Route(path: '/', name: 'log_view')] public function showLogs(Request $request, DataTableFactory $dataTable): Response { @@ -96,8 +89,6 @@ class LogController extends AbstractController /** * @param Request $request - * @param AbstractLogEntry $logEntry - * @return Response */ #[Route(path: '/{id}/details', name: 'log_details')] public function logDetails(AbstractLogEntry $logEntry, LogEntryExtraFormatter $logEntryExtraFormatter, @@ -150,7 +141,7 @@ class LogController extends AbstractController } $log_element = $this->entityManager->find(AbstractLogEntry::class, $id); - if (null === $log_element) { + if (!$log_element instanceof \App\Entity\LogSystem\AbstractLogEntry) { throw new InvalidArgumentException('No log entry with the given ID is existing!'); } diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index 20a2006c..c10858ac 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -62,16 +62,8 @@ use function Symfony\Component\Translation\t; #[Route(path: '/part')] class PartController extends AbstractController { - protected PricedetailHelper $pricedetailHelper; - protected PartPreviewGenerator $partPreviewGenerator; - protected EventCommentHelper $commentHelper; - - public function __construct(PricedetailHelper $pricedetailHelper, - PartPreviewGenerator $partPreviewGenerator, EventCommentHelper $commentHelper) + public function __construct(protected PricedetailHelper $pricedetailHelper, protected PartPreviewGenerator $partPreviewGenerator, protected EventCommentHelper $commentHelper) { - $this->pricedetailHelper = $pricedetailHelper; - $this->partPreviewGenerator = $partPreviewGenerator; - $this->commentHelper = $commentHelper; } /** @@ -218,11 +210,13 @@ class PartController extends AbstractController ?Part $part = null, ?Project $project = null): Response { - if ($part) { //Clone part + if ($part instanceof \App\Entity\Parts\Part) { + //Clone part $new_part = clone $part; - } else if ($project) { //Initialize a new part for a build part from the given project + } elseif ($project instanceof \App\Entity\ProjectSystem\Project) { + //Initialize a new part for a build part from the given project //Ensure that the project has not already a build part - if ($project->getBuildPart() !== null) { + if ($project->getBuildPart() instanceof \App\Entity\Parts\Part) { $this->addFlash('error', 'part.new_build_part.error.build_part_already_exists'); return $this->redirectToRoute('part_edit', ['id' => $project->getBuildPart()->getID()]); } @@ -235,7 +229,7 @@ class PartController extends AbstractController $cid = $request->get('category', null); $category = $cid ? $em->find(Category::class, $cid) : null; - if (null !== $category && null === $new_part->getCategory()) { + if ($category instanceof \App\Entity\Parts\Category && !$new_part->getCategory() instanceof \App\Entity\Parts\Category) { $new_part->setCategory($category); $new_part->setDescription($category->getDefaultDescription()); $new_part->setComment($category->getDefaultComment()); @@ -243,19 +237,19 @@ class PartController extends AbstractController $fid = $request->get('footprint', null); $footprint = $fid ? $em->find(Footprint::class, $fid) : null; - if (null !== $footprint && null === $new_part->getFootprint()) { + if ($footprint instanceof \App\Entity\Parts\Footprint && !$new_part->getFootprint() instanceof \App\Entity\Parts\Footprint) { $new_part->setFootprint($footprint); } $mid = $request->get('manufacturer', null); $manufacturer = $mid ? $em->find(Manufacturer::class, $mid) : null; - if (null !== $manufacturer && null === $new_part->getManufacturer()) { + if ($manufacturer instanceof \App\Entity\Parts\Manufacturer && !$new_part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer) { $new_part->setManufacturer($manufacturer); } $store_id = $request->get('storelocation', null); $storelocation = $store_id ? $em->find(Storelocation::class, $store_id) : null; - if (null !== $storelocation && $new_part->getPartLots()->isEmpty()) { + if ($storelocation instanceof \App\Entity\Parts\Storelocation && $new_part->getPartLots()->isEmpty()) { $partLot = new PartLot(); $partLot->setStorageLocation($storelocation); $partLot->setInstockUnknown(true); @@ -264,7 +258,7 @@ class PartController extends AbstractController $supplier_id = $request->get('supplier', null); $supplier = $supplier_id ? $em->find(Supplier::class, $supplier_id) : null; - if (null !== $supplier && $new_part->getOrderdetails()->isEmpty()) { + if ($supplier instanceof \App\Entity\Parts\Supplier && $new_part->getOrderdetails()->isEmpty()) { $orderdetail = new Orderdetail(); $orderdetail->setSupplier($supplier); $new_part->addOrderdetail($orderdetail); @@ -335,7 +329,7 @@ class PartController extends AbstractController if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) { //Retrieve partlot from the request $partLot = $em->find(PartLot::class, $request->request->get('lot_id')); - if($partLot === null) { + if(!$partLot instanceof \App\Entity\Parts\PartLot) { throw new \RuntimeException('Part lot not found!'); } //Ensure that the partlot belongs to the part @@ -375,7 +369,7 @@ class PartController extends AbstractController default: throw new \RuntimeException("Unknown action!"); } - } catch (AccessDeniedException $exception) { + } catch (AccessDeniedException) { $this->addFlash('error', t('part.withdraw.access_denied')); goto err; } diff --git a/src/Controller/PartImportExportController.php b/src/Controller/PartImportExportController.php index fd37c045..b5d4c4e1 100644 --- a/src/Controller/PartImportExportController.php +++ b/src/Controller/PartImportExportController.php @@ -36,22 +36,10 @@ use UnexpectedValueException; class PartImportExportController extends AbstractController { - private PartsTableActionHandler $partsTableActionHandler; - private EntityImporter $entityImporter; - private EventCommentHelper $commentHelper; - - public function __construct(PartsTableActionHandler $partsTableActionHandler, - EntityImporter $entityImporter, EventCommentHelper $commentHelper) + public function __construct(private readonly PartsTableActionHandler $partsTableActionHandler, private readonly EntityImporter $entityImporter, private readonly EventCommentHelper $commentHelper) { - $this->partsTableActionHandler = $partsTableActionHandler; - $this->entityImporter = $entityImporter; - $this->commentHelper = $commentHelper; } - /** - * @param Request $request - * @return Response - */ #[Route(path: '/parts/import', name: 'parts_import')] public function importParts(Request $request): Response { @@ -116,16 +104,13 @@ class PartImportExportController extends AbstractController ]); } - /** - * @return Response - */ #[Route(path: '/parts/export', name: 'parts_export', methods: ['GET'])] public function exportParts(Request $request, EntityExporter $entityExporter): Response { $ids = $request->query->get('ids', ''); $parts = $this->partsTableActionHandler->idStringToArray($ids); - if (empty($parts)) { + if ($parts === []) { throw new \RuntimeException('No parts found!'); } diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php index 271adb06..322d2ebf 100644 --- a/src/Controller/PartListsController.php +++ b/src/Controller/PartListsController.php @@ -48,18 +48,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PartListsController extends AbstractController { - private EntityManagerInterface $entityManager; - private NodesListBuilder $nodesListBuilder; - private DataTableFactory $dataTableFactory; - - private TranslatorInterface $translator; - - public function __construct(EntityManagerInterface $entityManager, NodesListBuilder $nodesListBuilder, DataTableFactory $dataTableFactory, TranslatorInterface $translator) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NodesListBuilder $nodesListBuilder, private readonly DataTableFactory $dataTableFactory, private readonly TranslatorInterface $translator) { - $this->entityManager = $entityManager; - $this->nodesListBuilder = $nodesListBuilder; - $this->dataTableFactory = $dataTableFactory; - $this->translator = $translator; } #[Route(path: '/table/action', name: 'table_action', methods: ['POST'])] @@ -100,8 +90,6 @@ class PartListsController extends AbstractController /** * Disable the given form interface after creation of the form by removing and reattaching the form. - * @param FormInterface $form - * @return void */ private function disableFormFieldAfterCreation(FormInterface $form, bool $disabled = true): void { @@ -109,12 +97,12 @@ class PartListsController extends AbstractController $attrs['disabled'] = $disabled; $parent = $form->getParent(); - if ($parent === null) { + if (!$parent instanceof \Symfony\Component\Form\FormInterface) { throw new \RuntimeException('This function can only be used on form fields that are children of another form!'); } $parent->remove($form->getName()); - $parent->add($form->getName(), get_class($form->getConfig()->getType()->getInnerType()), $attrs); + $parent->add($form->getName(), $form->getConfig()->getType()->getInnerType()::class, $attrs); } /** @@ -125,7 +113,6 @@ class PartListsController extends AbstractController * @param callable|null $form_changer A function that is called with the form object as parameter. This function can be used to customize the form * @param array $additonal_template_vars Any additional template variables that should be passed to the template * @param array $additional_table_vars Any additional variables that should be passed to the table creation - * @return Response */ protected function showListWithFilter(Request $request, string $template, ?callable $filter_changer = null, ?callable $form_changer = null, array $additonal_template_vars = [], array $additional_table_vars = []): Response { @@ -172,9 +159,6 @@ class PartListsController extends AbstractController ], $additonal_template_vars)); } - /** - * @return JsonResponse|Response - */ #[Route(path: '/category/{id}/parts', name: 'part_list_category')] public function showCategory(Category $category, Request $request): Response { @@ -193,9 +177,6 @@ class PartListsController extends AbstractController ); } - /** - * @return JsonResponse|Response - */ #[Route(path: '/footprint/{id}/parts', name: 'part_list_footprint')] public function showFootprint(Footprint $footprint, Request $request): Response { @@ -214,9 +195,6 @@ class PartListsController extends AbstractController ); } - /** - * @return JsonResponse|Response - */ #[Route(path: '/manufacturer/{id}/parts', name: 'part_list_manufacturer')] public function showManufacturer(Manufacturer $manufacturer, Request $request): Response { @@ -235,9 +213,6 @@ class PartListsController extends AbstractController ); } - /** - * @return JsonResponse|Response - */ #[Route(path: '/store_location/{id}/parts', name: 'part_list_store_location')] public function showStorelocation(Storelocation $storelocation, Request $request): Response { @@ -256,9 +231,6 @@ class PartListsController extends AbstractController ); } - /** - * @return JsonResponse|Response - */ #[Route(path: '/supplier/{id}/parts', name: 'part_list_supplier')] public function showSupplier(Supplier $supplier, Request $request): Response { @@ -277,9 +249,6 @@ class PartListsController extends AbstractController ); } - /** - * @return JsonResponse|Response - */ #[Route(path: '/parts/by_tag/{tag}', name: 'part_list_tags', requirements: ['tag' => '.*'])] public function showTag(string $tag, Request $request): Response { @@ -321,9 +290,6 @@ class PartListsController extends AbstractController return $filter; } - /** - * @return JsonResponse|Response - */ #[Route(path: '/parts/search', name: 'parts_search')] public function showSearch(Request $request, DataTableFactory $dataTable): Response { @@ -343,9 +309,6 @@ class PartListsController extends AbstractController ); } - /** - * @return Response - */ #[Route(path: '/parts', name: 'parts_show_all')] public function showAll(Request $request): Response { diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 2db1c1a7..a8fae5df 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -50,11 +50,8 @@ use function Symfony\Component\Translation\t; #[Route(path: '/project')] class ProjectController extends AbstractController { - private DataTableFactory $dataTableFactory; - - public function __construct(DataTableFactory $dataTableFactory) + public function __construct(private readonly DataTableFactory $dataTableFactory) { - $this->dataTableFactory = $dataTableFactory; } #[Route(path: '/{id}/info', name: 'project_info', requirements: ['id' => '\d+'])] @@ -180,9 +177,7 @@ class ProjectController extends AbstractController if (count ($errors) > 0) { $this->addFlash('error', t('project.bom_import.flash.invalid_entries')); } - } catch (\UnexpectedValueException $e) { - $this->addFlash('error', t('project.bom_import.flash.invalid_file', ['%message%' => $e->getMessage()])); - } catch (SyntaxError $e) { + } catch (\UnexpectedValueException|SyntaxError $e) { $this->addFlash('error', t('project.bom_import.flash.invalid_file', ['%message%' => $e->getMessage()])); } } @@ -194,15 +189,11 @@ class ProjectController extends AbstractController ]); } - /** - * @param Request $request - * @param Project|null $project - */ #[Route(path: '/add_parts', name: 'project_add_parts_no_id')] #[Route(path: '/{id}/add_parts', name: 'project_add_parts', requirements: ['id' => '\d+'])] public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response { - if($project) { + if($project instanceof \App\Entity\ProjectSystem\Project) { $this->denyAccessUnlessGranted('edit', $project); } else { $this->denyAccessUnlessGranted('@projects.edit'); @@ -212,7 +203,7 @@ class ProjectController extends AbstractController $builder->add('project', StructuralEntityType::class, [ 'class' => Project::class, 'required' => true, - 'disabled' => $project !== null, //If a project is given, disable the field + 'disabled' => $project instanceof \App\Entity\ProjectSystem\Project, //If a project is given, disable the field 'data' => $project, 'constraints' => [ new NotNull() @@ -224,7 +215,7 @@ class ProjectController extends AbstractController //Preset the BOM entries with the selected parts, when the form was not submitted yet $preset_data = new ArrayCollection(); - foreach (explode(',', $request->get('parts', '')) as $part_id) { + foreach (explode(',', (string) $request->get('parts', '')) as $part_id) { $part = $entityManager->getRepository(Part::class)->find($part_id); if (null !== $part) { //If there is already a BOM entry for this part, we use this one (we edit it then) diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index a6099ace..16bed9ea 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -32,15 +32,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class RedirectController extends AbstractController { - protected string $default_locale; - protected TranslatorInterface $translator; - protected bool $enforce_index_php; - - public function __construct(string $default_locale, TranslatorInterface $translator, bool $enforce_index_php) + public function __construct(protected string $default_locale, protected TranslatorInterface $translator, protected bool $enforce_index_php) { - $this->default_locale = $default_locale; - $this->translator = $translator; - $this->enforce_index_php = $enforce_index_php; } /** diff --git a/src/Controller/ScanController.php b/src/Controller/ScanController.php index 1c7a2670..41959d0a 100644 --- a/src/Controller/ScanController.php +++ b/src/Controller/ScanController.php @@ -54,13 +54,8 @@ use Symfony\Component\Routing\Annotation\Route; #[Route(path: '/scan')] class ScanController extends AbstractController { - protected BarcodeRedirector $barcodeParser; - protected BarcodeNormalizer $barcodeNormalizer; - - public function __construct(BarcodeRedirector $barcodeParser, BarcodeNormalizer $barcodeNormalizer) + public function __construct(protected BarcodeRedirector $barcodeParser, protected BarcodeNormalizer $barcodeNormalizer) { - $this->barcodeParser = $barcodeParser; - $this->barcodeNormalizer = $barcodeNormalizer; } #[Route(path: '', name: 'scan_dialog')] @@ -79,10 +74,10 @@ class ScanController extends AbstractController try { return $this->redirect($this->barcodeParser->getRedirectURL($type, $id)); - } catch (EntityNotFoundException $exception) { + } catch (EntityNotFoundException) { $this->addFlash('success', 'scan.qr_not_found'); } - } catch (InvalidArgumentException $exception) { + } catch (InvalidArgumentException) { $this->addFlash('error', 'scan.format_unknown'); } } @@ -101,7 +96,7 @@ class ScanController extends AbstractController $this->addFlash('success', 'scan.qr_success'); return $this->redirect($this->barcodeParser->getRedirectURL($type, $id)); - } catch (EntityNotFoundException $exception) { + } catch (EntityNotFoundException) { $this->addFlash('success', 'scan.qr_not_found'); return $this->redirectToRoute('homepage'); diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index bd696e1e..4ad6b772 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -48,13 +48,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SecurityController extends AbstractController { - protected TranslatorInterface $translator; - protected bool $allow_email_pw_reset; - - public function __construct(TranslatorInterface $translator, bool $allow_email_pw_reset) + public function __construct(protected TranslatorInterface $translator, protected bool $allow_email_pw_reset) { - $this->translator = $translator; - $this->allow_email_pw_reset = $allow_email_pw_reset; } #[Route(path: '/login', name: 'login', methods: ['GET', 'POST'])] @@ -76,7 +71,7 @@ class SecurityController extends AbstractController * @return RedirectResponse|Response */ #[Route(path: '/pw_reset/request', name: 'pw_reset_request')] - public function requestPwReset(PasswordResetManager $passwordReset, Request $request) + public function requestPwReset(PasswordResetManager $passwordReset, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { if (!$this->allow_email_pw_reset) { throw new AccessDeniedHttpException('The password reset via email is disabled!'); @@ -119,7 +114,7 @@ class SecurityController extends AbstractController * @return RedirectResponse|Response */ #[Route(path: '/pw_reset/new_pw/{user}/{token}', name: 'pw_reset_new_pw')] - public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null) + public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { if (!$this->allow_email_pw_reset) { throw new AccessDeniedHttpException('The password reset via email is disabled!'); @@ -189,7 +184,7 @@ class SecurityController extends AbstractController } #[Route(path: '/logout', name: 'logout')] - public function logout(): void + public function logout(): never { throw new RuntimeException('Will be intercepted before getting here'); } diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php index 7ea9a8bd..8691b967 100644 --- a/src/Controller/SelectAPIController.php +++ b/src/Controller/SelectAPIController.php @@ -42,15 +42,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; #[Route(path: '/select_api')] class SelectAPIController extends AbstractController { - private NodesListBuilder $nodesListBuilder; - private TranslatorInterface $translator; - private StructuralEntityChoiceHelper $choiceHelper; - - public function __construct(NodesListBuilder $nodesListBuilder, TranslatorInterface $translator, StructuralEntityChoiceHelper $choiceHelper) + public function __construct(private readonly NodesListBuilder $nodesListBuilder, private readonly TranslatorInterface $translator, private readonly StructuralEntityChoiceHelper $choiceHelper) { - $this->nodesListBuilder = $nodesListBuilder; - $this->translator = $translator; - $this->choiceHelper = $choiceHelper; } #[Route(path: '/category', name: 'select_category')] @@ -92,17 +85,12 @@ class SelectAPIController extends AbstractController 3 => $this->translator->trans('export.level.full'), ]; - return $this->json(array_map(static function ($key, $value) { - return [ - 'text' => $value, - 'value' => $key, - ]; - }, array_keys($entries), $entries)); + return $this->json(array_map(static fn($key, $value) => [ + 'text' => $value, + 'value' => $key, + ], array_keys($entries), $entries)); } - /** - * @return Response - */ #[Route(path: '/label_profiles', name: 'select_label_profiles')] public function labelProfiles(EntityManagerInterface $entityManager): Response { @@ -121,9 +109,6 @@ class SelectAPIController extends AbstractController return $this->json($nodes); } - /** - * @return Response - */ #[Route(path: '/label_profiles_lot', name: 'select_label_profiles_lot')] public function labelProfilesLot(EntityManagerInterface $entityManager): Response { diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index 56711d43..65321a19 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -77,7 +77,7 @@ class ToolsController extends AbstractController 'php_version' => PHP_VERSION, 'php_uname' => php_uname('a'), 'php_sapi' => PHP_SAPI, - 'php_extensions' => array_merge(get_loaded_extensions()), + 'php_extensions' => [...get_loaded_extensions()], 'php_opcache_enabled' => ini_get('opcache.enable'), 'php_upload_max_filesize' => ini_get('upload_max_filesize'), 'php_post_max_size' => ini_get('post_max_size'), @@ -91,32 +91,22 @@ class ToolsController extends AbstractController ]); } - /** - * @return Response - */ #[Route(path: '/builtin_footprints', name: 'tools_builtin_footprints_viewer')] public function builtInFootprintsViewer(BuiltinAttachmentsFinder $builtinAttachmentsFinder, AttachmentURLGenerator $urlGenerator): Response { $this->denyAccessUnlessGranted('@tools.builtin_footprints_viewer'); $grouped_footprints = $builtinAttachmentsFinder->getListOfFootprintsGroupedByFolder(); - $grouped_footprints = array_map(function($group) use ($urlGenerator) { - return array_map(function($placeholder_filepath) use ($urlGenerator) { - return [ - 'filename' => basename($placeholder_filepath), - 'assets_path' => $urlGenerator->placeholderPathToAssetPath($placeholder_filepath), - ]; - }, $group); - }, $grouped_footprints); + $grouped_footprints = array_map(fn($group) => array_map(fn($placeholder_filepath) => [ + 'filename' => basename((string) $placeholder_filepath), + 'assets_path' => $urlGenerator->placeholderPathToAssetPath($placeholder_filepath), + ], $group), $grouped_footprints); return $this->render('tools/builtin_footprints_viewer/builtin_footprints_viewer.html.twig', [ 'grouped_footprints' => $grouped_footprints, ]); } - /** - * @return Response - */ #[Route(path: '/ic_logos', name: 'tools_ic_logos')] public function icLogos(): Response { diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php index 806dd4d2..3d8e9074 100644 --- a/src/Controller/TreeController.php +++ b/src/Controller/TreeController.php @@ -40,11 +40,8 @@ use Symfony\Component\Routing\Annotation\Route; #[Route(path: '/tree')] class TreeController extends AbstractController { - protected TreeViewGenerator $treeGenerator; - - public function __construct(TreeViewGenerator $treeGenerator) + public function __construct(protected TreeViewGenerator $treeGenerator) { - $this->treeGenerator = $treeGenerator; } #[Route(path: '/tools', name: 'tree_tools')] diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index 19385d0f..791cb793 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -55,13 +55,8 @@ use Symfony\Component\Serializer\Serializer; #[Route(path: '/typeahead')] class TypeaheadController extends AbstractController { - protected AttachmentURLGenerator $urlGenerator; - protected Packages $assets; - - public function __construct(AttachmentURLGenerator $URLGenerator, Packages $assets) + public function __construct(protected AttachmentURLGenerator $urlGenerator, protected Packages $assets) { - $this->urlGenerator = $URLGenerator; - $this->assets = $assets; } #[Route(path: '/builtInResources/search', name: 'typeahead_builtInRessources')] @@ -93,45 +88,26 @@ class TypeaheadController extends AbstractController /** * This function map the parameter type to the class, so we can access its repository - * @param string $type * @return class-string */ private function typeToParameterClass(string $type): string { - switch ($type) { - case 'category': - return CategoryParameter::class; - case 'part': - return PartParameter::class; - case 'device': - return ProjectParameter::class; - case 'footprint': - return FootprintParameter::class; - case 'manufacturer': - return ManufacturerParameter::class; - case 'storelocation': - return StorelocationParameter::class; - case 'supplier': - return SupplierParameter::class; - case 'attachment_type': - return AttachmentTypeParameter::class; - case 'group': - return GroupParameter::class; - case 'measurement_unit': - return MeasurementUnitParameter::class; - case 'currency': - return Currency::class; - - default: - throw new \InvalidArgumentException('Invalid parameter type: '.$type); - } + return match ($type) { + 'category' => CategoryParameter::class, + 'part' => PartParameter::class, + 'device' => ProjectParameter::class, + 'footprint' => FootprintParameter::class, + 'manufacturer' => ManufacturerParameter::class, + 'storelocation' => StorelocationParameter::class, + 'supplier' => SupplierParameter::class, + 'attachment_type' => AttachmentTypeParameter::class, + 'group' => GroupParameter::class, + 'measurement_unit' => MeasurementUnitParameter::class, + 'currency' => Currency::class, + default => throw new \InvalidArgumentException('Invalid parameter type: '.$type), + }; } - /** - * @param string $query - * @param EntityManagerInterface $entityManager - * @return JsonResponse - */ #[Route(path: '/parts/search/{query}', name: 'typeahead_parts')] public function parts(EntityManagerInterface $entityManager, PartPreviewGenerator $previewGenerator, AttachmentURLGenerator $attachmentURLGenerator, string $query = ""): JsonResponse @@ -146,7 +122,7 @@ class TypeaheadController extends AbstractController foreach ($parts as $part) { //Determine the picture to show: $preview_attachment = $previewGenerator->getTablePreviewAttachment($part); - if($preview_attachment !== null) { + if($preview_attachment instanceof \App\Entity\Attachments\Attachment) { $preview_url = $attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm'); } else { $preview_url = ''; @@ -156,8 +132,8 @@ class TypeaheadController extends AbstractController $data[] = [ 'id' => $part->getID(), 'name' => $part->getName(), - 'category' => $part->getCategory() ? $part->getCategory()->getName() : 'Unknown', - 'footprint' => $part->getFootprint() ? $part->getFootprint()->getName() : '', + 'category' => $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : 'Unknown', + 'footprint' => $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '', 'description' => mb_strimwidth($part->getDescription(), 0, 127, '...'), 'image' => $preview_url, ]; @@ -166,10 +142,6 @@ class TypeaheadController extends AbstractController return new JsonResponse($data); } - /** - * @param string $query - * @return JsonResponse - */ #[Route(path: '/parameters/{type}/search/{query}', name: 'typeahead_parameters', requirements: ['type' => '.+'])] public function parameters(string $type, EntityManagerInterface $entityManager, string $query = ""): JsonResponse { diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 7d2b8160..ceb86802 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -180,7 +180,7 @@ class UserController extends AdminPages\BaseAdminController public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response { //If no user id was passed, then we show info about the current user - if (null === $user) { + if (!$user instanceof \App\Entity\UserSystem\User) { $tmp = $this->getUser(); if (!$tmp instanceof User) { throw new InvalidArgumentException('Userinfo only works for database users!'); diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php index 298b94d0..d21d0bbd 100644 --- a/src/Controller/UserSettingsController.php +++ b/src/Controller/UserSettingsController.php @@ -54,16 +54,13 @@ use Symfony\Component\Validator\Constraints\Length; #[Route(path: '/user')] class UserSettingsController extends AbstractController { - protected bool $demo_mode; - /** * @var EventDispatcher|EventDispatcherInterface */ protected $eventDispatcher; - public function __construct(bool $demo_mode, EventDispatcherInterface $eventDispatcher) + public function __construct(protected bool $demo_mode, EventDispatcherInterface $eventDispatcher) { - $this->demo_mode = $demo_mode; $this->eventDispatcher = $eventDispatcher; } @@ -121,49 +118,43 @@ class UserSettingsController extends AbstractController $key_repo = $entityManager->getRepository(U2FKey::class); /** @var U2FKey|null $u2f */ $u2f = $key_repo->find($key_id); - if (null === $u2f) { + if (!$u2f instanceof \App\Entity\UserSystem\U2FKey) { $this->addFlash('danger', 'tfa_u2f.u2f_delete.not_existing'); return $this->redirectToRoute('user_settings'); } - //User can only delete its own U2F keys if ($u2f->getUser() !== $user) { $this->addFlash('danger', 'tfa_u2f.u2f_delete.access_denied'); return $this->redirectToRoute('user_settings'); } - $backupCodeManager->disableBackupCodesIfUnused($user); $entityManager->remove($u2f); $entityManager->flush(); $this->addFlash('success', 'tfa.u2f.u2f_delete.success'); - $security_event = new SecurityEvent($user); $this->eventDispatcher->dispatch($security_event, SecurityEvents::U2F_REMOVED); - } else if ($request->request->has('webauthn_key_id')) { + } elseif ($request->request->has('webauthn_key_id')) { $key_id = $request->request->get('webauthn_key_id'); $key_repo = $entityManager->getRepository(WebauthnKey::class); /** @var WebauthnKey|null $key */ $key = $key_repo->find($key_id); - if (null === $key) { + if (!$key instanceof \App\Entity\UserSystem\WebauthnKey) { $this->addFlash('error', 'tfa_u2f.u2f_delete.not_existing'); return $this->redirectToRoute('user_settings'); } - //User can only delete its own U2F keys if ($key->getUser() !== $user) { $this->addFlash('error', 'tfa_u2f.u2f_delete.access_denied'); return $this->redirectToRoute('user_settings'); } - $backupCodeManager->disableBackupCodesIfUnused($user); $entityManager->remove($key); $entityManager->flush(); $this->addFlash('success', 'tfa.u2f.u2f_delete.success'); - $security_event = new SecurityEvent($user); $this->eventDispatcher->dispatch($security_event, SecurityEvents::U2F_REMOVED); } @@ -174,11 +165,8 @@ class UserSettingsController extends AbstractController return $this->redirectToRoute('user_settings'); } - /** - * @return RuntimeException|RedirectResponse - */ #[Route(path: '/invalidate_trustedDevices', name: 'tfa_trustedDevices_invalidate', methods: ['DELETE'])] - public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager) + public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager): \RuntimeException|\Symfony\Component\HttpFoundation\RedirectResponse { if ($this->demo_mode) { throw new RuntimeException('You can not do 2FA things in demo mode'); @@ -215,7 +203,7 @@ class UserSettingsController extends AbstractController * @return RedirectResponse|Response */ #[Route(path: '/settings', name: 'user_settings')] - public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper) + public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response { /** @var User $user */ $user = $this->getUser(); @@ -254,13 +242,11 @@ class UserSettingsController extends AbstractController } /** @var Form $form We need a form implementation for the next calls */ - if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName()) { - //Remove the avatar attachment from the user if requested - if ($user->getMasterPictureAttachment() !== null) { - $em->remove($user->getMasterPictureAttachment()); - $user->setMasterPictureAttachment(null); - $page_need_reload = true; - } + //Remove the avatar attachment from the user if requested + if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName() && $user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + $em->remove($user->getMasterPictureAttachment()); + $user->setMasterPictureAttachment(null); + $page_need_reload = true; } $em->flush(); diff --git a/src/Controller/WebauthnKeyRegistrationController.php b/src/Controller/WebauthnKeyRegistrationController.php index ee39954a..cf273626 100644 --- a/src/Controller/WebauthnKeyRegistrationController.php +++ b/src/Controller/WebauthnKeyRegistrationController.php @@ -33,11 +33,8 @@ use function Symfony\Component\Translation\t; class WebauthnKeyRegistrationController extends AbstractController { - private bool $demo_mode; - - public function __construct(bool $demo_mode) + public function __construct(private readonly bool $demo_mode) { - $this->demo_mode = $demo_mode; } #[Route(path: '/webauthn/register', name: 'webauthn_register')] @@ -73,7 +70,7 @@ class WebauthnKeyRegistrationController extends AbstractController //Check the response try { $new_key = $registrationHelper->checkRegistrationResponse($webauthnResponse); - } catch (\Exception $exception) { + } catch (\Exception) { $this->addFlash('error', t('tfa_u2f.add_key.registration_error')); return $this->redirectToRoute('webauthn_register'); } diff --git a/src/DataFixtures/DataStructureFixtures.php b/src/DataFixtures/DataStructureFixtures.php index c7416abe..5abf6d6f 100644 --- a/src/DataFixtures/DataStructureFixtures.php +++ b/src/DataFixtures/DataStructureFixtures.php @@ -38,11 +38,8 @@ use InvalidArgumentException; class DataStructureFixtures extends Fixture { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $entityManager; } /** diff --git a/src/DataFixtures/GroupFixtures.php b/src/DataFixtures/GroupFixtures.php index 93e93b79..d8e54b9f 100644 --- a/src/DataFixtures/GroupFixtures.php +++ b/src/DataFixtures/GroupFixtures.php @@ -30,18 +30,12 @@ use Doctrine\Persistence\ObjectManager; class GroupFixtures extends Fixture { - public const ADMINS = 'group-admin'; - public const USERS = 'group-users'; - public const READONLY = 'group-readonly'; + final public const ADMINS = 'group-admin'; + final public const USERS = 'group-users'; + final public const READONLY = 'group-readonly'; - - private PermissionPresetsHelper $permission_presets; - private PermissionManager $permissionManager; - - public function __construct(PermissionPresetsHelper $permissionPresetsHelper, PermissionManager $permissionManager) + public function __construct(private readonly PermissionPresetsHelper $permission_presets, private readonly PermissionManager $permissionManager) { - $this->permission_presets = $permissionPresetsHelper; - $this->permissionManager = $permissionManager; } public function load(ObjectManager $manager): void diff --git a/src/DataFixtures/LabelProfileFixtures.php b/src/DataFixtures/LabelProfileFixtures.php index d2c23fad..77ebe791 100644 --- a/src/DataFixtures/LabelProfileFixtures.php +++ b/src/DataFixtures/LabelProfileFixtures.php @@ -49,11 +49,8 @@ use Doctrine\Persistence\ObjectManager; class LabelProfileFixtures extends Fixture { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $entityManager; } public function load(ObjectManager $manager): void diff --git a/src/DataFixtures/PartFixtures.php b/src/DataFixtures/PartFixtures.php index 45789dd9..6b765bc8 100644 --- a/src/DataFixtures/PartFixtures.php +++ b/src/DataFixtures/PartFixtures.php @@ -60,11 +60,8 @@ use Doctrine\Persistence\ObjectManager; class PartFixtures extends Fixture { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $entityManager; } public function load(ObjectManager $manager): void diff --git a/src/DataFixtures/UserFixtures.php b/src/DataFixtures/UserFixtures.php index f9e138b6..f329d1a2 100644 --- a/src/DataFixtures/UserFixtures.php +++ b/src/DataFixtures/UserFixtures.php @@ -30,13 +30,8 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; class UserFixtures extends Fixture { - protected UserPasswordHasherInterface $encoder; - protected EntityManagerInterface $em; - - public function __construct(UserPasswordHasherInterface $encoder, EntityManagerInterface $entityManager) + public function __construct(protected UserPasswordHasherInterface $encoder, protected EntityManagerInterface $em) { - $this->em = $entityManager; - $this->encoder = $encoder; } public function load(ObjectManager $manager): void diff --git a/src/DataTables/AttachmentDataTable.php b/src/DataTables/AttachmentDataTable.php index dd82f5a8..62a35049 100644 --- a/src/DataTables/AttachmentDataTable.php +++ b/src/DataTables/AttachmentDataTable.php @@ -42,27 +42,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class AttachmentDataTable implements DataTableTypeInterface { - private TranslatorInterface $translator; - private EntityURLGenerator $entityURLGenerator; - private AttachmentManager $attachmentHelper; - private ElementTypeNameGenerator $elementTypeNameGenerator; - private AttachmentURLGenerator $attachmentURLGenerator; - - public function __construct(TranslatorInterface $translator, EntityURLGenerator $entityURLGenerator, - AttachmentManager $attachmentHelper, AttachmentURLGenerator $attachmentURLGenerator, - ElementTypeNameGenerator $elementTypeNameGenerator) + public function __construct(private readonly TranslatorInterface $translator, private readonly EntityURLGenerator $entityURLGenerator, private readonly AttachmentManager $attachmentHelper, private readonly AttachmentURLGenerator $attachmentURLGenerator, private readonly ElementTypeNameGenerator $elementTypeNameGenerator) { - $this->translator = $translator; - $this->entityURLGenerator = $entityURLGenerator; - $this->attachmentHelper = $attachmentHelper; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; - $this->attachmentURLGenerator = $attachmentURLGenerator; } public function configure(DataTable $dataTable, array $options): void { $dataTable->add('dont_matter', RowClassColumn::class, [ - 'render' => function ($value, Attachment $context) { + 'render' => function ($value, Attachment $context): string { //Mark attachments with missing files yellow if(!$this->attachmentHelper->isFileExisting($context)){ return 'table-warning'; @@ -75,7 +62,7 @@ final class AttachmentDataTable implements DataTableTypeInterface $dataTable->add('picture', TextColumn::class, [ 'label' => '', 'className' => 'no-colvis', - 'render' => function ($value, Attachment $context) { + 'render' => function ($value, Attachment $context): string { if ($context->isPicture() && !$context->isExternal() && $this->attachmentHelper->isFileExisting($context)) { @@ -125,25 +112,21 @@ final class AttachmentDataTable implements DataTableTypeInterface $dataTable->add('attachment_type', TextColumn::class, [ 'label' => 'attachment.table.type', 'field' => 'attachment_type.name', - 'render' => function ($value, Attachment $context) { - return sprintf( - '%s', - $this->entityURLGenerator->editURL($context->getAttachmentType()), - htmlspecialchars($value) - ); - }, + 'render' => fn($value, Attachment $context): string => sprintf( + '%s', + $this->entityURLGenerator->editURL($context->getAttachmentType()), + htmlspecialchars((string) $value) + ), ]); $dataTable->add('element', TextColumn::class, [ 'label' => 'attachment.table.element', //'propertyPath' => 'element.name', - 'render' => function ($value, Attachment $context) { - return sprintf( - '%s', - $this->entityURLGenerator->infoURL($context->getElement()), - $this->elementTypeNameGenerator->getTypeNameCombination($context->getElement(), true) - ); - }, + 'render' => fn($value, Attachment $context): string => sprintf( + '%s', + $this->entityURLGenerator->infoURL($context->getElement()), + $this->elementTypeNameGenerator->getTypeNameCombination($context->getElement(), true) + ), ]); $dataTable->add('filename', TextColumn::class, [ diff --git a/src/DataTables/Column/EntityColumn.php b/src/DataTables/Column/EntityColumn.php index df3bf3d2..c14eabe9 100644 --- a/src/DataTables/Column/EntityColumn.php +++ b/src/DataTables/Column/EntityColumn.php @@ -31,13 +31,8 @@ use Symfony\Component\PropertyAccess\PropertyAccessorInterface; class EntityColumn extends AbstractColumn { - protected EntityURLGenerator $urlGenerator; - protected PropertyAccessorInterface $accessor; - - public function __construct(EntityURLGenerator $URLGenerator, PropertyAccessorInterface $accessor) + public function __construct(protected EntityURLGenerator $urlGenerator, protected PropertyAccessorInterface $accessor) { - $this->urlGenerator = $URLGenerator; - $this->accessor = $accessor; } /** @@ -58,34 +53,30 @@ class EntityColumn extends AbstractColumn $resolver->setRequired('property'); - $resolver->setDefault('field', static function (Options $option) { - return $option['property'].'.name'; - }); + $resolver->setDefault('field', static fn(Options $option): string => $option['property'].'.name'); - $resolver->setDefault('render', function (Options $options) { - return function ($value, $context) use ($options) { - if ($this->accessor->isReadable($context, $options['property'])) { - $entity = $this->accessor->getValue($context, $options['property']); - } else { - $entity = null; + $resolver->setDefault('render', fn(Options $options) => function ($value, $context) use ($options): string { + if ($this->accessor->isReadable($context, $options['property'])) { + $entity = $this->accessor->getValue($context, $options['property']); + } else { + $entity = null; + } + + /** @var AbstractNamedDBElement|null $entity */ + + if ($entity instanceof \App\Entity\Base\AbstractNamedDBElement) { + if (null !== $entity->getID()) { + return sprintf( + '%s', + $this->urlGenerator->listPartsURL($entity), + htmlspecialchars($entity->getName()) + ); } - /** @var AbstractNamedDBElement|null $entity */ + return sprintf('%s', $value); + } - if (null !== $entity) { - if (null !== $entity->getID()) { - return sprintf( - '%s', - $this->urlGenerator->listPartsURL($entity), - htmlspecialchars($entity->getName()) - ); - } - - return sprintf('%s', $value); - } - - return ''; - }; + return ''; }); return $this; diff --git a/src/DataTables/Column/LocaleDateTimeColumn.php b/src/DataTables/Column/LocaleDateTimeColumn.php index 733c0b6c..922f7eb3 100644 --- a/src/DataTables/Column/LocaleDateTimeColumn.php +++ b/src/DataTables/Column/LocaleDateTimeColumn.php @@ -38,7 +38,6 @@ class LocaleDateTimeColumn extends AbstractColumn { /** * @param $value - * @return string * @throws Exception */ public function normalize($value): string diff --git a/src/DataTables/Column/LogEntryExtraColumn.php b/src/DataTables/Column/LogEntryExtraColumn.php index da6b4865..7ac5ccd0 100644 --- a/src/DataTables/Column/LogEntryExtraColumn.php +++ b/src/DataTables/Column/LogEntryExtraColumn.php @@ -28,13 +28,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class LogEntryExtraColumn extends AbstractColumn { - protected TranslatorInterface $translator; - protected LogEntryExtraFormatter $formatter; - - public function __construct(TranslatorInterface $translator, LogEntryExtraFormatter $formatter) + public function __construct(protected TranslatorInterface $translator, protected LogEntryExtraFormatter $formatter) { - $this->translator = $translator; - $this->formatter = $formatter; } /** diff --git a/src/DataTables/Column/LogEntryTargetColumn.php b/src/DataTables/Column/LogEntryTargetColumn.php index 0f61d567..8a4e7fc5 100644 --- a/src/DataTables/Column/LogEntryTargetColumn.php +++ b/src/DataTables/Column/LogEntryTargetColumn.php @@ -44,11 +44,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class LogEntryTargetColumn extends AbstractColumn { - private LogTargetHelper $logTargetHelper; - - public function __construct(LogTargetHelper $logTargetHelper) + public function __construct(private readonly LogTargetHelper $logTargetHelper) { - $this->logTargetHelper = $logTargetHelper; } /** diff --git a/src/DataTables/Column/MarkdownColumn.php b/src/DataTables/Column/MarkdownColumn.php index 4e3dc9ff..23b89b49 100644 --- a/src/DataTables/Column/MarkdownColumn.php +++ b/src/DataTables/Column/MarkdownColumn.php @@ -27,11 +27,8 @@ use Omines\DataTablesBundle\Column\AbstractColumn; class MarkdownColumn extends AbstractColumn { - protected MarkdownParser $markdown; - - public function __construct(MarkdownParser $markdown) + public function __construct(protected MarkdownParser $markdown) { - $this->markdown = $markdown; } /** diff --git a/src/DataTables/Column/PartAttachmentsColumn.php b/src/DataTables/Column/PartAttachmentsColumn.php index 48ab3201..a5715d17 100644 --- a/src/DataTables/Column/PartAttachmentsColumn.php +++ b/src/DataTables/Column/PartAttachmentsColumn.php @@ -33,15 +33,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PartAttachmentsColumn extends AbstractColumn { - protected FAIconGenerator $FAIconGenerator; - protected EntityURLGenerator $urlGenerator; - protected AttachmentManager $attachmentManager; - - public function __construct(FAIconGenerator $FAIconGenerator, EntityURLGenerator $urlGenerator, AttachmentManager $attachmentManager) + public function __construct(protected FAIconGenerator $FAIconGenerator, protected EntityURLGenerator $urlGenerator, protected AttachmentManager $attachmentManager) { - $this->FAIconGenerator = $FAIconGenerator; - $this->urlGenerator = $urlGenerator; - $this->attachmentManager = $attachmentManager; } /** @@ -61,9 +54,7 @@ class PartAttachmentsColumn extends AbstractColumn throw new RuntimeException('$context must be a Part object!'); } $tmp = ''; - $attachments = $context->getAttachments()->filter(function (Attachment $attachment) { - return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment); - }); + $attachments = $context->getAttachments()->filter(fn(Attachment $attachment) => $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment)); $count = 5; foreach ($attachments as $attachment) { diff --git a/src/DataTables/Column/PrettyBoolColumn.php b/src/DataTables/Column/PrettyBoolColumn.php index a6f74c3c..ffddeac5 100644 --- a/src/DataTables/Column/PrettyBoolColumn.php +++ b/src/DataTables/Column/PrettyBoolColumn.php @@ -25,11 +25,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PrettyBoolColumn extends AbstractColumn { - protected TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(protected TranslatorInterface $translator) { - $this->translator = $translator; } public function normalize($value): ?bool diff --git a/src/DataTables/Column/RevertLogColumn.php b/src/DataTables/Column/RevertLogColumn.php index 0215bd24..b61c0a87 100644 --- a/src/DataTables/Column/RevertLogColumn.php +++ b/src/DataTables/Column/RevertLogColumn.php @@ -51,13 +51,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class RevertLogColumn extends AbstractColumn { - protected TranslatorInterface $translator; - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(TranslatorInterface $translator, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected TranslatorInterface $translator, protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->translator = $translator; - $this->security = $security; } /** @@ -105,8 +100,6 @@ class RevertLogColumn extends AbstractColumn $this->translator->trans('log.undo.revert') ); - $tmp .= ''; - - return $tmp; + return $tmp . ''; } } diff --git a/src/DataTables/Column/SIUnitNumberColumn.php b/src/DataTables/Column/SIUnitNumberColumn.php index fa09e227..61e1999c 100644 --- a/src/DataTables/Column/SIUnitNumberColumn.php +++ b/src/DataTables/Column/SIUnitNumberColumn.php @@ -26,11 +26,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class SIUnitNumberColumn extends AbstractColumn { - protected SIFormatter $formatter; - - public function __construct(SIFormatter $formatter) + public function __construct(protected SIFormatter $formatter) { - $this->formatter = $formatter; } public function configureOptions(OptionsResolver $resolver): self diff --git a/src/DataTables/Column/TagsColumn.php b/src/DataTables/Column/TagsColumn.php index 4d0dee0a..9314e499 100644 --- a/src/DataTables/Column/TagsColumn.php +++ b/src/DataTables/Column/TagsColumn.php @@ -27,11 +27,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class TagsColumn extends AbstractColumn { - protected UrlGeneratorInterface $urlGenerator; - - public function __construct(UrlGeneratorInterface $urlGenerator) + public function __construct(protected UrlGeneratorInterface $urlGenerator) { - $this->urlGenerator = $urlGenerator; } /** @@ -46,7 +43,7 @@ class TagsColumn extends AbstractColumn return []; } - return explode(',', $value); + return explode(',', (string) $value); } public function render($tags, $context): string @@ -61,7 +58,7 @@ class TagsColumn extends AbstractColumn $html .= sprintf( '%s', $this->urlGenerator->generate('part_list_tags', ['tag' => $tag]), - htmlspecialchars($tag) + htmlspecialchars((string) $tag) ); } diff --git a/src/DataTables/ErrorDataTable.php b/src/DataTables/ErrorDataTable.php index 29888f17..6bb66841 100644 --- a/src/DataTables/ErrorDataTable.php +++ b/src/DataTables/ErrorDataTable.php @@ -54,16 +54,12 @@ class ErrorDataTable implements DataTableTypeInterface $dataTable ->add('dont_matter_we_only_set_color', RowClassColumn::class, [ - 'render' => function ($value, $context) { - return 'table-warning'; - }, + 'render' => fn($value, $context): string => 'table-warning', ]) ->add('error', TextColumn::class, [ 'label' => 'error_table.error', - 'render' => function ($value, $context) { - return ' ' . $value; - }, + 'render' => fn($value, $context): string => ' ' . $value, ]) ; diff --git a/src/DataTables/Filters/AttachmentFilter.php b/src/DataTables/Filters/AttachmentFilter.php index 9325bd60..5fc38296 100644 --- a/src/DataTables/Filters/AttachmentFilter.php +++ b/src/DataTables/Filters/AttachmentFilter.php @@ -60,59 +60,38 @@ class AttachmentFilter implements FilterInterface $this->applyAllChildFilters($queryBuilder); } - /** - * @return NumberConstraint - */ public function getDbId(): NumberConstraint { return $this->dbId; } - /** - * @return TextConstraint - */ public function getName(): TextConstraint { return $this->name; } - /** - * @return DateTimeConstraint - */ public function getLastModified(): DateTimeConstraint { return $this->lastModified; } - /** - * @return DateTimeConstraint - */ public function getAddedDate(): DateTimeConstraint { return $this->addedDate; } - /** - * @return BooleanConstraint - */ public function getShowInTable(): BooleanConstraint { return $this->showInTable; } - /** - * @return EntityConstraint - */ public function getAttachmentType(): EntityConstraint { return $this->attachmentType; } - /** - * @return InstanceOfConstraint - */ public function getTargetType(): InstanceOfConstraint { return $this->targetType; diff --git a/src/DataTables/Filters/CompoundFilterTrait.php b/src/DataTables/Filters/CompoundFilterTrait.php index ba778aac..24a9f46c 100644 --- a/src/DataTables/Filters/CompoundFilterTrait.php +++ b/src/DataTables/Filters/CompoundFilterTrait.php @@ -60,8 +60,6 @@ trait CompoundFilterTrait /** * Applies all children filters that are declared as property of this filter using reflection. - * @param QueryBuilder $queryBuilder - * @return void */ protected function applyAllChildFilters(QueryBuilder $queryBuilder): void { diff --git a/src/DataTables/Filters/Constraints/AbstractConstraint.php b/src/DataTables/Filters/Constraints/AbstractConstraint.php index d57b6add..2ef89c8e 100644 --- a/src/DataTables/Filters/Constraints/AbstractConstraint.php +++ b/src/DataTables/Filters/Constraints/AbstractConstraint.php @@ -26,11 +26,6 @@ abstract class AbstractConstraint implements FilterInterface { use FilterTrait; - /** - * @var string The property where this BooleanConstraint should apply to - */ - protected string $property; - /** * @var string */ @@ -43,9 +38,11 @@ abstract class AbstractConstraint implements FilterInterface */ abstract public function isEnabled(): bool; - public function __construct(string $property, string $identifier = null) + public function __construct(/** + * @var string The property where this BooleanConstraint should apply to + */ + protected string $property, string $identifier = null) { - $this->property = $property; $this->identifier = $identifier ?? $this->generateParameterIdentifier($property); } } \ No newline at end of file diff --git a/src/DataTables/Filters/Constraints/BooleanConstraint.php b/src/DataTables/Filters/Constraints/BooleanConstraint.php index ea3cfd6a..2810c26e 100644 --- a/src/DataTables/Filters/Constraints/BooleanConstraint.php +++ b/src/DataTables/Filters/Constraints/BooleanConstraint.php @@ -24,19 +24,14 @@ use Doctrine\ORM\QueryBuilder; class BooleanConstraint extends AbstractConstraint { - /** @var bool|null The value of our constraint */ - protected ?bool $value; - - - public function __construct(string $property, string $identifier = null, ?bool $default_value = null) + public function __construct(string $property, string $identifier = null, /** @var bool|null The value of our constraint */ + protected ?bool $value = null) { parent::__construct($property, $identifier); - $this->value = $default_value; } /** * Gets the value of this constraint. Null means "don't filter", true means "filter for true", false means "filter for false". - * @return bool|null */ public function getValue(): ?bool { @@ -45,7 +40,6 @@ class BooleanConstraint extends AbstractConstraint /** * Sets the value of this constraint. Null means "don't filter", true means "filter for true", false means "filter for false". - * @param bool|null $value */ public function setValue(?bool $value): void { diff --git a/src/DataTables/Filters/Constraints/ChoiceConstraint.php b/src/DataTables/Filters/Constraints/ChoiceConstraint.php index 52c0739f..9aa6ebbc 100644 --- a/src/DataTables/Filters/Constraints/ChoiceConstraint.php +++ b/src/DataTables/Filters/Constraints/ChoiceConstraint.php @@ -24,7 +24,7 @@ use Doctrine\ORM\QueryBuilder; class ChoiceConstraint extends AbstractConstraint { - public const ALLOWED_OPERATOR_VALUES = ['ANY', 'NONE']; + final public const ALLOWED_OPERATOR_VALUES = ['ANY', 'NONE']; /** * @var string[]|int[] The values to compare to @@ -46,7 +46,6 @@ class ChoiceConstraint extends AbstractConstraint /** * @param string[]|int[] $value - * @return ChoiceConstraint */ public function setValue(array $value): ChoiceConstraint { @@ -54,18 +53,11 @@ class ChoiceConstraint extends AbstractConstraint return $this; } - /** - * @return string - */ public function getOperator(): string { return $this->operator; } - /** - * @param string $operator - * @return ChoiceConstraint - */ public function setOperator(string $operator): ChoiceConstraint { $this->operator = $operator; diff --git a/src/DataTables/Filters/Constraints/EntityConstraint.php b/src/DataTables/Filters/Constraints/EntityConstraint.php index facbbfea..3fc002b3 100644 --- a/src/DataTables/Filters/Constraints/EntityConstraint.php +++ b/src/DataTables/Filters/Constraints/EntityConstraint.php @@ -33,26 +33,6 @@ class EntityConstraint extends AbstractConstraint private const ALLOWED_OPERATOR_VALUES_BASE = ['=', '!=']; private const ALLOWED_OPERATOR_VALUES_STRUCTURAL = ['INCLUDING_CHILDREN', 'EXCLUDING_CHILDREN']; - /** - * @var NodesListBuilder - */ - protected ?NodesListBuilder $nodesListBuilder; - - /** - * @var class-string The class to use for the comparison - */ - protected string $class; - - /** - * @var string|null The operator to use - */ - protected ?string $operator; - - /** - * @var T The value to compare to - */ - protected $value; - /** * @param NodesListBuilder|null $nodesListBuilder * @param class-string $class @@ -61,18 +41,13 @@ class EntityConstraint extends AbstractConstraint * @param null $value * @param string $operator */ - public function __construct(?NodesListBuilder $nodesListBuilder, string $class, string $property, string $identifier = null, $value = null, string $operator = '') + public function __construct(protected ?\App\Services\Trees\NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '') { - $this->nodesListBuilder = $nodesListBuilder; - $this->class = $class; - - if ($nodesListBuilder === null && $this->isStructural()) { + if (!$nodesListBuilder instanceof \App\Services\Trees\NodesListBuilder && $this->isStructural()) { throw new \InvalidArgumentException('NodesListBuilder must be provided for structural entities'); } parent::__construct($property, $identifier); - $this->value = $value; - $this->operator = $operator; } public function getClass(): string @@ -80,17 +55,11 @@ class EntityConstraint extends AbstractConstraint return $this->class; } - /** - * @return string|null - */ public function getOperator(): ?string { return $this->operator; } - /** - * @param string|null $operator - */ public function setOperator(?string $operator): self { $this->operator = $operator; @@ -119,7 +88,6 @@ class EntityConstraint extends AbstractConstraint /** * Checks whether the constraints apply to a structural type or not - * @return bool */ public function isStructural(): bool { @@ -136,7 +104,7 @@ class EntityConstraint extends AbstractConstraint $tmp = self::ALLOWED_OPERATOR_VALUES_BASE; if ($this->isStructural()) { - $tmp = array_merge($tmp, self::ALLOWED_OPERATOR_VALUES_STRUCTURAL); + $tmp = [...$tmp, ...self::ALLOWED_OPERATOR_VALUES_STRUCTURAL]; } return $tmp; @@ -160,7 +128,7 @@ class EntityConstraint extends AbstractConstraint } //We need to handle null values differently, as they can not be compared with == or != - if ($this->value === null) { + if (!$this->value instanceof \App\Entity\Base\AbstractDBElement) { if($this->operator === '=' || $this->operator === 'INCLUDING_CHILDREN') { $queryBuilder->andWhere(sprintf("%s IS NULL", $this->property)); return; diff --git a/src/DataTables/Filters/Constraints/FilterTrait.php b/src/DataTables/Filters/Constraints/FilterTrait.php index 733a2217..8244eac3 100644 --- a/src/DataTables/Filters/Constraints/FilterTrait.php +++ b/src/DataTables/Filters/Constraints/FilterTrait.php @@ -35,7 +35,6 @@ trait FilterTrait /** * Checks if the given input is an aggregateFunction like COUNT(part.partsLot) or so - * @return bool */ protected function isAggregateFunctionString(string $input): bool { @@ -44,8 +43,6 @@ trait FilterTrait /** * Generates a parameter identifier that can be used for the given property. It gives random results, to be unique, so you have to cache it. - * @param string $property - * @return string */ protected function generateParameterIdentifier(string $property): string { @@ -57,13 +54,8 @@ trait FilterTrait /** * Adds a simple constraint in the form of (property OPERATOR value) (e.g. "part.name = :name") to the given query builder. - * @param QueryBuilder $queryBuilder - * @param string $property - * @param string $comparison_operator - * @param mixed $value - * @return void */ - protected function addSimpleAndConstraint(QueryBuilder $queryBuilder, string $property, string $parameterIdentifier, string $comparison_operator, $value): void + protected function addSimpleAndConstraint(QueryBuilder $queryBuilder, string $property, string $parameterIdentifier, string $comparison_operator, mixed $value): void { if ($comparison_operator === 'IN' || $comparison_operator === 'NOT IN') { $expression = sprintf("%s %s (:%s)", $property, $comparison_operator, $parameterIdentifier); diff --git a/src/DataTables/Filters/Constraints/InstanceOfConstraint.php b/src/DataTables/Filters/Constraints/InstanceOfConstraint.php index e339ecc1..879e2321 100644 --- a/src/DataTables/Filters/Constraints/InstanceOfConstraint.php +++ b/src/DataTables/Filters/Constraints/InstanceOfConstraint.php @@ -27,7 +27,7 @@ use Doctrine\ORM\QueryBuilder; */ class InstanceOfConstraint extends AbstractConstraint { - public const ALLOWED_OPERATOR_VALUES = ['ANY', 'NONE']; + final public const ALLOWED_OPERATOR_VALUES = ['ANY', 'NONE']; /** * @var string[] The values to compare to (fully qualified class names) @@ -57,16 +57,12 @@ class InstanceOfConstraint extends AbstractConstraint return $this; } - /** - * @return string - */ public function getOperator(): string { return $this->operator; } /** - * @param string $operator * @return $this */ public function setOperator(string $operator): self diff --git a/src/DataTables/Filters/Constraints/NumberConstraint.php b/src/DataTables/Filters/Constraints/NumberConstraint.php index d5066f46..81ab26a6 100644 --- a/src/DataTables/Filters/Constraints/NumberConstraint.php +++ b/src/DataTables/Filters/Constraints/NumberConstraint.php @@ -25,61 +25,28 @@ use RuntimeException; class NumberConstraint extends AbstractConstraint { - public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN']; + final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN']; - - /** - * The value1 used for comparison (this is the main one used for all mono-value comparisons) - * @var float|null|int|\DateTimeInterface - */ - protected $value1; - - /** - * The second value used when operator is RANGE; this is the upper bound of the range - * @var float|null|int|\DateTimeInterface - */ - protected $value2; - - /** - * @var string|null The operator to use - */ - protected ?string $operator; - - /** - * @return float|int|null|\DateTimeInterface - */ - public function getValue1() + public function getValue1(): float|int|null|\DateTimeInterface { return $this->value1; } - /** - * @param float|int|\DateTimeInterface|null $value1 - */ - public function setValue1($value1): void + public function setValue1(float|int|\DateTimeInterface|null $value1): void { $this->value1 = $value1; } - /** - * @return float|int|null - */ - public function getValue2() + public function getValue2(): float|int|null { return $this->value2; } - /** - * @param float|int|null $value2 - */ - public function setValue2($value2): void + public function setValue2(float|int|null $value2): void { $this->value2 = $value2; } - /** - * @return string - */ public function getOperator(): string { return $this->operator; @@ -94,12 +61,22 @@ class NumberConstraint extends AbstractConstraint } - public function __construct(string $property, string $identifier = null, $value1 = null, string $operator = null, $value2 = null) + /** + * @param float|null|int|\DateTimeInterface $value1 + * @param float|null|int|\DateTimeInterface $value2 + */ + public function __construct(string $property, string $identifier = null, /** + * The value1 used for comparison (this is the main one used for all mono-value comparisons) + */ + protected float|int|\DateTimeInterface|null $value1 = null, /** + * @var string|null The operator to use + */ + protected ?string $operator = null, /** + * The second value used when operator is RANGE; this is the upper bound of the range + */ + protected float|int|\DateTimeInterface|null $value2 = null) { parent::__construct($property, $identifier); - $this->value1 = $value1; - $this->value2 = $value2; - $this->operator = $operator; } public function isEnabled(): bool diff --git a/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php b/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php index ed29653b..2d431faf 100644 --- a/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php @@ -103,71 +103,44 @@ class ParameterConstraint extends AbstractConstraint $queryBuilder->andWhere('(' . $subqb->getDQL() . ') > 0'); } - /** - * @return string - */ public function getName(): string { return $this->name; } - /** - * @param string $name - * @return ParameterConstraint - */ public function setName(string $name): ParameterConstraint { $this->name = $name; return $this; } - /** - * @return string - */ public function getSymbol(): string { return $this->symbol; } - /** - * @param string $symbol - * @return ParameterConstraint - */ public function setSymbol(string $symbol): ParameterConstraint { $this->symbol = $symbol; return $this; } - /** - * @return string - */ public function getUnit(): string { return $this->unit; } - /** - * @param string $unit - * @return ParameterConstraint - */ public function setUnit(string $unit): ParameterConstraint { $this->unit = $unit; return $this; } - /** - * @return TextConstraint - */ public function getValueText(): TextConstraint { return $this->value_text; } - /** - * @return ParameterValueConstraint - */ public function getValue(): ParameterValueConstraint { return $this->value; diff --git a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php index 5da64098..0b4d5271 100644 --- a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php @@ -25,18 +25,14 @@ use Doctrine\ORM\QueryBuilder; class ParameterValueConstraint extends NumberConstraint { - protected string $alias; - - public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN', + final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN', //Additional operators 'IN_RANGE', 'NOT_IN_RANGE', 'GREATER_THAN_RANGE', 'GREATER_EQUAL_RANGE', 'LESS_THAN_RANGE', 'LESS_EQUAL_RANGE', 'RANGE_IN_RANGE', 'RANGE_INTERSECT_RANGE']; /** * @param string $alias The alias which is used in the sub query of ParameterConstraint */ - public function __construct(string $alias) { - $this->alias = $alias; - + public function __construct(protected string $alias) { parent::__construct($alias . '.value_typical'); } diff --git a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php index 92c78f6a..dfd15259 100644 --- a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php @@ -26,23 +26,20 @@ use Doctrine\ORM\QueryBuilder; class TagsConstraint extends AbstractConstraint { - public const ALLOWED_OPERATOR_VALUES = ['ANY', 'ALL', 'NONE']; + final public const ALLOWED_OPERATOR_VALUES = ['ANY', 'ALL', 'NONE']; /** - * @var string|null The operator to use + * @param string $value */ - protected ?string $operator; - - /** + public function __construct(string $property, string $identifier = null, /** * @var string The value to compare to */ - protected $value; - - public function __construct(string $property, string $identifier = null, $value = null, string $operator = '') + protected $value = null, /** + * @var string|null The operator to use + */ + protected ?string $operator = '') { parent::__construct($property, $identifier); - $this->value = $value; - $this->operator = $operator; } /** @@ -62,17 +59,11 @@ class TagsConstraint extends AbstractConstraint return $this; } - /** - * @return string - */ public function getValue(): string { return $this->value; } - /** - * @param string $value - */ public function setValue(string $value): self { $this->value = $value; @@ -96,9 +87,6 @@ class TagsConstraint extends AbstractConstraint /** * Builds an expression to query for a single tag - * @param QueryBuilder $queryBuilder - * @param string $tag - * @return Expr\Orx */ protected function getExpressionForTag(QueryBuilder $queryBuilder, string $tag): Expr\Orx { diff --git a/src/DataTables/Filters/Constraints/TextConstraint.php b/src/DataTables/Filters/Constraints/TextConstraint.php index 2b4ecea4..22e02fea 100644 --- a/src/DataTables/Filters/Constraints/TextConstraint.php +++ b/src/DataTables/Filters/Constraints/TextConstraint.php @@ -25,23 +25,20 @@ use Doctrine\ORM\QueryBuilder; class TextConstraint extends AbstractConstraint { - public const ALLOWED_OPERATOR_VALUES = ['=', '!=', 'STARTS', 'ENDS', 'CONTAINS', 'LIKE', 'REGEX']; + final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', 'STARTS', 'ENDS', 'CONTAINS', 'LIKE', 'REGEX']; /** - * @var string|null The operator to use + * @param string $value */ - protected ?string $operator; - - /** + public function __construct(string $property, string $identifier = null, /** * @var string The value to compare to */ - protected $value; - - public function __construct(string $property, string $identifier = null, $value = null, string $operator = '') + protected $value = null, /** + * @var string|null The operator to use + */ + protected ?string $operator = '') { parent::__construct($property, $identifier); - $this->value = $value; - $this->operator = $operator; } /** @@ -61,17 +58,11 @@ class TextConstraint extends AbstractConstraint return $this; } - /** - * @return string - */ public function getValue(): string { return $this->value; } - /** - * @param string $value - */ public function setValue(string $value): self { $this->value = $value; @@ -105,11 +96,11 @@ class TextConstraint extends AbstractConstraint $like_value = null; if ($this->operator === 'LIKE') { $like_value = $this->value; - } else if ($this->operator === 'STARTS') { + } elseif ($this->operator === 'STARTS') { $like_value = $this->value . '%'; - } else if ($this->operator === 'ENDS') { + } elseif ($this->operator === 'ENDS') { $like_value = '%' . $this->value; - } else if ($this->operator === 'CONTAINS') { + } elseif ($this->operator === 'CONTAINS') { $like_value = '%' . $this->value . '%'; } diff --git a/src/DataTables/Filters/LogFilter.php b/src/DataTables/Filters/LogFilter.php index 86a600b0..1751d565 100644 --- a/src/DataTables/Filters/LogFilter.php +++ b/src/DataTables/Filters/LogFilter.php @@ -58,9 +58,6 @@ class LogFilter implements FilterInterface $this->applyAllChildFilters($queryBuilder); } - /** - * @return DateTimeConstraint - */ public function getTimestamp(): DateTimeConstraint { return $this->timestamp; @@ -69,38 +66,26 @@ class LogFilter implements FilterInterface /** * @return IntConstraint|NumberConstraint */ - public function getDbId() + public function getDbId(): \App\DataTables\Filters\Constraints\IntConstraint|\App\DataTables\Filters\Constraints\NumberConstraint { return $this->dbId; } - /** - * @return ChoiceConstraint - */ public function getLevel(): ChoiceConstraint { return $this->level; } - /** - * @return InstanceOfConstraint - */ public function getEventType(): InstanceOfConstraint { return $this->eventType; } - /** - * @return ChoiceConstraint - */ public function getTargetType(): ChoiceConstraint { return $this->targetType; } - /** - * @return IntConstraint - */ public function getTargetId(): IntConstraint { return $this->targetId; diff --git a/src/DataTables/Filters/PartFilter.php b/src/DataTables/Filters/PartFilter.php index 2e9bdeae..92032a28 100644 --- a/src/DataTables/Filters/PartFilter.php +++ b/src/DataTables/Filters/PartFilter.php @@ -145,17 +145,11 @@ class PartFilter implements FilterInterface } - /** - * @return BooleanConstraint - */ public function getFavorite(): BooleanConstraint { return $this->favorite; } - /** - * @return BooleanConstraint - */ public function getNeedsReview(): BooleanConstraint { return $this->needsReview; @@ -176,17 +170,11 @@ class PartFilter implements FilterInterface return $this->description; } - /** - * @return DateTimeConstraint - */ public function getLastModified(): DateTimeConstraint { return $this->lastModified; } - /** - * @return DateTimeConstraint - */ public function getAddedDate(): DateTimeConstraint { return $this->addedDate; @@ -197,49 +185,31 @@ class PartFilter implements FilterInterface return $this->category; } - /** - * @return EntityConstraint - */ public function getFootprint(): EntityConstraint { return $this->footprint; } - /** - * @return EntityConstraint - */ public function getManufacturer(): EntityConstraint { return $this->manufacturer; } - /** - * @return EntityConstraint - */ public function getSupplier(): EntityConstraint { return $this->supplier; } - /** - * @return EntityConstraint - */ public function getStorelocation(): EntityConstraint { return $this->storelocation; } - /** - * @return EntityConstraint - */ public function getMeasurementUnit(): EntityConstraint { return $this->measurementUnit; } - /** - * @return NumberConstraint - */ public function getDbId(): NumberConstraint { return $this->dbId; @@ -250,33 +220,21 @@ class PartFilter implements FilterInterface return $this->ipn; } - /** - * @return TextConstraint - */ public function getComment(): TextConstraint { return $this->comment; } - /** - * @return NumberConstraint - */ public function getMinAmount(): NumberConstraint { return $this->minAmount; } - /** - * @return TextConstraint - */ public function getManufacturerProductUrl(): TextConstraint { return $this->manufacturer_product_url; } - /** - * @return TextConstraint - */ public function getManufacturerProductNumber(): TextConstraint { return $this->manufacturer_product_number; @@ -287,73 +245,46 @@ class PartFilter implements FilterInterface return $this->lotCount; } - /** - * @return EntityConstraint - */ public function getLotOwner(): EntityConstraint { return $this->lotOwner; } - /** - * @return TagsConstraint - */ public function getTags(): TagsConstraint { return $this->tags; } - /** - * @return IntConstraint - */ public function getOrderdetailsCount(): IntConstraint { return $this->orderdetailsCount; } - /** - * @return IntConstraint - */ public function getAttachmentsCount(): IntConstraint { return $this->attachmentsCount; } - /** - * @return BooleanConstraint - */ public function getLotNeedsRefill(): BooleanConstraint { return $this->lotNeedsRefill; } - /** - * @return BooleanConstraint - */ public function getLotUnknownAmount(): BooleanConstraint { return $this->lotUnknownAmount; } - /** - * @return DateTimeConstraint - */ public function getLotExpirationDate(): DateTimeConstraint { return $this->lotExpirationDate; } - /** - * @return EntityConstraint - */ public function getAttachmentType(): EntityConstraint { return $this->attachmentType; } - /** - * @return TextConstraint - */ public function getAttachmentName(): TextConstraint { return $this->attachmentName; @@ -369,9 +300,6 @@ class PartFilter implements FilterInterface return $this->amountSum; } - /** - * @return ArrayCollection - */ public function getParameters(): ArrayCollection { return $this->parameters; @@ -382,25 +310,16 @@ class PartFilter implements FilterInterface return $this->parametersCount; } - /** - * @return TextConstraint - */ public function getLotDescription(): TextConstraint { return $this->lotDescription; } - /** - * @return BooleanConstraint - */ public function getObsolete(): BooleanConstraint { return $this->obsolete; } - /** - * @return LessThanDesiredConstraint - */ public function getLessThanDesired(): LessThanDesiredConstraint { return $this->lessThanDesired; diff --git a/src/DataTables/Filters/PartSearchFilter.php b/src/DataTables/Filters/PartSearchFilter.php index ccbb71fd..7ddaf86e 100644 --- a/src/DataTables/Filters/PartSearchFilter.php +++ b/src/DataTables/Filters/PartSearchFilter.php @@ -26,9 +26,6 @@ use Doctrine\ORM\QueryBuilder; class PartSearchFilter implements FilterInterface { - /** @var string The string to query for */ - protected string $keyword; - /** @var boolean Whether to use regex for searching */ protected bool $regex = false; @@ -68,9 +65,11 @@ class PartSearchFilter implements FilterInterface /** @var bool Use Internal Part number for searching */ protected bool $ipn = true; - public function __construct(string $query) + public function __construct( + /** @var string The string to query for */ + protected string $keyword + ) { - $this->keyword = $query; } protected function getFieldsToSearch(): array @@ -122,12 +121,12 @@ class PartSearchFilter implements FilterInterface $fields_to_search = $this->getFieldsToSearch(); //If we have nothing to search for, do nothing - if (empty($fields_to_search) || empty($this->keyword)) { + if ($fields_to_search === [] || empty($this->keyword)) { return; } //Convert the fields to search to a list of expressions - $expressions = array_map(function (string $field) { + $expressions = array_map(function (string $field): string { if ($this->regex) { return sprintf("REGEXP(%s, :search_query) = 1", $field); } @@ -148,162 +147,99 @@ class PartSearchFilter implements FilterInterface } } - /** - * @return string - */ public function getKeyword(): string { return $this->keyword; } - /** - * @param string $keyword - * @return PartSearchFilter - */ public function setKeyword(string $keyword): PartSearchFilter { $this->keyword = $keyword; return $this; } - /** - * @return bool - */ public function isRegex(): bool { return $this->regex; } - /** - * @param bool $regex - * @return PartSearchFilter - */ public function setRegex(bool $regex): PartSearchFilter { $this->regex = $regex; return $this; } - /** - * @return bool - */ public function isName(): bool { return $this->name; } - /** - * @param bool $name - * @return PartSearchFilter - */ public function setName(bool $name): PartSearchFilter { $this->name = $name; return $this; } - /** - * @return bool - */ public function isCategory(): bool { return $this->category; } - /** - * @param bool $category - * @return PartSearchFilter - */ public function setCategory(bool $category): PartSearchFilter { $this->category = $category; return $this; } - /** - * @return bool - */ public function isDescription(): bool { return $this->description; } - /** - * @param bool $description - * @return PartSearchFilter - */ public function setDescription(bool $description): PartSearchFilter { $this->description = $description; return $this; } - /** - * @return bool - */ public function isTags(): bool { return $this->tags; } - /** - * @param bool $tags - * @return PartSearchFilter - */ public function setTags(bool $tags): PartSearchFilter { $this->tags = $tags; return $this; } - /** - * @return bool - */ public function isStorelocation(): bool { return $this->storelocation; } - /** - * @param bool $storelocation - * @return PartSearchFilter - */ public function setStorelocation(bool $storelocation): PartSearchFilter { $this->storelocation = $storelocation; return $this; } - /** - * @return bool - */ public function isOrdernr(): bool { return $this->ordernr; } - /** - * @param bool $ordernr - * @return PartSearchFilter - */ public function setOrdernr(bool $ordernr): PartSearchFilter { $this->ordernr = $ordernr; return $this; } - /** - * @return bool - */ public function isMpn(): bool { return $this->mpn; } - /** - * @param bool $mpn - * @return PartSearchFilter - */ public function setMpn(bool $mpn): PartSearchFilter { $this->mpn = $mpn; @@ -321,72 +257,44 @@ class PartSearchFilter implements FilterInterface return $this; } - /** - * @return bool - */ public function isSupplier(): bool { return $this->supplier; } - /** - * @param bool $supplier - * @return PartSearchFilter - */ public function setSupplier(bool $supplier): PartSearchFilter { $this->supplier = $supplier; return $this; } - /** - * @return bool - */ public function isManufacturer(): bool { return $this->manufacturer; } - /** - * @param bool $manufacturer - * @return PartSearchFilter - */ public function setManufacturer(bool $manufacturer): PartSearchFilter { $this->manufacturer = $manufacturer; return $this; } - /** - * @return bool - */ public function isFootprint(): bool { return $this->footprint; } - /** - * @param bool $footprint - * @return PartSearchFilter - */ public function setFootprint(bool $footprint): PartSearchFilter { $this->footprint = $footprint; return $this; } - /** - * @return bool - */ public function isComment(): bool { return $this->comment; } - /** - * @param bool $comment - * @return PartSearchFilter - */ public function setComment(bool $comment): PartSearchFilter { $this->comment = $comment; diff --git a/src/DataTables/Helpers/PartDataTableHelper.php b/src/DataTables/Helpers/PartDataTableHelper.php index b13ee813..9e7c9686 100644 --- a/src/DataTables/Helpers/PartDataTableHelper.php +++ b/src/DataTables/Helpers/PartDataTableHelper.php @@ -31,19 +31,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class PartDataTableHelper { - private PartPreviewGenerator $previewGenerator; - private AttachmentURLGenerator $attachmentURLGenerator; - - private TranslatorInterface $translator; - private EntityURLGenerator $entityURLGenerator; - - public function __construct(PartPreviewGenerator $previewGenerator, AttachmentURLGenerator $attachmentURLGenerator, - EntityURLGenerator $entityURLGenerator, TranslatorInterface $translator) + public function __construct(private readonly PartPreviewGenerator $previewGenerator, private readonly AttachmentURLGenerator $attachmentURLGenerator, private readonly EntityURLGenerator $entityURLGenerator, private readonly TranslatorInterface $translator) { - $this->previewGenerator = $previewGenerator; - $this->attachmentURLGenerator = $attachmentURLGenerator; - $this->translator = $translator; - $this->entityURLGenerator = $entityURLGenerator; } public function renderName(Part $context): string @@ -57,7 +46,7 @@ class PartDataTableHelper if ($context->isNeedsReview()) { $icon = sprintf('', $this->translator->trans('part.needs_review.badge')); } - if ($context->getBuiltProject() !== null) { + if ($context->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { $icon = sprintf('', $this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName()); } @@ -74,7 +63,7 @@ class PartDataTableHelper public function renderPicture(Part $context): string { $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($context); - if (null === $preview_attachment) { + if (!$preview_attachment instanceof \App\Entity\Attachments\Attachment) { return ''; } diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php index 424297e0..5bf3febc 100644 --- a/src/DataTables/LogDataTable.php +++ b/src/DataTables/LogDataTable.php @@ -61,27 +61,13 @@ use Symfony\Contracts\Translation\TranslatorInterface; class LogDataTable implements DataTableTypeInterface { - protected ElementTypeNameGenerator $elementTypeNameGenerator; - protected TranslatorInterface $translator; - protected UrlGeneratorInterface $urlGenerator; - protected EntityURLGenerator $entityURLGenerator; protected LogEntryRepository $logRepo; - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected UserAvatarHelper $userAvatarHelper; - protected LogLevelHelper $logLevelHelper; - public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator, - UrlGeneratorInterface $urlGenerator, EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, - \Symfony\Bundle\SecurityBundle\Security $security, UserAvatarHelper $userAvatarHelper, LogLevelHelper $logLevelHelper) + public function __construct(protected ElementTypeNameGenerator $elementTypeNameGenerator, protected TranslatorInterface $translator, + protected UrlGeneratorInterface $urlGenerator, protected EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, + protected \Symfony\Bundle\SecurityBundle\Security $security, protected UserAvatarHelper $userAvatarHelper, protected LogLevelHelper $logLevelHelper) { - $this->elementTypeNameGenerator = $elementTypeNameGenerator; - $this->translator = $translator; - $this->urlGenerator = $urlGenerator; - $this->entityURLGenerator = $entityURLGenerator; $this->logRepo = $entityManager->getRepository(AbstractLogEntry::class); - $this->security = $security; - $this->userAvatarHelper = $userAvatarHelper; - $this->logLevelHelper = $logLevelHelper; } public function configureOptions(OptionsResolver $optionsResolver): void @@ -115,21 +101,17 @@ class LogDataTable implements DataTableTypeInterface //This special $$rowClass column is used to set the row class depending on the log level. The class gets set by the frontend controller $dataTable->add('dont_matter', RowClassColumn::class, [ - 'render' => function ($value, AbstractLogEntry $context) { - return $this->logLevelHelper->logLevelToTableColorClass($context->getLevelString()); - }, + 'render' => fn($value, AbstractLogEntry $context) => $this->logLevelHelper->logLevelToTableColorClass($context->getLevelString()), ]); $dataTable->add('symbol', TextColumn::class, [ 'label' => '', 'className' => 'no-colvis', - 'render' => function ($value, AbstractLogEntry $context) { - return sprintf( - '', - $this->logLevelHelper->logLevelToIconClass($context->getLevelString()), - $context->getLevelString() - ); - }, + 'render' => fn($value, AbstractLogEntry $context): string => sprintf( + '', + $this->logLevelHelper->logLevelToIconClass($context->getLevelString()), + $context->getLevelString() + ), ]); $dataTable->add('id', TextColumn::class, [ @@ -140,12 +122,10 @@ class LogDataTable implements DataTableTypeInterface $dataTable->add('timestamp', LocaleDateTimeColumn::class, [ 'label' => 'log.timestamp', 'timeFormat' => 'medium', - 'render' => function (string $value, AbstractLogEntry $context) { - return sprintf('%s', - $this->urlGenerator->generate('log_details', ['id' => $context->getId()]), - $value - ); - } + 'render' => fn(string $value, AbstractLogEntry $context): string => sprintf('%s', + $this->urlGenerator->generate('log_details', ['id' => $context->getId()]), + $value + ) ]); $dataTable->add('type', TextColumn::class, [ @@ -169,18 +149,16 @@ class LogDataTable implements DataTableTypeInterface 'label' => 'log.level', 'visible' => 'system_log' === $options['mode'], 'propertyPath' => 'levelString', - 'render' => function (string $value, AbstractLogEntry $context) { - return $this->translator->trans('log.level.'.$value); - }, + 'render' => fn(string $value, AbstractLogEntry $context) => $this->translator->trans('log.level.'.$value), ]); $dataTable->add('user', TextColumn::class, [ 'label' => 'log.user', - 'render' => function ($value, AbstractLogEntry $context) { + 'render' => function ($value, AbstractLogEntry $context): string { $user = $context->getUser(); //If user was deleted, show the info from the username field - if ($user === null) { + if (!$user instanceof \App\Entity\UserSystem\User) { if ($context->isCLIEntry()) { return sprintf('%s [%s]', htmlentities($context->getCLIUsername()), @@ -241,19 +219,17 @@ class LogDataTable implements DataTableTypeInterface ) { try { $target = $this->logRepo->getTargetElement($context); - if (null !== $target) { + if ($target instanceof \App\Entity\Base\AbstractDBElement) { return $this->entityURLGenerator->timeTravelURL($target, $context->getTimestamp()); } - } catch (EntityNotSupportedException $exception) { + } catch (EntityNotSupportedException) { return null; } } return null; }, - 'disabled' => function ($value, AbstractLogEntry $context) { - return !$this->security->isGranted('show_history', $context->getTargetClass()); - }, + 'disabled' => fn($value, AbstractLogEntry $context) => !$this->security->isGranted('show_history', $context->getTargetClass()), ]); $dataTable->add('actionRevert', RevertLogColumn::class, [ @@ -310,7 +286,7 @@ class LogDataTable implements DataTableTypeInterface foreach ($options['filter_elements'] as $element) { /** @var AbstractDBElement $element */ - $target_type = AbstractLogEntry::targetTypeClassToID(get_class($element)); + $target_type = AbstractLogEntry::targetTypeClassToID($element::class); $target_id = $element->getID(); $builder->orWhere("log.target_type = ${target_type} AND log.target_id = ${target_id}"); } diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 8436cd89..c1f8296c 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -54,22 +54,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PartsDataTable implements DataTableTypeInterface { - private TranslatorInterface $translator; - private AmountFormatter $amountFormatter; - private \Symfony\Bundle\SecurityBundle\Security $security; - - private PartDataTableHelper $partDataTableHelper; - - private EntityURLGenerator $urlGenerator; - - public function __construct(EntityURLGenerator $urlGenerator, TranslatorInterface $translator, - AmountFormatter $amountFormatter,PartDataTableHelper $partDataTableHelper, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly EntityURLGenerator $urlGenerator, private readonly TranslatorInterface $translator, private readonly AmountFormatter $amountFormatter, private readonly PartDataTableHelper $partDataTableHelper, private readonly \Symfony\Bundle\SecurityBundle\Security $security) { - $this->urlGenerator = $urlGenerator; - $this->translator = $translator; - $this->amountFormatter = $amountFormatter; - $this->security = $security; - $this->partDataTableHelper = $partDataTableHelper; } public function configureOptions(OptionsResolver $optionsResolver): void @@ -92,7 +78,7 @@ final class PartsDataTable implements DataTableTypeInterface $dataTable //Color the table rows depending on the review and favorite status ->add('dont_matter', RowClassColumn::class, [ - 'render' => function ($value, Part $context) { + 'render' => function ($value, Part $context): string { if ($context->isNeedsReview()) { return 'table-secondary'; } @@ -108,15 +94,11 @@ final class PartsDataTable implements DataTableTypeInterface ->add('picture', TextColumn::class, [ 'label' => '', 'className' => 'no-colvis', - 'render' => function ($value, Part $context) { - return $this->partDataTableHelper->renderPicture($context); - }, + 'render' => fn($value, Part $context) => $this->partDataTableHelper->renderPicture($context), ]) ->add('name', TextColumn::class, [ 'label' => $this->translator->trans('part.table.name'), - 'render' => function ($value, Part $context) { - return $this->partDataTableHelper->renderName($context); - }, + 'render' => fn($value, Part $context) => $this->partDataTableHelper->renderName($context), ]) ->add('id', TextColumn::class, [ 'label' => $this->translator->trans('part.table.id'), @@ -153,11 +135,11 @@ final class PartsDataTable implements DataTableTypeInterface $dataTable->add('storelocation', TextColumn::class, [ 'label' => $this->translator->trans('part.table.storeLocations'), 'orderField' => 'storelocations.name', - 'render' => function ($value, Part $context) { + 'render' => function ($value, Part $context): string { $tmp = []; foreach ($context->getPartLots() as $lot) { //Ignore lots without storelocation - if (null === $lot->getStorageLocation()) { + if (!$lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { continue; } $tmp[] = sprintf( @@ -216,9 +198,7 @@ final class PartsDataTable implements DataTableTypeInterface ->add('minamount', TextColumn::class, [ 'label' => $this->translator->trans('part.table.minamount'), 'visible' => false, - 'render' => function ($value, Part $context) { - return htmlspecialchars($this->amountFormatter->format($value, $context->getPartUnit())); - }, + 'render' => fn($value, Part $context): string => htmlspecialchars($this->amountFormatter->format($value, $context->getPartUnit())), ]); if ($this->security->isGranted('@footprints.read')) { @@ -278,12 +258,8 @@ final class PartsDataTable implements DataTableTypeInterface ->add('edit', IconLinkColumn::class, [ 'label' => $this->translator->trans('part.table.edit'), 'visible' => false, - 'href' => function ($value, Part $context) { - return $this->urlGenerator->editURL($context); - }, - 'disabled' => function ($value, Part $context) { - return !$this->security->isGranted('edit', $context); - }, + 'href' => fn($value, Part $context) => $this->urlGenerator->editURL($context), + 'disabled' => fn($value, Part $context) => !$this->security->isGranted('edit', $context), 'title' => $this->translator->trans('part.table.edit.title'), ]) diff --git a/src/DataTables/ProjectBomEntriesDataTable.php b/src/DataTables/ProjectBomEntriesDataTable.php index eac5ae5a..5c44caf1 100644 --- a/src/DataTables/ProjectBomEntriesDataTable.php +++ b/src/DataTables/ProjectBomEntriesDataTable.php @@ -40,18 +40,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ProjectBomEntriesDataTable implements DataTableTypeInterface { - protected TranslatorInterface $translator; - protected PartDataTableHelper $partDataTableHelper; - protected EntityURLGenerator $entityURLGenerator; - protected AmountFormatter $amountFormatter; - - public function __construct(TranslatorInterface $translator, PartDataTableHelper $partDataTableHelper, - EntityURLGenerator $entityURLGenerator, AmountFormatter $amountFormatter) + public function __construct(protected TranslatorInterface $translator, protected PartDataTableHelper $partDataTableHelper, protected EntityURLGenerator $entityURLGenerator, protected AmountFormatter $amountFormatter) { - $this->translator = $translator; - $this->partDataTableHelper = $partDataTableHelper; - $this->entityURLGenerator = $entityURLGenerator; - $this->amountFormatter = $amountFormatter; } @@ -63,7 +53,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface 'label' => '', 'className' => 'no-colvis', 'render' => function ($value, ProjectBOMEntry $context) { - if($context->getPart() === null) { + if(!$context->getPart() instanceof \App\Entity\Parts\Part) { return ''; } return $this->partDataTableHelper->renderPicture($context->getPart()); @@ -79,9 +69,9 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface 'label' => $this->translator->trans('project.bom.quantity'), 'className' => 'text-center', 'orderField' => 'bom_entry.quantity', - 'render' => function ($value, ProjectBOMEntry $context) { + 'render' => function ($value, ProjectBOMEntry $context): float|string { //If we have a non-part entry, only show the rounded quantity - if ($context->getPart() === null) { + if (!$context->getPart() instanceof \App\Entity\Parts\Part) { return round($context->getQuantity()); } //Otherwise use the unit of the part to format the quantity @@ -93,10 +83,10 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface 'label' => $this->translator->trans('part.table.name'), 'orderField' => 'part.name', 'render' => function ($value, ProjectBOMEntry $context) { - if($context->getPart() === null) { + if(!$context->getPart() instanceof \App\Entity\Parts\Part) { return htmlspecialchars($context->getName()); } - if($context->getPart() !== null) { + if($context->getPart() instanceof \App\Entity\Parts\Part) { $tmp = $this->partDataTableHelper->renderName($context->getPart()); if(!empty($context->getName())) { $tmp .= '
'.htmlspecialchars($context->getName()).''; @@ -110,7 +100,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface ->add('description', MarkdownColumn::class, [ 'label' => $this->translator->trans('part.table.description'), 'data' => function (ProjectBOMEntry $context) { - if($context->getPart() !== null) { + if($context->getPart() instanceof \App\Entity\Parts\Part) { return $context->getPart()->getDescription(); } //For non-part BOM entries show the comment field diff --git a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php index a3fdaf1e..4d3b9f6c 100644 --- a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php +++ b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php @@ -47,11 +47,8 @@ use function preg_match; */ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface { - public const PURGE_MODE_DELETE = 1; - public const PURGE_MODE_TRUNCATE = 2; - - /** @var EntityManagerInterface|null */ - private ?EntityManagerInterface $em; + final public const PURGE_MODE_DELETE = 1; + final public const PURGE_MODE_TRUNCATE = 2; /** * If the purge should be done through DELETE or TRUNCATE statements @@ -60,31 +57,26 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface */ private int $purgeMode = self::PURGE_MODE_DELETE; - /** - * Table/view names to be excluded from purge - * - * @var string[] - */ - private array $excluded; - /** * Construct new purger instance. * * @param EntityManagerInterface|null $em EntityManagerInterface instance used for persistence. * @param string[] $excluded array of table/view names to be excluded from purge */ - public function __construct(?EntityManagerInterface $em = null, array $excluded = []) + public function __construct( + private ?\Doctrine\ORM\EntityManagerInterface $em = null, + /** + * Table/view names to be excluded from purge + */ + private readonly array $excluded = [] + ) { - $this->em = $em; - $this->excluded = $excluded; } /** * Set the purge mode * - * @param int $mode * - * @return void */ public function setPurgeMode(int $mode): void { @@ -93,8 +85,6 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface /** * Get the purge mode - * - * @return int */ public function getPurgeMode(): int { @@ -123,7 +113,7 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface $classes = []; foreach ($this->em->getMetadataFactory()->getAllMetadata() as $metadata) { - if ($metadata->isMappedSuperclass || (isset($metadata->isEmbeddedClass) && $metadata->isEmbeddedClass)) { + if ($metadata->isMappedSuperclass || ($metadata->isEmbeddedClass !== null && $metadata->isEmbeddedClass)) { continue; } @@ -143,7 +133,7 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface $class = $commitOrder[$i]; if ( - (isset($class->isEmbeddedClass) && $class->isEmbeddedClass) || + ($class->isEmbeddedClass !== null && $class->isEmbeddedClass) || $class->isMappedSuperclass || ($class->isInheritanceTypeSingleTable() && $class->name !== $class->rootEntityName) ) { @@ -172,13 +162,13 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface foreach ($orderedTables as $tbl) { // If we have a filter expression, check it and skip if necessary - if (! $emptyFilterExpression && ! preg_match($filterExpr, $tbl)) { + if (! $emptyFilterExpression && ! preg_match($filterExpr, (string) $tbl)) { continue; } // The table name might be quoted, we have to trim it // See https://github.com/Part-DB/Part-DB-server/issues/299 - $tbl = trim($tbl, '"'); + $tbl = trim((string) $tbl, '"'); $tbl = trim($tbl, '`'); // If the table is excluded, skip it as well @@ -276,11 +266,6 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface return array_reverse($sorter->sort()); } - /** - * @param array $classes - * - * @return array - */ private function getAssociationTables(array $classes, AbstractPlatform $platform): array { $associationTables = []; @@ -310,9 +295,6 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface return $this->em->getConfiguration()->getQuoteStrategy()->getTableName($class, $platform); } - /** - * @param array $assoc - */ private function getJoinTableName( array $assoc, ClassMetadata $class, diff --git a/src/Doctrine/SQLiteRegexExtension.php b/src/Doctrine/SQLiteRegexExtension.php index 0845ffb2..cc1ff5f8 100644 --- a/src/Doctrine/SQLiteRegexExtension.php +++ b/src/Doctrine/SQLiteRegexExtension.php @@ -45,7 +45,7 @@ class SQLiteRegexExtension implements EventSubscriberInterface if($native_connection instanceof \PDO && method_exists($native_connection, 'sqliteCreateFunction' )) { $native_connection->sqliteCreateFunction('REGEXP', function ($pattern, $value) { try { - return (false !== mb_ereg($pattern, $value)) ? 1 : 0; + return (mb_ereg($pattern, $value)) ? 1 : 0; } catch (\ErrorException $e) { throw InvalidRegexException::fromMBRegexError($e); } diff --git a/src/Doctrine/Types/BigDecimalType.php b/src/Doctrine/Types/BigDecimalType.php index f1522857..4dcabbb3 100644 --- a/src/Doctrine/Types/BigDecimalType.php +++ b/src/Doctrine/Types/BigDecimalType.php @@ -27,7 +27,7 @@ use Doctrine\DBAL\Types\Type; class BigDecimalType extends Type { - public const BIG_DECIMAL = 'big_decimal'; + final public const BIG_DECIMAL = 'big_decimal'; public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { @@ -53,7 +53,7 @@ class BigDecimalType extends Type */ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string { - if (null === $value) { + if (!$value instanceof \Brick\Math\BigDecimal) { return null; } diff --git a/src/Doctrine/Types/UTCDateTimeType.php b/src/Doctrine/Types/UTCDateTimeType.php index c9fe215b..462d4ae4 100644 --- a/src/Doctrine/Types/UTCDateTimeType.php +++ b/src/Doctrine/Types/UTCDateTimeType.php @@ -47,7 +47,7 @@ class UTCDateTimeType extends DateTimeType */ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string { - if (!self::$utc_timezone) { + if (!self::$utc_timezone instanceof \DateTimeZone) { self::$utc_timezone = new DateTimeZone('UTC'); } @@ -60,7 +60,7 @@ class UTCDateTimeType extends DateTimeType public function convertToPHPValue($value, AbstractPlatform $platform): ?DateTime { - if (!self::$utc_timezone) { + if (!self::$utc_timezone instanceof \DateTimeZone) { self::$utc_timezone = new DateTimeZone('UTC'); } diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index bc3f52b8..5fd1de14 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -34,11 +34,11 @@ use LogicException; /** * Class Attachment. */ -#[ORM\Entity(repositoryClass: 'App\Repository\AttachmentRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\AttachmentRepository::class)] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'class_name', type: 'string')] #[ORM\DiscriminatorMap(['PartDB\Part' => 'PartAttachment', 'Part' => 'PartAttachment', 'PartDB\Device' => 'ProjectAttachment', 'Device' => 'ProjectAttachment', 'AttachmentType' => 'AttachmentTypeAttachment', 'Category' => 'CategoryAttachment', 'Footprint' => 'FootprintAttachment', 'Manufacturer' => 'ManufacturerAttachment', 'Currency' => 'CurrencyAttachment', 'Group' => 'GroupAttachment', 'MeasurementUnit' => 'MeasurementUnitAttachment', 'Storelocation' => 'StorelocationAttachment', 'Supplier' => 'SupplierAttachment', 'User' => 'UserAttachment', 'LabelProfile' => 'LabelAttachment'])] -#[ORM\EntityListeners(['App\EntityListeners\AttachmentDeleteListener'])] +#[ORM\EntityListeners([\App\EntityListeners\AttachmentDeleteListener::class])] #[ORM\Table(name: '`attachments`')] #[ORM\Index(name: 'attachments_idx_id_element_id_class_name', columns: ['id', 'element_id', 'class_name'])] #[ORM\Index(name: 'attachments_idx_class_name_id', columns: ['class_name', 'id'])] @@ -51,23 +51,23 @@ abstract class Attachment extends AbstractNamedDBElement * Based on: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types * It will be used to determine if an attachment is a picture and therefore will be shown to user as preview. */ - public const PICTURE_EXTS = ['apng', 'bmp', 'gif', 'ico', 'cur', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png', + final public const PICTURE_EXTS = ['apng', 'bmp', 'gif', 'ico', 'cur', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png', 'svg', 'webp', ]; /** * A list of extensions that will be treated as a 3D Model that can be shown to user directly in Part-DB. */ - public const MODEL_EXTS = ['x3d']; + final public const MODEL_EXTS = ['x3d']; /** * When the path begins with one of the placeholders. */ - public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%']; + final public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%']; /** * @var array placeholders for attachments which using built in files */ - public const BUILTIN_PLACEHOLDER = ['%FOOTPRINTS%', '%FOOTPRINTS3D%']; + final public const BUILTIN_PLACEHOLDER = ['%FOOTPRINTS%', '%FOOTPRINTS3D%']; /** * @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses. diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index e2614168..bac4ecc4 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -33,7 +33,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. */ -#[ORM\Entity(repositoryClass: 'App\Repository\StructuralDBElementRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\StructuralDBElementRepository::class)] #[ORM\Table(name: '`attachment_types`')] #[ORM\Index(name: 'attachment_types_idx_name', columns: ['name'])] #[ORM\Index(name: 'attachment_types_idx_parent_name', columns: ['parent_id', 'name'])] @@ -45,7 +45,7 @@ class AttachmentType extends AbstractStructuralDBElement #[ORM\ManyToOne(targetEntity: 'AttachmentType', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?AbstractStructuralDBElement $parent; + protected ?AbstractStructuralDBElement $parent = null; /** * @var string @@ -57,14 +57,14 @@ class AttachmentType extends AbstractStructuralDBElement * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\AttachmentTypeAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\AttachmentTypeParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php index b6dab86f..a8e441c2 100644 --- a/src/Entity/Attachments/AttachmentTypeAttachment.php +++ b/src/Entity/Attachments/AttachmentTypeAttachment.php @@ -32,11 +32,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class AttachmentTypeAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; + final public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; /** * @var AttachmentContainingDBElement|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\AttachmentType', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php index e7a54fdd..854d628f 100644 --- a/src/Entity/Attachments/CategoryAttachment.php +++ b/src/Entity/Attachments/CategoryAttachment.php @@ -33,11 +33,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class CategoryAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Category::class; + final public const ALLOWED_ELEMENT_CLASS = Category::class; /** * @var AttachmentContainingDBElement|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Category', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php index 6671bdca..d3b06654 100644 --- a/src/Entity/Attachments/CurrencyAttachment.php +++ b/src/Entity/Attachments/CurrencyAttachment.php @@ -33,11 +33,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class CurrencyAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Currency::class; + final public const ALLOWED_ELEMENT_CLASS = Currency::class; /** * @var Currency|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php index 3fc3e2af..2cd60bfb 100644 --- a/src/Entity/Attachments/FootprintAttachment.php +++ b/src/Entity/Attachments/FootprintAttachment.php @@ -33,11 +33,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class FootprintAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Footprint::class; + final public const ALLOWED_ELEMENT_CLASS = Footprint::class; /** * @var Footprint|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Footprint', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php index a2d439bf..e10d17f6 100644 --- a/src/Entity/Attachments/GroupAttachment.php +++ b/src/Entity/Attachments/GroupAttachment.php @@ -33,12 +33,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class GroupAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Group::class; + final public const ALLOWED_ELEMENT_CLASS = Group::class; /** * @var Group|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\Group', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/LabelAttachment.php b/src/Entity/Attachments/LabelAttachment.php index 7ff1a191..ddb13283 100644 --- a/src/Entity/Attachments/LabelAttachment.php +++ b/src/Entity/Attachments/LabelAttachment.php @@ -52,12 +52,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class LabelAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = LabelProfile::class; + final public const ALLOWED_ELEMENT_CLASS = LabelProfile::class; /** * @var LabelProfile the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\LabelSystem\LabelProfile', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\LabelSystem\LabelProfile::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php index 1d5709dd..620d5c58 100644 --- a/src/Entity/Attachments/ManufacturerAttachment.php +++ b/src/Entity/Attachments/ManufacturerAttachment.php @@ -33,12 +33,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class ManufacturerAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; + final public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; /** * @var Manufacturer|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Manufacturer', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php index ad4fbbc9..0df01536 100644 --- a/src/Entity/Attachments/MeasurementUnitAttachment.php +++ b/src/Entity/Attachments/MeasurementUnitAttachment.php @@ -34,11 +34,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class MeasurementUnitAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; + final public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; /** * @var Manufacturer|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\MeasurementUnit', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php index 82db5c72..fbc7479c 100644 --- a/src/Entity/Attachments/PartAttachment.php +++ b/src/Entity/Attachments/PartAttachment.php @@ -33,11 +33,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class PartAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Part::class; + final public const ALLOWED_ELEMENT_CLASS = Part::class; /** * @var Part the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/ProjectAttachment.php b/src/Entity/Attachments/ProjectAttachment.php index 052996c3..6dfa9dcd 100644 --- a/src/Entity/Attachments/ProjectAttachment.php +++ b/src/Entity/Attachments/ProjectAttachment.php @@ -33,11 +33,11 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class ProjectAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Project::class; + final public const ALLOWED_ELEMENT_CLASS = Project::class; /** * @var Project|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php index b0fc6cb6..f1ac9090 100644 --- a/src/Entity/Attachments/StorelocationAttachment.php +++ b/src/Entity/Attachments/StorelocationAttachment.php @@ -33,12 +33,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class StorelocationAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Storelocation::class; + final public const ALLOWED_ELEMENT_CLASS = Storelocation::class; /** * @var Storelocation|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Storelocation', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php index 0f611d4c..241f401a 100644 --- a/src/Entity/Attachments/SupplierAttachment.php +++ b/src/Entity/Attachments/SupplierAttachment.php @@ -33,12 +33,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class SupplierAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = Supplier::class; + final public const ALLOWED_ELEMENT_CLASS = Supplier::class; /** * @var Supplier|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php index 8fc9b9df..c08b38f8 100644 --- a/src/Entity/Attachments/UserAttachment.php +++ b/src/Entity/Attachments/UserAttachment.php @@ -33,12 +33,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[ORM\Entity] class UserAttachment extends Attachment { - public const ALLOWED_ELEMENT_CLASS = User::class; + final public const ALLOWED_ELEMENT_CLASS = User::class; /** * @var User|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index ce55c700..101493fe 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -35,8 +35,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * Every database table which are managed with this class (or a subclass of it) * must have the table row "id"!! The ID is the unique key to identify the elements. */ -#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => 'App\Entity\Attachments\AttachmentType', 'attachment' => 'App\Entity\Attachments\Attachment', 'attachment_type_attachment' => 'App\Entity\Attachments\AttachmentTypeAttachment', 'category_attachment' => 'App\Entity\Attachments\CategoryAttachment', 'currency_attachment' => 'App\Entity\Attachments\CurrencyAttachment', 'footprint_attachment' => 'App\Entity\Attachments\FootprintAttachment', 'group_attachment' => 'App\Entity\Attachments\GroupAttachment', 'label_attachment' => 'App\Entity\Attachments\LabelAttachment', 'manufacturer_attachment' => 'App\Entity\Attachments\ManufacturerAttachment', 'measurement_unit_attachment' => 'App\Entity\Attachments\MeasurementUnitAttachment', 'part_attachment' => 'App\Entity\Attachments\PartAttachment', 'project_attachment' => 'App\Entity\Attachments\ProjectAttachment', 'storelocation_attachment' => 'App\Entity\Attachments\StorelocationAttachment', 'supplier_attachment' => 'App\Entity\Attachments\SupplierAttachment', 'user_attachment' => 'App\Entity\Attachments\UserAttachment', 'category' => 'App\Entity\Parts\Category', 'project' => 'App\Entity\ProjectSystem\Project', 'project_bom_entry' => 'App\Entity\ProjectSystem\ProjectBOMEntry', 'footprint' => 'App\Entity\Parts\Footprint', 'group' => 'App\Entity\UserSystem\Group', 'manufacturer' => 'App\Entity\Parts\Manufacturer', 'orderdetail' => 'App\Entity\PriceInformations\Orderdetail', 'part' => 'App\Entity\Parts\Part', 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => 'App\Entity\Parts\Storelocation', 'part_lot' => 'App\Entity\Parts\PartLot', 'currency' => 'App\Entity\PriceInformations\Currency', 'measurement_unit' => 'App\Entity\Parts\MeasurementUnit', 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => 'App\Entity\Parts\Supplier', 'user' => 'App\Entity\UserSystem\User'])] -#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\DBElementRepository')] +#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => \App\Entity\Attachments\AttachmentType::class, 'attachment' => \App\Entity\Attachments\Attachment::class, 'attachment_type_attachment' => \App\Entity\Attachments\AttachmentTypeAttachment::class, 'category_attachment' => \App\Entity\Attachments\CategoryAttachment::class, 'currency_attachment' => \App\Entity\Attachments\CurrencyAttachment::class, 'footprint_attachment' => \App\Entity\Attachments\FootprintAttachment::class, 'group_attachment' => \App\Entity\Attachments\GroupAttachment::class, 'label_attachment' => \App\Entity\Attachments\LabelAttachment::class, 'manufacturer_attachment' => \App\Entity\Attachments\ManufacturerAttachment::class, 'measurement_unit_attachment' => \App\Entity\Attachments\MeasurementUnitAttachment::class, 'part_attachment' => \App\Entity\Attachments\PartAttachment::class, 'project_attachment' => \App\Entity\Attachments\ProjectAttachment::class, 'storelocation_attachment' => \App\Entity\Attachments\StorelocationAttachment::class, 'supplier_attachment' => \App\Entity\Attachments\SupplierAttachment::class, 'user_attachment' => \App\Entity\Attachments\UserAttachment::class, 'category' => \App\Entity\Parts\Category::class, 'project' => \App\Entity\ProjectSystem\Project::class, 'project_bom_entry' => \App\Entity\ProjectSystem\ProjectBOMEntry::class, 'footprint' => \App\Entity\Parts\Footprint::class, 'group' => \App\Entity\UserSystem\Group::class, 'manufacturer' => \App\Entity\Parts\Manufacturer::class, 'orderdetail' => \App\Entity\PriceInformations\Orderdetail::class, 'part' => \App\Entity\Parts\Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => \App\Entity\Parts\Storelocation::class, 'part_lot' => \App\Entity\Parts\PartLot::class, 'currency' => \App\Entity\PriceInformations\Currency::class, 'measurement_unit' => \App\Entity\Parts\MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => \App\Entity\Parts\Supplier::class, 'user' => \App\Entity\UserSystem\User::class])] +#[ORM\MappedSuperclass(repositoryClass: \App\Repository\DBElementRepository::class)] abstract class AbstractDBElement implements JsonSerializable { /** @var int|null The Identification number for this part. This value is unique for the element in this table. diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php index 4b2b9d9e..f286e6b8 100644 --- a/src/Entity/Base/AbstractNamedDBElement.php +++ b/src/Entity/Base/AbstractNamedDBElement.php @@ -33,7 +33,7 @@ use Symfony\Component\Validator\Constraints as Assert; */ #[ORM\MappedSuperclass(repositoryClass: 'App\Repository\NamedDBElement')] #[ORM\HasLifecycleCallbacks] -abstract class AbstractNamedDBElement extends AbstractDBElement implements NamedElementInterface, TimeStampableInterface +abstract class AbstractNamedDBElement extends AbstractDBElement implements NamedElementInterface, TimeStampableInterface, \Stringable { use TimestampTrait; @@ -51,7 +51,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named * ******************************************************************************/ - public function __toString() + public function __toString(): string { return $this->getName(); } diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index 7ccb74c3..1885bfb9 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -29,7 +29,7 @@ use Symfony\Component\Serializer\Annotation\Groups; /** * Class PartsContainingDBElement. */ -#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\AbstractPartsContainingRepository')] +#[ORM\MappedSuperclass(repositoryClass: \App\Repository\AbstractPartsContainingRepository::class)] abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement { #[Groups(['full'])] diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 484fbaf6..847c5ff3 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -46,8 +46,8 @@ use Symfony\Component\Serializer\Annotation\Groups; * */ #[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')] -#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\StructuralDBElementRepository')] -#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])] +#[ORM\MappedSuperclass(repositoryClass: \App\Repository\StructuralDBElementRepository::class)] +#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])] abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement { use ParametersTrait; @@ -105,7 +105,6 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement parent::__construct(); $this->children = new ArrayCollection(); $this->parameters = new ArrayCollection(); - $this->parent = null; } public function __clone() @@ -141,11 +140,11 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement //Check if both elements compared, are from the same type // (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type): - if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) { + if (!$another_element instanceof $class_name && !is_a($this, $another_element::class)) { throw new InvalidArgumentException('isChildOf() only works for objects of the same type!'); } - if (null === $this->getParent()) { // this is the root node + if (!$this->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement) { // this is the root node return false; } @@ -170,7 +169,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement */ public function isRoot(): bool { - return null === $this->parent; + return !$this->parent instanceof \App\Entity\Base\AbstractStructuralDBElement; } /****************************************************************************** @@ -213,9 +212,9 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement /* * Only check for nodes that have a parent. In the other cases zero is correct. */ - if (0 === $this->level && null !== $this->parent) { + if (0 === $this->level && $this->parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { $element = $this->parent; - while (null !== $element) { + while ($element instanceof \App\Entity\Base\AbstractStructuralDBElement) { /** @var AbstractStructuralDBElement $element */ $element = $element->parent; ++$this->level; @@ -234,14 +233,14 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement */ public function getFullPath(string $delimiter = self::PATH_DELIMITER_ARROW): string { - if (empty($this->full_path_strings)) { + if ($this->full_path_strings === []) { $this->full_path_strings = []; $this->full_path_strings[] = $this->getName(); $element = $this; $overflow = 20; //We only allow 20 levels depth - while (null !== $element->parent && $overflow >= 0) { + while ($element->parent instanceof \App\Entity\Base\AbstractStructuralDBElement && $overflow >= 0) { $element = $element->parent; $this->full_path_strings[] = $element->getName(); //Decrement to prevent mem overflow. @@ -328,7 +327,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement $this->parent = $new_parent; //Add this element as child to the new parent - if (null !== $new_parent) { + if ($new_parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { $new_parent->getChildren()->add($this); } diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php index f1451e1c..e3801fb6 100644 --- a/src/Entity/Base/MasterAttachmentTrait.php +++ b/src/Entity/Base/MasterAttachmentTrait.php @@ -35,7 +35,7 @@ trait MasterAttachmentTrait * @var Attachment|null */ #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] - #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\Attachment')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)] #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] protected ?Attachment $master_picture_attachment = null; diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index 19360fb8..b50230e8 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -47,11 +47,11 @@ use Symfony\Component\Validator\Constraints as Assert; #[ORM\Embeddable] class LabelOptions { - public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93', 'code128']; - public const SUPPORTED_ELEMENTS = ['part', 'part_lot', 'storelocation']; - public const PICTURE_TYPES = ['none', 'element_picture', 'main_attachment']; + final public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93', 'code128']; + final public const SUPPORTED_ELEMENTS = ['part', 'part_lot', 'storelocation']; + final public const PICTURE_TYPES = ['none', 'element_picture', 'main_attachment']; - public const LINES_MODES = ['html', 'twig']; + final public const LINES_MODES = ['html', 'twig']; /** * @var float The page size of the label in mm @@ -111,9 +111,6 @@ class LabelOptions return $this->width; } - /** - * @return LabelOptions - */ public function setWidth(float $width): self { $this->width = $width; @@ -126,9 +123,6 @@ class LabelOptions return $this->height; } - /** - * @return LabelOptions - */ public function setHeight(float $height): self { $this->height = $height; @@ -141,9 +135,6 @@ class LabelOptions return $this->barcode_type; } - /** - * @return LabelOptions - */ public function setBarcodeType(string $barcode_type): self { $this->barcode_type = $barcode_type; @@ -156,9 +147,6 @@ class LabelOptions return $this->picture_type; } - /** - * @return LabelOptions - */ public function setPictureType(string $picture_type): self { $this->picture_type = $picture_type; @@ -171,9 +159,6 @@ class LabelOptions return $this->supported_element; } - /** - * @return LabelOptions - */ public function setSupportedElement(string $supported_element): self { $this->supported_element = $supported_element; @@ -186,9 +171,6 @@ class LabelOptions return $this->lines; } - /** - * @return LabelOptions - */ public function setLines(string $lines): self { $this->lines = $lines; @@ -204,9 +186,6 @@ class LabelOptions return $this->additional_css; } - /** - * @return LabelOptions - */ public function setAdditionalCss(string $additional_css): self { $this->additional_css = $additional_css; @@ -219,9 +198,6 @@ class LabelOptions return $this->lines_mode; } - /** - * @return LabelOptions - */ public function setLinesMode(string $lines_mode): self { $this->lines_mode = $lines_mode; diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php index 8548104b..c7fd4a26 100644 --- a/src/Entity/LabelSystem/LabelProfile.php +++ b/src/Entity/LabelSystem/LabelProfile.php @@ -49,15 +49,15 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Validator\Constraints as Assert; #[UniqueEntity(['name', 'options.supported_element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\LabelProfileRepository')] -#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])] +#[ORM\Entity(repositoryClass: \App\Repository\LabelProfileRepository::class)] +#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])] #[ORM\Table(name: 'label_profiles')] class LabelProfile extends AttachmentContainingDBElement { /** * @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\LabelAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -126,8 +126,6 @@ class LabelProfile extends AttachmentContainingDBElement /** * Sets the show in dropdown menu. - * - * @return LabelProfile */ public function setShowInDropdown(bool $show_in_dropdown): self { diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index f2ca701c..fe94ec81 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -61,14 +61,14 @@ use App\Repository\LogEntryRepository; #[ORM\Index(columns: ['datetime'], name: 'log_idx_datetime')] abstract class AbstractLogEntry extends AbstractDBElement { - public const LEVEL_EMERGENCY = 0; - public const LEVEL_ALERT = 1; - public const LEVEL_CRITICAL = 2; - public const LEVEL_ERROR = 3; - public const LEVEL_WARNING = 4; - public const LEVEL_NOTICE = 5; - public const LEVEL_INFO = 6; - public const LEVEL_DEBUG = 7; + final public const LEVEL_EMERGENCY = 0; + final public const LEVEL_ALERT = 1; + final public const LEVEL_CRITICAL = 2; + final public const LEVEL_ERROR = 3; + final public const LEVEL_WARNING = 4; + final public const LEVEL_NOTICE = 5; + final public const LEVEL_INFO = 6; + final public const LEVEL_DEBUG = 7; protected const TARGET_TYPE_NONE = 0; protected const TARGET_TYPE_USER = 1; @@ -129,7 +129,7 @@ abstract class AbstractLogEntry extends AbstractDBElement /** @var User|null The user which has caused this log entry */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', fetch: 'EAGER')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, fetch: 'EAGER')] #[ORM\JoinColumn(name: 'id_user', onDelete: 'SET NULL')] protected ?User $user = null; @@ -147,7 +147,7 @@ abstract class AbstractLogEntry extends AbstractDBElement /** @var int The priority level of the associated level. 0 is highest, 7 lowest */ #[ORM\Column(type: 'tinyint', name: 'level')] - protected int $level; + protected int $level = self::LEVEL_WARNING; /** @var int The ID of the element targeted by this event */ @@ -173,7 +173,6 @@ abstract class AbstractLogEntry extends AbstractDBElement public function __construct() { $this->timestamp = new DateTime(); - $this->level = self::LEVEL_WARNING; } /** @@ -214,7 +213,6 @@ abstract class AbstractLogEntry extends AbstractDBElement * Marks this log entry as a CLI entry, and set the username of the CLI user. * This removes the association to a user object in database, as CLI users are not really related to logged in * Part-DB users. - * @param string $cli_username * @return $this */ public function setCLIUsername(string $cli_username): self @@ -372,14 +370,14 @@ abstract class AbstractLogEntry extends AbstractDBElement */ public function setTargetElement(?AbstractDBElement $element): self { - if (null === $element) { + if (!$element instanceof \App\Entity\Base\AbstractDBElement) { $this->target_id = 0; $this->target_type = self::TARGET_TYPE_NONE; return $this; } - $this->target_type = static::targetTypeClassToID(get_class($element)); + $this->target_type = static::targetTypeClassToID($element::class); $this->target_id = $element->getID(); return $this; diff --git a/src/Entity/LogSystem/CollectionElementDeleted.php b/src/Entity/LogSystem/CollectionElementDeleted.php index 15f23e7f..8e85dd10 100644 --- a/src/Entity/LogSystem/CollectionElementDeleted.php +++ b/src/Entity/LogSystem/CollectionElementDeleted.php @@ -93,11 +93,9 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU public function __construct(AbstractDBElement $changed_element, string $collection_name, AbstractDBElement $deletedElement) { parent::__construct(); - - $this->level = self::LEVEL_INFO; $this->setTargetElement($changed_element); $this->extra['n'] = $collection_name; - $this->extra['c'] = self::targetTypeClassToID(get_class($deletedElement)); + $this->extra['c'] = self::targetTypeClassToID($deletedElement::class); $this->extra['i'] = $deletedElement->getID(); if ($deletedElement instanceof NamedElementInterface) { $this->extra['o'] = $deletedElement->getName(); @@ -141,8 +139,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU /** * This functions maps an abstract class name derived from the extra c element to an instantiable class name (based on the target element of this log entry). * For example if the target element is a part and the extra c element is "App\Entity\Attachments\Attachment", this function will return "App\Entity\Attachments\PartAttachment". - * @param string $abstract_class - * @return string */ private function resolveAbstractClassToInstantiableClass(string $abstract_class): string { diff --git a/src/Entity/LogSystem/PartStockChangedLogEntry.php b/src/Entity/LogSystem/PartStockChangedLogEntry.php index 5fc755bf..22c7a9ee 100644 --- a/src/Entity/LogSystem/PartStockChangedLogEntry.php +++ b/src/Entity/LogSystem/PartStockChangedLogEntry.php @@ -26,9 +26,9 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class PartStockChangedLogEntry extends AbstractLogEntry { - public const TYPE_ADD = "add"; - public const TYPE_WITHDRAW = "withdraw"; - public const TYPE_MOVE = "move"; + final public const TYPE_ADD = "add"; + final public const TYPE_WITHDRAW = "withdraw"; + final public const TYPE_MOVE = "move"; protected string $typeString = 'part_stock_changed'; @@ -68,7 +68,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry $this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...'); } - if ($move_to_target) { + if ($move_to_target instanceof \App\Entity\Parts\PartLot) { if ($type !== self::TYPE_MOVE) { throw new \InvalidArgumentException('The move_to_target parameter can only be set if the type is "move"!'); } @@ -130,7 +130,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Returns the old stock of the lot. - * @return float */ public function getOldStock(): float { @@ -139,7 +138,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Returns the new stock of the lot. - * @return float */ public function getNewStock(): float { @@ -148,7 +146,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Returns the new total instock of the part. - * @return float */ public function getNewTotalPartInstock(): float { @@ -157,7 +154,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Returns the comment associated with the change. - * @return string */ public function getComment(): string { @@ -166,7 +162,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Gets the difference between the old and the new stock value of the lot as a positive number. - * @return float */ public function getChangeAmount(): float { @@ -175,7 +170,6 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Returns the target lot ID (where the instock was moved to) if the type is TYPE_MOVE. - * @return int|null */ public function getMoveToTargetID(): ?int { @@ -184,39 +178,27 @@ class PartStockChangedLogEntry extends AbstractLogEntry /** * Converts the human-readable type (TYPE_* consts) to the version stored in DB - * @param string $type - * @return string */ protected function typeToShortType(string $type): string { - switch ($type) { - case self::TYPE_ADD: - return 'a'; - case self::TYPE_WITHDRAW: - return 'w'; - case self::TYPE_MOVE: - return 'm'; - default: - throw new \InvalidArgumentException('Invalid type: '.$type); - } + return match ($type) { + self::TYPE_ADD => 'a', + self::TYPE_WITHDRAW => 'w', + self::TYPE_MOVE => 'm', + default => throw new \InvalidArgumentException('Invalid type: '.$type), + }; } /** * Converts the short type stored in DB to the human-readable type (TYPE_* consts). - * @param string $short_type - * @return string */ protected function shortTypeToType(string $short_type): string { - switch ($short_type) { - case 'a': - return self::TYPE_ADD; - case 'w': - return self::TYPE_WITHDRAW; - case 'm': - return self::TYPE_MOVE; - default: - throw new \InvalidArgumentException('Invalid short type: '.$short_type); - } + return match ($short_type) { + 'a' => self::TYPE_ADD, + 'w' => self::TYPE_WITHDRAW, + 'm' => self::TYPE_MOVE, + default => throw new \InvalidArgumentException('Invalid short type: '.$short_type), + }; } } \ No newline at end of file diff --git a/src/Entity/LogSystem/SecurityEventLogEntry.php b/src/Entity/LogSystem/SecurityEventLogEntry.php index 2d74f5ea..0dafce92 100644 --- a/src/Entity/LogSystem/SecurityEventLogEntry.php +++ b/src/Entity/LogSystem/SecurityEventLogEntry.php @@ -54,7 +54,7 @@ use Symfony\Component\HttpFoundation\IpUtils; #[ORM\Entity] class SecurityEventLogEntry extends AbstractLogEntry { - public const SECURITY_TYPE_MAPPING = [ + final public const SECURITY_TYPE_MAPPING = [ 0 => SecurityEvents::PASSWORD_CHANGED, 1 => SecurityEvents::PASSWORD_RESET, 2 => SecurityEvents::BACKUP_KEYS_RESET, diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index be918d00..dd080d5a 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -51,7 +51,7 @@ use Symfony\Component\Validator\Constraints as Assert; use function sprintf; -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')] #[ORM\DiscriminatorMap([0 => 'CategoryParameter', 1 => 'CurrencyParameter', 2 => 'ProjectParameter', 3 => 'FootprintParameter', 4 => 'GroupParameter', 5 => 'ManufacturerParameter', 6 => 'MeasurementUnitParameter', 7 => 'PartParameter', 8 => 'StorelocationParameter', 9 => 'SupplierParameter', 10 => 'AttachmentTypeParameter'])] @@ -187,7 +187,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement $str .= ')'; } - if ($this->value_text) { + if ($this->value_text !== '' && $this->value_text !== '0') { $str .= ' ['.$this->value_text.']'; } @@ -317,7 +317,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement /** * Sets the typical value of this property. * - * @param float|null $value_typical * * @return $this */ diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php index 28f53669..f06c26aa 100644 --- a/src/Entity/Parameters/AttachmentTypeParameter.php +++ b/src/Entity/Parameters/AttachmentTypeParameter.php @@ -47,14 +47,14 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class AttachmentTypeParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; + final public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; /** * @var AttachmentType the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\AttachmentType', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php index ba71e46f..94004355 100644 --- a/src/Entity/Parameters/CategoryParameter.php +++ b/src/Entity/Parameters/CategoryParameter.php @@ -47,14 +47,14 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class CategoryParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Category::class; + final public const ALLOWED_ELEMENT_CLASS = Category::class; /** * @var Category the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Category', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php index fc3d6726..3db70701 100644 --- a/src/Entity/Parameters/CurrencyParameter.php +++ b/src/Entity/Parameters/CurrencyParameter.php @@ -50,15 +50,15 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a category element. */ #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class CurrencyParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Currency::class; + final public const ALLOWED_ELEMENT_CLASS = Currency::class; /** * @var Currency the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php index 1f8f517b..ca632a8f 100644 --- a/src/Entity/Parameters/FootprintParameter.php +++ b/src/Entity/Parameters/FootprintParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class FootprintParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Footprint::class; + final public const ALLOWED_ELEMENT_CLASS = Footprint::class; /** * @var Footprint the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Footprint', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php index 0b181929..eb838e99 100644 --- a/src/Entity/Parameters/GroupParameter.php +++ b/src/Entity/Parameters/GroupParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class GroupParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Group::class; + final public const ALLOWED_ELEMENT_CLASS = Group::class; /** * @var Group the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\Group', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php index 3fa585cf..d4a59793 100644 --- a/src/Entity/Parameters/ManufacturerParameter.php +++ b/src/Entity/Parameters/ManufacturerParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class ManufacturerParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; + final public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; /** * @var Manufacturer the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Manufacturer', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php index 67d20f3f..a32910be 100644 --- a/src/Entity/Parameters/MeasurementUnitParameter.php +++ b/src/Entity/Parameters/MeasurementUnitParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class MeasurementUnitParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; + final public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; /** * @var MeasurementUnit the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\MeasurementUnit', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index 97494abc..65aba267 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class PartParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Part::class; + final public const ALLOWED_ELEMENT_CLASS = Part::class; /** * @var Part the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php index bda1b59a..11462e38 100644 --- a/src/Entity/Parameters/ProjectParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class ProjectParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Project::class; + final public const ALLOWED_ELEMENT_CLASS = Project::class; /** * @var Project the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php index f119f4a7..f6ed82e2 100644 --- a/src/Entity/Parameters/StorelocationParameter.php +++ b/src/Entity/Parameters/StorelocationParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class StorelocationParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Storelocation::class; + final public const ALLOWED_ELEMENT_CLASS = Storelocation::class; /** * @var Storelocation the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Storelocation', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php index e3087c27..6ffcbcfa 100644 --- a/src/Entity/Parameters/SupplierParameter.php +++ b/src/Entity/Parameters/SupplierParameter.php @@ -47,15 +47,15 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] class SupplierParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Supplier::class; + final public const ALLOWED_ELEMENT_CLASS = Supplier::class; /** * @var Supplier the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 56450f11..ba5c5750 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -34,7 +34,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. */ -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\CategoryRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\CategoryRepository::class)] #[ORM\Table(name: '`categories`')] #[ORM\Index(name: 'category_idx_name', columns: ['name'])] #[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])] @@ -112,7 +112,7 @@ class Category extends AbstractPartsContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\CategoryAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -120,7 +120,7 @@ class Category extends AbstractPartsContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\CategoryParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -129,9 +129,6 @@ class Category extends AbstractPartsContainingDBElement return $this->partname_hint; } - /** - * @return Category - */ public function setPartnameHint(string $partname_hint): self { $this->partname_hint = $partname_hint; @@ -144,9 +141,6 @@ class Category extends AbstractPartsContainingDBElement return $this->partname_regex; } - /** - * @return Category - */ public function setPartnameRegex(string $partname_regex): self { $this->partname_regex = $partname_regex; @@ -159,9 +153,6 @@ class Category extends AbstractPartsContainingDBElement return $this->disable_footprints; } - /** - * @return Category - */ public function setDisableFootprints(bool $disable_footprints): self { $this->disable_footprints = $disable_footprints; @@ -174,9 +165,6 @@ class Category extends AbstractPartsContainingDBElement return $this->disable_manufacturers; } - /** - * @return Category - */ public function setDisableManufacturers(bool $disable_manufacturers): self { $this->disable_manufacturers = $disable_manufacturers; @@ -189,9 +177,6 @@ class Category extends AbstractPartsContainingDBElement return $this->disable_autodatasheets; } - /** - * @return Category - */ public function setDisableAutodatasheets(bool $disable_autodatasheets): self { $this->disable_autodatasheets = $disable_autodatasheets; @@ -204,9 +189,6 @@ class Category extends AbstractPartsContainingDBElement return $this->disable_properties; } - /** - * @return Category - */ public function setDisableProperties(bool $disable_properties): self { $this->disable_properties = $disable_properties; @@ -219,9 +201,6 @@ class Category extends AbstractPartsContainingDBElement return $this->default_description; } - /** - * @return Category - */ public function setDefaultDescription(string $default_description): self { $this->default_description = $default_description; @@ -234,9 +213,6 @@ class Category extends AbstractPartsContainingDBElement return $this->default_comment; } - /** - * @return Category - */ public function setDefaultComment(string $default_comment): self { $this->default_comment = $default_comment; diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index f7c56a79..b228141f 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -32,7 +32,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Footprint. */ -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\FootprintRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\FootprintRepository::class)] #[ORM\Table('`footprints`')] #[ORM\Index(name: 'footprint_idx_name', columns: ['name'])] #[ORM\Index(name: 'footprint_idx_parent_name', columns: ['parent_id', 'name'])] @@ -40,7 +40,7 @@ class Footprint extends AbstractPartsContainingDBElement { #[ORM\ManyToOne(targetEntity: 'Footprint', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?\App\Entity\Base\AbstractStructuralDBElement $parent; + protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null; /** * @var Collection @@ -53,21 +53,21 @@ class Footprint extends AbstractPartsContainingDBElement * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\FootprintAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** * @var FootprintAttachment|null */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\FootprintAttachment')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\FootprintAttachment::class)] #[ORM\JoinColumn(name: 'id_footprint_3d')] protected ?FootprintAttachment $footprint_3d = null; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\FootprintParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -88,13 +88,10 @@ class Footprint extends AbstractPartsContainingDBElement * Setters * *********************************************************************************/ - /** * Sets the 3D Model associated with this footprint. * * @param FootprintAttachment|null $new_attachment The new 3D Model - * - * @return Footprint */ public function setFootprint3d(?FootprintAttachment $new_attachment): self { diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 1e56bcfb..0ff9d49c 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -32,7 +32,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Manufacturer. */ -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\ManufacturerRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\ManufacturerRepository::class)] #[ORM\Table('`manufacturers`')] #[ORM\Index(name: 'manufacturer_name', columns: ['name'])] #[ORM\Index(name: 'manufacturer_idx_parent_name', columns: ['parent_id', 'name'])] @@ -40,7 +40,7 @@ class Manufacturer extends AbstractCompany { #[ORM\ManyToOne(targetEntity: 'Manufacturer', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?\App\Entity\Base\AbstractStructuralDBElement $parent; + protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null; /** * @var Collection @@ -53,14 +53,14 @@ class Manufacturer extends AbstractCompany * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\ManufacturerAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\ManufacturerParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; public function __construct() diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index b36db648..1faac9e0 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -36,7 +36,7 @@ use Symfony\Component\Validator\Constraints as Assert; * This could be something like N, grams, meters, etc... */ #[UniqueEntity('unit')] -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\MeasurementUnitRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\MeasurementUnitRepository::class)] #[ORM\Table(name: '`measurement_units`')] #[ORM\Index(name: 'unit_idx_name', columns: ['name'])] #[ORM\Index(name: 'unit_idx_parent_name', columns: ['parent_id', 'name'])] @@ -77,20 +77,20 @@ class MeasurementUnit extends AbstractPartsContainingDBElement #[ORM\ManyToOne(targetEntity: 'MeasurementUnit', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?\App\Entity\Base\AbstractStructuralDBElement $parent; + protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null; /** * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\MeasurementUnitAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\MeasurementUnitParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -102,11 +102,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement return $this->unit; } - /** - * @param string|null $unit - * - * @return MeasurementUnit - */ public function setUnit(?string $unit): self { $this->unit = $unit; @@ -119,9 +114,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement return $this->is_integer; } - /** - * @return MeasurementUnit - */ public function setIsInteger(bool $isInteger): self { $this->is_integer = $isInteger; @@ -134,9 +126,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement return $this->use_si_prefix; } - /** - * @return MeasurementUnit - */ public function setUseSIPrefix(bool $usesSIPrefixes): self { $this->use_si_prefix = $usesSIPrefixes; diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index df127d94..a77f10e5 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -49,7 +49,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * Otherwise, this class would be too big, to be maintained. */ #[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')] -#[ORM\Entity(repositoryClass: 'App\Repository\PartRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\PartRepository::class)] #[ORM\Table('`parts`')] #[ORM\Index(name: 'parts_idx_datet_name_last_id_needs', columns: ['datetime_added', 'name', 'last_modified', 'id', 'needs_review'])] #[ORM\Index(name: 'parts_idx_name', columns: ['name'])] @@ -69,7 +69,7 @@ class Part extends AttachmentContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\PartParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -89,7 +89,7 @@ class Part extends AttachmentContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\PartAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -97,7 +97,7 @@ class Part extends AttachmentContainingDBElement * @var Attachment|null */ #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] - #[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\Attachment')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)] #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] protected ?Attachment $master_picture_attachment = null; @@ -142,15 +142,13 @@ class Part extends AttachmentContainingDBElement public function validate(ExecutionContextInterface $context, $payload) { //Ensure that the part name fullfills the regex of the category - if ($this->category) { + if ($this->category instanceof \App\Entity\Parts\Category) { $regex = $this->category->getPartnameRegex(); - if (!empty($regex)) { - if (!preg_match($regex, $this->name)) { - $context->buildViolation('part.name.must_match_category_regex') - ->atPath('name') - ->setParameter('%regex%', $regex) - ->addViolation(); - } + if (!empty($regex) && !preg_match($regex, $this->name)) { + $context->buildViolation('part.name.must_match_category_regex') + ->atPath('name') + ->setParameter('%regex%', $regex) + ->addViolation(); } } } diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index eb47581e..58b30726 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -115,7 +115,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * @var User|null The owner of this part lot */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)] #[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')] protected ?User $owner = null; @@ -137,7 +137,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named */ public function isExpired(): ?bool { - if (null === $this->expiration_date) { + if (!$this->expiration_date instanceof \DateTimeInterface) { return null; } @@ -155,8 +155,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the description of the part lot. - * - * @return PartLot */ public function setDescription(string $description): self { @@ -175,8 +173,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the comment for this part lot. - * - * @return PartLot */ public function setComment(string $comment): self { @@ -196,9 +192,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the expiration date for the part lot. Set to null, if the part lot does not expire. * - * @param \DateTimeInterface|null $expiration_date * - * @return PartLot */ public function setExpirationDate(?\DateTimeInterface $expiration_date): self { @@ -219,8 +213,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the storage location, where this part lot is stored. - * - * @return PartLot */ public function setStorageLocation(?Storelocation $storage_location): self { @@ -239,8 +231,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the part that is stored in this part lot. - * - * @return PartLot */ public function setPart(Part $part): self { @@ -259,8 +249,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Set the unknown instock status of this part lot. - * - * @return PartLot */ public function setInstockUnknown(bool $instock_unknown): self { @@ -302,9 +290,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named return $this->needs_refill; } - /** - * @return PartLot - */ public function setNeedsRefill(bool $needs_refill): self { $this->needs_refill = $needs_refill; @@ -314,7 +299,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Returns the owner of this part lot. - * @return User|null */ public function getOwner(): ?User { @@ -323,8 +307,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * Sets the owner of this part lot. - * @param User|null $owner - * @return PartLot */ public function setOwner(?User $owner): PartLot { @@ -349,14 +331,12 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named //When the storage location sets the owner must match, the part lot owner must match the storage location owner if ($this->getStorageLocation() && $this->getStorageLocation()->isPartOwnerMustMatch() - && $this->getStorageLocation()->getOwner() && $this->getOwner()) { - if ($this->getOwner() !== $this->getStorageLocation()->getOwner() - && $this->owner->getID() !== $this->getStorageLocation()->getOwner()->getID()) { - $context->buildViolation('validator.part_lot.owner_must_match_storage_location_owner') - ->setParameter('%owner_name%', $this->getStorageLocation()->getOwner()->getFullName(true)) - ->atPath('owner') - ->addViolation(); - } + && $this->getStorageLocation()->getOwner() && $this->getOwner() && ($this->getOwner() !== $this->getStorageLocation()->getOwner() + && $this->owner->getID() !== $this->getStorageLocation()->getOwner()->getID())) { + $context->buildViolation('validator.part_lot.owner_must_match_storage_location_owner') + ->setParameter('%owner_name%', $this->getStorageLocation()->getOwner()->getFullName(true)) + ->atPath('owner') + ->addViolation(); } } } diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index fe3db50b..9079c21d 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -142,7 +142,6 @@ trait AdvancedPropertyTrait /** * Sets the internal part number of the part * @param string $ipn The new IPN of the part - * @return Part */ public function setIpn(?string $ipn): Part { diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 152ade10..9ae170ab 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -153,7 +153,6 @@ trait InstockTrait /** * Returns true, if the total instock amount of this part is less than the minimum amount. - * @return bool */ public function isNotEnoughInstock(): bool { @@ -204,7 +203,6 @@ trait InstockTrait /** * Returns the summed amount of all part lots that are expired. If no part lots are expired 0 is returned. - * @return float */ public function getExpiredAmountSum(): float { diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index b4e661a8..18b6698e 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -39,7 +39,7 @@ trait OrderTrait */ #[Assert\Valid] #[Groups(['extended', 'full', 'import'])] - #[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Orderdetail', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['supplierpartnr' => 'ASC'])] protected \Doctrine\Common\Collections\Collection $orderdetails; @@ -58,7 +58,7 @@ trait OrderTrait /** * @var Orderdetail|null */ - #[ORM\OneToOne(targetEntity: 'App\Entity\PriceInformations\Orderdetail')] + #[ORM\OneToOne(targetEntity: \App\Entity\PriceInformations\Orderdetail::class)] #[ORM\JoinColumn(name: 'order_orderdetails_id')] protected ?Orderdetail $order_orderdetail = null; @@ -105,9 +105,7 @@ trait OrderTrait { //If needed hide the obsolete entries if ($hide_obsolete) { - return $this->orderdetails->filter(function (Orderdetail $orderdetail) { - return ! $orderdetail->getObsolete(); - }); + return $this->orderdetails->filter(fn(Orderdetail $orderdetail) => ! $orderdetail->getObsolete()); } return $this->orderdetails; diff --git a/src/Entity/Parts/PartTraits/ProjectTrait.php b/src/Entity/Parts/PartTraits/ProjectTrait.php index a8a7162c..2a5cf6ed 100644 --- a/src/Entity/Parts/PartTraits/ProjectTrait.php +++ b/src/Entity/Parts/PartTraits/ProjectTrait.php @@ -13,13 +13,13 @@ trait ProjectTrait /** * @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries */ - #[ORM\OneToMany(targetEntity: 'App\Entity\ProjectSystem\ProjectBOMEntry', mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\ProjectSystem\ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)] protected \Doctrine\Common\Collections\Collection $project_bom_entries; /** * @var Project|null If a project is set here, then this part is special and represents the builds of a project. */ - #[ORM\OneToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'build_part')] + #[ORM\OneToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'build_part')] #[ORM\JoinColumn] protected ?Project $built_project = null; @@ -43,7 +43,6 @@ trait ProjectTrait /** * Returns the project that this part represents the builds of, or null if it doesn't - * @return Project|null */ public function getBuiltProject(): ?Project { diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index 2249fb00..71ea2669 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -35,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Store location. */ -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\StorelocationRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\StorelocationRepository::class)] #[ORM\Table('`storelocations`')] #[ORM\Index(name: 'location_idx_name', columns: ['name'])] #[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])] @@ -50,7 +50,7 @@ class Storelocation extends AbstractPartsContainingDBElement #[ORM\ManyToOne(targetEntity: 'Storelocation', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?AbstractStructuralDBElement $parent; + protected ?AbstractStructuralDBElement $parent = null; /** * @var MeasurementUnit|null The measurement unit, which parts can be stored in here @@ -62,7 +62,7 @@ class Storelocation extends AbstractPartsContainingDBElement /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\StorelocationParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -91,7 +91,7 @@ class Storelocation extends AbstractPartsContainingDBElement * @var User|null The owner of this storage location */ #[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')] - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)] #[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')] protected ?User $owner = null; @@ -105,7 +105,7 @@ class Storelocation extends AbstractPartsContainingDBElement * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\StorelocationAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $attachments; /******************************************************************************** @@ -135,9 +135,6 @@ class Storelocation extends AbstractPartsContainingDBElement return $this->only_single_part; } - /** - * @return Storelocation - */ public function setOnlySinglePart(bool $only_single_part): self { $this->only_single_part = $only_single_part; @@ -153,9 +150,6 @@ class Storelocation extends AbstractPartsContainingDBElement return $this->limit_to_existing_parts; } - /** - * @return Storelocation - */ public function setLimitToExistingParts(bool $limit_to_existing_parts): self { $this->limit_to_existing_parts = $limit_to_existing_parts; @@ -168,9 +162,6 @@ class Storelocation extends AbstractPartsContainingDBElement return $this->storage_type; } - /** - * @return Storelocation - */ public function setStorageType(?MeasurementUnit $storage_type): self { $this->storage_type = $storage_type; @@ -180,7 +171,6 @@ class Storelocation extends AbstractPartsContainingDBElement /** * Returns the owner of this storage location - * @return User|null */ public function getOwner(): ?User { @@ -189,8 +179,6 @@ class Storelocation extends AbstractPartsContainingDBElement /** * Sets the owner of this storage location - * @param User|null $owner - * @return Storelocation */ public function setOwner(?User $owner): Storelocation { @@ -200,7 +188,6 @@ class Storelocation extends AbstractPartsContainingDBElement /** * If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here. - * @return bool */ public function isPartOwnerMustMatch(): bool { @@ -209,8 +196,6 @@ class Storelocation extends AbstractPartsContainingDBElement /** * If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here. - * @param bool $part_owner_must_match - * @return Storelocation */ public function setPartOwnerMustMatch(bool $part_owner_must_match): Storelocation { @@ -226,7 +211,6 @@ class Storelocation extends AbstractPartsContainingDBElement * Setters * *********************************************************************************/ - /** * Change the "is full" attribute of this store location. * @@ -235,8 +219,6 @@ class Storelocation extends AbstractPartsContainingDBElement * * @param bool $new_is_full * true means that the storelocation is full * * false means that the storelocation isn't full - * - * @return Storelocation */ public function setIsFull(bool $new_is_full): self { diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index 65b82fec..d0d4bd12 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -38,7 +38,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Supplier. */ -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\SupplierRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\SupplierRepository::class)] #[ORM\Table('`suppliers`')] #[ORM\Index(name: 'supplier_idx_name', columns: ['name'])] #[ORM\Index(name: 'supplier_idx_parent_name', columns: ['parent_id', 'name'])] @@ -53,12 +53,12 @@ class Supplier extends AbstractCompany #[ORM\ManyToOne(targetEntity: 'Supplier', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?AbstractStructuralDBElement $parent; + protected ?AbstractStructuralDBElement $parent = null; /** * @var \Doctrine\Common\Collections\Collection|\App\Entity\PriceInformations\Orderdetail[] */ - #[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Orderdetail', mappedBy: 'supplier')] + #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'supplier')] protected Collection $orderdetails; /** @@ -66,7 +66,7 @@ class Supplier extends AbstractCompany * Set to null, to use global base currency. * @Selectable() */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency')] + #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)] #[ORM\JoinColumn(name: 'default_currency_id')] protected ?Currency $default_currency = null; @@ -82,14 +82,14 @@ class Supplier extends AbstractCompany * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\SupplierAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\SupplierParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -103,8 +103,6 @@ class Supplier extends AbstractCompany /** * Sets the default currency. - * - * @return Supplier */ public function setDefaultCurrency(?Currency $default_currency): self { @@ -127,12 +125,10 @@ class Supplier extends AbstractCompany * Sets the shipping costs for an order with this supplier. * * @param BigDecimal|null $shipping_costs a BigDecimal with the shipping costs - * - * @return Supplier */ public function setShippingCosts(?BigDecimal $shipping_costs): self { - if (null === $shipping_costs) { + if (!$shipping_costs instanceof \Brick\Math\BigDecimal) { $this->shipping_costs = null; } diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index f434c1ff..106cb052 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -45,7 +45,7 @@ use Symfony\Component\Validator\Constraints as Assert; #[ORM\Index(name: 'currency_idx_parent_name', columns: ['parent_id', 'name'])] class Currency extends AbstractStructuralDBElement { - public const PRICE_SCALE = 5; + final public const PRICE_SCALE = 5; /** * @var BigDecimal|null The exchange rate between this currency and the base currency @@ -69,26 +69,26 @@ class Currency extends AbstractStructuralDBElement #[ORM\ManyToOne(targetEntity: 'Currency', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?AbstractStructuralDBElement $parent; + protected ?AbstractStructuralDBElement $parent = null; /** * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\CurrencyAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\CurrencyParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\PriceInformations\Pricedetail', mappedBy: 'currency')] + #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Pricedetail::class, mappedBy: 'currency')] protected Collection $pricedetails; public function __construct() @@ -115,11 +115,6 @@ class Currency extends AbstractStructuralDBElement return $this->iso_code; } - /** - * @param string|null $iso_code - * - * @return Currency - */ public function setIsoCode(?string $iso_code): self { $this->iso_code = $iso_code; @@ -134,7 +129,7 @@ class Currency extends AbstractStructuralDBElement { $tmp = $this->getExchangeRate(); - if (null === $tmp || $tmp->isZero()) { + if (!$tmp instanceof \Brick\Math\BigDecimal || $tmp->isZero()) { return null; } @@ -155,12 +150,10 @@ class Currency extends AbstractStructuralDBElement * * @param BigDecimal|null $exchange_rate The new exchange rate of the currency. * Set to null, if the exchange rate is unknown. - * - * @return Currency */ public function setExchangeRate(?BigDecimal $exchange_rate): self { - if (null === $exchange_rate) { + if (!$exchange_rate instanceof \Brick\Math\BigDecimal) { $this->exchange_rate = null; } $tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP); diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index 9fce1a5f..9feec023 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -81,7 +81,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * @var Part|null */ #[Assert\NotNull] - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'orderdetails')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'orderdetails')] #[ORM\JoinColumn(name: 'part_id', nullable: false, onDelete: 'CASCADE')] protected ?Part $part = null; @@ -90,7 +90,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N */ #[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')] #[Groups(['extended', 'full', 'import'])] - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'orderdetails')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'orderdetails')] #[ORM\JoinColumn(name: 'id_supplier')] protected ?Supplier $supplier = null; @@ -121,7 +121,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N public function updateTimestamps(): void { $this->lastModified = new DateTime('now'); - if (null === $this->addedDate) { + if (!$this->addedDate instanceof \DateTimeInterface) { $this->addedDate = new DateTime('now'); } @@ -194,7 +194,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N return $this->supplier_product_url; } - if (null === $this->getSupplier()) { + if (!$this->getSupplier() instanceof \App\Entity\Parts\Supplier) { return ''; } @@ -216,8 +216,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * Adds a price detail to this orderdetail. * * @param Pricedetail $pricedetail The pricedetail to add - * - * @return Orderdetail */ public function addPricedetail(Pricedetail $pricedetail): self { @@ -229,8 +227,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N /** * Removes a price detail from this orderdetail. - * - * @return Orderdetail */ public function removePricedetail(Pricedetail $pricedetail): self { @@ -273,11 +269,8 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * Setters * *********************************************************************************/ - /** * Sets a new part with which this orderdetail is associated. - * - * @return Orderdetail */ public function setPart(Part $part): self { @@ -288,8 +281,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N /** * Sets the new supplier associated with this orderdetail. - * - * @return Orderdetail */ public function setSupplier(Supplier $new_supplier): self { @@ -302,9 +293,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * Set the supplier part-nr. * * @param string $new_supplierpartnr the new supplier-part-nr - * - * @return Orderdetail - * @return Orderdetail */ public function setSupplierpartnr(string $new_supplierpartnr): self { @@ -317,9 +305,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * Set if the part is obsolete at the supplier of that orderdetails. * * @param bool $new_obsolete true means that this part is obsolete - * - * @return Orderdetail - * @return Orderdetail */ public function setObsolete(bool $new_obsolete): self { @@ -333,8 +318,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * Set this to "", if the function getSupplierProductURL should return the automatic generated URL. * * @param string $new_url The new URL for the supplier URL - * - * @return Orderdetail */ public function setSupplierProductUrl(string $new_url): self { diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index b9af1e5b..d0f97929 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -48,7 +48,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface { use TimestampTrait; - public const PRICE_PRECISION = 5; + final public const PRICE_PRECISION = 5; /** * @var BigDecimal The price related to the detail. (Given in the selected currency) @@ -119,7 +119,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface public function updateTimestamps(): void { $this->lastModified = new DateTime('now'); - if (null === $this->addedDate) { + if (!$this->addedDate instanceof \DateTimeInterface) { $this->addedDate = new DateTime('now'); } @@ -166,7 +166,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * * @return BigDecimal the price as a bcmath string */ - public function getPricePerUnit($multiplier = 1.0): BigDecimal + public function getPricePerUnit(float|string|\Brick\Math\BigDecimal $multiplier = 1.0): BigDecimal { $tmp = BigDecimal::of($multiplier); $tmp = $tmp->multipliedBy($this->price); @@ -248,8 +248,6 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface /** * Sets the currency associated with the price information. * Set to null, to use the global base currency. - * - * @return Pricedetail */ public function setCurrency(?Currency $currency): self { diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index a539e6cf..a2b920ca 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -37,7 +37,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Class AttachmentType. */ -#[ORM\Entity(repositoryClass: 'App\Repository\Parts\DeviceRepository')] +#[ORM\Entity(repositoryClass: \App\Repository\Parts\DeviceRepository::class)] #[ORM\Table(name: 'projects')] class Project extends AbstractStructuralDBElement { @@ -50,7 +50,7 @@ class Project extends AbstractStructuralDBElement #[ORM\ManyToOne(targetEntity: 'Project', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?AbstractStructuralDBElement $parent; + protected ?AbstractStructuralDBElement $parent = null; #[Assert\Valid] #[Groups(['extended', 'full'])] @@ -72,7 +72,7 @@ class Project extends AbstractStructuralDBElement /** * @var Part|null The (optional) part that represents the builds of this project in the stock */ - #[ORM\OneToOne(targetEntity: 'App\Entity\Parts\Part', mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)] + #[ORM\OneToOne(targetEntity: \App\Entity\Parts\Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)] protected ?Part $build_part = null; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] @@ -85,13 +85,13 @@ class Project extends AbstractStructuralDBElement /** * @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\ProjectAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\ProjectParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -174,8 +174,6 @@ class Project extends AbstractStructuralDBElement * Set the "order_only_missing_parts" attribute. * * @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute - * - * @return Project */ public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self { @@ -193,7 +191,6 @@ class Project extends AbstractStructuralDBElement } /** - * @param ProjectBOMEntry $entry * @return $this */ public function addBomEntry(ProjectBOMEntry $entry): self @@ -204,7 +201,6 @@ class Project extends AbstractStructuralDBElement } /** - * @param ProjectBOMEntry $entry * @return $this */ public function removeBomEntry(ProjectBOMEntry $entry): self @@ -213,18 +209,11 @@ class Project extends AbstractStructuralDBElement return $this; } - /** - * @return string - */ public function getDescription(): string { return $this->description; } - /** - * @param string $description - * @return Project - */ public function setDescription(string $description): Project { $this->description = $description; @@ -249,16 +238,14 @@ class Project extends AbstractStructuralDBElement /** * Checks if this project has an associated part representing the builds of this project in the stock. - * @return bool */ public function hasBuildPart(): bool { - return $this->build_part !== null; + return $this->build_part instanceof \App\Entity\Parts\Part; } /** * Gets the part representing the builds of this project in the stock, if it is existing - * @return Part|null */ public function getBuildPart(): ?Part { @@ -267,12 +254,11 @@ class Project extends AbstractStructuralDBElement /** * Sets the part representing the builds of this project in the stock. - * @param Part|null $build_part */ public function setBuildPart(?Part $build_part): void { $this->build_part = $build_part; - if ($build_part) { + if ($build_part instanceof \App\Entity\Parts\Part) { $build_part->setBuiltProject($this); } } @@ -283,7 +269,7 @@ class Project extends AbstractStructuralDBElement //If this project has subprojects, and these have builds part, they must be included in the BOM foreach ($this->getChildren() as $child) { /** @var $child Project */ - if ($child->getBuildPart() === null) { + if (!$child->getBuildPart() instanceof \App\Entity\Parts\Part) { continue; } //We have to search all bom entries for the build part diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index 04be2862..4d432f75 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -82,7 +82,7 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var Part|null The part associated with this */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'project_bom_entries')] + #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'project_bom_entries')] #[ORM\JoinColumn(name: 'id_part')] protected ?Part $part = null; @@ -91,52 +91,36 @@ class ProjectBOMEntry extends AbstractDBElement */ #[Assert\AtLeastOneOf([new BigDecimalPositive(), new Assert\IsNull()])] #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] - protected ?BigDecimal $price; + protected ?BigDecimal $price = null; /** * @var ?Currency The currency for the price of this non-part BOM entry * @Selectable() */ - #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency')] + #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)] #[ORM\JoinColumn] protected ?Currency $price_currency = null; public function __construct() { - //$this->price = BigDecimal::zero()->toScale(5); - $this->price = null; } - /** - * @return float - */ public function getQuantity(): float { return $this->quantity; } - /** - * @param float $quantity - * @return ProjectBOMEntry - */ public function setQuantity(float $quantity): ProjectBOMEntry { $this->quantity = $quantity; return $this; } - /** - * @return string - */ public function getMountnames(): string { return $this->mountnames; } - /** - * @param string $mountnames - * @return ProjectBOMEntry - */ public function setMountnames(string $mountnames): ProjectBOMEntry { $this->mountnames = $mountnames; @@ -153,7 +137,6 @@ class ProjectBOMEntry extends AbstractDBElement /** * @param string $name - * @return ProjectBOMEntry */ public function setName(?string $name): ProjectBOMEntry { @@ -161,36 +144,22 @@ class ProjectBOMEntry extends AbstractDBElement return $this; } - /** - * @return string - */ public function getComment(): string { return $this->comment; } - /** - * @param string $comment - * @return ProjectBOMEntry - */ public function setComment(string $comment): ProjectBOMEntry { $this->comment = $comment; return $this; } - /** - * @return Project|null - */ public function getProject(): ?Project { return $this->project; } - /** - * @param Project|null $project - * @return ProjectBOMEntry - */ public function setProject(?Project $project): ProjectBOMEntry { $this->project = $project; @@ -199,18 +168,11 @@ class ProjectBOMEntry extends AbstractDBElement - /** - * @return Part|null - */ public function getPart(): ?Part { return $this->part; } - /** - * @param Part|null $part - * @return ProjectBOMEntry - */ public function setPart(?Part $part): ProjectBOMEntry { $this->part = $part; @@ -220,7 +182,6 @@ class ProjectBOMEntry extends AbstractDBElement /** * Returns the price of this BOM entry, if existing. * Prices are only valid on non-Part BOM entries. - * @return BigDecimal|null */ public function getPrice(): ?BigDecimal { @@ -230,24 +191,17 @@ class ProjectBOMEntry extends AbstractDBElement /** * Sets the price of this BOM entry. * Prices are only valid on non-Part BOM entries. - * @param BigDecimal|null $price */ public function setPrice(?BigDecimal $price): void { $this->price = $price; } - /** - * @return Currency|null - */ public function getPriceCurrency(): ?Currency { return $this->price_currency; } - /** - * @param Currency|null $price_currency - */ public function setPriceCurrency(?Currency $price_currency): void { $this->price_currency = $price_currency; @@ -259,20 +213,18 @@ class ProjectBOMEntry extends AbstractDBElement */ public function isPartBomEntry(): bool { - return $this->part !== null; + return $this->part instanceof \App\Entity\Parts\Part; } #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload): void { //Round quantity to whole numbers, if the part is not a decimal part - if ($this->part) { - if (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger()) { - $this->quantity = round($this->quantity); - } + if ($this->part instanceof \App\Entity\Parts\Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) { + $this->quantity = round($this->quantity); } //Non-Part BOM entries are rounded - if ($this->part === null) { + if (!$this->part instanceof \App\Entity\Parts\Part) { $this->quantity = round($this->quantity); } @@ -296,14 +248,14 @@ class ProjectBOMEntry extends AbstractDBElement } //Prices are only allowed on non-part BOM entries - if ($this->part !== null && $this->price !== null) { + if ($this->part instanceof \App\Entity\Parts\Part && $this->price instanceof \Brick\Math\BigDecimal) { $context->buildViolation('project.bom_entry.price_not_allowed_on_parts') ->atPath('price') ->addViolation(); } //Check that the part is not the build representation part of this device or one of its parents - if ($this->part && $this->part->getBuiltProject() !== null) { + if ($this->part && $this->part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { //Get the associated project $associated_project = $this->part->getBuiltProject(); //Check that it is not the same as the current project neither one of its parents diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 663e9fed..6207e25c 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -51,7 +51,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa #[ORM\ManyToOne(targetEntity: 'Group', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?AbstractStructuralDBElement $parent; + protected ?AbstractStructuralDBElement $parent = null; /** * @var Collection @@ -69,7 +69,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\GroupAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -84,7 +84,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\GroupParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -122,7 +122,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa public function getPermissions(): PermissionData { - if ($this->permissions === null) { + if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) { $this->permissions = new PermissionData(); } diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index 9d6c4cf2..65101ee9 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -42,6 +42,10 @@ final class PermissionData implements \JsonSerializable public const CURRENT_SCHEMA_VERSION = 2; /** + * Creates a new Permission Data Instance using the given data. + * By default, an empty array is used, meaning + */ + public function __construct(/** * @var array|null This array contains the permission values for each permission * This array contains the permission values for each permission, in the form of: * permission => [ @@ -49,19 +53,8 @@ final class PermissionData implements \JsonSerializable * ] */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'data')] - protected ?array $data = [ - //$ prefixed entries are used for metadata - '$ver' => self::CURRENT_SCHEMA_VERSION, //The schema version of the permission data - ]; - - /** - * Creates a new Permission Data Instance using the given data. - * By default, an empty array is used, meaning - */ - public function __construct(array $data = []) + protected array $data = []) { - $this->data = $data; - //If the passed data did not contain a schema version, we set it to the current version if (!isset($this->data['$ver'])) { $this->data['$ver'] = self::CURRENT_SCHEMA_VERSION; @@ -70,8 +63,6 @@ final class PermissionData implements \JsonSerializable /** * Checks if any of the operations of the given permission is defined (meaning it is either ALLOW or DENY) - * @param string $permission - * @return bool */ public function isAnyOperationOfPermissionSet(string $permission): bool { @@ -80,7 +71,6 @@ final class PermissionData implements \JsonSerializable /** * Returns an associative array containing all defined (non-INHERIT) operations of the given permission. - * @param string $permission * @return array An array in the form ["operation" => value], returns an empty array if no operations are defined */ public function getAllDefinedOperationsOfPermission(string $permission): array @@ -95,8 +85,6 @@ final class PermissionData implements \JsonSerializable /** * Sets all operations of the given permission via the given array. * The data is an array in the form [$operation => $value], all existing values will be overwritten/deleted. - * @param string $permission - * @param array $data * @return $this */ public function setAllOperationsOfPermission(string $permission, array $data): self @@ -108,7 +96,6 @@ final class PermissionData implements \JsonSerializable /** * Removes a whole permission from the data including all operations (effectivly setting them to INHERIT) - * @param string $permission * @return $this */ public function removePermission(string $permission): self @@ -120,8 +107,6 @@ final class PermissionData implements \JsonSerializable /** * Check if a permission value is set for the given permission and operation (meaning there value is not inherit). - * @param string $permission - * @param string $operation * @return bool True if the permission value is set, false otherwise */ public function isPermissionSet(string $permission, string $operation): bool @@ -136,8 +121,6 @@ final class PermissionData implements \JsonSerializable /** * Returns the permission value for the given permission and operation. - * @param string $permission - * @param string $operation * @return bool|null True means allow, false means disallow, null means inherit */ public function getPermissionValue(string $permission, string $operation): ?bool @@ -152,9 +135,6 @@ final class PermissionData implements \JsonSerializable /** * Sets the permission value for the given permission and operation. - * @param string $permission - * @param string $operation - * @param bool|null $value * @return $this */ public function setPermissionValue(string $permission, string $operation, ?bool $value): self @@ -185,8 +165,6 @@ final class PermissionData implements \JsonSerializable /** * Creates a new Permission Data Instance using the given JSON encoded data - * @param string $json - * @return static * @throws \JsonException */ public static function fromJSON(string $json): self @@ -202,7 +180,6 @@ final class PermissionData implements \JsonSerializable /** * Returns an JSON encodable representation of this object. - * @return array */ public function jsonSerialize(): array { @@ -215,9 +192,7 @@ final class PermissionData implements \JsonSerializable continue; } - $ret[$permission] = array_filter($operations, static function ($value) { - return $value !== null; - }); + $ret[$permission] = array_filter($operations, static fn($value) => $value !== null); //If the permission has no operations, unset it if (empty($ret[$permission])) { @@ -239,7 +214,6 @@ final class PermissionData implements \JsonSerializable /** * Sets the schema version of this permission data - * @param int $new_version * @return $this */ public function setSchemaVersion(int $new_version): self diff --git a/src/Entity/UserSystem/U2FKey.php b/src/Entity/UserSystem/U2FKey.php index 8bc86705..fefbbe20 100644 --- a/src/Entity/UserSystem/U2FKey.php +++ b/src/Entity/UserSystem/U2FKey.php @@ -73,7 +73,7 @@ class U2FKey implements LegacyU2FKeyInterface #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name; - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', inversedBy: 'u2fKeys')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'u2fKeys')] protected ?User $user = null; public function getKeyHandle(): string diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index a2fa7b11..b7badde3 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -56,8 +56,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface * Also, this entity is able to save some information about the user, like the names, email-address and other info. */ #[UniqueEntity('name', message: 'validator.user.username_already_used')] -#[ORM\Entity(repositoryClass: 'App\Repository\UserRepository')] -#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])] +#[ORM\Entity(repositoryClass: \App\Repository\UserRepository::class)] +#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])] #[ORM\Table('`users`')] #[ORM\Index(name: 'user_idx_username', columns: ['name'])] class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, @@ -68,7 +68,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * The User id of the anonymous user. */ - public const ID_ANONYMOUS = 1; + final public const ID_ANONYMOUS = 1; /** * @var bool Determines if the user is disabled (user can not log in) @@ -214,7 +214,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\UserAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -226,13 +226,13 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\UserSystem\U2FKey', mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] protected Collection $u2fKeys; /** * @var Collection */ - #[ORM\OneToMany(targetEntity: 'App\Entity\UserSystem\WebauthnKey', mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] protected Collection $webauthn_keys; /** @@ -243,9 +243,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @Selectable() */ #[Groups(['extended', 'full', 'import'])] - #[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency')] + #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)] #[ORM\JoinColumn(name: 'currency_id')] - protected ?Currency $currency; + protected ?Currency $currency = null; /** * @var PermissionData|null @@ -259,7 +259,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @var \DateTimeInterface|null the time until the password reset token is valid */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] - protected ?\DateTimeInterface $pw_reset_expires; + protected ?\DateTimeInterface $pw_reset_expires = null; /** * @var bool True if the user was created by a SAML provider (and therefore cannot change its password) @@ -350,8 +350,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Sets the password hash for this user. - * - * @return User */ public function setPassword(string $password): self { @@ -389,8 +387,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Sets the currency the users prefers to see prices in. - * - * @return User */ public function setCurrency(?Currency $currency): self { @@ -413,8 +409,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * Sets the status if a user is disabled. * * @param bool $disabled true if the user should be disabled - * - * @return User */ public function setDisabled(bool $disabled): self { @@ -425,7 +419,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe public function getPermissions(): PermissionData { - if ($this->permissions === null) { + if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) { $this->permissions = new PermissionData(); } @@ -442,8 +436,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Set the status, if the user needs a password change. - * - * @return User */ public function setNeedPwChange(bool $need_pw_change): self { @@ -462,8 +454,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Sets the encrypted password reset token. - * - * @return User */ public function setPwResetToken(?string $pw_reset_token): self { @@ -482,8 +472,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Sets the datetime when the password reset token expires. - * - * @return User */ public function setPwResetExpires(\DateTimeInterface $pw_reset_expires): self { @@ -595,8 +583,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * Change the department of the user. * * @param string|null $department The new department - * - * @return User */ public function setDepartment(?string $department): self { @@ -631,7 +617,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Gets whether the email address of the user is shown on the public profile page. - * @return bool */ public function isShowEmailOnProfile(): bool { @@ -640,8 +625,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Sets whether the email address of the user is shown on the public profile page. - * @param bool $show_email_on_profile - * @return User */ public function setShowEmailOnProfile(bool $show_email_on_profile): User { @@ -653,7 +636,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Returns the about me text of the user. - * @return string */ public function getAboutMe(): string { @@ -662,8 +644,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Change the about me text of the user. - * @param string $aboutMe - * @return User */ public function setAboutMe(string $aboutMe): User { @@ -689,8 +669,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * * @param string|null $language The new language as 2-letter ISO code (e.g. 'en' or 'de'). * Set to null, to use the system-wide language. - * - * @return User */ public function setLanguage(?string $language): self { @@ -855,11 +833,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe public function setBackupCodes(array $codes): self { $this->backupCodes = $codes; - if (empty($codes)) { - $this->backupCodesGenerationDate = null; - } else { - $this->backupCodesGenerationDate = new DateTime(); - } + $this->backupCodesGenerationDate = $codes === [] ? null : new DateTime(); return $this; } @@ -938,7 +912,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Returns true, if the user was created by the SAML authentication. - * @return bool */ public function isSamlUser(): bool { @@ -947,8 +920,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * Sets the saml_user flag. - * @param bool $saml_user - * @return User */ public function setSamlUser(bool $saml_user): User { diff --git a/src/Entity/UserSystem/WebauthnKey.php b/src/Entity/UserSystem/WebauthnKey.php index fd43ad33..82a0a5fe 100644 --- a/src/Entity/UserSystem/WebauthnKey.php +++ b/src/Entity/UserSystem/WebauthnKey.php @@ -39,48 +39,31 @@ class WebauthnKey extends BasePublicKeyCredentialSource #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] protected string $name; - #[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User', inversedBy: 'webauthn_keys')] + #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'webauthn_keys')] protected ?User $user = null; - /** - * @return string - */ public function getName(): string { return $this->name; } - /** - * @param string $name - * @return WebauthnKey - */ public function setName(string $name): WebauthnKey { $this->name = $name; return $this; } - /** - * @return User|null - */ public function getUser(): ?User { return $this->user; } - /** - * @param User|null $user - * @return WebauthnKey - */ public function setUser(?User $user): WebauthnKey { $this->user = $user; return $this; } - /** - * @return int - */ public function getId(): int { return $this->id; diff --git a/src/EntityListeners/AttachmentDeleteListener.php b/src/EntityListeners/AttachmentDeleteListener.php index 430740cb..11ddd794 100644 --- a/src/EntityListeners/AttachmentDeleteListener.php +++ b/src/EntityListeners/AttachmentDeleteListener.php @@ -41,15 +41,8 @@ use SplFileInfo; */ class AttachmentDeleteListener { - protected AttachmentReverseSearch $attachmentReverseSearch; - protected AttachmentManager $attachmentHelper; - protected AttachmentPathResolver $pathResolver; - - public function __construct(AttachmentReverseSearch $attachmentReverseSearch, AttachmentManager $attachmentHelper, AttachmentPathResolver $pathResolver) + public function __construct(protected AttachmentReverseSearch $attachmentReverseSearch, protected AttachmentManager $attachmentHelper, protected AttachmentPathResolver $pathResolver) { - $this->attachmentReverseSearch = $attachmentReverseSearch; - $this->attachmentHelper = $attachmentHelper; - $this->pathResolver = $pathResolver; } /** @@ -87,7 +80,7 @@ class AttachmentDeleteListener //Ensure that the attachment that will be deleted, is not used as preview picture anymore... $attachment_holder = $attachment->getElement(); - if (null === $attachment_holder) { + if (!$attachment_holder instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { return; } @@ -100,7 +93,7 @@ class AttachmentDeleteListener if (!$em instanceof EntityManagerInterface) { throw new \RuntimeException('Invalid EntityManagerInterface!'); } - $classMetadata = $em->getClassMetadata(get_class($attachment_holder)); + $classMetadata = $em->getClassMetadata($attachment_holder::class); $em->getUnitOfWork()->computeChangeSet($classMetadata, $attachment_holder); } } @@ -118,7 +111,7 @@ class AttachmentDeleteListener $file = $this->attachmentHelper->attachmentToFile($attachment); //Only delete if the attachment has a valid file. - if (null !== $file) { + if ($file instanceof \SplFileInfo) { /* The original file has already been removed, so we have to decrease the threshold to zero, as any remaining attachment depends on this attachment, and we must not delete this file! */ $this->attachmentReverseSearch->deleteIfNotUsed($file, 0); diff --git a/src/EntityListeners/TreeCacheInvalidationListener.php b/src/EntityListeners/TreeCacheInvalidationListener.php index 6e17fe3f..4cbcf8f8 100644 --- a/src/EntityListeners/TreeCacheInvalidationListener.php +++ b/src/EntityListeners/TreeCacheInvalidationListener.php @@ -35,13 +35,8 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface; class TreeCacheInvalidationListener { - protected TagAwareCacheInterface $cache; - protected UserCacheKeyGenerator $keyGenerator; - - public function __construct(TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator) + public function __construct(protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator) { - $this->cache = $treeCache; - $this->keyGenerator = $keyGenerator; } #[ORM\PostUpdate] @@ -51,7 +46,7 @@ class TreeCacheInvalidationListener { //If an element was changed, then invalidate all cached trees with this element class if ($element instanceof AbstractStructuralDBElement || $element instanceof LabelProfile) { - $secure_class_name = str_replace('\\', '_', get_class($element)); + $secure_class_name = str_replace('\\', '_', $element::class); $this->cache->invalidateTags([$secure_class_name]); //Trigger a sidebar reload for all users (see SidebarTreeUpdater service) @@ -62,7 +57,7 @@ class TreeCacheInvalidationListener //If a user change, then invalidate all cached trees for him if ($element instanceof User) { - $secure_class_name = str_replace('\\', '_', get_class($element)); + $secure_class_name = str_replace('\\', '_', $element::class); $tag = $this->keyGenerator->generateKey($element); $this->cache->invalidateTags([$tag, $secure_class_name]); } diff --git a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php index eed5953d..f66a96e5 100644 --- a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php @@ -70,30 +70,12 @@ class EventLoggerSubscriber implements EventSubscriber ]; protected const MAX_STRING_LENGTH = 2000; - - protected EventLogger $logger; - protected SerializerInterface $serializer; - protected EventCommentHelper $eventCommentHelper; - protected EventUndoHelper $eventUndoHelper; - protected bool $save_changed_fields; - protected bool $save_changed_data; - protected bool $save_removed_data; protected bool $save_new_data; - protected PropertyAccessorInterface $propertyAccessor; - public function __construct(EventLogger $logger, SerializerInterface $serializer, EventCommentHelper $commentHelper, - bool $save_changed_fields, bool $save_changed_data, bool $save_removed_data, bool $save_new_data, - PropertyAccessorInterface $propertyAccessor, EventUndoHelper $eventUndoHelper) + public function __construct(protected EventLogger $logger, protected SerializerInterface $serializer, protected EventCommentHelper $eventCommentHelper, + protected bool $save_changed_fields, protected bool $save_changed_data, protected bool $save_removed_data, bool $save_new_data, + protected PropertyAccessorInterface $propertyAccessor, protected EventUndoHelper $eventUndoHelper) { - $this->logger = $logger; - $this->serializer = $serializer; - $this->eventCommentHelper = $commentHelper; - $this->propertyAccessor = $propertyAccessor; - $this->eventUndoHelper = $eventUndoHelper; - - $this->save_changed_fields = $save_changed_fields; - $this->save_changed_data = $save_changed_data; - $this->save_removed_data = $save_removed_data; //This option only makes sense if save_changed_data is true $this->save_new_data = $save_new_data && $save_changed_data; } @@ -181,7 +163,7 @@ class EventLoggerSubscriber implements EventSubscriber public function hasFieldRestrictions(AbstractDBElement $element): bool { foreach (array_keys(static::FIELD_BLACKLIST) as $class) { - if (is_a($element, $class)) { + if ($element instanceof $class) { return true; } } @@ -195,7 +177,7 @@ class EventLoggerSubscriber implements EventSubscriber public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool { foreach (static::FIELD_BLACKLIST as $class => $blacklist) { - if (is_a($element, $class) && in_array($field_name, $blacklist, true)) { + if ($element instanceof $class && in_array($field_name, $blacklist, true)) { return false; } } @@ -231,11 +213,11 @@ class EventLoggerSubscriber implements EventSubscriber //Check if we have to log CollectionElementDeleted entries if ($this->save_changed_data) { - $metadata = $em->getClassMetadata(get_class($entity)); + $metadata = $em->getClassMetadata($entity::class); $mappings = $metadata->getAssociationMappings(); //Check if class is whitelisted for CollectionElementDeleted entry foreach (static::TRIGGER_ASSOCIATION_LOG_WHITELIST as $class => $whitelist) { - if (is_a($entity, $class)) { + if ($entity instanceof $class) { //Check names foreach ($mappings as $field => $mapping) { if (in_array($field, $whitelist, true)) { @@ -308,8 +290,6 @@ class EventLoggerSubscriber implements EventSubscriber /** * Restrict the length of every string in the given array to MAX_STRING_LENGTH, to save memory in the case of very * long strings (e.g. images in notes) - * @param array $fields - * @return array */ protected function fieldLengthRestrict(array $fields): array { @@ -325,6 +305,7 @@ class EventLoggerSubscriber implements EventSubscriber protected function saveChangeSet(AbstractDBElement $entity, AbstractLogEntry $logEntry, EntityManagerInterface $em, bool $element_deleted = false): void { + $new_data = null; $uow = $em->getUnitOfWork(); if (!$logEntry instanceof ElementEditedLogEntry && !$logEntry instanceof ElementDeletedLogEntry) { @@ -348,7 +329,7 @@ class EventLoggerSubscriber implements EventSubscriber $logEntry->setOldData($old_data); - if (!empty($new_data)) { + if ($new_data !== []) { $new_data = $this->filterFieldRestrictions($entity, $new_data); $new_data = $this->fieldLengthRestrict($new_data); diff --git a/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php b/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php index 45dbe61b..abe2f9ba 100644 --- a/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php +++ b/src/EventSubscriber/LogSystem/LogAccessDeniedSubscriber.php @@ -53,11 +53,8 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; */ class LogAccessDeniedSubscriber implements EventSubscriberInterface { - private EventLogger $logger; - - public function __construct(EventLogger $logger) + public function __construct(private readonly EventLogger $logger) { - $this->logger = $logger; } public function onKernelException(ExceptionEvent $event): void diff --git a/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php b/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php index 610c0b5e..8e3af891 100644 --- a/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php +++ b/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php @@ -37,13 +37,8 @@ class LogDBMigrationSubscriber implements EventSubscriber protected ?string $old_version = null; protected ?string $new_version = null; - protected EventLogger $eventLogger; - protected DependencyFactory $dependencyFactory; - - public function __construct(EventLogger $eventLogger, DependencyFactory $dependencyFactory) + public function __construct(protected EventLogger $eventLogger, protected DependencyFactory $dependencyFactory) { - $this->eventLogger = $eventLogger; - $this->dependencyFactory = $dependencyFactory; } public function onMigrationsMigrated(MigrationsEventArgs $args): void @@ -66,7 +61,7 @@ class LogDBMigrationSubscriber implements EventSubscriber try { $log = new DatabaseUpdatedLogEntry($this->old_version, $this->new_version); $this->eventLogger->logAndFlush($log); - } catch (\Throwable $exception) { + } catch (\Throwable) { //Ignore any exception occuring here... } } diff --git a/src/EventSubscriber/LogSystem/LogLogoutEventListener.php b/src/EventSubscriber/LogSystem/LogLogoutEventListener.php index f9586c76..80dfb98f 100644 --- a/src/EventSubscriber/LogSystem/LogLogoutEventListener.php +++ b/src/EventSubscriber/LogSystem/LogLogoutEventListener.php @@ -32,15 +32,10 @@ use Symfony\Component\Security\Http\Event\LogoutEvent; * This handler logs to event log, if a user logs out. */ #[AsEventListener] -final class LogLogoutEventListener +final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface { - protected EventLogger $logger; - protected bool $gpdr_compliance; - - public function __construct(EventLogger $logger, bool $gpdr_compliance) + public function __construct(protected EventLogger $logger, protected bool $gpdr_compliance) { - $this->logger = $logger; - $this->gpdr_compliance = $gpdr_compliance; } public function __invoke(LogoutEvent $event): void @@ -48,7 +43,7 @@ final class LogLogoutEventListener $request = $event->getRequest(); $token = $event->getToken(); - if (null === $token) { + if (!$token instanceof \Symfony\Component\Security\Core\Authentication\Token\TokenInterface) { return; } @@ -60,4 +55,11 @@ final class LogLogoutEventListener $this->logger->logAndFlush($log); } + /** + * @return array + */ + public static function getSubscribedEvents(): array + { + return ['' => '']; + } } diff --git a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php index 88eeef2c..66fb9fde 100644 --- a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php @@ -53,15 +53,8 @@ use Symfony\Component\HttpFoundation\RequestStack; */ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface { - private RequestStack $requestStack; - private bool $gpdr_compliant; - private EventLogger $eventLogger; - - public function __construct(RequestStack $requestStack, EventLogger $eventLogger, bool $gpdr_compliance) + public function __construct(private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliant) { - $this->requestStack = $requestStack; - $this->gpdr_compliant = $gpdr_compliance; - $this->eventLogger = $eventLogger; } public static function getSubscribedEvents(): array @@ -129,7 +122,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface $anonymize = $this->gpdr_compliant; $request = $this->requestStack->getCurrentRequest(); - if (null !== $request) { + if ($request instanceof \Symfony\Component\HttpFoundation\Request) { $ip = $request->getClientIp() ?? 'unknown'; } else { $ip = 'Console'; diff --git a/src/EventSubscriber/SetMailFromSubscriber.php b/src/EventSubscriber/SetMailFromSubscriber.php index 6c9f563c..3675c487 100644 --- a/src/EventSubscriber/SetMailFromSubscriber.php +++ b/src/EventSubscriber/SetMailFromSubscriber.php @@ -32,13 +32,8 @@ use Symfony\Component\Mime\Email; */ final class SetMailFromSubscriber implements EventSubscriberInterface { - private string $email; - private string $name; - - public function __construct(string $email, string $name) + public function __construct(private readonly string $email, private readonly string $name) { - $this->email = $email; - $this->name = $name; } public function onMessage(MessageEvent $event): void diff --git a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php index d2aab142..c404ffc0 100644 --- a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php +++ b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php @@ -30,11 +30,8 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent; */ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface { - private bool $kernel_debug; - - public function __construct(bool $kernel_debug) + public function __construct(private readonly bool $kernel_debug) { - $this->kernel_debug = $kernel_debug; } /** diff --git a/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php b/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php index cce88d82..e1cdfd84 100644 --- a/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php +++ b/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php @@ -37,17 +37,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class LoginSuccessSubscriber implements EventSubscriberInterface { - private TranslatorInterface $translator; - private RequestStack $requestStack; - private EventLogger $eventLogger; - private bool $gpdr_compliance; - - public function __construct(TranslatorInterface $translator, RequestStack $requestStack, EventLogger $eventLogger, bool $gpdr_compliance) + public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliance) { - $this->translator = $translator; - $this->requestStack = $requestStack; - $this->eventLogger = $eventLogger; - $this->gpdr_compliance = $gpdr_compliance; } public function onLogin(InteractiveLoginEvent $event): void diff --git a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php index 73708566..da8d3b94 100644 --- a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php +++ b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php @@ -36,14 +36,8 @@ use Symfony\Component\Security\Core\Security; */ final class LogoutDisabledUserSubscriber implements EventSubscriberInterface { - private \Symfony\Bundle\SecurityBundle\Security $security; - private UrlGeneratorInterface $urlGenerator; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator) { - $this->security = $security; - - $this->urlGenerator = $urlGenerator; } public function onRequest(RequestEvent $event): void diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php index 6c7e61f5..db8b6575 100644 --- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php +++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php @@ -55,13 +55,9 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface * @var string The route the user will redirected to, if he needs to change this password */ public const REDIRECT_TARGET = 'user_settings'; - private \Symfony\Bundle\SecurityBundle\Security $security; - private HttpUtils $httpUtils; - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, HttpUtils $httpUtils) + public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly HttpUtils $httpUtils) { - $this->security = $security; - $this->httpUtils = $httpUtils; } /** @@ -129,7 +125,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface { $tfa_enabled = $user->isWebAuthnAuthenticatorEnabled() || $user->isGoogleAuthenticatorEnabled(); - return null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled; + return $user->getGroup() instanceof \App\Entity\UserSystem\Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled; } public static function getSubscribedEvents(): array diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php index a6347c26..cf1206c1 100644 --- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php +++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php @@ -33,13 +33,8 @@ use Symfony\Component\Security\Core\Security; */ final class SetUserTimezoneSubscriber implements EventSubscriberInterface { - private string $default_timezone; - private \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(string $timezone, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly string $default_timezone, private readonly \Symfony\Bundle\SecurityBundle\Security $security) { - $this->default_timezone = $timezone; - $this->security = $security; } public function setTimeZone(ControllerEvent $event): void diff --git a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php index 551bb8b6..b2f30b01 100644 --- a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php +++ b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php @@ -35,17 +35,8 @@ use Symfony\Component\Security\Core\Security; */ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface { - private \Symfony\Bundle\SecurityBundle\Security $security; - private PermissionSchemaUpdater $permissionSchemaUpdater; - private EntityManagerInterface $entityManager; - private EventCommentHelper $eventCommentHelper; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, PermissionSchemaUpdater $permissionSchemaUpdater, EntityManagerInterface $entityManager, EventCommentHelper $eventCommentHelper) + public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper) { - $this->security = $security; - $this->permissionSchemaUpdater = $permissionSchemaUpdater; - $this->entityManager = $entityManager; - $this->eventCommentHelper = $eventCommentHelper; } public function onRequest(RequestEvent $event): void @@ -55,7 +46,7 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface } $user = $this->security->getUser(); - if (null === $user) { + if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) { //Retrieve anonymous user $user = $this->entityManager->getRepository(User::class)->getAnonymousUser(); } diff --git a/src/Events/SecurityEvent.php b/src/Events/SecurityEvent.php index 68f277c5..883460a7 100644 --- a/src/Events/SecurityEvent.php +++ b/src/Events/SecurityEvent.php @@ -50,11 +50,8 @@ use Symfony\Contracts\EventDispatcher\Event; */ class SecurityEvent extends Event { - protected User $targetUser; - - public function __construct(User $targetUser) + public function __construct(protected User $targetUser) { - $this->targetUser = $targetUser; } /** diff --git a/src/Events/SecurityEvents.php b/src/Events/SecurityEvents.php index 6ac1f882..c7c43882 100644 --- a/src/Events/SecurityEvents.php +++ b/src/Events/SecurityEvents.php @@ -43,13 +43,13 @@ namespace App\Events; class SecurityEvents { - public const PASSWORD_CHANGED = 'security.password_changed'; - public const PASSWORD_RESET = 'security.password_reset'; - public const BACKUP_KEYS_RESET = 'security.backup_keys_reset'; - public const U2F_ADDED = 'security.u2f_added'; - public const U2F_REMOVED = 'security.u2f_removed'; - public const GOOGLE_ENABLED = 'security.google_enabled'; - public const GOOGLE_DISABLED = 'security.google_disabled'; - public const TRUSTED_DEVICE_RESET = 'security.trusted_device_reset'; - public const TFA_ADMIN_RESET = 'security.2fa_admin_reset'; + final public const PASSWORD_CHANGED = 'security.password_changed'; + final public const PASSWORD_RESET = 'security.password_reset'; + final public const BACKUP_KEYS_RESET = 'security.backup_keys_reset'; + final public const U2F_ADDED = 'security.u2f_added'; + final public const U2F_REMOVED = 'security.u2f_removed'; + final public const GOOGLE_ENABLED = 'security.google_enabled'; + final public const GOOGLE_DISABLED = 'security.google_disabled'; + final public const TRUSTED_DEVICE_RESET = 'security.trusted_device_reset'; + final public const TFA_ADMIN_RESET = 'security.2fa_admin_reset'; } diff --git a/src/Exceptions/InvalidRegexException.php b/src/Exceptions/InvalidRegexException.php index a94201d0..e2dcd68e 100644 --- a/src/Exceptions/InvalidRegexException.php +++ b/src/Exceptions/InvalidRegexException.php @@ -25,17 +25,13 @@ use ErrorException; class InvalidRegexException extends \RuntimeException { - private ?string $reason; - - public function __construct(string $reason = null) + public function __construct(private readonly ?string $reason = null) { - $this->reason = $reason; parent::__construct('Invalid regular expression'); } /** * Returns the reason for the exception (what the regex driver deemed invalid) - * @return string|null */ public function getReason(): ?string { @@ -44,8 +40,6 @@ class InvalidRegexException extends \RuntimeException /** * Creates a new exception from a driver exception happening, when MySQL encounters an invalid regex - * @param DriverException $exception - * @return self */ public static function fromDriverException(DriverException $exception): self { @@ -62,13 +56,11 @@ class InvalidRegexException extends \RuntimeException /** * Creates a new exception from the errorException thrown by mb_ereg - * @param ErrorException $ex - * @return self */ public static function fromMBRegexError(ErrorException $ex): self { //Ensure that the error is really a mb_ereg error - if ($ex->getSeverity() !== E_WARNING || !strpos($ex->getMessage(), 'mb_ereg()') !== false) { + if ($ex->getSeverity() !== E_WARNING || !strpos($ex->getMessage(), 'mb_ereg()')) { throw new \InvalidArgumentException('The given exception is not a mb_ereg error', 0, $ex); } diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php index 475eb66e..c2ea1c00 100644 --- a/src/Form/AdminPages/AttachmentTypeAdminForm.php +++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php @@ -32,11 +32,8 @@ use Symfony\Component\Security\Core\Security; class AttachmentTypeAdminForm extends BaseEntityAdminForm { - protected FileTypeFilterTools $filterTools; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, protected FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) { - $this->filterTools = $filterTools; parent::__construct($security, $eventCommentNeededHelper); } @@ -58,12 +55,8 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm //Normalize data before writing it to database $builder->get('filetype_filter')->addViewTransformer(new CallbackTransformer( - static function ($value) { - return $value; - }, - function ($value) { - return $this->filterTools->normalizeFilterString($value); - } + static fn($value) => $value, + fn($value) => $this->filterTools->normalizeFilterString($value) )); } } diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php index 4e49c784..464e32ad 100644 --- a/src/Form/AdminPages/BaseEntityAdminForm.php +++ b/src/Form/AdminPages/BaseEntityAdminForm.php @@ -44,13 +44,8 @@ use Symfony\Component\Security\Core\Security; class BaseEntityAdminForm extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected EventCommentNeededHelper $eventCommentNeededHelper; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected EventCommentNeededHelper $eventCommentNeededHelper) { - $this->security = $security; - $this->eventCommentNeededHelper = $eventCommentNeededHelper; } public function configureOptions(OptionsResolver $resolver): void @@ -82,7 +77,7 @@ class BaseEntityAdminForm extends AbstractType 'parent', StructuralEntityType::class, [ - 'class' => get_class($entity), + 'class' => $entity::class, 'required' => false, 'label' => 'parent.label', 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php index 0ba85c49..7ebe08bb 100644 --- a/src/Form/AdminPages/CurrencyAdminForm.php +++ b/src/Form/AdminPages/CurrencyAdminForm.php @@ -32,12 +32,9 @@ use Symfony\Component\Security\Core\Security; class CurrencyAdminForm extends BaseEntityAdminForm { - private string $default_currency; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $default_currency) { parent::__construct($security, $eventCommentNeededHelper); - $this->default_currency = $default_currency; } protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php index bc481a82..ceaa0c0c 100644 --- a/src/Form/AdminPages/ImportType.php +++ b/src/Form/AdminPages/ImportType.php @@ -37,11 +37,8 @@ use Symfony\Component\Security\Core\Security; class ImportType extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php index 6eb23785..dbf3fbcb 100644 --- a/src/Form/AdminPages/MassCreationForm.php +++ b/src/Form/AdminPages/MassCreationForm.php @@ -32,11 +32,8 @@ use Symfony\Component\Security\Core\Security; class MassCreationForm extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php index ea158484..d5253c1a 100644 --- a/src/Form/AdminPages/SupplierForm.php +++ b/src/Form/AdminPages/SupplierForm.php @@ -32,12 +32,9 @@ use Symfony\Component\Security\Core\Security; class SupplierForm extends CompanyForm { - protected string $default_currency; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $default_currency) { parent::__construct($security, $eventCommentNeededHelper); - $this->default_currency = $default_currency; } protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 72098dc4..88d4d3d1 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -48,25 +48,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class AttachmentFormType extends AbstractType { - protected AttachmentManager $attachment_helper; - protected UrlGeneratorInterface $urlGenerator; - protected bool $allow_attachments_download; - protected string $max_file_size; - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected AttachmentSubmitHandler $submitHandler; - protected TranslatorInterface $translator; - - public function __construct(AttachmentManager $attachmentHelper, UrlGeneratorInterface $urlGenerator, - \Symfony\Bundle\SecurityBundle\Security $security, AttachmentSubmitHandler $submitHandler, TranslatorInterface $translator, - bool $allow_attachments_downloads, string $max_file_size) + public function __construct(protected AttachmentManager $attachment_helper, protected UrlGeneratorInterface $urlGenerator, protected \Symfony\Bundle\SecurityBundle\Security $security, protected AttachmentSubmitHandler $submitHandler, protected TranslatorInterface $translator, protected bool $allow_attachments_download, protected string $max_file_size) { - $this->attachment_helper = $attachmentHelper; - $this->urlGenerator = $urlGenerator; - $this->allow_attachments_download = $allow_attachments_downloads; - $this->security = $security; - $this->submitHandler = $submitHandler; - $this->translator = $translator; - $this->max_file_size = $max_file_size; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/CollectionTypeExtension.php b/src/Form/CollectionTypeExtension.php index 1c0c8d63..a70576fd 100644 --- a/src/Form/CollectionTypeExtension.php +++ b/src/Form/CollectionTypeExtension.php @@ -67,11 +67,8 @@ use Symfony\Component\PropertyAccess\PropertyAccessorInterface; */ class CollectionTypeExtension extends AbstractTypeExtension { - protected PropertyAccessorInterface $propertyAccess; - - public function __construct(PropertyAccessorInterface $propertyAccess) + public function __construct(protected PropertyAccessorInterface $propertyAccess) { - $this->propertyAccess = $propertyAccess; } public static function getExtendedTypes(): iterable @@ -93,9 +90,7 @@ class CollectionTypeExtension extends AbstractTypeExtension //Set a unique prototype name, so that we can use nested collections $resolver->setDefaults([ - 'prototype_name' => function (Options $options) { - return '__name_'.uniqid("", false) . '__'; - }, + 'prototype_name' => fn(Options $options): string => '__name_'.uniqid("", false) . '__', ]); $resolver->setAllowedTypes('reindex_enable', 'bool'); @@ -156,7 +151,7 @@ class CollectionTypeExtension extends AbstractTypeExtension //The validator uses the number of the element as index, so we have to map the errors to the correct index $error_mapping = []; $n = 0; - foreach ($data as $key => $item) { + foreach (array_keys($data) as $key) { $error_mapping['['.$n.']'] = $key; $n++; } diff --git a/src/Form/Filters/Constraints/InstanceOfConstraintType.php b/src/Form/Filters/Constraints/InstanceOfConstraintType.php index 4a776cd6..b88fa50f 100644 --- a/src/Form/Filters/Constraints/InstanceOfConstraintType.php +++ b/src/Form/Filters/Constraints/InstanceOfConstraintType.php @@ -27,11 +27,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class InstanceOfConstraintType extends AbstractType { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $entityManager; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Form/Filters/Constraints/TagsConstraintType.php b/src/Form/Filters/Constraints/TagsConstraintType.php index e6134a65..5fbf348c 100644 --- a/src/Form/Filters/Constraints/TagsConstraintType.php +++ b/src/Form/Filters/Constraints/TagsConstraintType.php @@ -30,11 +30,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class TagsConstraintType extends AbstractType { - protected UrlGeneratorInterface $urlGenerator; - - public function __construct(UrlGeneratorInterface $urlGenerator) + public function __construct(protected UrlGeneratorInterface $urlGenerator) { - $this->urlGenerator = $urlGenerator; } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php index 78546702..25c3c646 100644 --- a/src/Form/LabelOptionsType.php +++ b/src/Form/LabelOptionsType.php @@ -53,11 +53,8 @@ use Symfony\Component\Security\Core\Security; class LabelOptionsType extends AbstractType { - private \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function buildForm(FormBuilderInterface $builder, array $options): void @@ -101,7 +98,7 @@ class LabelOptionsType extends AbstractType 'label_options.barcode_type.code93' => 'code93', 'label_options.barcode_type.datamatrix' => 'datamatrix', ], - 'group_by' => static function ($choice, $key, $value) { + 'group_by' => static function ($choice, $key, $value): ?string { if (in_array($choice, ['qr', 'datamatrix'], true)) { return 'label_options.barcode_type.2D'; } diff --git a/src/Form/LabelSystem/LabelDialogType.php b/src/Form/LabelSystem/LabelDialogType.php index 4427fab1..faf12adb 100644 --- a/src/Form/LabelSystem/LabelDialogType.php +++ b/src/Form/LabelSystem/LabelDialogType.php @@ -52,11 +52,8 @@ use Symfony\Component\Security\Core\Security; class LabelDialogType extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php index b904e582..67d2aa82 100644 --- a/src/Form/Part/OrderdetailType.php +++ b/src/Form/Part/OrderdetailType.php @@ -40,11 +40,8 @@ use Symfony\Component\Security\Core\Security; class OrderdetailType extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function buildForm(FormBuilderInterface $builder, array $options): void @@ -82,7 +79,7 @@ class OrderdetailType extends AbstractType $orderdetail = $event->getData(); $dummy_pricedetail = new Pricedetail(); - if (null !== $orderdetail && null !== $orderdetail->getSupplier()) { + if ($orderdetail instanceof \App\Entity\PriceInformations\Orderdetail && $orderdetail->getSupplier() instanceof \App\Entity\Parts\Supplier) { $dummy_pricedetail->setCurrency($orderdetail->getSupplier()->getDefaultCurrency()); } diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php index f00458d2..53205e1f 100644 --- a/src/Form/Part/PartBaseType.php +++ b/src/Form/Part/PartBaseType.php @@ -52,15 +52,8 @@ use Symfony\Component\Security\Core\Security; class PartBaseType extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected UrlGeneratorInterface $urlGenerator; - protected EventCommentNeededHelper $event_comment_needed_helper; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator, EventCommentNeededHelper $event_comment_needed_helper) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected UrlGeneratorInterface $urlGenerator, protected EventCommentNeededHelper $event_comment_needed_helper) { - $this->security = $security; - $this->urlGenerator = $urlGenerator; - $this->event_comment_needed_helper = $event_comment_needed_helper; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php index e0e3f98c..d845b2c4 100644 --- a/src/Form/Part/PartLotType.php +++ b/src/Form/Part/PartLotType.php @@ -38,11 +38,8 @@ use Symfony\Component\Security\Core\Security; class PartLotType extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Form/Permissions/PermissionGroupType.php b/src/Form/Permissions/PermissionGroupType.php index c395337f..f3f7ffec 100644 --- a/src/Form/Permissions/PermissionGroupType.php +++ b/src/Form/Permissions/PermissionGroupType.php @@ -30,12 +30,10 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PermissionGroupType extends AbstractType { - protected PermissionManager $resolver; protected array $perm_structure; - public function __construct(PermissionManager $resolver) + public function __construct(protected PermissionManager $resolver) { - $this->resolver = $resolver; $this->perm_structure = $resolver->getPermissionStructure(); } @@ -68,9 +66,7 @@ class PermissionGroupType extends AbstractType { parent::configureOptions($resolver); - $resolver->setDefault('group_name', static function (Options $options) { - return trim($options['name']); - }); + $resolver->setDefault('group_name', static fn(Options $options): string => trim((string) $options['name'])); $resolver->setDefault('inherit', false); diff --git a/src/Form/Permissions/PermissionType.php b/src/Form/Permissions/PermissionType.php index 804fed0a..ab5ee86b 100644 --- a/src/Form/Permissions/PermissionType.php +++ b/src/Form/Permissions/PermissionType.php @@ -33,12 +33,10 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PermissionType extends AbstractType { - protected PermissionManager $resolver; protected array $perm_structure; - public function __construct(PermissionManager $resolver) + public function __construct(protected PermissionManager $resolver) { - $this->resolver = $resolver; $this->perm_structure = $resolver->getPermissionStructure(); } @@ -46,9 +44,7 @@ class PermissionType extends AbstractType { parent::configureOptions($resolver); - $resolver->setDefault('perm_name', static function (Options $options) { - return $options['name']; - }); + $resolver->setDefault('perm_name', static fn(Options $options) => $options['name']); $resolver->setDefault('label', function (Options $options) { if (!empty($this->perm_structure['perms'][$options['perm_name']]['label'])) { @@ -58,9 +54,7 @@ class PermissionType extends AbstractType return $options['name']; }); - $resolver->setDefault('multi_checkbox', static function (Options $options) { - return !$options['disabled']; - }); + $resolver->setDefault('multi_checkbox', static fn(Options $options) => !$options['disabled']); $resolver->setDefaults([ 'inherit' => false, diff --git a/src/Form/Permissions/PermissionsMapper.php b/src/Form/Permissions/PermissionsMapper.php index 9ecf09f7..07c47bdd 100644 --- a/src/Form/Permissions/PermissionsMapper.php +++ b/src/Form/Permissions/PermissionsMapper.php @@ -34,13 +34,8 @@ use Traversable; */ final class PermissionsMapper implements DataMapperInterface { - private PermissionManager $resolver; - private bool $inherit; - - public function __construct(PermissionManager $resolver, bool $inherit = false) + public function __construct(private readonly PermissionManager $resolver, private readonly bool $inherit = false) { - $this->inherit = $inherit; - $this->resolver = $resolver; } /** diff --git a/src/Form/Permissions/PermissionsType.php b/src/Form/Permissions/PermissionsType.php index e5688729..b0c7ba9d 100644 --- a/src/Form/Permissions/PermissionsType.php +++ b/src/Form/Permissions/PermissionsType.php @@ -33,12 +33,10 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class PermissionsType extends AbstractType { - protected PermissionManager $resolver; protected array $perm_structure; - public function __construct(PermissionManager $resolver) + public function __construct(protected PermissionManager $resolver) { - $this->resolver = $resolver; $this->perm_structure = $resolver->getPermissionStructure(); } diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 206ce3f0..6d6a194a 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -38,11 +38,8 @@ use Symfony\Component\Security\Core\Security; class ProjectBuildType extends AbstractType implements DataMapperInterface { - private \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function configureOptions(OptionsResolver $resolver) @@ -79,10 +76,10 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface $form->add('addBuildsToBuildsPart', CheckboxType::class, [ 'label' => 'project.build.add_builds_to_builds_part', 'required' => false, - 'disabled' => $build_request->getProject()->getBuildPart() === null, + 'disabled' => !$build_request->getProject()->getBuildPart() instanceof \App\Entity\Parts\Part, ]); - if ($build_request->getProject()->getBuildPart()) { + if ($build_request->getProject()->getBuildPart() instanceof \App\Entity\Parts\Part) { $form->add('buildsPartLot', PartLotSelectType::class, [ 'label' => 'project.build.builds_part_lot', 'required' => false, diff --git a/src/Form/Type/CurrencyEntityType.php b/src/Form/Type/CurrencyEntityType.php index 46aeac66..07f0a9f8 100644 --- a/src/Form/Type/CurrencyEntityType.php +++ b/src/Form/Type/CurrencyEntityType.php @@ -36,12 +36,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class CurrencyEntityType extends StructuralEntityType { - protected ?string $base_currency; - - public function __construct(EntityManagerInterface $em, NodesListBuilder $builder, TranslatorInterface $translator, StructuralEntityChoiceHelper $choiceHelper, ?string $base_currency) + public function __construct(EntityManagerInterface $em, NodesListBuilder $builder, TranslatorInterface $translator, StructuralEntityChoiceHelper $choiceHelper, protected ?string $base_currency) { parent::__construct($em, $builder, $translator, $choiceHelper); - $this->base_currency = $base_currency; } public function configureOptions(OptionsResolver $resolver): void @@ -56,11 +53,7 @@ class CurrencyEntityType extends StructuralEntityType // This options allows you to override the currency shown for the null value $resolver->setDefault('base_currency', null); - $resolver->setDefault('choice_attr', function (Options $options) { - return function ($choice) use ($options) { - return $this->choice_helper->generateChoiceAttrCurrency($choice, $options); - }; - }); + $resolver->setDefault('choice_attr', fn(Options $options) => fn($choice) => $this->choice_helper->generateChoiceAttrCurrency($choice, $options)); $resolver->setDefault('empty_message', function (Options $options) { //By default, we use the global base currency: diff --git a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php index da52b83e..3540e892 100644 --- a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php +++ b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php @@ -34,22 +34,15 @@ use Symfony\Contracts\Translation\TranslatorInterface; class StructuralEntityChoiceHelper { - private AttachmentURLGenerator $attachmentURLGenerator; - private TranslatorInterface $translator; - - public function __construct(AttachmentURLGenerator $attachmentURLGenerator, TranslatorInterface $translator) + public function __construct(private readonly AttachmentURLGenerator $attachmentURLGenerator, private readonly TranslatorInterface $translator) { - $this->attachmentURLGenerator = $attachmentURLGenerator; - $this->translator = $translator; } /** * Generates the choice attributes for the given AbstractStructuralDBElement. - * @param AbstractNamedDBElement $choice - * @param Options|array $options * @return array|string[] */ - public function generateChoiceAttr(AbstractNamedDBElement $choice, $options): array + public function generateChoiceAttr(AbstractNamedDBElement $choice, \Symfony\Component\OptionsResolver\Options|array $options): array { $tmp = [ 'data-level' => 0, @@ -69,19 +62,19 @@ class StructuralEntityChoiceHelper $level = $choice->getLevel(); /** @var AbstractStructuralDBElement|null $parent */ $parent = $options['subentities_of'] ?? null; - if (null !== $parent) { + if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { $level -= $parent->getLevel() - 1; } $tmp += [ 'data-level' => $level, - 'data-parent' => $choice->getParent() ? $choice->getParent()->getFullPath() : null, + 'data-parent' => $choice->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $choice->getParent()->getFullPath() : null, 'data-path' => $choice->getFullPath('->'), ]; } if ($choice instanceof HasMasterAttachmentInterface) { - $tmp['data-image'] = $choice->getMasterPictureAttachment() ? + $tmp['data-image'] = $choice->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment ? $this->attachmentURLGenerator->getThumbnailURL($choice->getMasterPictureAttachment(), 'thumbnail_xs') : null @@ -97,37 +90,21 @@ class StructuralEntityChoiceHelper /** * Generates the choice attributes for the given AbstractStructuralDBElement. - * @param Currency $choice - * @param Options|array $options * @return array|string[] */ - public function generateChoiceAttrCurrency(Currency $choice, $options): array + public function generateChoiceAttrCurrency(Currency $choice, \Symfony\Component\OptionsResolver\Options|array $options): array { $tmp = $this->generateChoiceAttr($choice, $options); + $symbol = empty($choice->getIsoCode()) ? null : Currencies::getSymbol($choice->getIsoCode()); + $tmp['data-short'] = $options['short'] ? $symbol : $choice->getName(); - if(!empty($choice->getIsoCode())) { - $symbol = Currencies::getSymbol($choice->getIsoCode()); - } else { - $symbol = null; - } - - if ($options['short']) { - $tmp['data-short'] = $symbol; - } else { - $tmp['data-short'] = $choice->getName(); - } - - $tmp += [ + return $tmp + [ 'data-symbol' => $symbol, ]; - - return $tmp; } /** * Returns the choice label for the given AbstractStructuralDBElement. - * @param AbstractNamedDBElement $choice - * @return string */ public function generateChoiceLabel(AbstractNamedDBElement $choice): string { @@ -136,12 +113,10 @@ class StructuralEntityChoiceHelper /** * Returns the choice value for the given AbstractStructuralDBElement. - * @param AbstractNamedDBElement|null $element - * @return string|int|null */ - public function generateChoiceValue(?AbstractNamedDBElement $element) + public function generateChoiceValue(?AbstractNamedDBElement $element): string|int|null { - if ($element === null) { + if (!$element instanceof \App\Entity\Base\AbstractNamedDBElement) { return null; } @@ -162,10 +137,6 @@ class StructuralEntityChoiceHelper return $element->getID(); } - /** - * @param AbstractDBElement $element - * @return string|null - */ public function generateGroupBy(AbstractDBElement $element): ?string { //Show entities that are not added to DB yet separately from other entities diff --git a/src/Form/Type/Helper/StructuralEntityChoiceLoader.php b/src/Form/Type/Helper/StructuralEntityChoiceLoader.php index 4f5347ad..fe7b71dd 100644 --- a/src/Form/Type/Helper/StructuralEntityChoiceLoader.php +++ b/src/Form/Type/Helper/StructuralEntityChoiceLoader.php @@ -28,17 +28,10 @@ use Symfony\Component\OptionsResolver\Options; class StructuralEntityChoiceLoader extends AbstractChoiceLoader { - private Options $options; - private NodesListBuilder $builder; - private EntityManagerInterface $entityManager; - private ?string $additional_element = null; - public function __construct(Options $options, NodesListBuilder $builder, EntityManagerInterface $entityManager) + public function __construct(private readonly Options $options, private readonly NodesListBuilder $builder, private readonly EntityManagerInterface $entityManager) { - $this->options = $options; - $this->builder = $builder; - $this->entityManager = $entityManager; } protected function loadChoices(): iterable diff --git a/src/Form/Type/MasterPictureAttachmentType.php b/src/Form/Type/MasterPictureAttachmentType.php index 7aba9cc6..b5edbd55 100644 --- a/src/Form/Type/MasterPictureAttachmentType.php +++ b/src/Form/Type/MasterPictureAttachmentType.php @@ -42,32 +42,28 @@ class MasterPictureAttachmentType extends AbstractType $resolver->setDefaults([ 'filter' => 'picture', 'choice_translation_domain' => false, - 'choice_attr' => static function (Options $options) { - return static function ($choice, $key, $value) use ($options) { - /** @var Attachment $choice */ - $tmp = ['data-subtext' => $choice->getFilename() ?? 'URL']; + 'choice_attr' => static fn(Options $options) => static function ($choice, $key, $value) use ($options) { + /** @var Attachment $choice */ + $tmp = ['data-subtext' => $choice->getFilename() ?? 'URL']; - if ('picture' === $options['filter'] && !$choice->isPicture()) { - $tmp += ['disabled' => 'disabled']; - } elseif ('3d_model' === $options['filter'] && !$choice->is3DModel()) { - $tmp += ['disabled' => 'disabled']; - } + if ('picture' === $options['filter'] && !$choice->isPicture()) { + $tmp += ['disabled' => 'disabled']; + } elseif ('3d_model' === $options['filter'] && !$choice->is3DModel()) { + $tmp += ['disabled' => 'disabled']; + } - return $tmp; - }; + return $tmp; }, 'choice_label' => 'name', - 'choice_loader' => static function (Options $options) { - return new CallbackChoiceLoader( - static function () use ($options) { - $entity = $options['entity']; - if (!$entity instanceof AttachmentContainingDBElement) { - throw new RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); - } + 'choice_loader' => static fn(Options $options) => new CallbackChoiceLoader( + static function () use ($options) { + $entity = $options['entity']; + if (!$entity instanceof AttachmentContainingDBElement) { + throw new RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)'); + } - return $entity->getAttachments()->toArray(); - }); - }, + return $entity->getAttachments()->toArray(); + }), ]); $resolver->setAllowedValues('filter', ['', 'picture', '3d_model']); diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php index 76e31ecb..2f15443e 100644 --- a/src/Form/Type/PartLotSelectType.php +++ b/src/Form/Type/PartLotSelectType.php @@ -43,17 +43,11 @@ class PartLotSelectType extends AbstractType $resolver->setDefaults([ 'class' => PartLot::class, - 'choice_label' => ChoiceList::label($this, static function (PartLot $part_lot) { - return ($part_lot->getStorageLocation() ? $part_lot->getStorageLocation()->getFullPath() : '') - . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount(); - }), - 'query_builder' => function (Options $options) { - return static function (EntityRepository $er) use ($options) { - return $er->createQueryBuilder('l') - ->where('l.part = :part') - ->setParameter('part', $options['part']); - }; - } + 'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $part_lot->getStorageLocation()->getFullPath() : '') + . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount()), + 'query_builder' => fn(Options $options) => static fn(EntityRepository $er) => $er->createQueryBuilder('l') + ->where('l.part = :part') + ->setParameter('part', $options['part']) ]); } } \ No newline at end of file diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index c78ce55e..d81f70cd 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -19,18 +19,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class PartSelectType extends AbstractType implements DataMapperInterface { - private UrlGeneratorInterface $urlGenerator; - private EntityManagerInterface $em; - private PartPreviewGenerator $previewGenerator; - private AttachmentURLGenerator $attachmentURLGenerator; - - public function __construct(UrlGeneratorInterface $urlGenerator, EntityManagerInterface $em, PartPreviewGenerator $previewGenerator, - AttachmentURLGenerator $attachmentURLGenerator) + public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly EntityManagerInterface $em, private readonly PartPreviewGenerator $previewGenerator, private readonly AttachmentURLGenerator $attachmentURLGenerator) { - $this->urlGenerator = $urlGenerator; - $this->em = $em; - $this->previewGenerator = $previewGenerator; - $this->attachmentURLGenerator = $attachmentURLGenerator; } public function buildForm(FormBuilderInterface $builder, array $options) @@ -96,10 +86,10 @@ class PartSelectType extends AbstractType implements DataMapperInterface $resolver->setDefaults([ //Prefill the selected choice with the needed data, so the user can see it without an additional Ajax request 'choice_attr' => ChoiceList::attr($this, function (?Part $part) { - if($part) { + if($part instanceof \App\Entity\Parts\Part) { //Determine the picture to show: $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($part); - if ($preview_attachment !== null) { + if ($preview_attachment instanceof \App\Entity\Attachments\Attachment) { $preview_url = $this->attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm'); } else { @@ -107,10 +97,10 @@ class PartSelectType extends AbstractType implements DataMapperInterface } } - return $part ? [ + return $part instanceof \App\Entity\Parts\Part ? [ 'data-description' => mb_strimwidth($part->getDescription(), 0, 127, '...'), - 'data-category' => $part->getCategory() ? $part->getCategory()->getName() : '', - 'data-footprint' => $part->getFootprint() ? $part->getFootprint()->getName() : '', + 'data-category' => $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : '', + 'data-footprint' => $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '', 'data-image' => $preview_url, ] : []; }) diff --git a/src/Form/Type/RichTextEditorType.php b/src/Form/Type/RichTextEditorType.php index 1d076916..fd796e52 100644 --- a/src/Form/Type/RichTextEditorType.php +++ b/src/Form/Type/RichTextEditorType.php @@ -48,18 +48,13 @@ class RichTextEditorType extends AbstractType protected function optionsToAttrArray(array $options): array { - $tmp = []; - - //Set novalidate attribute, or we will get problems that form can not be submitted as textarea is not focusable - $tmp['novalidate'] = 'novalidate'; - - $tmp['data-mode'] = $options['mode']; - - //Add our data-controller element to the textarea - $tmp['data-controller'] = 'elements--ckeditor'; - - - return $tmp; + return [ + //Set novalidate attribute, or we will get problems that form can not be submitted as textarea is not focusable + 'novalidate' => 'novalidate', + 'data-mode' => $options['mode'], + //Add our data-controller element to the textarea + 'data-controller' => 'elements--ckeditor', + ]; } public function getParent(): string diff --git a/src/Form/Type/SIUnitType.php b/src/Form/Type/SIUnitType.php index 3f40acc9..c018d5e1 100644 --- a/src/Form/Type/SIUnitType.php +++ b/src/Form/Type/SIUnitType.php @@ -38,11 +38,8 @@ use Traversable; final class SIUnitType extends AbstractType implements DataMapperInterface { - protected SIFormatter $si_formatter; - - public function __construct(SIFormatter $SIFormatter) + public function __construct(protected SIFormatter $si_formatter) { - $this->si_formatter = $SIFormatter; } public function configureOptions(OptionsResolver $resolver): void @@ -91,7 +88,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface $resolver->setDefaults([ 'min' => 0, 'max' => '', - 'step' => static function (Options $options) { + 'step' => static function (Options $options): int|string { if (true === $options['is_integer']) { return 1; } @@ -138,7 +135,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface //Check if we need to make this thing small if (isset($options['attr']['class'])) { - $view->vars['sm'] = str_contains($options['attr']['class'], 'form-control-sm'); + $view->vars['sm'] = str_contains((string) $options['attr']['class'], 'form-control-sm'); } $view->vars['unit'] = $options['unit']; diff --git a/src/Form/Type/StructuralEntityType.php b/src/Form/Type/StructuralEntityType.php index 9c489b47..8afb6ce2 100644 --- a/src/Form/Type/StructuralEntityType.php +++ b/src/Form/Type/StructuralEntityType.php @@ -44,21 +44,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class StructuralEntityType extends AbstractType { - protected EntityManagerInterface $em; - protected TranslatorInterface $translator; - protected StructuralEntityChoiceHelper $choice_helper; - - /** - * @var NodesListBuilder - */ - protected NodesListBuilder $builder; - - public function __construct(EntityManagerInterface $em, NodesListBuilder $builder, TranslatorInterface $translator, StructuralEntityChoiceHelper $choice_helper) + public function __construct(protected EntityManagerInterface $em, protected NodesListBuilder $builder, protected TranslatorInterface $translator, protected StructuralEntityChoiceHelper $choice_helper) { - $this->em = $em; - $this->builder = $builder; - $this->translator = $translator; - $this->choice_helper = $choice_helper; } public function buildForm(FormBuilderInterface $builder, array $options): void @@ -81,11 +68,7 @@ class StructuralEntityType extends AbstractType }); $builder->addModelTransformer(new CallbackTransformer( - function ($value) use ($options) { - return $this->modelTransform($value, $options); - }, function ($value) use ($options) { - return $this->modelReverseTransform($value, $options); - })); + fn($value) => $this->modelTransform($value, $options), fn($value) => $this->modelReverseTransform($value, $options))); } public function configureOptions(OptionsResolver $resolver): void @@ -96,25 +79,11 @@ class StructuralEntityType extends AbstractType 'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext 'subentities_of' => null, //Only show entities with the given parent class 'disable_not_selectable' => false, //Disable entries with not selectable property - 'choice_value' => function (?AbstractNamedDBElement $element) { - return $this->choice_helper->generateChoiceValue($element); - }, //Use the element id as option value and for comparing items - 'choice_loader' => function (Options $options) { - return new StructuralEntityChoiceLoader($options, $this->builder, $this->em); - }, - 'choice_label' => function (Options $options) { - return function ($choice, $key, $value) { - return $this->choice_helper->generateChoiceLabel($choice); - }; - }, - 'choice_attr' => function (Options $options) { - return function ($choice, $key, $value) use ($options) { - return $this->choice_helper->generateChoiceAttr($choice, $options); - }; - }, - 'group_by' => function (AbstractNamedDBElement $element) { - return $this->choice_helper->generateGroupBy($element); - }, + 'choice_value' => fn(?AbstractNamedDBElement $element) => $this->choice_helper->generateChoiceValue($element), //Use the element id as option value and for comparing items + 'choice_loader' => fn(Options $options) => new StructuralEntityChoiceLoader($options, $this->builder, $this->em), + 'choice_label' => fn(Options $options) => fn($choice, $key, $value) => $this->choice_helper->generateChoiceLabel($choice), + 'choice_attr' => fn(Options $options) => fn($choice, $key, $value) => $this->choice_helper->generateChoiceAttr($choice, $options), + 'group_by' => fn(AbstractNamedDBElement $element) => $this->choice_helper->generateGroupBy($element), 'choice_translation_domain' => false, //Don't translate the entity names ]); diff --git a/src/Form/Type/ThemeChoiceType.php b/src/Form/Type/ThemeChoiceType.php index 96b47510..c5a45ac4 100644 --- a/src/Form/Type/ThemeChoiceType.php +++ b/src/Form/Type/ThemeChoiceType.php @@ -26,11 +26,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ThemeChoiceType extends AbstractType { - private array $available_themes; - - public function __construct(array $available_themes) + public function __construct(private readonly array $available_themes) { - $this->available_themes = $available_themes; } public function getParent(): string @@ -42,9 +39,7 @@ class ThemeChoiceType extends AbstractType { $resolver->setDefaults([ 'choices' => $this->available_themes, - 'choice_label' => static function ($entity, $key, $value) { - return $value; - }, + 'choice_label' => static fn($entity, $key, $value) => $value, 'choice_translation_domain' => false, 'placeholder' => 'user_settings.theme.placeholder' ]); diff --git a/src/Form/Type/TriStateCheckboxType.php b/src/Form/Type/TriStateCheckboxType.php index 6e8dafc4..df4b0f3a 100644 --- a/src/Form/Type/TriStateCheckboxType.php +++ b/src/Form/Type/TriStateCheckboxType.php @@ -147,17 +147,11 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer */ public function reverseTransform($value) { - switch ($value) { - case 'true': - return true; - case 'false': - return false; - case 'indeterminate': - case 'null': - case '': - return null; - default: - throw new InvalidArgumentException('Invalid value encountered!: '.$value); - } + return match ($value) { + 'true' => true, + 'false' => false, + 'indeterminate', 'null', '' => null, + default => throw new InvalidArgumentException('Invalid value encountered!: '.$value), + }; } } diff --git a/src/Form/Type/UserSelectType.php b/src/Form/Type/UserSelectType.php index 97d8e26d..a089f66d 100644 --- a/src/Form/Type/UserSelectType.php +++ b/src/Form/Type/UserSelectType.php @@ -32,11 +32,7 @@ class UserSelectType extends AbstractType { $resolver->setDefaults([ 'class' => User::class, - 'choice_label' => function (Options $options) { - return function (User $choice, $key, $value) { - return $choice->getFullName(true); - }; - }, + 'choice_label' => fn(Options $options) => fn(User $choice, $key, $value) => $choice->getFullName(true), ]); } diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php index d42ea9d9..2b690619 100644 --- a/src/Form/UserAdminForm.php +++ b/src/Form/UserAdminForm.php @@ -48,11 +48,8 @@ use Symfony\Component\Validator\Constraints\Length; class UserAdminForm extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php index de7017d6..07b4a38a 100644 --- a/src/Form/UserSettingsType.php +++ b/src/Form/UserSettingsType.php @@ -44,13 +44,8 @@ use Symfony\Component\Validator\Constraints\File; class UserSettingsType extends AbstractType { - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected bool $demo_mode; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, bool $demo_mode) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected bool $demo_mode) { - $this->security = $security; - $this->demo_mode = $demo_mode; } public function buildForm(FormBuilderInterface $builder, array $options): void diff --git a/src/Helpers/Projects/ProjectBuildRequest.php b/src/Helpers/Projects/ProjectBuildRequest.php index 4cb942d1..d29cf303 100644 --- a/src/Helpers/Projects/ProjectBuildRequest.php +++ b/src/Helpers/Projects/ProjectBuildRequest.php @@ -30,8 +30,7 @@ use App\Validator\Constraints\ProjectSystem\ValidProjectBuildRequest; */ final class ProjectBuildRequest { - private Project $project; - private int $number_of_builds; + private readonly int $number_of_builds; /** * @var array @@ -48,19 +47,17 @@ final class ProjectBuildRequest * @param Project $project The project that should be build * @param int $number_of_builds The number of builds that should be created */ - public function __construct(Project $project, int $number_of_builds) + public function __construct(private readonly Project $project, int $number_of_builds) { if ($number_of_builds < 1) { throw new \InvalidArgumentException('Number of builds must be at least 1!'); } - - $this->project = $project; $this->number_of_builds = $number_of_builds; $this->initializeArray(); //By default, use the first available lot of builds part if there is one. - if($project->getBuildPart() !== null) { + if($project->getBuildPart() instanceof \App\Entity\Parts\Part) { $this->add_build_to_builds_part = true; foreach( $project->getBuildPart()->getPartLots() as $lot) { if (!$lot->isInstockUnknown()) { @@ -89,8 +86,6 @@ final class ProjectBuildRequest /** * Ensure that the projectBOMEntry belongs to the project, otherwise throw an exception. - * @param ProjectBOMEntry $entry - * @return void */ private function ensureBOMEntryValid(ProjectBOMEntry $entry): void { @@ -101,7 +96,6 @@ final class ProjectBuildRequest /** * Returns the partlot where the builds should be added to, or null if it should not be added to any lot. - * @return PartLot|null */ public function getBuildsPartLot(): ?PartLot { @@ -110,7 +104,6 @@ final class ProjectBuildRequest /** * Return if the builds should be added to the builds part of this project as new stock - * @return bool */ public function getAddBuildsToBuildsPart(): bool { @@ -119,7 +112,6 @@ final class ProjectBuildRequest /** * Set if the builds should be added to the builds part of this project as new stock - * @param bool $new_value * @return $this */ public function setAddBuildsToBuildsPart(bool $new_value): self @@ -136,17 +128,16 @@ final class ProjectBuildRequest /** * Set the partlot where the builds should be added to, or null if it should not be added to any lot. * The part lot must belong to the project build part, or an exception is thrown! - * @param PartLot|null $new_part_lot * @return $this */ public function setBuildsPartLot(?PartLot $new_part_lot): self { //Ensure that this new_part_lot belongs to the project - if (($new_part_lot !== null && $new_part_lot->getPart() !== $this->project->getBuildPart()) || $this->project->getBuildPart() === null) { + if (($new_part_lot instanceof \App\Entity\Parts\PartLot && $new_part_lot->getPart() !== $this->project->getBuildPart()) || !$this->project->getBuildPart() instanceof \App\Entity\Parts\Part) { throw new \InvalidArgumentException('The given part lot does not belong to the projects build part!'); } - if ($new_part_lot !== null) { + if ($new_part_lot instanceof \App\Entity\Parts\PartLot) { $this->setAddBuildsToBuildsPart(true); } @@ -157,7 +148,6 @@ final class ProjectBuildRequest /** * Returns the comment where the user can write additional information about the build. - * @return string */ public function getComment(): string { @@ -166,7 +156,6 @@ final class ProjectBuildRequest /** * Sets the comment where the user can write additional information about the build. - * @param string $comment */ public function setComment(string $comment): void { @@ -176,9 +165,8 @@ final class ProjectBuildRequest /** * Returns the amount of parts that should be withdrawn from the given lot for the corresponding BOM entry. * @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got - * @return float */ - public function getLotWithdrawAmount($lot): float + public function getLotWithdrawAmount(\App\Entity\Parts\PartLot|int $lot): float { if ($lot instanceof PartLot) { $lot_id = $lot->getID(); @@ -198,10 +186,9 @@ final class ProjectBuildRequest /** * Sets the amount of parts that should be withdrawn from the given lot for the corresponding BOM entry. * @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got - * @param float $amount * @return $this */ - public function setLotWithdrawAmount($lot, float $amount): self + public function setLotWithdrawAmount(\App\Entity\Parts\PartLot|int $lot, float $amount): self { if ($lot instanceof PartLot) { $lot_id = $lot->getID(); @@ -218,8 +205,6 @@ final class ProjectBuildRequest /** * Returns the sum of all withdraw amounts for the given BOM entry. - * @param ProjectBOMEntry $entry - * @return float */ public function getWithdrawAmountSum(ProjectBOMEntry $entry): float { @@ -239,14 +224,13 @@ final class ProjectBuildRequest /** * Returns the number of available lots to take stock from for the given BOM entry. - * @param ProjectBOMEntry $projectBOMEntry * @return PartLot[]|null Returns null if the entry is a non-part BOM entry */ public function getPartLotsForBOMEntry(ProjectBOMEntry $projectBOMEntry): ?array { $this->ensureBOMEntryValid($projectBOMEntry); - if ($projectBOMEntry->getPart() === null) { + if (!$projectBOMEntry->getPart() instanceof \App\Entity\Parts\Part) { return null; } @@ -256,8 +240,6 @@ final class ProjectBuildRequest /** * Returns the needed amount of parts for the given BOM entry. - * @param ProjectBOMEntry $entry - * @return float */ public function getNeededAmountForBOMEntry(ProjectBOMEntry $entry): float { @@ -281,14 +263,11 @@ final class ProjectBuildRequest */ public function getPartBomEntries(): array { - return $this->project->getBomEntries()->filter(function (ProjectBOMEntry $entry) { - return $entry->isPartBomEntry(); - })->toArray(); + return $this->project->getBomEntries()->filter(fn(ProjectBOMEntry $entry) => $entry->isPartBomEntry())->toArray(); } /** * Returns which project should be build - * @return Project */ public function getProject(): Project { @@ -297,7 +276,6 @@ final class ProjectBuildRequest /** * Returns the number of builds that should be created. - * @return int */ public function getNumberOfBuilds(): int { diff --git a/src/Helpers/Trees/TreeViewNode.php b/src/Helpers/Trees/TreeViewNode.php index 85053239..8fa328a3 100644 --- a/src/Helpers/Trees/TreeViewNode.php +++ b/src/Helpers/Trees/TreeViewNode.php @@ -30,10 +30,6 @@ use JsonSerializable; */ final class TreeViewNode implements JsonSerializable { - private string $text; - private ?string $href; - private ?array $nodes; - private ?TreeViewNodeState $state = null; private ?array $tags = null; @@ -51,12 +47,8 @@ final class TreeViewNode implements JsonSerializable * @param array|null $nodes An array containing other TreeViewNodes. They will be used as children nodes of the * newly created nodes. Set to null, if it should not have children. */ - public function __construct(string $text, ?string $href = null, ?array $nodes = null) + public function __construct(private string $text, private ?string $href = null, private ?array $nodes = null) { - $this->text = $text; - $this->href = $href; - $this->nodes = $nodes; - //$this->state = new TreeViewNodeState(); } @@ -94,8 +86,6 @@ final class TreeViewNode implements JsonSerializable * Sets the node text. * * @param string $text the new node text - * - * @return TreeViewNode */ public function setText(string $text): self { @@ -116,8 +106,6 @@ final class TreeViewNode implements JsonSerializable * Sets the href link. * * @param string|null $href the new href link - * - * @return TreeViewNode */ public function setHref(?string $href): self { @@ -140,8 +128,6 @@ final class TreeViewNode implements JsonSerializable * Sets the children nodes. * * @param array|null $nodes The new children nodes - * - * @return TreeViewNode */ public function setNodes(?array $nodes): self { @@ -165,7 +151,7 @@ final class TreeViewNode implements JsonSerializable public function setDisabled(?bool $disabled): self { //Lazy loading of state, so it does not need to get serialized and transfered, when it is empty. - if (null === $this->state) { + if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { $this->state = new TreeViewNodeState(); } @@ -177,7 +163,7 @@ final class TreeViewNode implements JsonSerializable public function setSelected(?bool $selected): self { //Lazy loading of state, so it does not need to get serialized and transfered, when it is empty. - if (null === $this->state) { + if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { $this->state = new TreeViewNodeState(); } @@ -189,7 +175,7 @@ final class TreeViewNode implements JsonSerializable public function setExpanded(?bool $selected = true): self { //Lazy loading of state, so it does not need to get serialized and transfered, when it is empty. - if (null === $this->state) { + if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { $this->state = new TreeViewNodeState(); } @@ -215,17 +201,11 @@ final class TreeViewNode implements JsonSerializable return $this; } - /** - * @return string|null - */ public function getIcon(): ?string { return $this->icon; } - /** - * @param string|null $icon - */ public function setIcon(?string $icon): self { $this->icon = $icon; @@ -252,7 +232,7 @@ final class TreeViewNode implements JsonSerializable $ret['nodes'] = $this->nodes; } - if (null !== $this->state) { + if ($this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { $ret['state'] = $this->state; } diff --git a/src/Migration/AbstractMultiPlatformMigration.php b/src/Migration/AbstractMultiPlatformMigration.php index 324eeb8d..48fff8bd 100644 --- a/src/Migration/AbstractMultiPlatformMigration.php +++ b/src/Migration/AbstractMultiPlatformMigration.php @@ -30,14 +30,11 @@ use Psr\Log\LoggerInterface; abstract class AbstractMultiPlatformMigration extends AbstractMigration { - public const ADMIN_PW_LENGTH = 10; + final public const ADMIN_PW_LENGTH = 10; protected string $admin_pw = ''; - protected LoggerInterface $logger; - - public function __construct(Connection $connection, LoggerInterface $logger) + public function __construct(Connection $connection, protected LoggerInterface $logger) { - $this->logger = $logger; parent::__construct($connection, $logger); } @@ -45,34 +42,22 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration { $db_type = $this->getDatabaseType(); - switch ($db_type) { - case 'mysql': - $this->mySQLUp($schema); - break; - case 'sqlite': - $this->sqLiteUp($schema); - break; - default: - $this->abortIf(true, "Database type '$db_type' is not supported!"); - break; - } + match ($db_type) { + 'mysql' => $this->mySQLUp($schema), + 'sqlite' => $this->sqLiteUp($schema), + default => $this->abortIf(true, "Database type '$db_type' is not supported!"), + }; } public function down(Schema $schema): void { $db_type = $this->getDatabaseType(); - switch ($db_type) { - case 'mysql': - $this->mySQLDown($schema); - break; - case 'sqlite': - $this->sqLiteDown($schema); - break; - default: - $this->abortIf(true, "Database type is not supported!"); - break; - } + match ($db_type) { + 'mysql' => $this->mySQLDown($schema), + 'sqlite' => $this->sqLiteDown($schema), + default => $this->abortIf(true, "Database type is not supported!"), + }; } /** @@ -91,7 +76,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration return 0; } return (int) $version; - } catch (Exception $dBALException) { + } catch (Exception) { //when the table was not found, we can proceed, because we have an empty DB! return 0; } @@ -112,7 +97,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration } //As we don't have access to container, just use the default PHP pw hash function - return password_hash($this->admin_pw, PASSWORD_DEFAULT); + return password_hash((string) $this->admin_pw, PASSWORD_DEFAULT); } public function postUp(Schema $schema): void @@ -129,8 +114,6 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration /** * Checks if a foreign key on a table exists in the database. * This method is only supported for MySQL/MariaDB databases yet! - * @param string $table - * @param string $fk_name * @return bool Returns true, if the foreign key exists * @throws Exception */ diff --git a/src/Repository/AbstractPartsContainingRepository.php b/src/Repository/AbstractPartsContainingRepository.php index b42d075f..0603ce06 100644 --- a/src/Repository/AbstractPartsContainingRepository.php +++ b/src/Repository/AbstractPartsContainingRepository.php @@ -51,7 +51,6 @@ abstract class AbstractPartsContainingRepository extends StructuralDBElementRepo /** * Returns the count of the parts associated with this element and all its children. * Please be aware that this function is pretty slow on large trees! - * @param AbstractPartsContainingDBElement $element * @return int */ public function getPartsCountRecursive(AbstractPartsContainingDBElement $element): int @@ -64,8 +63,6 @@ abstract class AbstractPartsContainingRepository extends StructuralDBElementRepo * This function is used to limit the recursion depth (remaining_depth is decreased on each call). * If the recursion limit is reached (remaining_depth <= 0), a RuntimeException is thrown. * @internal This function is not intended to be called directly, use getPartsCountRecursive() instead. - * @param AbstractPartsContainingDBElement $element - * @param int $remaining_depth * @return int */ protected function getPartsCountRecursiveWithDepthN(AbstractPartsContainingDBElement $element, int $remaining_depth): int diff --git a/src/Repository/DBElementRepository.php b/src/Repository/DBElementRepository.php index 0f7024b6..1f1fe7ee 100644 --- a/src/Repository/DBElementRepository.php +++ b/src/Repository/DBElementRepository.php @@ -57,7 +57,7 @@ class DBElementRepository extends EntityRepository public function changeID(AbstractDBElement $element, int $new_id): void { $qb = $this->createQueryBuilder('element'); - $q = $qb->update(get_class($element), 'element') + $q = $qb->update($element::class, 'element') ->set('element.id', $new_id) ->where('element.id = ?1') ->setParameter(1, $element->getID()) @@ -87,7 +87,7 @@ class DBElementRepository extends EntityRepository protected function setField(AbstractDBElement $element, string $field, int $new_value): void { - $reflection = new ReflectionClass(get_class($element)); + $reflection = new ReflectionClass($element::class); $property = $reflection->getProperty($field); $property->setAccessible(true); $property->setValue($element, $new_value); diff --git a/src/Repository/LabelProfileRepository.php b/src/Repository/LabelProfileRepository.php index 76372f34..f3459af9 100644 --- a/src/Repository/LabelProfileRepository.php +++ b/src/Repository/LabelProfileRepository.php @@ -84,7 +84,7 @@ class LabelProfileRepository extends NamedDBElementRepository $type_children[] = $node; } - if (!empty($type_children)) { + if ($type_children !== []) { //Use default label e.g. 'part_label'. $$ marks that it will be translated in TreeViewGenerator $tmp = new TreeViewNode('$$'.$type.'.label', null, $type_children); @@ -112,7 +112,6 @@ class LabelProfileRepository extends NamedDBElementRepository /** * Returns all LabelProfiles that can be used for parts - * @return array */ public function getPartLabelProfiles(): array { @@ -121,7 +120,6 @@ class LabelProfileRepository extends NamedDBElementRepository /** * Returns all LabelProfiles that can be used for part lots - * @return array */ public function getPartLotsLabelProfiles(): array { @@ -130,7 +128,6 @@ class LabelProfileRepository extends NamedDBElementRepository /** * Returns all LabelProfiles that can be used for storelocations - * @return array */ public function getStorelocationsLabelProfiles(): array { diff --git a/src/Repository/LogEntryRepository.php b/src/Repository/LogEntryRepository.php index 16ada41b..a3456b6c 100644 --- a/src/Repository/LogEntryRepository.php +++ b/src/Repository/LogEntryRepository.php @@ -41,7 +41,7 @@ class LogEntryRepository extends DBElementRepository /** @var AbstractDBElement $element */ $element = $criteria['target']; $criteria['target_id'] = $element->getID(); - $criteria['target_type'] = AbstractLogEntry::targetTypeClassToID(get_class($element)); + $criteria['target_type'] = AbstractLogEntry::targetTypeClassToID($element::class); unset($criteria['target']); } @@ -117,7 +117,7 @@ class LogEntryRepository extends DBElementRepository ->orderBy('log.timestamp', 'DESC'); $qb->setParameters([ - 'target_type' => AbstractLogEntry::targetTypeClassToID(get_class($element)), + 'target_type' => AbstractLogEntry::targetTypeClassToID($element::class), 'target_id' => $element->getID(), 'until' => $until, ]); @@ -143,7 +143,7 @@ class LogEntryRepository extends DBElementRepository ->orderBy('log.timestamp', 'DESC'); $qb->setParameters([ - 'target_type' => AbstractLogEntry::targetTypeClassToID(get_class($element)), + 'target_type' => AbstractLogEntry::targetTypeClassToID($element::class), 'target_id' => $element->getID(), 'until' => $timestamp, ]); @@ -151,13 +151,12 @@ class LogEntryRepository extends DBElementRepository $query = $qb->getQuery(); $count = $query->getSingleScalarResult(); - return !($count > 0); + return $count <= 0; } /** * Gets the last log entries ordered by timestamp. * - * @param string $order * @param null $limit * @param null $offset */ @@ -216,7 +215,7 @@ class LogEntryRepository extends DBElementRepository ->orderBy('log.timestamp', 'DESC'); $qb->setParameters([ - 'target_type' => AbstractLogEntry::targetTypeClassToID(get_class($element)), + 'target_type' => AbstractLogEntry::targetTypeClassToID($element::class), 'target_id' => $element->getID(), ]); diff --git a/src/Repository/ParameterRepository.php b/src/Repository/ParameterRepository.php index 37420306..694d6bb2 100644 --- a/src/Repository/ParameterRepository.php +++ b/src/Repository/ParameterRepository.php @@ -26,8 +26,6 @@ class ParameterRepository extends DBElementRepository * Find parameters using a parameter name * @param string $name The name to search for * @param bool $exact True, if only exact names should match. False, if the name just needs to be contained in the parameter name - * @param int $max_results - * @return array */ public function autocompleteParamName(string $name, bool $exact = false, int $max_results = 50): array { diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php index 442c5860..dbecfc2f 100644 --- a/src/Repository/StructuralDBElementRepository.php +++ b/src/Repository/StructuralDBElementRepository.php @@ -100,8 +100,6 @@ class StructuralDBElementRepository extends NamedDBElementRepository * Creates a structure of AbstractStructuralDBElements from a path separated by $separator, which splits the various levels. * This function will try to use existing elements, if they are already in the database. If not, they will be created. * An array of the created elements will be returned, with the last element being the deepest element. - * @param string $path - * @param string $separator * @return AbstractStructuralDBElement[] */ public function getNewEntityFromPath(string $path, string $separator = '->'): array @@ -118,7 +116,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository $entity = $this->getNewEntityFromCache($name, $parent); //See if we already have an element with this name and parent in the database - if (!$entity) { + if (!$entity instanceof \App\Entity\Base\AbstractStructuralDBElement) { $entity = $this->findOneBy(['name' => $name, 'parent' => $parent]); } if (null === $entity) { @@ -140,7 +138,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository private function getNewEntityFromCache(string $name, ?AbstractStructuralDBElement $parent): ?AbstractStructuralDBElement { - $key = $parent ? $parent->getFullPath('%->%').'%->%'.$name : $name; + $key = $parent instanceof \App\Entity\Base\AbstractStructuralDBElement ? $parent->getFullPath('%->%').'%->%'.$name : $name; if (isset($this->new_entity_cache[$key])) { return $this->new_entity_cache[$key]; } @@ -157,8 +155,6 @@ class StructuralDBElementRepository extends NamedDBElementRepository * Returns an element of AbstractStructuralDBElements queried from a path separated by $separator, which splits the various levels. * An array of the created elements will be returned, with the last element being the deepest element. * If no element was found, an empty array will be returned. - * @param string $path - * @param string $separator * @return AbstractStructuralDBElement[] */ public function getEntityByPath(string $path, string $separator = '->'): array diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index 648f86bd..4cb51b64 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -44,7 +44,7 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU */ public function getAnonymousUser(): ?User { - if (null === $this->anonymous_user) { + if (!$this->anonymous_user instanceof \App\Entity\UserSystem\User) { $this->anonymous_user = $this->findOneBy([ 'id' => User::ID_ANONYMOUS, ]); @@ -78,7 +78,7 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU try { return $qb->getQuery()->getOneOrNullResult(); - } catch (NonUniqueResultException $nonUniqueResultException) { + } catch (NonUniqueResultException) { return null; } } diff --git a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php index 583760c1..0d80630d 100644 --- a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php +++ b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php @@ -29,11 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { - $this->translator = $translator; } public static function getSubscribedEvents(): array @@ -53,10 +50,9 @@ class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface if ($user instanceof User && !$user->isSAMLUser()) { throw new CustomUserMessageAccountStatusException($this->translator->trans('saml.error.cannot_login_local_user_per_saml', [], 'security')); } - } else { //Ensure that you can not login locally with a SAML user (even if this should not happen, as the password is not set) - if ($user instanceof User && $user->isSamlUser()) { - throw new CustomUserMessageAccountStatusException($this->translator->trans('saml.error.cannot_login_saml_user_locally', [], 'security')); - } + } elseif ($user instanceof User && $user->isSamlUser()) { + //Ensure that you can not login locally with a SAML user (even if this should not happen, as the password is not set) + throw new CustomUserMessageAccountStatusException($this->translator->trans('saml.error.cannot_login_saml_user_locally', [], 'security')); } } } \ No newline at end of file diff --git a/src/Security/SamlUserFactory.php b/src/Security/SamlUserFactory.php index b5434be9..84704987 100644 --- a/src/Security/SamlUserFactory.php +++ b/src/Security/SamlUserFactory.php @@ -31,22 +31,14 @@ use Symfony\Component\Security\Core\User\UserInterface; class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterface { - private EntityManagerInterface $em; - private array $saml_role_mapping; - private bool $update_group_on_login; + private readonly array $saml_role_mapping; - public function __construct(EntityManagerInterface $entityManager, ?array $saml_role_mapping, bool $update_group_on_login) + public function __construct(private readonly EntityManagerInterface $em, ?array $saml_role_mapping, private readonly bool $update_group_on_login) { - $this->em = $entityManager; - if ($saml_role_mapping) { - $this->saml_role_mapping = $saml_role_mapping; - } else { - $this->saml_role_mapping = []; - } - $this->update_group_on_login = $update_group_on_login; + $this->saml_role_mapping = $saml_role_mapping ?: []; } - public const SAML_PASSWORD_PLACEHOLDER = '!!SAML!!'; + final public const SAML_PASSWORD_PLACEHOLDER = '!!SAML!!'; public function createUser($username, array $attributes = []): UserInterface { @@ -70,8 +62,6 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf /** * This method is called after a successful authentication. It is used to update the group of the user, * based on the new SAML attributes. - * @param AuthenticationSuccessEvent $event - * @return void */ public function onAuthenticationSuccess(AuthenticationSuccessEvent $event): void { @@ -98,7 +88,6 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf /** * Maps the given SAML attributes to a local group. * @param array $attributes The SAML attributes - * @return Group|null */ public function mapSAMLAttributesToLocalGroup(array $attributes): ?Group { @@ -109,7 +98,7 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf //Check if we can find a group with the given ID if ($group_id !== null) { $group = $this->em->find(Group::class, $group_id); - if ($group !== null) { + if ($group instanceof \App\Entity\UserSystem\Group) { return $group; } } @@ -127,7 +116,7 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf */ public function mapSAMLRolesToLocalGroupID(array $roles, array $map = null): ?int { - $map = $map ?? $this->saml_role_mapping; + $map ??= $this->saml_role_mapping; //Iterate over the mapping (from first to last) and check if we have a match foreach ($map as $saml_role => $group_id) { diff --git a/src/Security/UserChecker.php b/src/Security/UserChecker.php index f64fb50e..55fa3db3 100644 --- a/src/Security/UserChecker.php +++ b/src/Security/UserChecker.php @@ -31,11 +31,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class UserChecker implements UserCheckerInterface { - private TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(private readonly TranslatorInterface $translator) { - $this->translator = $translator; } /** diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index 95d20733..2f27d232 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -45,12 +45,9 @@ use function in_array; class AttachmentVoter extends ExtendedVoter { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); - $this->security = $security; } /** @@ -76,7 +73,7 @@ class AttachmentVoter extends ExtendedVoter if (is_object($subject)) { //If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element $target_element = $subject->getElement(); - if ($target_element) { + if ($target_element instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { return $this->security->isGranted($this->mapOperation($attribute), $target_element); } } @@ -112,7 +109,7 @@ class AttachmentVoter extends ExtendedVoter $param = 'parts'; } else { - throw new RuntimeException('Encountered unknown Parameter type: ' . (is_object($subject) ? get_class($subject) : $subject)); + throw new RuntimeException('Encountered unknown Parameter type: ' . (is_object($subject) ? $subject::class : $subject)); } return $this->resolver->inherit($user, $param, $this->mapOperation($attribute)) ?? false; @@ -123,21 +120,12 @@ class AttachmentVoter extends ExtendedVoter private function mapOperation(string $attribute): string { - switch ($attribute) { - //We can view the attachment if we can view the element - case 'read': - case 'view': - return 'read'; - //We can edit/create/delete the attachment if we can edit the element - case 'edit': - case 'create': - case 'delete': - return 'edit'; - case 'show_history': - return 'show_history'; - } - - throw new \RuntimeException('Encountered unknown attribute "'.$attribute.'" in AttachmentVoter!'); + return match ($attribute) { + 'read', 'view' => 'read', + 'edit', 'create', 'delete' => 'edit', + 'show_history' => 'show_history', + default => throw new \RuntimeException('Encountered unknown attribute "'.$attribute.'" in AttachmentVoter!'), + }; } /** diff --git a/src/Security/Voter/ExtendedVoter.php b/src/Security/Voter/ExtendedVoter.php index 825d768c..2474d02b 100644 --- a/src/Security/Voter/ExtendedVoter.php +++ b/src/Security/Voter/ExtendedVoter.php @@ -34,13 +34,8 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter; */ abstract class ExtendedVoter extends Voter { - protected EntityManagerInterface $entityManager; - protected PermissionManager $resolver; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager) + public function __construct(protected PermissionManager $resolver, protected EntityManagerInterface $entityManager) { - $this->resolver = $resolver; - $this->entityManager = $entityManager; } final protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool @@ -57,7 +52,7 @@ abstract class ExtendedVoter extends Voter /** @var UserRepository $repo */ $repo = $this->entityManager->getRepository(User::class); $user = $repo->getAnonymousUser(); - if (null === $user) { + if (!$user instanceof \App\Entity\UserSystem\User) { return false; } } @@ -68,8 +63,6 @@ abstract class ExtendedVoter extends Voter /** * Similar to voteOnAttribute, but checking for the anonymous user is already done. * The current user (or the anonymous user) is passed by $user. - * - * @param string $attribute */ abstract protected function voteOnUser(string $attribute, $subject, User $user): bool; } diff --git a/src/Security/Voter/LogEntryVoter.php b/src/Security/Voter/LogEntryVoter.php index df1033c0..0c9f86da 100644 --- a/src/Security/Voter/LogEntryVoter.php +++ b/src/Security/Voter/LogEntryVoter.php @@ -30,14 +30,11 @@ use Symfony\Component\Security\Core\Security; class LogEntryVoter extends ExtendedVoter { - public const ALLOWED_OPS = ['read', 'show_details', 'delete']; + final public const ALLOWED_OPS = ['read', 'show_details', 'delete']; - private \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, private readonly \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); - $this->security = $security; } protected function voteOnUser(string $attribute, $subject, User $user): bool diff --git a/src/Security/Voter/OrderdetailVoter.php b/src/Security/Voter/OrderdetailVoter.php index 6b2ff874..f550807d 100644 --- a/src/Security/Voter/OrderdetailVoter.php +++ b/src/Security/Voter/OrderdetailVoter.php @@ -49,12 +49,9 @@ use Symfony\Component\Security\Core\Security; class OrderdetailVoter extends ExtendedVoter { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); - $this->security = $security; } protected const ALLOWED_PERMS = ['read', 'edit', 'create', 'delete', 'show_history', 'revert_element']; @@ -65,27 +62,16 @@ class OrderdetailVoter extends ExtendedVoter throw new \RuntimeException('This voter can only handle Orderdetail objects!'); } - switch ($attribute) { - case 'read': - $operation = 'read'; - break; - case 'edit': //As long as we can edit, we can also edit orderdetails - case 'create': - case 'delete': - $operation = 'edit'; - break; - case 'show_history': - $operation = 'show_history'; - break; - case 'revert_element': - $operation = 'revert_element'; - break; - default: - throw new \RuntimeException('Encountered unknown operation "'.$attribute.'"!'); - } + $operation = match ($attribute) { + 'read' => 'read', + 'edit', 'create', 'delete' => 'edit', + 'show_history' => 'show_history', + 'revert_element' => 'revert_element', + default => throw new \RuntimeException('Encountered unknown operation "'.$attribute.'"!'), + }; //If we have no part associated use the generic part permission - if (is_string($subject) || $subject->getPart() === null) { + if (is_string($subject) || !$subject->getPart() instanceof \App\Entity\Parts\Part) { return $this->resolver->inherit($user, 'parts', $operation) ?? false; } diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index 6e38c718..edc096a2 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -41,11 +41,8 @@ use Symfony\Component\Security\Core\Security; class ParameterVoter extends ExtendedVoter { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->security = $security; parent::__construct($resolver, $entityManager); } @@ -60,31 +57,14 @@ class ParameterVoter extends ExtendedVoter if (is_object($subject)) { //If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element $target_element = $subject->getElement(); - if ($target_element !== null) { - //Depending on the operation delegate either to the attachments element or to the attachment permission - - - switch ($attribute) { - //We can view the attachment if we can view the element - case 'read': - case 'view': - $operation = 'read'; - break; - //We can edit/create/delete the attachment if we can edit the element - case 'edit': - case 'create': - case 'delete': - $operation = 'edit'; - break; - case 'show_history': - $operation = 'show_history'; - break; - case 'revert_element': - $operation = 'revert_element'; - break; - default: - throw new RuntimeException('Unknown operation: '.$attribute); - } + if ($target_element instanceof \App\Entity\Base\AbstractDBElement) { + $operation = match ($attribute) { + 'read', 'view' => 'read', + 'edit', 'create', 'delete' => 'edit', + 'show_history' => 'show_history', + 'revert_element' => 'revert_element', + default => throw new RuntimeException('Unknown operation: '.$attribute), + }; return $this->security->isGranted($operation, $target_element); } @@ -118,7 +98,7 @@ class ParameterVoter extends ExtendedVoter $param = 'parts'; } else { - throw new RuntimeException('Encountered unknown Parameter type: ' . (is_object($subject) ? get_class($subject) : $subject)); + throw new RuntimeException('Encountered unknown Parameter type: ' . (is_object($subject) ? $subject::class : $subject)); } return $this->resolver->inherit($user, $param, $attribute) ?? false; diff --git a/src/Security/Voter/PartLotVoter.php b/src/Security/Voter/PartLotVoter.php index 1d495c9a..8293e234 100644 --- a/src/Security/Voter/PartLotVoter.php +++ b/src/Security/Voter/PartLotVoter.php @@ -49,12 +49,9 @@ use Symfony\Component\Security\Core\Security; class PartLotVoter extends ExtendedVoter { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); - $this->security = $security; } protected const ALLOWED_PERMS = ['read', 'edit', 'create', 'delete', 'show_history', 'revert_element', 'withdraw', 'add', 'move']; @@ -78,27 +75,16 @@ class PartLotVoter extends ExtendedVoter return $base_permission && $lot_permission; } - switch ($attribute) { - case 'read': - $operation = 'read'; - break; - case 'edit': //As long as we can edit, we can also edit orderdetails - case 'create': - case 'delete': - $operation = 'edit'; - break; - case 'show_history': - $operation = 'show_history'; - break; - case 'revert_element': - $operation = 'revert_element'; - break; - default: - throw new \RuntimeException('Encountered unknown operation "'.$attribute.'"!'); - } + $operation = match ($attribute) { + 'read' => 'read', + 'edit', 'create', 'delete' => 'edit', + 'show_history' => 'show_history', + 'revert_element' => 'revert_element', + default => throw new \RuntimeException('Encountered unknown operation "'.$attribute.'"!'), + }; //If we have no part associated use the generic part permission - if (is_string($subject) || $subject->getPart() === null) { + if (is_string($subject) || !$subject->getPart() instanceof \App\Entity\Parts\Part) { return $this->resolver->inherit($user, 'parts', $operation) ?? false; } diff --git a/src/Security/Voter/PartVoter.php b/src/Security/Voter/PartVoter.php index fb1e3a38..878fc6a4 100644 --- a/src/Security/Voter/PartVoter.php +++ b/src/Security/Voter/PartVoter.php @@ -32,7 +32,7 @@ use App\Entity\UserSystem\User; */ class PartVoter extends ExtendedVoter { - public const READ = 'read'; + final public const READ = 'read'; protected function supports($attribute, $subject): bool { diff --git a/src/Security/Voter/PricedetailVoter.php b/src/Security/Voter/PricedetailVoter.php index 8cae7452..98898ecf 100644 --- a/src/Security/Voter/PricedetailVoter.php +++ b/src/Security/Voter/PricedetailVoter.php @@ -49,12 +49,9 @@ use Symfony\Component\Security\Core\Security; class PricedetailVoter extends ExtendedVoter { - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) { parent::__construct($resolver, $entityManager); - $this->security = $security; } protected const ALLOWED_PERMS = ['read', 'edit', 'create', 'delete', 'show_history', 'revert_element']; @@ -65,27 +62,16 @@ class PricedetailVoter extends ExtendedVoter throw new \RuntimeException('This voter can only handle Pricedetails objects!'); } - switch ($attribute) { - case 'read': - $operation = 'read'; - break; - case 'edit': //As long as we can edit, we can also edit orderdetails - case 'create': - case 'delete': - $operation = 'edit'; - break; - case 'show_history': - $operation = 'show_history'; - break; - case 'revert_element': - $operation = 'revert_element'; - break; - default: - throw new \RuntimeException('Encountered unknown operation "'.$attribute.'"!'); - } + $operation = match ($attribute) { + 'read' => 'read', + 'edit', 'create', 'delete' => 'edit', + 'show_history' => 'show_history', + 'revert_element' => 'revert_element', + default => throw new \RuntimeException('Encountered unknown operation "'.$attribute.'"!'), + }; //If we have no part associated use the generic part permission - if (is_string($subject) || $subject->getOrderdetail() === null || $subject->getOrderdetail()->getPart() === null) { + if (is_string($subject) || !$subject->getOrderdetail() instanceof \App\Entity\PriceInformations\Orderdetail || !$subject->getOrderdetail()->getPart() instanceof \App\Entity\Parts\Part) { return $this->resolver->inherit($user, 'parts', $operation) ?? false; } diff --git a/src/Security/Voter/StructureVoter.php b/src/Security/Voter/StructureVoter.php index a37083ea..79cef811 100644 --- a/src/Security/Voter/StructureVoter.php +++ b/src/Security/Voter/StructureVoter.php @@ -77,11 +77,7 @@ class StructureVoter extends ExtendedVoter */ protected function instanceToPermissionName($subject): ?string { - if (!is_string($subject)) { - $class_name = get_class($subject); - } else { - $class_name = $subject; - } + $class_name = is_string($subject) ? $subject : $subject::class; //If it is existing in index, we can skip the loop if (isset(static::OBJ_PERM_MAP[$class_name])) { diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index ce910d8c..740d9861 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -44,13 +44,8 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach 'storage_location' => 'storelocation', ]; - private ObjectNormalizer $normalizer; - private StructuralElementFromNameDenormalizer $locationDenormalizer; - - public function __construct(ObjectNormalizer $normalizer, StructuralElementFromNameDenormalizer $locationDenormalizer) + public function __construct(private readonly ObjectNormalizer $normalizer, private readonly StructuralElementFromNameDenormalizer $locationDenormalizer) { - $this->normalizer = $normalizer; - $this->locationDenormalizer = $locationDenormalizer; } public function supportsNormalization($data, string $format = null): bool @@ -120,12 +115,12 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach throw new \InvalidArgumentException('This normalizer only supports Part objects!'); } - if ((isset($data['instock']) && trim($data['instock']) !== "") || (isset($data['storelocation']) && trim($data['storelocation']) !== "")) { + if ((isset($data['instock']) && trim((string) $data['instock']) !== "") || (isset($data['storelocation']) && trim((string) $data['storelocation']) !== "")) { $partLot = new PartLot(); if (isset($data['instock']) && $data['instock'] !== "") { //Replace comma with dot - $instock = (float) str_replace(',', '.', $data['instock']); + $instock = (float) str_replace(',', '.', (string) $data['instock']); $partLot->setAmount($instock); } else { @@ -157,7 +152,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach $pricedetail = new Pricedetail(); $pricedetail->setMinDiscountQuantity(1); $pricedetail->setPriceRelatedQuantity(1); - $price = BigDecimal::of(str_replace(',', '.', $data['price'])); + $price = BigDecimal::of(str_replace(',', '.', (string) $data['price'])); $pricedetail->setPrice($price); $orderdetail->addPricedetail($pricedetail); diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index 2d7fd3f3..e7b90744 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -31,15 +31,10 @@ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; class StructuralElementDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, CacheableSupportsMethodInterface { - private DenormalizerInterface $normalizer; - private EntityManagerInterface $entityManager; - private array $object_cache = []; - public function __construct(ObjectNormalizer $normalizer, EntityManagerInterface $entityManager) + public function __construct(private readonly ObjectNormalizer $normalizer, private readonly EntityManagerInterface $entityManager) { - $this->normalizer = $normalizer; - $this->entityManager = $entityManager; } public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool @@ -61,7 +56,7 @@ class StructuralElementDenormalizer implements \Symfony\Component\Serializer\Nor $path = $deserialized_entity->getFullPath(AbstractStructuralDBElement::PATH_DELIMITER_ARROW); $db_elements = $repo->getEntityByPath($path, AbstractStructuralDBElement::PATH_DELIMITER_ARROW); - if ($db_elements) { + if ($db_elements !== []) { //We already have the entity in the database, so we can return it return end($db_elements); } diff --git a/src/Serializer/StructuralElementFromNameDenormalizer.php b/src/Serializer/StructuralElementFromNameDenormalizer.php index 8516c951..9de31048 100644 --- a/src/Serializer/StructuralElementFromNameDenormalizer.php +++ b/src/Serializer/StructuralElementFromNameDenormalizer.php @@ -28,11 +28,8 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class StructuralElementFromNameDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface { - private EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(private readonly EntityManagerInterface $em) { - $this->em = $em; } public function supportsDenormalization($data, string $type, string $format = null): bool @@ -54,14 +51,14 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, Ca foreach ($elements as $element) { $this->em->persist($element); } - if (empty($elements)) { + if ($elements === []) { return null; } return end($elements); } $elements = $repo->getEntityByPath($data, $path_delimiter); - if (empty($elements)) { + if ($elements === []) { return null; } return end($elements); diff --git a/src/Serializer/StructuralElementNormalizer.php b/src/Serializer/StructuralElementNormalizer.php index 060fecaf..fb6a42b1 100644 --- a/src/Serializer/StructuralElementNormalizer.php +++ b/src/Serializer/StructuralElementNormalizer.php @@ -27,11 +27,8 @@ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; class StructuralElementNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface { - private NormalizerInterface $normalizer; - - public function __construct(ObjectNormalizer $normalizer) + public function __construct(private readonly ObjectNormalizer $normalizer) { - $this->normalizer = $normalizer; } public function supportsNormalization($data, string $format = null): bool diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php index 81b1334f..3057b5b1 100644 --- a/src/Services/Attachments/AttachmentManager.php +++ b/src/Services/Attachments/AttachmentManager.php @@ -35,11 +35,8 @@ use function strlen; */ class AttachmentManager { - protected AttachmentPathResolver $pathResolver; - - public function __construct(AttachmentPathResolver $pathResolver) + public function __construct(protected AttachmentPathResolver $pathResolver) { - $this->pathResolver = $pathResolver; } /** diff --git a/src/Services/Attachments/AttachmentPathResolver.php b/src/Services/Attachments/AttachmentPathResolver.php index 635d0bc6..116072b5 100644 --- a/src/Services/Attachments/AttachmentPathResolver.php +++ b/src/Services/Attachments/AttachmentPathResolver.php @@ -32,14 +32,12 @@ use Symfony\Component\Filesystem\Filesystem; */ class AttachmentPathResolver { - protected string $project_dir; - protected ?string $media_path; protected ?string $footprints_path; protected ?string $models_path; protected ?string $secure_path; - protected array $placeholders; + protected array $placeholders = ['%MEDIA%', '%BASE%/data/media', '%FOOTPRINTS%', '%FOOTPRINTS_3D%', '%SECURE%']; protected array $pathes; protected array $placeholders_regex; protected array $pathes_regex; @@ -53,18 +51,13 @@ class AttachmentPathResolver * Set to null if this ressource should be disabled. * @param string|null $models_path set to null if this ressource should be disabled */ - public function __construct(string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path) + public function __construct(protected string $project_dir, string $media_path, string $secure_path, ?string $footprints_path, ?string $models_path) { - $this->project_dir = $project_dir; - //Determine the path for our ressources $this->media_path = $this->parameterToAbsolutePath($media_path); $this->footprints_path = $this->parameterToAbsolutePath($footprints_path); $this->models_path = $this->parameterToAbsolutePath($models_path); $this->secure_path = $this->parameterToAbsolutePath($secure_path); - - //Here we define the valid placeholders and their replacement values - $this->placeholders = ['%MEDIA%', '%BASE%/data/media', '%FOOTPRINTS%', '%FOOTPRINTS_3D%', '%SECURE%']; $this->pathes = [$this->media_path, $this->media_path, $this->footprints_path, $this->models_path, $this->secure_path]; //Remove all disabled placeholders @@ -248,7 +241,7 @@ class AttachmentPathResolver $ret = []; foreach ($array as $item) { - $item = str_replace(['\\'], ['/'], $item); + $item = str_replace(['\\'], ['/'], (string) $item); $ret[] = '/'.preg_quote($item, '/').'/'; } diff --git a/src/Services/Attachments/AttachmentReverseSearch.php b/src/Services/Attachments/AttachmentReverseSearch.php index efcbb5bd..5f4f86de 100644 --- a/src/Services/Attachments/AttachmentReverseSearch.php +++ b/src/Services/Attachments/AttachmentReverseSearch.php @@ -34,18 +34,8 @@ use Symfony\Component\Filesystem\Filesystem; */ class AttachmentReverseSearch { - protected EntityManagerInterface $em; - protected AttachmentPathResolver $pathResolver; - protected CacheManager $cacheManager; - protected AttachmentURLGenerator $attachmentURLGenerator; - - public function __construct(EntityManagerInterface $em, AttachmentPathResolver $pathResolver, - CacheManager $cacheManager, AttachmentURLGenerator $attachmentURLGenerator) + public function __construct(protected EntityManagerInterface $em, protected AttachmentPathResolver $pathResolver, protected CacheManager $cacheManager, protected AttachmentURLGenerator $attachmentURLGenerator) { - $this->em = $em; - $this->pathResolver = $pathResolver; - $this->cacheManager = $cacheManager; - $this->attachmentURLGenerator = $attachmentURLGenerator; } /** diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index 4dca3c4c..c85470d8 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -55,16 +55,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; */ class AttachmentSubmitHandler { - protected AttachmentPathResolver $pathResolver; protected array $folder_mapping; - protected bool $allow_attachments_downloads; - protected HttpClientInterface $httpClient; - protected MimeTypesInterface $mimeTypes; - protected FileTypeFilterTools $filterTools; - /** - * @var string The user configured maximum upload size. This is a string like "10M" or "1G" and will be converted to - */ - protected string $max_upload_size; private ?int $max_upload_size_bytes = null; @@ -72,18 +63,13 @@ class AttachmentSubmitHandler 'asp', 'cgi', 'py', 'pl', 'exe', 'aspx', 'js', 'mjs', 'jsp', 'css', 'jar', 'html', 'htm', 'shtm', 'shtml', 'htaccess', 'htpasswd', '']; - public function __construct(AttachmentPathResolver $pathResolver, bool $allow_attachments_downloads, - HttpClientInterface $httpClient, MimeTypesInterface $mimeTypes, - FileTypeFilterTools $filterTools, string $max_upload_size) + public function __construct(protected AttachmentPathResolver $pathResolver, protected bool $allow_attachments_downloads, + protected HttpClientInterface $httpClient, protected MimeTypesInterface $mimeTypes, + protected FileTypeFilterTools $filterTools, /** + * @var string The user configured maximum upload size. This is a string like "10M" or "1G" and will be converted to + */ + protected string $max_upload_size) { - $this->pathResolver = $pathResolver; - $this->allow_attachments_downloads = $allow_attachments_downloads; - $this->httpClient = $httpClient; - $this->mimeTypes = $mimeTypes; - $this->max_upload_size = $max_upload_size; - - $this->filterTools = $filterTools; - //The mapping used to determine which folder will be used for an attachment type $this->folder_mapping = [ PartAttachment::class => 'part', @@ -155,25 +141,21 @@ class AttachmentSubmitHandler */ public function generateAttachmentPath(Attachment $attachment, bool $secure_upload = false): string { - if ($secure_upload) { - $base_path = $this->pathResolver->getSecurePath(); - } else { - $base_path = $this->pathResolver->getMediaPath(); - } + $base_path = $secure_upload ? $this->pathResolver->getSecurePath() : $this->pathResolver->getMediaPath(); //Ensure the given attachment class is known to mapping - if (!isset($this->folder_mapping[get_class($attachment)])) { - throw new InvalidArgumentException('The given attachment class is not known! The passed class was: '.get_class($attachment)); + if (!isset($this->folder_mapping[$attachment::class])) { + throw new InvalidArgumentException('The given attachment class is not known! The passed class was: '.$attachment::class); } //Ensure the attachment has an assigned element - if (null === $attachment->getElement()) { + if (!$attachment->getElement() instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { throw new InvalidArgumentException('The given attachment is not assigned to an element! An element is needed to generate a path!'); } //Build path return $base_path.DIRECTORY_SEPARATOR //Base path - .$this->folder_mapping[get_class($attachment)].DIRECTORY_SEPARATOR.$attachment->getElement()->getID(); + .$this->folder_mapping[$attachment::class].DIRECTORY_SEPARATOR.$attachment->getElement()->getID(); } /** @@ -194,7 +176,7 @@ class AttachmentSubmitHandler $options = $resolver->resolve($options); //When a file is given then upload it, otherwise check if we need to download the URL - if ($file) { + if ($file instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) { $this->upload($attachment, $file, $options); } elseif ($options['download_url'] && $attachment->isExternal()) { $this->downloadURL($attachment, $options); @@ -210,7 +192,7 @@ class AttachmentSubmitHandler //this is only possible if the attachment is new (not yet persisted to DB) if ($options['become_preview_if_empty'] && null === $attachment->getID() && $attachment->isPicture()) { $element = $attachment->getElement(); - if ($element instanceof AttachmentContainingDBElement && null === $element->getMasterPictureAttachment()) { + if ($element instanceof AttachmentContainingDBElement && !$element->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { $element->setMasterPictureAttachment($attachment); } } @@ -220,8 +202,6 @@ class AttachmentSubmitHandler /** * Rename attachments with an unsafe extension (meaning files which would be run by a to a safe one). - * @param Attachment $attachment - * @return Attachment */ protected function renameBlacklistedExtensions(Attachment $attachment): Attachment { @@ -391,7 +371,7 @@ class AttachmentSubmitHandler $new_path = $this->pathResolver->realPathToPlaceholder($new_path); //Save the path to the attachment $attachment->setPath($new_path); - } catch (TransportExceptionInterface $transportExceptionInterface) { + } catch (TransportExceptionInterface) { throw new AttachmentDownloadException('Transport error!'); } @@ -428,8 +408,6 @@ class AttachmentSubmitHandler /** * Parses the given file size string and returns the size in bytes. * Taken from https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/Validator/Constraints/File.php - * @param string $maxSize - * @return int */ private function parseFileSizeString(string $maxSize): int { diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index cbeab36a..7108cf12 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -32,26 +32,12 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class AttachmentURLGenerator { - protected Packages $assets; protected string $public_path; - protected AttachmentPathResolver $pathResolver; - protected UrlGeneratorInterface $urlGenerator; - protected AttachmentManager $attachmentHelper; - protected CacheManager $thumbnailManager; - protected LoggerInterface $logger; - - public function __construct(Packages $assets, AttachmentPathResolver $pathResolver, - UrlGeneratorInterface $urlGenerator, AttachmentManager $attachmentHelper, - CacheManager $thumbnailManager, LoggerInterface $logger) + public function __construct(protected Packages $assets, protected AttachmentPathResolver $pathResolver, + protected UrlGeneratorInterface $urlGenerator, protected AttachmentManager $attachmentHelper, + protected CacheManager $thumbnailManager, protected LoggerInterface $logger) { - $this->assets = $assets; - $this->pathResolver = $pathResolver; - $this->urlGenerator = $urlGenerator; - $this->attachmentHelper = $attachmentHelper; - $this->thumbnailManager = $thumbnailManager; - $this->logger = $logger; - //Determine a normalized path to the public folder (assets are relative to this folder) $this->public_path = $this->pathResolver->parameterToAbsolutePath('public'); } diff --git a/src/Services/Attachments/BuiltinAttachmentsFinder.php b/src/Services/Attachments/BuiltinAttachmentsFinder.php index 7c3c8f4b..f3f8740f 100644 --- a/src/Services/Attachments/BuiltinAttachmentsFinder.php +++ b/src/Services/Attachments/BuiltinAttachmentsFinder.php @@ -33,13 +33,8 @@ use Symfony\Contracts\Cache\CacheInterface; */ class BuiltinAttachmentsFinder { - protected AttachmentPathResolver $pathResolver; - protected CacheInterface $cache; - - public function __construct(CacheInterface $cache, AttachmentPathResolver $pathResolver) + public function __construct(protected CacheInterface $cache, protected AttachmentPathResolver $pathResolver) { - $this->pathResolver = $pathResolver; - $this->cache = $cache; } /** @@ -49,7 +44,6 @@ class BuiltinAttachmentsFinder * '%FOOTPRINTS%/path/to/folder/file1.png', * '%FOOTPRINTS%/path/to/folder/file2.png', * ] - * @return array */ public function getListOfFootprintsGroupedByFolder(): array { @@ -109,7 +103,7 @@ class BuiltinAttachmentsFinder return $results; }); - } catch (InvalidArgumentException $invalidArgumentException) { + } catch (InvalidArgumentException) { return []; } } diff --git a/src/Services/Attachments/FileTypeFilterTools.php b/src/Services/Attachments/FileTypeFilterTools.php index 1b06655a..948b429b 100644 --- a/src/Services/Attachments/FileTypeFilterTools.php +++ b/src/Services/Attachments/FileTypeFilterTools.php @@ -43,13 +43,8 @@ class FileTypeFilterTools protected const AUDIO_EXTS = ['mp3', 'flac', 'ogg', 'oga', 'wav', 'm4a', 'opus']; protected const ALLOWED_MIME_PLACEHOLDERS = ['image/*', 'audio/*', 'video/*']; - protected MimeTypesInterface $mimeTypes; - protected CacheInterface $cache; - - public function __construct(MimeTypesInterface $mimeTypes, CacheInterface $cache) + public function __construct(protected MimeTypesInterface $mimeTypes, protected CacheInterface $cache) { - $this->mimeTypes = $mimeTypes; - $this->cache = $cache; } /** diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php index 39d1c65c..5917e88b 100644 --- a/src/Services/Attachments/PartPreviewGenerator.php +++ b/src/Services/Attachments/PartPreviewGenerator.php @@ -27,11 +27,8 @@ use App\Entity\Parts\Part; class PartPreviewGenerator { - protected AttachmentManager $attachmentHelper; - - public function __construct(AttachmentManager $attachmentHelper) + public function __construct(protected AttachmentManager $attachmentHelper) { - $this->attachmentHelper = $attachmentHelper; } /** @@ -55,21 +52,21 @@ class PartPreviewGenerator $list[] = $attachment; } - if (null !== $part->getFootprint()) { + if ($part->getFootprint() instanceof \App\Entity\Parts\Footprint) { $attachment = $part->getFootprint()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; } } - if (null !== $part->getBuiltProject()) { + if ($part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { $attachment = $part->getBuiltProject()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; } } - if (null !== $part->getCategory()) { + if ($part->getCategory() instanceof \App\Entity\Parts\Category) { $attachment = $part->getCategory()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; @@ -77,7 +74,7 @@ class PartPreviewGenerator } foreach ($part->getPartLots() as $lot) { - if (null !== $lot->getStorageLocation()) { + if ($lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { $attachment = $lot->getStorageLocation()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; @@ -85,14 +82,14 @@ class PartPreviewGenerator } } - if (null !== $part->getPartUnit()) { + if ($part->getPartUnit() instanceof \App\Entity\Parts\MeasurementUnit) { $attachment = $part->getPartUnit()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; } } - if (null !== $part->getManufacturer()) { + if ($part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer) { $attachment = $part->getManufacturer()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; @@ -117,7 +114,7 @@ class PartPreviewGenerator } //Otherwise check if the part has a footprint with a valid master attachment - if (null !== $part->getFootprint()) { + if ($part->getFootprint() instanceof \App\Entity\Parts\Footprint) { $attachment = $part->getFootprint()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { return $attachment; @@ -125,7 +122,7 @@ class PartPreviewGenerator } //With lowest priority use the master attachment of the project this part represents (when existing) - if (null !== $part->getBuiltProject()) { + if ($part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { $attachment = $part->getBuiltProject()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { return $attachment; @@ -145,7 +142,7 @@ class PartPreviewGenerator */ protected function isAttachmentValidPicture(?Attachment $attachment): bool { - return null !== $attachment + return $attachment instanceof \App\Entity\Attachments\Attachment && $attachment->isPicture() && $this->attachmentHelper->isFileExisting($attachment); } diff --git a/src/Services/CustomEnvVarProcessor.php b/src/Services/CustomEnvVarProcessor.php index 8969b765..f269cc7d 100644 --- a/src/Services/CustomEnvVarProcessor.php +++ b/src/Services/CustomEnvVarProcessor.php @@ -35,7 +35,7 @@ final class CustomEnvVarProcessor implements EnvVarProcessorInterface $env = $getEnv($name); return !empty($env) && 'null://null' !== $env; - } catch (EnvNotFoundException $envNotFoundException) { + } catch (EnvNotFoundException) { return false; } } diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index cbe8344f..b31ecf07 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -50,15 +50,10 @@ use Symfony\Contracts\Translation\TranslatorInterface; class ElementTypeNameGenerator { - protected TranslatorInterface $translator; - private EntityURLGenerator $entityURLGenerator; protected array $mapping; - public function __construct(TranslatorInterface $translator, EntityURLGenerator $entityURLGenerator) + public function __construct(protected TranslatorInterface $translator, private readonly EntityURLGenerator $entityURLGenerator) { - $this->translator = $translator; - $this->entityURLGenerator = $entityURLGenerator; - //Child classes has to become before parent classes $this->mapping = [ Attachment::class => $this->translator->trans('attachment.label'), @@ -97,7 +92,7 @@ class ElementTypeNameGenerator */ public function getLocalizedTypeLabel($entity): string { - $class = is_string($entity) ? $entity : get_class($entity); + $class = is_string($entity) ? $entity : $entity::class; //Check if we have a direct array entry for our entity class, then we can use it if (isset($this->mapping[$class])) { @@ -112,7 +107,7 @@ class ElementTypeNameGenerator } //When nothing was found throw an exception - throw new EntityNotSupportedException(sprintf('No localized label for the element with type %s was found!', is_object($entity) ? get_class($entity) : (string) $entity)); + throw new EntityNotSupportedException(sprintf('No localized label for the element with type %s was found!', is_object($entity) ? $entity::class : (string) $entity)); } /** @@ -143,7 +138,6 @@ class ElementTypeNameGenerator * "Type: ID" (on elements without a name). If possible the value is given as a link to the element. * @param AbstractDBElement $entity The entity for which the label should be generated * @param bool $include_associated If set to true, the associated entity (like the part belonging to a part lot) is included in the label to give further information - * @return string */ public function formatLabelHTMLForEntity(AbstractDBElement $entity, bool $include_associated = false): string { @@ -155,7 +149,7 @@ class ElementTypeNameGenerator $this->entityURLGenerator->infoURL($entity), $this->getTypeNameCombination($entity, true) ); - } catch (EntityNotSupportedException $exception) { + } catch (EntityNotSupportedException) { $tmp = $this->getTypeNameCombination($entity, true); } } else { //Target does not have a name @@ -168,17 +162,17 @@ class ElementTypeNameGenerator //Add a hint to the associated element if possible if ($include_associated) { - if ($entity instanceof Attachment && null !== $entity->getElement()) { + if ($entity instanceof Attachment && $entity->getElement() instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { $on = $entity->getElement(); - } elseif ($entity instanceof AbstractParameter && null !== $entity->getElement()) { + } elseif ($entity instanceof AbstractParameter && $entity->getElement() instanceof \App\Entity\Base\AbstractDBElement) { $on = $entity->getElement(); - } elseif ($entity instanceof PartLot && null !== $entity->getPart()) { + } elseif ($entity instanceof PartLot && $entity->getPart() instanceof \App\Entity\Parts\Part) { $on = $entity->getPart(); - } elseif ($entity instanceof Orderdetail && null !== $entity->getPart()) { + } elseif ($entity instanceof Orderdetail && $entity->getPart() instanceof \App\Entity\Parts\Part) { $on = $entity->getPart(); - } elseif ($entity instanceof Pricedetail && null !== $entity->getOrderdetail() && null !== $entity->getOrderdetail()->getPart()) { + } elseif ($entity instanceof Pricedetail && $entity->getOrderdetail() instanceof \App\Entity\PriceInformations\Orderdetail && $entity->getOrderdetail()->getPart() instanceof \App\Entity\Parts\Part) { $on = $entity->getOrderdetail()->getPart(); - } elseif ($entity instanceof ProjectBOMEntry && null !== $entity->getProject()) { + } elseif ($entity instanceof ProjectBOMEntry && $entity->getProject() instanceof \App\Entity\ProjectSystem\Project) { $on = $entity->getProject(); } @@ -189,7 +183,7 @@ class ElementTypeNameGenerator $this->entityURLGenerator->infoURL($on), $this->getTypeNameCombination($on, true) ); - } catch (EntityNotSupportedException $exception) { + } catch (EntityNotSupportedException) { } } } @@ -200,9 +194,6 @@ class ElementTypeNameGenerator /** * Create a HTML formatted label for a deleted element of which we only know the class and the ID. * Please note that it is not checked if the element really not exists anymore, so you have to do this yourself. - * @param string $class - * @param int $id - * @return string */ public function formatElementDeletedHTML(string $class, int $id): string { diff --git a/src/Services/EntityURLGenerator.php b/src/Services/EntityURLGenerator.php index 5f45e58c..487bed39 100644 --- a/src/Services/EntityURLGenerator.php +++ b/src/Services/EntityURLGenerator.php @@ -57,13 +57,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; */ class EntityURLGenerator { - protected UrlGeneratorInterface $urlGenerator; - protected AttachmentURLGenerator $attachmentURLGenerator; - - public function __construct(UrlGeneratorInterface $urlGenerator, AttachmentURLGenerator $attachmentURLGenerator) + public function __construct(protected UrlGeneratorInterface $urlGenerator, protected AttachmentURLGenerator $attachmentURLGenerator) { - $this->urlGenerator = $urlGenerator; - $this->attachmentURLGenerator = $attachmentURLGenerator; } /** @@ -79,29 +74,19 @@ class EntityURLGenerator * @throws EntityNotSupportedException thrown if the entity is not supported for the given type * @throws InvalidArgumentException thrown if the givent type is not existing */ - public function getURL($entity, string $type): string + public function getURL(mixed $entity, string $type): string { - switch ($type) { - case 'info': - return $this->infoURL($entity); - case 'edit': - return $this->editURL($entity); - case 'create': - return $this->createURL($entity); - case 'clone': - return $this->cloneURL($entity); - case 'list': - case 'list_parts': - return $this->listPartsURL($entity); - case 'delete': - return $this->deleteURL($entity); - case 'file_download': - return $this->downloadURL($entity); - case 'file_view': - return $this->viewURL($entity); - } - - throw new InvalidArgumentException('Method is not supported!'); + return match ($type) { + 'info' => $this->infoURL($entity), + 'edit' => $this->editURL($entity), + 'create' => $this->createURL($entity), + 'clone' => $this->cloneURL($entity), + 'list', 'list_parts' => $this->listPartsURL($entity), + 'delete' => $this->deleteURL($entity), + 'file_download' => $this->downloadURL($entity), + 'file_view' => $this->viewURL($entity), + default => throw new InvalidArgumentException('Method is not supported!'), + }; } /** @@ -134,7 +119,7 @@ class EntityURLGenerator 'timestamp' => $dateTime->getTimestamp(), ] ); - } catch (EntityNotSupportedException $exception) { + } catch (EntityNotSupportedException) { if ($entity instanceof PartLot) { return $this->urlGenerator->generate('part_info', [ 'id' => $entity->getPart()->getID(), @@ -168,7 +153,7 @@ class EntityURLGenerator } //Otherwise throw an error - throw new EntityNotSupportedException('The given entity is not supported yet! Passed class type: '.get_class($entity)); + throw new EntityNotSupportedException('The given entity is not supported yet! Passed class type: '.$entity::class); } public function viewURL(Attachment $entity): string @@ -191,7 +176,7 @@ class EntityURLGenerator } //Otherwise throw an error - throw new EntityNotSupportedException(sprintf('The given entity is not supported yet! Passed class type: %s', get_class($entity))); + throw new EntityNotSupportedException(sprintf('The given entity is not supported yet! Passed class type: %s', $entity::class)); } /** @@ -235,7 +220,7 @@ class EntityURLGenerator * * @throws EntityNotSupportedException If the method is not supported for the given Entity */ - public function editURL($entity): string + public function editURL(mixed $entity): string { $map = [ Part::class => 'part_edit', @@ -265,7 +250,7 @@ class EntityURLGenerator * * @throws EntityNotSupportedException If the method is not supported for the given Entity */ - public function createURL($entity): string + public function createURL(mixed $entity): string { $map = [ Part::class => 'part_new', @@ -373,9 +358,9 @@ class EntityURLGenerator * * @throws EntityNotSupportedException */ - protected function mapToController(array $map, $entity): string + protected function mapToController(array $map, mixed $entity): string { - $class = get_class($entity); + $class = $entity::class; //Check if we have an direct mapping for the given class if (!array_key_exists($class, $map)) { @@ -386,7 +371,7 @@ class EntityURLGenerator } } - throw new EntityNotSupportedException(sprintf('The given entity is not supported yet! Passed class type: %s', get_class($entity))); + throw new EntityNotSupportedException(sprintf('The given entity is not supported yet! Passed class type: %s', $entity::class)); } return $map[$class]; diff --git a/src/Services/Formatters/AmountFormatter.php b/src/Services/Formatters/AmountFormatter.php index ccc4c4b3..d092f2cd 100644 --- a/src/Services/Formatters/AmountFormatter.php +++ b/src/Services/Formatters/AmountFormatter.php @@ -32,25 +32,20 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class AmountFormatter { - protected SIFormatter $siFormatter; - - public function __construct(SIFormatter $siFormatter) + public function __construct(protected SIFormatter $siFormatter) { - $this->siFormatter = $siFormatter; } /** * Formats the given value using the measurement unit and options. * - * @param float|string|int $value * @param MeasurementUnit|null $unit The measurement unit, whose unit symbol should be used for formatting. * If set to null, it is assumed that the part amount is measured in pieces. * * @return string The formatted string - * * @throws InvalidArgumentException thrown if $value is not numeric */ - public function format($value, ?MeasurementUnit $unit = null, array $options = []): string + public function format(float|string|int $value, ?MeasurementUnit $unit = null, array $options = []): string { if (!is_numeric($value)) { throw new InvalidArgumentException('$value must be an numeric value!'); diff --git a/src/Services/Formatters/MarkdownParser.php b/src/Services/Formatters/MarkdownParser.php index 1c1d8ff8..f3ef07df 100644 --- a/src/Services/Formatters/MarkdownParser.php +++ b/src/Services/Formatters/MarkdownParser.php @@ -29,11 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class MarkdownParser { - protected TranslatorInterface $translator; - - public function __construct(TranslatorInterface $translator) + public function __construct(protected TranslatorInterface $translator) { - $this->translator = $translator; } /** diff --git a/src/Services/Formatters/MoneyFormatter.php b/src/Services/Formatters/MoneyFormatter.php index 1907fe90..3e65e159 100644 --- a/src/Services/Formatters/MoneyFormatter.php +++ b/src/Services/Formatters/MoneyFormatter.php @@ -28,12 +28,10 @@ use NumberFormatter; class MoneyFormatter { - protected string $base_currency; protected string $locale; - public function __construct(string $base_currency) + public function __construct(protected string $base_currency) { - $this->base_currency = $base_currency; $this->locale = Locale::getDefault(); } @@ -45,10 +43,10 @@ class MoneyFormatter * @param int $decimals the number of decimals that should be shown * @param bool $show_all_digits if set to true, all digits are shown, even if they are null */ - public function format($value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string + public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string { $iso_code = $this->base_currency; - if (null !== $currency && !empty($currency->getIsoCode())) { + if ($currency instanceof \App\Entity\PriceInformations\Currency && !empty($currency->getIsoCode())) { $iso_code = $currency->getIsoCode(); } diff --git a/src/Services/Formatters/SIFormatter.php b/src/Services/Formatters/SIFormatter.php index 619c2de3..a6d69d0b 100644 --- a/src/Services/Formatters/SIFormatter.php +++ b/src/Services/Formatters/SIFormatter.php @@ -93,11 +93,7 @@ class SIFormatter [$divisor, $symbol] = $this->getPrefixByMagnitude($this->getMagnitude($value)); $value /= $divisor; //Build the format string, e.g.: %.2d km - if ('' !== $unit || '' !== $symbol) { - $format_string = '%.'.$decimals.'f '.$symbol.$unit; - } else { - $format_string = '%.'.$decimals.'f'; - } + $format_string = '' !== $unit || '' !== $symbol ? '%.'.$decimals.'f '.$symbol.$unit : '%.'.$decimals.'f'; return sprintf($format_string, $value); } diff --git a/src/Services/ImportExportSystem/BOMImporter.php b/src/Services/ImportExportSystem/BOMImporter.php index 72fa84d5..72103436 100644 --- a/src/Services/ImportExportSystem/BOMImporter.php +++ b/src/Services/ImportExportSystem/BOMImporter.php @@ -54,9 +54,6 @@ class BOMImporter /** * Converts the given file into an array of BOM entries using the given options and save them into the given project. * The changes are not saved into the database yet. - * @param File $file - * @param array $options - * @param Project $project * @return ProjectBOMEntry[] */ public function importFileIntoProject(File $file, Project $project, array $options): array @@ -73,8 +70,6 @@ class BOMImporter /** * Converts the given file into an array of BOM entries using the given options. - * @param File $file - * @param array $options * @return ProjectBOMEntry[] */ public function fileToBOMEntries(File $file, array $options): array @@ -94,12 +89,10 @@ class BOMImporter $resolver = $this->configureOptions($resolver); $options = $resolver->resolve($options); - switch ($options['type']) { - case 'kicad_pcbnew': - return $this->parseKiCADPCB($data, $options); - default: - throw new InvalidArgumentException('Invalid import type!'); - } + return match ($options['type']) { + 'kicad_pcbnew' => $this->parseKiCADPCB($data, $options), + default => throw new InvalidArgumentException('Invalid import type!'), + }; } private function parseKiCADPCB(string $data, array $options = []): array @@ -112,9 +105,7 @@ class BOMImporter foreach ($csv->getRecords() as $offset => $entry) { //Translate the german field names to english - $entry = array_combine(array_map(static function ($key) { - return self::MAP_KICAD_PCB_FIELDS[$key] ?? $key; - }, array_keys($entry)), $entry); + $entry = array_combine(array_map(static fn($key) => self::MAP_KICAD_PCB_FIELDS[$key] ?? $key, array_keys($entry)), $entry); //Ensure that the entry has all required fields if (!isset ($entry['Designator'])) { diff --git a/src/Services/ImportExportSystem/EntityExporter.php b/src/Services/ImportExportSystem/EntityExporter.php index a4825869..a4c3b48e 100644 --- a/src/Services/ImportExportSystem/EntityExporter.php +++ b/src/Services/ImportExportSystem/EntityExporter.php @@ -39,11 +39,8 @@ use function Symfony\Component\String\u; */ class EntityExporter { - protected SerializerInterface $serializer; - - public function __construct(SerializerInterface $serializer) + public function __construct(protected SerializerInterface $serializer) { - $this->serializer = $serializer; } protected function configureOptions(OptionsResolver $resolver): void @@ -67,7 +64,7 @@ class EntityExporter * @param array $options The options to use for exporting * @return string The serialized data */ - public function exportEntities($entities, array $options): string + public function exportEntities(\App\Entity\Base\AbstractNamedDBElement|array $entities, array $options): string { if (!is_array($entities)) { $entities = [$entities]; @@ -111,7 +108,7 @@ class EntityExporter * * @throws ReflectionException */ - public function exportEntityFromRequest($entities, Request $request): Response + public function exportEntityFromRequest(\App\Entity\Base\AbstractNamedDBElement|array $entities, Request $request): Response { $options = [ 'format' => $request->get('format') ?? 'json', diff --git a/src/Services/ImportExportSystem/EntityImporter.php b/src/Services/ImportExportSystem/EntityImporter.php index c798f9f5..60014554 100644 --- a/src/Services/ImportExportSystem/EntityImporter.php +++ b/src/Services/ImportExportSystem/EntityImporter.php @@ -38,15 +38,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; class EntityImporter { - protected SerializerInterface $serializer; - protected EntityManagerInterface $em; - protected ValidatorInterface $validator; - - public function __construct(SerializerInterface $serializer, EntityManagerInterface $em, ValidatorInterface $validator) + public function __construct(protected SerializerInterface $serializer, protected EntityManagerInterface $em, protected ValidatorInterface $validator) { - $this->serializer = $serializer; - $this->em = $em; - $this->validator = $validator; } /** @@ -68,7 +61,7 @@ class EntityImporter if (!is_a($class_name, AbstractNamedDBElement::class, true)) { throw new InvalidArgumentException('$class_name must be a StructuralDBElement type!'); } - if (null !== $parent && !is_a($parent, $class_name)) { + if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement && !$parent instanceof $class_name) { throw new InvalidArgumentException('$parent must have the same type as specified in $class_name!'); } @@ -297,20 +290,13 @@ class EntityImporter //Convert the extension to lower case $extension = strtolower($extension); - switch ($extension) { - case 'json': - return 'json'; - case 'xml': - return 'xml'; - case 'csv': - case 'tsv': - return 'csv'; - case 'yaml': - case 'yml': - return 'yaml'; - default: - return null; - } + return match ($extension) { + 'json' => 'json', + 'xml' => 'xml', + 'csv', 'tsv' => 'csv', + 'yaml', 'yml' => 'yaml', + default => null, + }; } /** diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php index 52732a44..31939d31 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php @@ -87,7 +87,7 @@ class PKDatastructureImporter $this->em->flush(); - return count($distributor_data); + return is_countable($distributor_data) ? count($distributor_data) : 0; } public function importManufacturers(array $data): int @@ -130,7 +130,7 @@ class PKDatastructureImporter $this->importAttachments($data, 'manufacturericlogo', Manufacturer::class, 'manufacturer_id', ManufacturerAttachment::class); - return count($manufacturer_data); + return is_countable($manufacturer_data) ? count($manufacturer_data) : 0; } public function importPartUnits(array $data): int @@ -151,7 +151,7 @@ class PKDatastructureImporter $this->em->flush(); - return count($partunit_data); + return is_countable($partunit_data) ? count($partunit_data) : 0; } public function importCategories(array $data): int @@ -180,15 +180,11 @@ class PKDatastructureImporter } $this->em->flush(); - return count($partcategory_data); + return is_countable($partcategory_data) ? count($partcategory_data) : 0; } /** * The common import functions for footprints and storeloactions - * @param array $data - * @param string $target_class - * @param string $data_prefix - * @return int */ private function importElementsWithCategory(array $data, string $target_class, string $data_prefix): int { @@ -249,7 +245,7 @@ class PKDatastructureImporter $this->em->flush(); - return count($footprint_data) + count($footprintcategory_data); + return (is_countable($footprint_data) ? count($footprint_data) : 0) + (is_countable($footprintcategory_data) ? count($footprintcategory_data) : 0); } public function importFootprints(array $data): int diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php index 3709fac2..d51bc225 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php @@ -28,18 +28,14 @@ use Doctrine\ORM\EntityManagerInterface; */ class PKImportHelper { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $em; } /** * Purges the database tables for the import, so that all data can be created from scratch. * Existing users and groups are not purged. * This is needed to avoid ID collisions. - * @return void */ public function purgeDatabaseForImport(): void { @@ -50,8 +46,6 @@ class PKImportHelper /** * Extracts the current database schema version from the PartKeepr XML dump. - * @param array $data - * @return string */ public function getDatabaseSchemaVersion(array $data): string { @@ -64,7 +58,6 @@ class PKImportHelper /** * Checks that the database schema of the PartKeepr XML dump is compatible with the importer - * @param array $data * @return bool True if the schema is compatible, false otherwise */ public function checkVersion(array $data): bool diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php index a318c281..76326ebd 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php @@ -45,7 +45,6 @@ trait PKImportHelperTrait * @param array $attachment_row The attachment row from the PartKeepr database * @param string $target_class The target class for the attachment * @param string $type The type of the attachment (attachment or image) - * @return Attachment * @throws \Exception */ protected function convertAttachmentDataToEntity(array $attachment_row, string $target_class, string $type): Attachment @@ -87,10 +86,10 @@ trait PKImportHelperTrait //Use mime type to determine the extension like PartKeepr does in legacy implementation (just use the second part of the mime type) //See UploadedFile.php:291 in PartKeepr (https://github.com/partkeepr/PartKeepr/blob/f6176c3354b24fa39ac8bc4328ee0df91de3d5b6/src/PartKeepr/UploadedFileBundle/Entity/UploadedFile.php#L291) if (!empty ($attachment_row['mimetype'])) { - $attachment_row['extension'] = explode('/', $attachment_row['mimetype'])[1]; + $attachment_row['extension'] = explode('/', (string) $attachment_row['mimetype'])[1]; } else { //If the mime type is empty, we use the original extension - $attachment_row['extension'] = pathinfo($attachment_row['originalname'], PATHINFO_EXTENSION); + $attachment_row['extension'] = pathinfo((string) $attachment_row['originalname'], PATHINFO_EXTENSION); } } @@ -115,7 +114,6 @@ trait PKImportHelperTrait * @param string $target_class The target class (e.g. Part) * @param string $target_id_field The field name where the target ID is stored * @param string $attachment_class The attachment class (e.g. PartAttachment) - * @return void */ protected function importAttachments(array $data, string $table_name, string $target_class, string $target_id_field, string $attachment_class): void { @@ -156,12 +154,9 @@ trait PKImportHelperTrait /** * Assigns the parent to the given entity, using the numerical IDs from the imported data. - * @param string $class - * @param int|string $element_id - * @param int|string $parent_id * @return AbstractStructuralDBElement The structural element that was modified (with $element_id) */ - protected function setParent(string $class, $element_id, $parent_id): AbstractStructuralDBElement + protected function setParent(string $class, int|string $element_id, int|string $parent_id): AbstractStructuralDBElement { $element = $this->em->find($class, (int) $element_id); if (!$element) { @@ -184,7 +179,6 @@ trait PKImportHelperTrait /** * Sets the given field of the given entity to the entity with the given ID. - * @return AbstractDBElement */ protected function setAssociationField(AbstractDBElement $element, string $field, string $other_class, $other_id): AbstractDBElement { @@ -205,11 +199,8 @@ trait PKImportHelperTrait /** * Set the ID of an entity to a specific value. Must be called before persisting the entity, but before flushing. - * @param AbstractDBElement $element - * @param int|string $id - * @return void */ - protected function setIDOfEntity(AbstractDBElement $element, $id): void + protected function setIDOfEntity(AbstractDBElement $element, int|string $id): void { if (!is_int($id) && !is_string($id)) { throw new \InvalidArgumentException('ID must be an integer or string'); @@ -217,7 +208,7 @@ trait PKImportHelperTrait $id = (int) $id; - $metadata = $this->em->getClassMetadata(get_class($element)); + $metadata = $this->em->getClassMetadata($element::class); $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator()); $metadata->setIdentifierValues($element, ['id' => $id]); diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php index 4d3af4f4..e192eefa 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php @@ -45,7 +45,6 @@ class PKOptionalImporter /** * Import the projects from the given data. - * @param array $data * @return int The number of imported projects */ public function importProjects(array $data): int @@ -99,12 +98,11 @@ class PKOptionalImporter $this->importAttachments($data, 'projectattachment', Project::class, 'project_id', ProjectAttachment::class); - return count($projects_data); + return is_countable($projects_data) ? count($projects_data) : 0; } /** * Import the users from the given data. - * @param array $data * @return int The number of imported users */ public function importUsers(array $data): int @@ -144,6 +142,6 @@ class PKOptionalImporter $this->em->flush(); - return count($users_data); + return is_countable($users_data) ? count($users_data) : 0; } } \ No newline at end of file diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php index 3e00b033..3690ccbc 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php @@ -45,13 +45,10 @@ class PKPartImporter { use PKImportHelperTrait; - private string $base_currency; - - public function __construct(EntityManagerInterface $em, PropertyAccessorInterface $propertyAccessor, string $default_currency) + public function __construct(EntityManagerInterface $em, PropertyAccessorInterface $propertyAccessor, private readonly string $base_currency) { $this->em = $em; $this->propertyAccessor = $propertyAccessor; - $this->base_currency = $default_currency; } public function importParts(array $data): int @@ -128,7 +125,7 @@ class PKPartImporter //Import attachments $this->importAttachments($data, 'partattachment', Part::class, 'part_id', PartAttachment::class); - return count($part_data); + return is_countable($part_data) ? count($part_data) : 0; } protected function importPartManufacturers(array $data): void @@ -146,7 +143,7 @@ class PKPartImporter throw new \RuntimeException(sprintf('Could not find part with ID %s', $partmanufacturer['part_id'])); } $manufacturer = $this->em->find(Manufacturer::class, (int) $partmanufacturer['manufacturer_id']); - if (!$manufacturer) { + if (!$manufacturer instanceof \App\Entity\Parts\Manufacturer) { throw new \RuntimeException(sprintf('Could not find manufacturer with ID %s', $partmanufacturer['manufacturer_id'])); } $part->setManufacturer($manufacturer); @@ -190,7 +187,7 @@ class PKPartImporter } $part = $this->em->find(Part::class, (int) $partparameter['part_id']); - if (!$part) { + if (!$part instanceof \App\Entity\Parts\Part) { throw new \RuntimeException(sprintf('Could not find part with ID %s', $partparameter['part_id'])); } @@ -203,8 +200,6 @@ class PKPartImporter /** * Returns the currency for the given ISO code. If the currency does not exist, it is created. * This function returns null if the ISO code is the base currency. - * @param string $currency_iso_code - * @return Currency|null */ protected function getOrCreateCurrency(string $currency_iso_code): ?Currency { @@ -240,12 +235,12 @@ class PKPartImporter foreach ($data['partdistributor'] as $partdistributor) { //Retrieve the part $part = $this->em->find(Part::class, (int) $partdistributor['part_id']); - if (!$part) { + if (!$part instanceof \App\Entity\Parts\Part) { throw new \RuntimeException(sprintf('Could not find part with ID %s', $partdistributor['part_id'])); } //Retrieve the distributor $supplier = $this->em->find(Supplier::class, (int) $partdistributor['distributor_id']); - if (!$supplier) { + if (!$supplier instanceof \App\Entity\Parts\Supplier) { throw new \RuntimeException(sprintf('Could not find supplier with ID %s', $partdistributor['distributor_id'])); } @@ -305,9 +300,6 @@ class PKPartImporter /** * Returns the (parameter) unit symbol for the given ID. - * @param array $data - * @param int $id - * @return string */ protected function getUnitSymbol(array $data, int $id): string { diff --git a/src/Services/LabelSystem/BarcodeGenerator.php b/src/Services/LabelSystem/BarcodeGenerator.php index 801154a3..90cbc5d7 100644 --- a/src/Services/LabelSystem/BarcodeGenerator.php +++ b/src/Services/LabelSystem/BarcodeGenerator.php @@ -50,12 +50,8 @@ use InvalidArgumentException; final class BarcodeGenerator { - private BarcodeContentGenerator $barcodeContentGenerator; - - - public function __construct(BarcodeContentGenerator $barcodeContentGenerator) + public function __construct(private readonly BarcodeContentGenerator $barcodeContentGenerator) { - $this->barcodeContentGenerator = $barcodeContentGenerator; } public function generateHTMLBarcode(LabelOptions $options, object $target): ?string @@ -126,18 +122,11 @@ final class BarcodeGenerator public function getContent(LabelOptions $options, AbstractDBElement $target): ?string { - switch ($options->getBarcodeType()) { - case 'qr': - case 'datamatrix': - return $this->barcodeContentGenerator->getURLContent($target); - case 'code39': - case 'code93': - case 'code128': - return $this->barcodeContentGenerator->get1DBarcodeContent($target); - case 'none': - return null; - default: - throw new InvalidArgumentException('Unknown label type!'); - } + return match ($options->getBarcodeType()) { + 'qr', 'datamatrix' => $this->barcodeContentGenerator->getURLContent($target), + 'code39', 'code93', 'code128' => $this->barcodeContentGenerator->get1DBarcodeContent($target), + 'none' => null, + default => throw new InvalidArgumentException('Unknown label type!'), + }; } } diff --git a/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php b/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php index 588e34b4..6930bd79 100644 --- a/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php +++ b/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php @@ -62,11 +62,8 @@ final class BarcodeContentGenerator Storelocation::class => 'location', ]; - private UrlGeneratorInterface $urlGenerator; - - public function __construct(UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly UrlGeneratorInterface $urlGenerator) { - $this->urlGenerator = $urlGenerator; } /** @@ -97,17 +94,17 @@ final class BarcodeContentGenerator private function classToString(array $map, object $target): string { - $class = get_class($target); + $class = $target::class; if (isset($map[$class])) { return $map[$class]; } foreach ($map as $class => $string) { - if (is_a($target, $class)) { + if ($target instanceof $class) { return $string; } } - throw new InvalidArgumentException('Unknown object class '.get_class($target)); + throw new InvalidArgumentException('Unknown object class '.$target::class); } } diff --git a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php index 198cb43b..f9b289b3 100644 --- a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php +++ b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php @@ -49,13 +49,8 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; final class BarcodeRedirector { - private UrlGeneratorInterface $urlGenerator; - private EntityManagerInterface $em; - - public function __construct(UrlGeneratorInterface $urlGenerator, EntityManagerInterface $entityManager) + public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly EntityManagerInterface $em) { - $this->urlGenerator = $urlGenerator; - $this->em = $entityManager; } /** @@ -76,7 +71,7 @@ final class BarcodeRedirector case 'lot': //Try to determine the part to the given lot $lot = $this->em->find(PartLot::class, $id); - if (null === $lot) { + if (!$lot instanceof \App\Entity\Parts\PartLot) { throw new EntityNotFoundException(); } diff --git a/src/Services/LabelSystem/LabelExampleElementsGenerator.php b/src/Services/LabelSystem/LabelExampleElementsGenerator.php index 0bc3761a..d3717208 100644 --- a/src/Services/LabelSystem/LabelExampleElementsGenerator.php +++ b/src/Services/LabelSystem/LabelExampleElementsGenerator.php @@ -57,16 +57,12 @@ final class LabelExampleElementsGenerator { public function getElement(string $type): object { - switch ($type) { - case 'part': - return $this->getExamplePart(); - case 'part_lot': - return $this->getExamplePartLot(); - case 'storelocation': - return $this->getStorelocation(); - default: - throw new InvalidArgumentException('Unknown $type.'); - } + return match ($type) { + 'part' => $this->getExamplePart(), + 'part_lot' => $this->getExamplePartLot(), + 'storelocation' => $this->getStorelocation(), + default => throw new InvalidArgumentException('Unknown $type.'), + }; } public function getExamplePart(): Part diff --git a/src/Services/LabelSystem/LabelGenerator.php b/src/Services/LabelSystem/LabelGenerator.php index 4afb20ae..d5ae2718 100644 --- a/src/Services/LabelSystem/LabelGenerator.php +++ b/src/Services/LabelSystem/LabelGenerator.php @@ -58,11 +58,8 @@ final class LabelGenerator public const MM_TO_POINTS_FACTOR = 2.83465; - private LabelHTMLGenerator $labelHTMLGenerator; - - public function __construct(LabelHTMLGenerator $labelHTMLGenerator) + public function __construct(private readonly LabelHTMLGenerator $labelHTMLGenerator) { - $this->labelHTMLGenerator = $labelHTMLGenerator; } /** diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php index bd8aa7b3..6fd28aef 100644 --- a/src/Services/LabelSystem/LabelHTMLGenerator.php +++ b/src/Services/LabelSystem/LabelHTMLGenerator.php @@ -52,29 +52,13 @@ use Twig\Error\Error; final class LabelHTMLGenerator { - private Environment $twig; - private ElementTypeNameGenerator $elementTypeNameGenerator; - private LabelTextReplacer $replacer; - private BarcodeGenerator $barcodeGenerator; - private SandboxedTwigProvider $sandboxedTwigProvider; - private string $partdb_title; - private \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator, LabelTextReplacer $replacer, Environment $twig, - BarcodeGenerator $barcodeGenerator, SandboxedTwigProvider $sandboxedTwigProvider, \Symfony\Bundle\SecurityBundle\Security $security, string $partdb_title) + public function __construct(private readonly ElementTypeNameGenerator $elementTypeNameGenerator, private readonly LabelTextReplacer $replacer, private readonly Environment $twig, private readonly BarcodeGenerator $barcodeGenerator, private readonly SandboxedTwigProvider $sandboxedTwigProvider, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly string $partdb_title) { - $this->twig = $twig; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; - $this->replacer = $replacer; - $this->barcodeGenerator = $barcodeGenerator; - $this->sandboxedTwigProvider = $sandboxedTwigProvider; - $this->security = $security; - $this->partdb_title = $partdb_title; } public function getLabelHTML(LabelOptions $options, array $elements): string { - if (empty($elements)) { + if ($elements === []) { throw new InvalidArgumentException('$elements must not be empty'); } diff --git a/src/Services/LabelSystem/LabelProfileDropdownHelper.php b/src/Services/LabelSystem/LabelProfileDropdownHelper.php index 8245c062..4dadd36f 100644 --- a/src/Services/LabelSystem/LabelProfileDropdownHelper.php +++ b/src/Services/LabelSystem/LabelProfileDropdownHelper.php @@ -50,15 +50,8 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface; final class LabelProfileDropdownHelper { - private TagAwareCacheInterface $cache; - private EntityManagerInterface $entityManager; - private UserCacheKeyGenerator $keyGenerator; - - public function __construct(TagAwareCacheInterface $treeCache, EntityManagerInterface $entityManager, UserCacheKeyGenerator $keyGenerator) + public function __construct(private readonly TagAwareCacheInterface $cache, private readonly EntityManagerInterface $entityManager, private readonly UserCacheKeyGenerator $keyGenerator) { - $this->cache = $treeCache; - $this->entityManager = $entityManager; - $this->keyGenerator = $keyGenerator; } public function getDropdownProfiles(string $type): array diff --git a/src/Services/LabelSystem/LabelTextReplacer.php b/src/Services/LabelSystem/LabelTextReplacer.php index 5b94352b..3c0b5f92 100644 --- a/src/Services/LabelSystem/LabelTextReplacer.php +++ b/src/Services/LabelSystem/LabelTextReplacer.php @@ -49,11 +49,8 @@ use App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface; */ final class LabelTextReplacer { - private iterable $providers; - - public function __construct(iterable $providers) + public function __construct(private readonly iterable $providers) { - $this->providers = $providers; } /** @@ -89,9 +86,7 @@ final class LabelTextReplacer public function replace(string $lines, object $target): string { $patterns = [ - '/(\[\[[A-Z_0-9]+\]\])/' => function ($match) use ($target) { - return $this->handlePlaceholder($match[0], $target); - }, + '/(\[\[[A-Z_0-9]+\]\])/' => fn($match) => $this->handlePlaceholder($match[0], $target), ]; return preg_replace_callback_array($patterns, $lines); diff --git a/src/Services/LabelSystem/PlaceholderProviders/AbstractDBElementProvider.php b/src/Services/LabelSystem/PlaceholderProviders/AbstractDBElementProvider.php index f765cd0c..081b3e91 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/AbstractDBElementProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/AbstractDBElementProvider.php @@ -46,11 +46,8 @@ use App\Services\ElementTypeNameGenerator; final class AbstractDBElementProvider implements PlaceholderProviderInterface { - private ElementTypeNameGenerator $elementTypeNameGenerator; - - public function __construct(ElementTypeNameGenerator $elementTypeNameGenerator) + public function __construct(private readonly ElementTypeNameGenerator $elementTypeNameGenerator) { - $this->elementTypeNameGenerator = $elementTypeNameGenerator; } public function replace(string $placeholder, object $label_target, array $options = []): ?string diff --git a/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php b/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php index 06144831..868f8038 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php @@ -26,13 +26,8 @@ use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator; final class BarcodeProvider implements PlaceholderProviderInterface { - private BarcodeGenerator $barcodeGenerator; - private BarcodeContentGenerator $barcodeContentGenerator; - - public function __construct(BarcodeGenerator $barcodeGenerator, BarcodeContentGenerator $barcodeContentGenerator) + public function __construct(private readonly BarcodeGenerator $barcodeGenerator, private readonly BarcodeContentGenerator $barcodeContentGenerator) { - $this->barcodeGenerator = $barcodeGenerator; - $this->barcodeContentGenerator = $barcodeContentGenerator; } public function replace(string $placeholder, object $label_target, array $options = []): ?string @@ -40,7 +35,7 @@ final class BarcodeProvider implements PlaceholderProviderInterface if ('[[1D_CONTENT]]' === $placeholder) { try { return $this->barcodeContentGenerator->get1DBarcodeContent($label_target); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { return 'ERROR!'; } } @@ -48,7 +43,7 @@ final class BarcodeProvider implements PlaceholderProviderInterface if ('[[2D_CONTENT]]' === $placeholder) { try { return $this->barcodeContentGenerator->getURLContent($label_target); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { return 'ERROR!'; } } diff --git a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php index 5fd32a73..50efd563 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php +++ b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php @@ -53,15 +53,8 @@ use Symfony\Component\Security\Core\Security; */ final class GlobalProviders implements PlaceholderProviderInterface { - private string $partdb_title; - private \Symfony\Bundle\SecurityBundle\Security $security; - private UrlGeneratorInterface $url_generator; - - public function __construct(string $partdb_title, \Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $url_generator) + public function __construct(private readonly string $partdb_title, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $url_generator) { - $this->partdb_title = $partdb_title; - $this->security = $security; - $this->url_generator = $url_generator; } public function replace(string $placeholder, object $label_target, array $options = []): ?string diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php index a4fdf32a..ce071e9f 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php @@ -49,13 +49,8 @@ use Locale; final class PartLotProvider implements PlaceholderProviderInterface { - private LabelTextReplacer $labelTextReplacer; - private AmountFormatter $amountFormatter; - - public function __construct(LabelTextReplacer $labelTextReplacer, AmountFormatter $amountFormatter) + public function __construct(private readonly LabelTextReplacer $labelTextReplacer, private readonly AmountFormatter $amountFormatter) { - $this->labelTextReplacer = $labelTextReplacer; - $this->amountFormatter = $amountFormatter; } public function replace(string $placeholder, object $label_target, array $options = []): ?string @@ -74,7 +69,7 @@ final class PartLotProvider implements PlaceholderProviderInterface } if ('[[EXPIRATION_DATE]]' === $placeholder) { - if (null === $label_target->getExpirationDate()) { + if (!$label_target->getExpirationDate() instanceof \DateTimeInterface) { return ''; } $formatter = IntlDateFormatter::create( @@ -95,19 +90,19 @@ final class PartLotProvider implements PlaceholderProviderInterface } if ('[[LOCATION]]' === $placeholder) { - return $label_target->getStorageLocation() ? $label_target->getStorageLocation()->getName() : ''; + return $label_target->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $label_target->getStorageLocation()->getName() : ''; } if ('[[LOCATION_FULL]]' === $placeholder) { - return $label_target->getStorageLocation() ? $label_target->getStorageLocation()->getFullPath() : ''; + return $label_target->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $label_target->getStorageLocation()->getFullPath() : ''; } if ('[[OWNER]]' === $placeholder) { - return $label_target->getOwner() ? $label_target->getOwner()->getFullName() : ''; + return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getFullName() : ''; } if ('[[OWNER_USERNAME]]' === $placeholder) { - return $label_target->getOwner() ? $label_target->getOwner()->getUsername() : ''; + return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getUsername() : ''; } return $this->labelTextReplacer->handlePlaceholder($placeholder, $label_target->getPart()); diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php index 48e547f6..d794b855 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php @@ -48,13 +48,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; final class PartProvider implements PlaceholderProviderInterface { - private SIFormatter $siFormatter; - private TranslatorInterface $translator; - - public function __construct(SIFormatter $SIFormatter, TranslatorInterface $translator) + public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator) { - $this->siFormatter = $SIFormatter; - $this->translator = $translator; } public function replace(string $placeholder, object $part, array $options = []): ?string @@ -64,27 +59,27 @@ final class PartProvider implements PlaceholderProviderInterface } if ('[[CATEGORY]]' === $placeholder) { - return $part->getCategory() ? $part->getCategory()->getName() : ''; + return $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : ''; } if ('[[CATEGORY_FULL]]' === $placeholder) { - return $part->getCategory() ? $part->getCategory()->getFullPath() : ''; + return $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getFullPath() : ''; } if ('[[MANUFACTURER]]' === $placeholder) { - return $part->getManufacturer() ? $part->getManufacturer()->getName() : ''; + return $part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer ? $part->getManufacturer()->getName() : ''; } if ('[[MANUFACTURER_FULL]]' === $placeholder) { - return $part->getManufacturer() ? $part->getManufacturer()->getFullPath() : ''; + return $part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer ? $part->getManufacturer()->getFullPath() : ''; } if ('[[FOOTPRINT]]' === $placeholder) { - return $part->getFootprint() ? $part->getFootprint()->getName() : ''; + return $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : ''; } if ('[[FOOTPRINT_FULL]]' === $placeholder) { - return $part->getFootprint() ? $part->getFootprint()->getFullPath() : ''; + return $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getFullPath() : ''; } if ('[[MASS]]' === $placeholder) { @@ -114,7 +109,7 @@ final class PartProvider implements PlaceholderProviderInterface } if ('[[DESCRIPTION_T]]' === $placeholder) { - return strip_tags($parsedown->line($part->getDescription())); + return strip_tags((string) $parsedown->line($part->getDescription())); } if ('[[COMMENT]]' === $placeholder) { @@ -122,7 +117,7 @@ final class PartProvider implements PlaceholderProviderInterface } if ('[[COMMENT_T]]' === $placeholder) { - return strip_tags($parsedown->line($part->getComment())); + return strip_tags((string) $parsedown->line($part->getComment())); } return null; diff --git a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php index aac7f985..85c1d13a 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php @@ -28,11 +28,11 @@ class StorelocationProvider implements PlaceholderProviderInterface { if ($label_target instanceof Storelocation) { if ('[[OWNER]]' === $placeholder) { - return $label_target->getOwner() ? $label_target->getOwner()->getFullName() : ''; + return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getFullName() : ''; } if ('[[OWNER_USERNAME]]' === $placeholder) { - return $label_target->getOwner() ? $label_target->getOwner()->getUsername() : ''; + return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getUsername() : ''; } } diff --git a/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php index f4aebd8a..31d7618e 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php @@ -58,10 +58,10 @@ final class StructuralDBElementProvider implements PlaceholderProviderInterface return $label_target->getFullPath(); } if ('[[PARENT]]' === $placeholder) { - return $label_target->getParent() ? $label_target->getParent()->getName() : ''; + return $label_target->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $label_target->getParent()->getName() : ''; } if ('[[PARENT_FULL_PATH]]' === $placeholder) { - return $label_target->getParent() ? $label_target->getParent()->getFullPath() : ''; + return $label_target->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $label_target->getParent()->getFullPath() : ''; } } diff --git a/src/Services/LabelSystem/SandboxedTwigProvider.php b/src/Services/LabelSystem/SandboxedTwigProvider.php index 66488fca..39b47bfb 100644 --- a/src/Services/LabelSystem/SandboxedTwigProvider.php +++ b/src/Services/LabelSystem/SandboxedTwigProvider.php @@ -114,11 +114,8 @@ final class SandboxedTwigProvider ]; private const ALLOWED_PROPERTIES = []; - private FormatExtension $appExtension; - - public function __construct(FormatExtension $appExtension) + public function __construct(private readonly FormatExtension $appExtension) { - $this->appExtension = $appExtension; } public function getTwig(LabelOptions $options): Environment diff --git a/src/Services/LogSystem/EventCommentHelper.php b/src/Services/LogSystem/EventCommentHelper.php index 4afcf04d..cf06b724 100644 --- a/src/Services/LogSystem/EventCommentHelper.php +++ b/src/Services/LogSystem/EventCommentHelper.php @@ -45,11 +45,10 @@ class EventCommentHelper { protected const MAX_MESSAGE_LENGTH = 255; - protected ?string $message; + protected ?string $message = null; public function __construct() { - $this->message = null; } /** @@ -60,11 +59,7 @@ class EventCommentHelper public function setMessage(?string $message): void { //Restrict the length of the string - if ($message) { - $this->message = mb_strimwidth($message, 0, self::MAX_MESSAGE_LENGTH, '...'); - } else { - $this->message = null; - } + $this->message = $message ? mb_strimwidth($message, 0, self::MAX_MESSAGE_LENGTH, '...') : null; } /** diff --git a/src/Services/LogSystem/EventCommentNeededHelper.php b/src/Services/LogSystem/EventCommentNeededHelper.php index 7305b304..23e22072 100644 --- a/src/Services/LogSystem/EventCommentNeededHelper.php +++ b/src/Services/LogSystem/EventCommentNeededHelper.php @@ -26,9 +26,7 @@ namespace App\Services\LogSystem; */ class EventCommentNeededHelper { - protected array $enforce_change_comments_for; - - public const VALID_OPERATION_TYPES = [ + final public const VALID_OPERATION_TYPES = [ 'part_edit', 'part_create', 'part_delete', @@ -38,15 +36,12 @@ class EventCommentNeededHelper 'datastructure_delete', ]; - public function __construct(array $enforce_change_comments_for) + public function __construct(protected array $enforce_change_comments_for) { - $this->enforce_change_comments_for = $enforce_change_comments_for; } /** * Checks if a log change comment is needed for the given operation type - * @param string $comment_type - * @return bool */ public function isCommentNeeded(string $comment_type): bool { diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php index dde19edc..afc1c69b 100644 --- a/src/Services/LogSystem/EventLogger.php +++ b/src/Services/LogSystem/EventLogger.php @@ -30,22 +30,8 @@ use Symfony\Component\Security\Core\Security; class EventLogger { - protected int $minimum_log_level; - protected array $blacklist; - protected array $whitelist; - protected EntityManagerInterface $em; - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected ConsoleInfoHelper $console_info_helper; - - public function __construct(int $minimum_log_level, array $blacklist, array $whitelist, EntityManagerInterface $em, - \Symfony\Bundle\SecurityBundle\Security $security, ConsoleInfoHelper $console_info_helper) + public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected \Symfony\Bundle\SecurityBundle\Security $security, protected ConsoleInfoHelper $console_info_helper) { - $this->minimum_log_level = $minimum_log_level; - $this->blacklist = $blacklist; - $this->whitelist = $whitelist; - $this->em = $em; - $this->security = $security; - $this->console_info_helper = $console_info_helper; } /** @@ -58,14 +44,14 @@ class EventLogger { $user = $this->security->getUser(); //If the user is not specified explicitly, set it to the current user - if ((null === $user || $user instanceof User) && null === $logEntry->getUser()) { - if (null === $user) { + if ((!$user instanceof \Symfony\Component\Security\Core\User\UserInterface || $user instanceof User) && !$logEntry->getUser() instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof \App\Entity\UserSystem\User) { $repo = $this->em->getRepository(User::class); $user = $repo->getAnonymousUser(); } //If no anonymous user is available skip the log (needed for data fixtures) - if (null === $user) { + if (!$user instanceof \App\Entity\UserSystem\User) { return false; } $logEntry->setUser($user); @@ -88,15 +74,13 @@ class EventLogger /** * Same as log(), but this function can be safely called from within the onFlush() doctrine event, as it * updated the changesets of the unit of work. - * @param AbstractLogEntry $logEntry - * @return bool */ public function logFromOnFlush(AbstractLogEntry $logEntry): bool { if ($this->log($logEntry)) { $uow = $this->em->getUnitOfWork(); //As we call it from onFlush, we have to recompute the changeset here, according to https://www.doctrine-project.org/projects/doctrine-orm/en/2.14/reference/events.html#reference-events-on-flush - $uow->computeChangeSet($this->em->getClassMetadata(get_class($logEntry)), $logEntry); + $uow->computeChangeSet($this->em->getClassMetadata($logEntry::class), $logEntry); return true; } @@ -125,9 +109,9 @@ class EventLogger ?array $whitelist = null ): bool { //Apply the global settings, if nothing was specified - $minimum_log_level = $minimum_log_level ?? $this->minimum_log_level; - $blacklist = $blacklist ?? $this->blacklist; - $whitelist = $whitelist ?? $this->whitelist; + $minimum_log_level ??= $this->minimum_log_level; + $blacklist ??= $this->blacklist; + $whitelist ??= $this->whitelist; //Don't add the entry if it does not reach the minimum level if ($logEntry->getLevel() > $minimum_log_level) { @@ -135,17 +119,12 @@ class EventLogger } //Check if the event type is blacklisted - if (!empty($blacklist) && $this->isObjectClassInArray($logEntry, $blacklist)) { + if ($blacklist !== [] && $this->isObjectClassInArray($logEntry, $blacklist)) { return false; } - //Check for whitelisting - if (!empty($whitelist) && !$this->isObjectClassInArray($logEntry, $whitelist)) { - return false; - } - // By default, all things should be added - return true; + return !($whitelist !== [] && !$this->isObjectClassInArray($logEntry, $whitelist)); } /** @@ -157,13 +136,13 @@ class EventLogger protected function isObjectClassInArray(object $object, array $classes): bool { //Check if the class is directly in the classes array - if (in_array(get_class($object), $classes, true)) { + if (in_array($object::class, $classes, true)) { return true; } //Iterate over all classes and check for inheritance foreach ($classes as $class) { - if (is_a($object, $class)) { + if ($object instanceof $class) { return true; } } diff --git a/src/Services/LogSystem/EventUndoHelper.php b/src/Services/LogSystem/EventUndoHelper.php index f2328cbc..2416ced0 100644 --- a/src/Services/LogSystem/EventUndoHelper.php +++ b/src/Services/LogSystem/EventUndoHelper.php @@ -46,18 +46,16 @@ use InvalidArgumentException; class EventUndoHelper { - public const MODE_UNDO = 'undo'; - public const MODE_REVERT = 'revert'; + final public const MODE_UNDO = 'undo'; + final public const MODE_REVERT = 'revert'; protected const ALLOWED_MODES = [self::MODE_REVERT, self::MODE_UNDO]; - protected ?AbstractLogEntry $undone_event; - protected string $mode; + protected ?AbstractLogEntry $undone_event = null; + protected string $mode = self::MODE_UNDO; public function __construct() { - $this->undone_event = null; - $this->mode = self::MODE_UNDO; } public function setMode(string $mode): void diff --git a/src/Services/LogSystem/LogDataFormatter.php b/src/Services/LogSystem/LogDataFormatter.php index 1980c029..46dae945 100644 --- a/src/Services/LogSystem/LogDataFormatter.php +++ b/src/Services/LogSystem/LogDataFormatter.php @@ -29,25 +29,14 @@ class LogDataFormatter { private const STRING_MAX_LENGTH = 1024; - private TranslatorInterface $translator; - private EntityManagerInterface $entityManager; - private ElementTypeNameGenerator $elementTypeNameGenerator; - - public function __construct(TranslatorInterface $translator, EntityManagerInterface $entityManager, ElementTypeNameGenerator $elementTypeNameGenerator) + public function __construct(private readonly TranslatorInterface $translator, private readonly EntityManagerInterface $entityManager, private readonly ElementTypeNameGenerator $elementTypeNameGenerator) { - $this->translator = $translator; - $this->entityManager = $entityManager; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; } /** * Formats the given data of a log entry as HTML - * @param mixed $data - * @param AbstractLogEntry $logEntry - * @param string $fieldName - * @return string */ - public function formatData($data, AbstractLogEntry $logEntry, string $fieldName): string + public function formatData(mixed $data, AbstractLogEntry $logEntry, string $fieldName): string { if (is_string($data)) { $tmp = '"' . mb_strimwidth(htmlspecialchars($data), 0, self::STRING_MAX_LENGTH, ) . '"'; @@ -55,9 +44,8 @@ class LogDataFormatter //Show special characters and line breaks $tmp = preg_replace('/\n/', '\\n
', $tmp); $tmp = preg_replace('/\r/', '\\r', $tmp); - $tmp = preg_replace('/\t/', '\\t', $tmp); - return $tmp; + return preg_replace('/\t/', '\\t', $tmp); } if (is_bool($data)) { @@ -126,7 +114,7 @@ class LogDataFormatter } - } catch (\InvalidArgumentException|\ReflectionException $exception) { + } catch (\InvalidArgumentException|\ReflectionException) { return 'unknown target class: ' . $id; } } @@ -147,7 +135,7 @@ class LogDataFormatter try { $dateTime = new \DateTime($date, new \DateTimeZone($timezone)); - } catch (\Exception $exception) { + } catch (\Exception) { return 'unknown DateTime format'; } diff --git a/src/Services/LogSystem/LogDiffFormatter.php b/src/Services/LogSystem/LogDiffFormatter.php index 92b6d814..500e1a72 100644 --- a/src/Services/LogSystem/LogDiffFormatter.php +++ b/src/Services/LogSystem/LogDiffFormatter.php @@ -29,7 +29,6 @@ class LogDiffFormatter * If the diff is not possible, an empty string is returned. * @param $old_data * @param $new_data - * @return string */ public function formatDiff($old_data, $new_data): string { @@ -67,7 +66,7 @@ class LogDiffFormatter //Positive difference if ($difference > 0) { return sprintf('+%s', $difference); - } else if ($difference < 0) { + } elseif ($difference < 0) { return sprintf('%s', $difference); } else { return sprintf('%s', $difference); diff --git a/src/Services/LogSystem/LogEntryExtraFormatter.php b/src/Services/LogSystem/LogEntryExtraFormatter.php index 8ec328d0..017de1e0 100644 --- a/src/Services/LogSystem/LogEntryExtraFormatter.php +++ b/src/Services/LogSystem/LogEntryExtraFormatter.php @@ -48,13 +48,9 @@ class LogEntryExtraFormatter { protected const CONSOLE_SEARCH = ['', '', '', '', '']; protected const CONSOLE_REPLACE = ['→', '', '', '', '']; - protected TranslatorInterface $translator; - protected ElementTypeNameGenerator $elementTypeNameGenerator; - public function __construct(TranslatorInterface $translator, ElementTypeNameGenerator $elementTypeNameGenerator) + public function __construct(protected TranslatorInterface $translator, protected ElementTypeNameGenerator $elementTypeNameGenerator) { - $this->translator = $translator; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; } /** @@ -163,7 +159,7 @@ class LogEntryExtraFormatter '%s %s (%s)', $context->getOldInstock(), $context->getNewInstock(), - (!$context->isWithdrawal() ? '+' : '-').$context->getDifference(true) + ($context->isWithdrawal() ? '-' : '+').$context->getDifference(true) ); $array['log.instock_changed.comment'] = htmlspecialchars($context->getComment()); } diff --git a/src/Services/LogSystem/LogLevelHelper.php b/src/Services/LogSystem/LogLevelHelper.php index 926531da..efc8dd93 100644 --- a/src/Services/LogSystem/LogLevelHelper.php +++ b/src/Services/LogSystem/LogLevelHelper.php @@ -29,30 +29,20 @@ class LogLevelHelper * Returns the FontAwesome icon class for the given log level. * This returns just the specific icon class (so 'fa-info' for example). * @param string $logLevel The string representation of the log level (one of the LogLevel::* constants) - * @return string */ public function logLevelToIconClass(string $logLevel): string { - switch ($logLevel) { - case LogLevel::DEBUG: - return 'fa-bug'; - case LogLevel::INFO: - return 'fa-info'; - case LogLevel::NOTICE: - return 'fa-flag'; - case LogLevel::WARNING: - return 'fa-exclamation-circle'; - case LogLevel::ERROR: - return 'fa-exclamation-triangle'; - case LogLevel::CRITICAL: - return 'fa-bolt'; - case LogLevel::ALERT: - return 'fa-radiation'; - case LogLevel::EMERGENCY: - return 'fa-skull-crossbones'; - default: - return 'fa-question-circle'; - } + return match ($logLevel) { + LogLevel::DEBUG => 'fa-bug', + LogLevel::INFO => 'fa-info', + LogLevel::NOTICE => 'fa-flag', + LogLevel::WARNING => 'fa-exclamation-circle', + LogLevel::ERROR => 'fa-exclamation-triangle', + LogLevel::CRITICAL => 'fa-bolt', + LogLevel::ALERT => 'fa-radiation', + LogLevel::EMERGENCY => 'fa-skull-crossbones', + default => 'fa-question-circle', + }; } /** @@ -63,18 +53,11 @@ class LogLevelHelper public function logLevelToTableColorClass(string $logLevel): string { - switch ($logLevel) { - case LogLevel::EMERGENCY: - case LogLevel::ALERT: - case LogLevel::CRITICAL: - case LogLevel::ERROR: - return 'table-danger'; - case LogLevel::WARNING: - return 'table-warning'; - case LogLevel::NOTICE: - return 'table-info'; - default: - return ''; - } + return match ($logLevel) { + LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR => 'table-danger', + LogLevel::WARNING => 'table-warning', + LogLevel::NOTICE => 'table-info', + default => '', + }; } } \ No newline at end of file diff --git a/src/Services/LogSystem/LogTargetHelper.php b/src/Services/LogSystem/LogTargetHelper.php index 63946a0f..e8ea4a6b 100644 --- a/src/Services/LogSystem/LogTargetHelper.php +++ b/src/Services/LogSystem/LogTargetHelper.php @@ -40,21 +40,12 @@ use Symfony\Contracts\Translation\TranslatorInterface; class LogTargetHelper { - protected EntityManagerInterface $em; protected LogEntryRepository $entryRepository; - protected EntityURLGenerator $entityURLGenerator; - protected ElementTypeNameGenerator $elementTypeNameGenerator; - protected TranslatorInterface $translator; - public function __construct(EntityManagerInterface $entityManager, EntityURLGenerator $entityURLGenerator, - ElementTypeNameGenerator $elementTypeNameGenerator, TranslatorInterface $translator) + public function __construct(protected EntityManagerInterface $em, protected EntityURLGenerator $entityURLGenerator, + protected ElementTypeNameGenerator $elementTypeNameGenerator, protected TranslatorInterface $translator) { - $this->em = $entityManager; - $this->entryRepository = $entityManager->getRepository(AbstractLogEntry::class); - - $this->entityURLGenerator = $entityURLGenerator; - $this->elementTypeNameGenerator = $elementTypeNameGenerator; - $this->translator = $translator; + $this->entryRepository = $em->getRepository(AbstractLogEntry::class); } private function configureOptions(OptionsResolver $resolver): self @@ -79,7 +70,7 @@ class LogTargetHelper $target = $this->entryRepository->getTargetElement($context); //If the target is null and the context has a target, that means that the target was deleted. Show it that way. - if ($target === null) { + if (!$target instanceof \App\Entity\Base\AbstractDBElement) { if ($context->hasTarget()) { return $this->elementTypeNameGenerator->formatElementDeletedHTML($context->getTargetClass(), $context->getTargetId()); diff --git a/src/Services/LogSystem/TimeTravel.php b/src/Services/LogSystem/TimeTravel.php index daeed7ea..5cc4be79 100644 --- a/src/Services/LogSystem/TimeTravel.php +++ b/src/Services/LogSystem/TimeTravel.php @@ -43,12 +43,10 @@ use ReflectionClass; class TimeTravel { - protected EntityManagerInterface $em; protected LogEntryRepository $repo; - public function __construct(EntityManagerInterface $em) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $em; $this->repo = $em->getRepository(AbstractLogEntry::class); } @@ -126,7 +124,7 @@ class TimeTravel } // Revert any of the associated elements - $metadata = $this->em->getClassMetadata(get_class($element)); + $metadata = $this->em->getClassMetadata($element::class); $associations = $metadata->getAssociationMappings(); foreach ($associations as $field => $mapping) { if ( @@ -148,10 +146,10 @@ class TimeTravel } elseif ( //Revert *_TO_MANY associations (collection properties) (ClassMetadataInfo::MANY_TO_MANY === $mapping['type'] || ClassMetadataInfo::ONE_TO_MANY === $mapping['type']) - && false === $mapping['isOwningSide'] + && !$mapping['isOwningSide'] ) { $target_elements = $this->getField($element, $field); - if (null === $target_elements || count($target_elements) > 10) { + if (null === $target_elements || (is_countable($target_elements) ? count($target_elements) : 0) > 10) { continue; } foreach ($target_elements as $target_element) { @@ -200,7 +198,7 @@ class TimeTravel if (!$element instanceof TimeStampableInterface) { return; } - $metadata = $this->em->getClassMetadata(get_class($element)); + $metadata = $this->em->getClassMetadata($element::class); $old_data = $logEntry->getOldData(); foreach ($old_data as $field => $data) { @@ -232,19 +230,16 @@ class TimeTravel protected function getField(AbstractDBElement $element, string $field) { - $reflection = new ReflectionClass(get_class($element)); + $reflection = new ReflectionClass($element::class); $property = $reflection->getProperty($field); $property->setAccessible(true); return $property->getValue($element); } - /** - * @param DateTime|int|null $new_value - */ - protected function setField(AbstractDBElement $element, string $field, $new_value): void + protected function setField(AbstractDBElement $element, string $field, \DateTime|int|null $new_value): void { - $reflection = new ReflectionClass(get_class($element)); + $reflection = new ReflectionClass($element::class); $property = $reflection->getProperty($field); $property->setAccessible(true); diff --git a/src/Services/Misc/DBInfoHelper.php b/src/Services/Misc/DBInfoHelper.php index 896c0637..3d5c27a7 100644 --- a/src/Services/Misc/DBInfoHelper.php +++ b/src/Services/Misc/DBInfoHelper.php @@ -31,11 +31,9 @@ use Doctrine\ORM\EntityManagerInterface; class DBInfoHelper { protected Connection $connection; - protected EntityManagerInterface $entityManager; - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $entityManager) { - $this->entityManager = $entityManager; $this->connection = $entityManager->getConnection(); } @@ -58,7 +56,6 @@ class DBInfoHelper /** * Returns the database version of the used database. - * @return string|null * @throws \Doctrine\DBAL\Exception */ public function getDatabaseVersion(): ?string @@ -84,7 +81,7 @@ class DBInfoHelper if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) { try { return $this->connection->fetchOne('SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema = DATABASE()'); - } catch (\Doctrine\DBAL\Exception $e) { + } catch (\Doctrine\DBAL\Exception) { return null; } } @@ -92,7 +89,7 @@ class DBInfoHelper if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { try { return $this->connection->fetchOne('SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size();'); - } catch (\Doctrine\DBAL\Exception $e) { + } catch (\Doctrine\DBAL\Exception) { return null; } } @@ -102,7 +99,6 @@ class DBInfoHelper /** * Returns the name of the database. - * @return string|null */ public function getDatabaseName(): ?string { @@ -111,14 +107,13 @@ class DBInfoHelper /** * Returns the name of the database user. - * @return string|null */ public function getDatabaseUsername(): ?string { if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) { try { return $this->connection->fetchOne('SELECT USER()'); - } catch (\Doctrine\DBAL\Exception $e) { + } catch (\Doctrine\DBAL\Exception) { return null; } } diff --git a/src/Services/Misc/RangeParser.php b/src/Services/Misc/RangeParser.php index ab6e9aba..ddd4fd3b 100644 --- a/src/Services/Misc/RangeParser.php +++ b/src/Services/Misc/RangeParser.php @@ -94,7 +94,7 @@ class RangeParser $this->parse($range_str); return true; - } catch (InvalidArgumentException $exception) { + } catch (InvalidArgumentException) { return false; } } diff --git a/src/Services/Parameters/ParameterExtractor.php b/src/Services/Parameters/ParameterExtractor.php index a5c6a0c0..c1151970 100644 --- a/src/Services/Parameters/ParameterExtractor.php +++ b/src/Services/Parameters/ParameterExtractor.php @@ -74,7 +74,7 @@ class ParameterExtractor $split = $this->splitString($input); foreach ($split as $param_string) { $tmp = $this->stringToParam($param_string, $class); - if (null !== $tmp) { + if ($tmp instanceof \App\Entity\Parameters\AbstractParameter) { $parameters[] = $tmp; } } @@ -89,7 +89,7 @@ class ParameterExtractor $matches = []; preg_match($regex, $input, $matches); - if (!empty($matches)) { + if ($matches !== []) { [, $name, $value] = $matches; $value = trim($value); diff --git a/src/Services/Parts/PartLotWithdrawAddHelper.php b/src/Services/Parts/PartLotWithdrawAddHelper.php index a6f7060c..f63ae15f 100644 --- a/src/Services/Parts/PartLotWithdrawAddHelper.php +++ b/src/Services/Parts/PartLotWithdrawAddHelper.php @@ -9,20 +9,12 @@ use App\Services\LogSystem\EventLogger; final class PartLotWithdrawAddHelper { - private EventLogger $eventLogger; - private EventCommentHelper $eventCommentHelper; - - - public function __construct(EventLogger $eventLogger, EventCommentHelper $eventCommentHelper) + public function __construct(private readonly EventLogger $eventLogger, private readonly EventCommentHelper $eventCommentHelper) { - $this->eventLogger = $eventLogger; - $this->eventCommentHelper = $eventCommentHelper; } /** * Checks whether the given part can - * @param PartLot $partLot - * @return bool */ public function canAdd(PartLot $partLot): bool { @@ -32,16 +24,11 @@ final class PartLotWithdrawAddHelper } //So far all other restrictions are defined at the storelocation level - if($partLot->getStorageLocation() === null) { + if(!$partLot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { return true; } - //We can not add parts if the storage location of the lot is marked as full - if($partLot->getStorageLocation()->isFull()) { - return false; - } - - return true; + return !$partLot->getStorageLocation()->isFull(); } public function canWithdraw(PartLot $partLot): bool @@ -50,13 +37,8 @@ final class PartLotWithdrawAddHelper if ($partLot->isInstockUnknown()) { return false; } - //Part must contain more than 0 parts - if ($partLot->getAmount() <= 0) { - return false; - } - - return true; + return $partLot->getAmount() > 0; } /** @@ -153,7 +135,6 @@ final class PartLotWithdrawAddHelper * @param PartLot $target The part lot to which the parts should be added * @param float $amount The amount of parts that should be moved * @param string|null $comment A comment describing the reason for the move - * @return void */ public function move(PartLot $origin, PartLot $target, float $amount, ?string $comment = null): void { diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index b3cccb0e..d5e1f8a1 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -37,15 +37,8 @@ use Symfony\Component\Security\Core\Security; final class PartsTableActionHandler { - private EntityManagerInterface $entityManager; - private \Symfony\Bundle\SecurityBundle\Security $security; - private UrlGeneratorInterface $urlGenerator; - - public function __construct(EntityManagerInterface $entityManager, \Symfony\Bundle\SecurityBundle\Security $security, UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator) { - $this->entityManager = $entityManager; - $this->security = $security; - $this->urlGenerator = $urlGenerator; } /** @@ -86,10 +79,8 @@ final class PartsTableActionHandler if ($action === 'generate_label') { $targets = implode(',', array_map(static fn (Part $part) => $part->getID(), $selected_parts)); } else { //For lots we have to extract the part lots - $targets = implode(',', array_map(static function (Part $part) { - //We concat the lot IDs of every part with a comma (which are later concated with a comma too per part) - return implode(',', array_map(static fn (PartLot $lot) => $lot->getID(), $part->getPartLots()->toArray())); - }, $selected_parts)); + $targets = implode(',', array_map(static fn(Part $part): string => //We concat the lot IDs of every part with a comma (which are later concated with a comma too per part) +implode(',', array_map(static fn (PartLot $lot) => $lot->getID(), $part->getPartLots()->toArray())), $selected_parts)); } return new RedirectResponse( @@ -106,18 +97,11 @@ final class PartsTableActionHandler $matches = []; if (preg_match('/^export_(json|yaml|xml|csv)$/', $action, $matches)) { $ids = implode(',', array_map(static fn (Part $part) => $part->getID(), $selected_parts)); - switch ($target_id) { - case 1: - default: - $level = 'simple'; - break; - case 2: - $level = 'extended'; - break; - case 3: - $level = 'full'; - break; - } + $level = match ($target_id) { + 2 => 'extended', + 3 => 'full', + default => 'simple', + }; return new RedirectResponse( diff --git a/src/Services/Parts/PricedetailHelper.php b/src/Services/Parts/PricedetailHelper.php index a270c622..14c914d4 100644 --- a/src/Services/Parts/PricedetailHelper.php +++ b/src/Services/Parts/PricedetailHelper.php @@ -34,12 +34,10 @@ use function count; class PricedetailHelper { - protected string $base_currency; protected string $locale; - public function __construct(string $base_currency) + public function __construct(protected string $base_currency) { - $this->base_currency = $base_currency; $this->locale = Locale::getDefault(); } @@ -67,9 +65,7 @@ class PricedetailHelper } else { // We have to sort the pricedetails manually $array = $pricedetails->map( - static function (Pricedetail $pricedetail) { - return $pricedetail->getMinDiscountQuantity(); - } + static fn(Pricedetail $pricedetail) => $pricedetail->getMinDiscountQuantity() )->toArray(); sort($array); $max_amount = end($array); @@ -154,13 +150,13 @@ class PricedetailHelper $pricedetail = $orderdetail->findPriceForQty($amount); //When we don't have information about this amount, ignore it - if (null === $pricedetail) { + if (!$pricedetail instanceof \App\Entity\PriceInformations\Pricedetail) { continue; } $converted = $this->convertMoneyToCurrency($pricedetail->getPricePerUnit(), $pricedetail->getCurrency(), $currency); //Ignore price information that can not be converted to base currency. - if (null !== $converted) { + if ($converted instanceof \Brick\Math\BigDecimal) { $avg = $avg->plus($converted); ++$count; } @@ -193,9 +189,9 @@ class PricedetailHelper $val_base = $value; //Convert value to base currency - if (null !== $originCurrency) { + if ($originCurrency instanceof \App\Entity\PriceInformations\Currency) { //Without an exchange rate we can not calculate the exchange rate - if (null === $originCurrency->getExchangeRate() || $originCurrency->getExchangeRate()->isZero()) { + if (!$originCurrency->getExchangeRate() instanceof \Brick\Math\BigDecimal || $originCurrency->getExchangeRate()->isZero()) { return null; } @@ -204,9 +200,9 @@ class PricedetailHelper $val_target = $val_base; //Convert value in base currency to target currency - if (null !== $targetCurrency) { + if ($targetCurrency instanceof \App\Entity\PriceInformations\Currency) { //Without an exchange rate we can not calculate the exchange rate - if (null === $targetCurrency->getExchangeRate()) { + if (!$targetCurrency->getExchangeRate() instanceof \Brick\Math\BigDecimal) { return null; } diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php index 0e091547..30f31c33 100644 --- a/src/Services/ProjectSystem/ProjectBuildHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildHelper.php @@ -27,24 +27,19 @@ use App\Services\Parts\PartLotWithdrawAddHelper; class ProjectBuildHelper { - private PartLotWithdrawAddHelper $withdraw_add_helper; - - public function __construct(PartLotWithdrawAddHelper $withdraw_add_helper) + public function __construct(private readonly PartLotWithdrawAddHelper $withdraw_add_helper) { - $this->withdraw_add_helper = $withdraw_add_helper; } /** * Returns the maximum buildable amount of the given BOM entry based on the stock of the used parts. * This function only works for BOM entries that are associated with a part. - * @param ProjectBOMEntry $projectBOMEntry - * @return int */ public function getMaximumBuildableCountForBOMEntry(ProjectBOMEntry $projectBOMEntry): int { $part = $projectBOMEntry->getPart(); - if ($part === null) { + if (!$part instanceof \App\Entity\Parts\Part) { throw new \InvalidArgumentException('This function cannot determine the maximum buildable count for a BOM entry without a part!'); } @@ -59,8 +54,6 @@ class ProjectBuildHelper /** * Returns the maximum buildable amount of the given project, based on the stock of the used parts in the BOM. - * @param Project $project - * @return int */ public function getMaximumBuildableCount(Project $project): int { @@ -81,9 +74,7 @@ class ProjectBuildHelper /** * Checks if the given project can be built with the current stock. * This means that the maximum buildable count is greater or equal than the requested $number_of_projects - * @param Project $project * @parm int $number_of_builds - * @return bool */ public function isProjectBuildable(Project $project, int $number_of_builds = 1): bool { @@ -93,9 +84,6 @@ class ProjectBuildHelper /** * Check if the given BOM entry can be built with the current stock. * This means that the maximum buildable count is greater or equal than the requested $number_of_projects - * @param ProjectBOMEntry $bom_entry - * @param int $number_of_builds - * @return bool */ public function isBOMEntryBuildable(ProjectBOMEntry $bom_entry, int $number_of_builds = 1): bool { @@ -120,7 +108,7 @@ class ProjectBuildHelper $part = $bomEntry->getPart(); //Skip BOM entries without a part (as we can not determine that) - if ($part === null) { + if (!$part instanceof \App\Entity\Parts\Part) { continue; } @@ -138,8 +126,6 @@ class ProjectBuildHelper * Withdraw the parts from the stock using the given ProjectBuildRequest and create the build parts entries, if needed. * The ProjectBuildRequest has to be validated before!! * You have to flush changes to DB afterward - * @param ProjectBuildRequest $buildRequest - * @return void */ public function doBuild(ProjectBuildRequest $buildRequest): void { diff --git a/src/Services/ProjectSystem/ProjectBuildPartHelper.php b/src/Services/ProjectSystem/ProjectBuildPartHelper.php index 136e2ff7..80ab9395 100644 --- a/src/Services/ProjectSystem/ProjectBuildPartHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildPartHelper.php @@ -10,8 +10,6 @@ class ProjectBuildPartHelper /** * Returns a part that represents the builds of a project. This part is not saved to the database, and can be used * as initial data for the new part form. - * @param Project $project - * @return Part */ public function getPartInitialization(Project $project): Part { diff --git a/src/Services/Tools/ExchangeRateUpdater.php b/src/Services/Tools/ExchangeRateUpdater.php index 241e2539..04ef4d26 100644 --- a/src/Services/Tools/ExchangeRateUpdater.php +++ b/src/Services/Tools/ExchangeRateUpdater.php @@ -27,13 +27,8 @@ use Swap\Swap; class ExchangeRateUpdater { - private string $base_currency; - private Swap $swap; - - public function __construct(string $base_currency, Swap $swap) + public function __construct(private readonly string $base_currency, private readonly Swap $swap) { - $this->base_currency = $base_currency; - $this->swap = $swap; } /** diff --git a/src/Services/Tools/StatisticsHelper.php b/src/Services/Tools/StatisticsHelper.php index f31cb440..0ee736f9 100644 --- a/src/Services/Tools/StatisticsHelper.php +++ b/src/Services/Tools/StatisticsHelper.php @@ -62,13 +62,11 @@ use InvalidArgumentException; class StatisticsHelper { - protected EntityManagerInterface $em; protected PartRepository $part_repo; protected AttachmentRepository $attachment_repo; - public function __construct(EntityManagerInterface $em) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $em; $this->part_repo = $this->em->getRepository(Part::class); $this->attachment_repo = $this->em->getRepository(Attachment::class); } diff --git a/src/Services/Tools/TagFinder.php b/src/Services/Tools/TagFinder.php index d52b3008..bfc7c9db 100644 --- a/src/Services/Tools/TagFinder.php +++ b/src/Services/Tools/TagFinder.php @@ -34,11 +34,8 @@ use function array_slice; */ class TagFinder { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $entityManager) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $entityManager; } /** @@ -78,7 +75,7 @@ class TagFinder //Iterate over each possible tags (which are comma separated) and extract tags which match our keyword foreach ($possible_tags as $tags) { - $tags = explode(',', $tags['tags']); + $tags = explode(',', (string) $tags['tags']); $results = array_merge($results, preg_grep($keyword_regex, $tags)); } diff --git a/src/Services/TranslationExtractor/PermissionExtractor.php b/src/Services/TranslationExtractor/PermissionExtractor.php index 03acd5db..e17cba7a 100644 --- a/src/Services/TranslationExtractor/PermissionExtractor.php +++ b/src/Services/TranslationExtractor/PermissionExtractor.php @@ -32,7 +32,7 @@ use Symfony\Component\Translation\MessageCatalogue; */ final class PermissionExtractor implements ExtractorInterface { - private array $permission_structure; + private readonly array $permission_structure; private bool $finished = false; public function __construct(PermissionManager $resolver) diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php index 66ec2d40..30b868d3 100644 --- a/src/Services/Trees/NodesListBuilder.php +++ b/src/Services/Trees/NodesListBuilder.php @@ -34,15 +34,8 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface; */ class NodesListBuilder { - protected EntityManagerInterface $em; - protected TagAwareCacheInterface $cache; - protected UserCacheKeyGenerator $keyGenerator; - - public function __construct(EntityManagerInterface $em, TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator) + public function __construct(protected EntityManagerInterface $em, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator) { - $this->em = $em; - $this->keyGenerator = $keyGenerator; - $this->cache = $treeCache; } /** @@ -56,7 +49,7 @@ class NodesListBuilder */ public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array { - $parent_id = null !== $parent ? $parent->getID() : '0'; + $parent_id = $parent instanceof \App\Entity\Base\AbstractStructuralDBElement ? $parent->getID() : '0'; // Backslashes are not allowed in cache keys $secure_class_name = str_replace('\\', '_', $class_name); $key = 'list_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.$parent_id; @@ -81,6 +74,6 @@ class NodesListBuilder */ public function getChildrenFlatList(AbstractStructuralDBElement $element): array { - return $this->typeToNodesList(get_class($element), $element); + return $this->typeToNodesList($element::class, $element); } } diff --git a/src/Services/Trees/SidebarTreeUpdater.php b/src/Services/Trees/SidebarTreeUpdater.php index 13c3fb6c..16853d7e 100644 --- a/src/Services/Trees/SidebarTreeUpdater.php +++ b/src/Services/Trees/SidebarTreeUpdater.php @@ -27,19 +27,18 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface; final class SidebarTreeUpdater { private const CACHE_KEY = 'sidebar_tree_updated'; - private const TTL = 60 * 60 * 24; // 24 hours + private const TTL = 60 * 60 * 24; - private CacheInterface $cache; - - public function __construct(TagAwareCacheInterface $treeCache) + public function __construct( + // 24 hours + private readonly TagAwareCacheInterface $cache + ) { - $this->cache = $treeCache; } /** * Returns the time when the sidebar tree was updated the last time. * The frontend uses this information to reload the sidebar tree. - * @return \DateTimeInterface */ public function getLastTreeUpdate(): \DateTimeInterface { diff --git a/src/Services/Trees/StructuralElementRecursionHelper.php b/src/Services/Trees/StructuralElementRecursionHelper.php index 3096740c..bc46d7f7 100644 --- a/src/Services/Trees/StructuralElementRecursionHelper.php +++ b/src/Services/Trees/StructuralElementRecursionHelper.php @@ -27,11 +27,8 @@ use Doctrine\ORM\EntityManagerInterface; class StructuralElementRecursionHelper { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $em; } /** diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index 587dfbc7..37c84642 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -49,24 +49,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class ToolsTreeBuilder { - protected TranslatorInterface $translator; - protected UrlGeneratorInterface $urlGenerator; - protected UserCacheKeyGenerator $keyGenerator; - protected TagAwareCacheInterface $cache; - protected \Symfony\Bundle\SecurityBundle\Security $security; - - public function __construct(TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator, - TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, - \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected \Symfony\Bundle\SecurityBundle\Security $security) { - $this->translator = $translator; - $this->urlGenerator = $urlGenerator; - - $this->cache = $treeCache; - - $this->keyGenerator = $keyGenerator; - - $this->security = $security; } /** diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index e5bb4ddc..61f32922 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -47,26 +47,8 @@ use function count; class TreeViewGenerator { - protected EntityURLGenerator $urlGenerator; - protected EntityManagerInterface $em; - protected TagAwareCacheInterface $cache; - protected UserCacheKeyGenerator $keyGenerator; - protected TranslatorInterface $translator; - - protected bool $rootNodeExpandedByDefault; - protected bool $rootNodeEnabled; - - public function __construct(EntityURLGenerator $URLGenerator, EntityManagerInterface $em, - TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, TranslatorInterface $translator, bool $rootNodeExpandedByDefault, bool $rootNodeEnabled) + public function __construct(protected EntityURLGenerator $urlGenerator, protected EntityManagerInterface $em, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected TranslatorInterface $translator, protected bool $rootNodeExpandedByDefault, protected bool $rootNodeEnabled) { - $this->urlGenerator = $URLGenerator; - $this->em = $em; - $this->cache = $treeCache; - $this->keyGenerator = $keyGenerator; - $this->translator = $translator; - - $this->rootNodeExpandedByDefault = $rootNodeExpandedByDefault; - $this->rootNodeEnabled = $rootNodeEnabled; } /** @@ -92,7 +74,7 @@ class TreeViewGenerator $href = $this->urlGenerator->createURL(new $class()); $new_node = new TreeViewNode($this->translator->trans('entity.tree.new'), $href); //When the id of the selected element is null, then we have a new element, and we need to select "new" node - if (null === $selectedElement || null === $selectedElement->getID()) { + if (!$selectedElement instanceof \App\Entity\Base\AbstractDBElement || null === $selectedElement->getID()) { $new_node->setSelected(true); } $head[] = $new_node; @@ -116,7 +98,7 @@ class TreeViewGenerator $recursiveIterator = new RecursiveIteratorIterator($treeIterator, RecursiveIteratorIterator::SELF_FIRST); foreach ($recursiveIterator as $item) { /** @var TreeViewNode $item */ - if (null !== $selectedElement && $item->getId() === $selectedElement->getID()) { + if ($selectedElement instanceof \App\Entity\Base\AbstractDBElement && $item->getId() === $selectedElement->getID()) { $item->setSelected(true); } @@ -202,7 +184,7 @@ class TreeViewGenerator if (!is_a($class, AbstractNamedDBElement::class, true)) { throw new InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!'); } - if (null !== $parent && !is_a($parent, $class)) { + if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement && !$parent instanceof $class) { throw new InvalidArgumentException('$parent must be of the type $class!'); } @@ -210,7 +192,7 @@ class TreeViewGenerator $repo = $this->em->getRepository($class); //If we just want a part of a tree, don't cache it - if (null !== $parent) { + if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { return $repo->getGenericNodeTree($parent); } diff --git a/src/Services/UserSystem/PasswordResetManager.php b/src/Services/UserSystem/PasswordResetManager.php index 7b8a5be3..2a4c9274 100644 --- a/src/Services/UserSystem/PasswordResetManager.php +++ b/src/Services/UserSystem/PasswordResetManager.php @@ -35,21 +35,13 @@ use Symfony\Contracts\Translation\TranslatorInterface; class PasswordResetManager { - protected MailerInterface $mailer; - protected EntityManagerInterface $em; protected PasswordHasherInterface $passwordEncoder; - protected TranslatorInterface $translator; - protected UserPasswordHasherInterface $userPasswordEncoder; - public function __construct(MailerInterface $mailer, EntityManagerInterface $em, - TranslatorInterface $translator, UserPasswordHasherInterface $userPasswordEncoder, + public function __construct(protected MailerInterface $mailer, protected EntityManagerInterface $em, + protected TranslatorInterface $translator, protected UserPasswordHasherInterface $userPasswordEncoder, PasswordHasherFactoryInterface $encoderFactory) { - $this->em = $em; - $this->mailer = $mailer; $this->passwordEncoder = $encoderFactory->getPasswordHasher(User::class); - $this->translator = $translator; - $this->userPasswordEncoder = $userPasswordEncoder; } public function request(string $name_or_email): void @@ -59,7 +51,7 @@ class PasswordResetManager //Try to find a user by the given string $user = $repo->findByEmailOrName($name_or_email); //Do nothing if no user was found - if (null === $user) { + if (!$user instanceof \App\Entity\UserSystem\User) { return; } @@ -109,7 +101,7 @@ class PasswordResetManager $user = $repo->findOneBy(['name' => $username]); //If no user matching the name, show an error message - if (null === $user) { + if (!$user instanceof \App\Entity\UserSystem\User) { return false; } diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php index 47e42635..5ef71d4c 100644 --- a/src/Services/UserSystem/PermissionManager.php +++ b/src/Services/UserSystem/PermissionManager.php @@ -40,19 +40,16 @@ use Symfony\Component\Yaml\Yaml; class PermissionManager { protected $permission_structure; - - protected bool $is_debug; protected string $cache_file; /** * PermissionResolver constructor. */ - public function __construct(bool $kernel_debug, string $kernel_cache_dir) + public function __construct(protected bool $is_debug, string $kernel_cache_dir) { $cache_dir = $kernel_cache_dir; //Here the cached structure will be saved. $this->cache_file = $cache_dir.'/permissions.php.cache'; - $this->is_debug = $kernel_debug; $this->permission_structure = $this->generatePermissionStructure(); } @@ -113,7 +110,7 @@ class PermissionManager /** @var Group $parent */ $parent = $user->getGroup(); - while (null !== $parent) { //The top group, has parent == null + while ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { //The top group, has parent == null //Check if our current element gives an info about disallow/allow $allowed = $this->dontInherit($parent, $permission, $operation); if (null !== $allowed) { @@ -196,8 +193,6 @@ class PermissionManager /** * This functions sets all operations mentioned in the alsoSet value of a permission, so that the structure is always valid. - * @param HasPermissionsInterface $user - * @return void */ public function ensureCorrectSetOperations(HasPermissionsInterface $user): void { @@ -215,12 +210,7 @@ class PermissionManager //Set every op listed in also Set foreach ($op['alsoSet'] as $set_also) { //If the alsoSet value contains a dot then we set the operation of another permission - if (str_contains($set_also, '.')) { - [$set_perm, $set_op] = explode('.', $set_also); - } else { - //Else we set the operation of the same permission - [$set_perm, $set_op] = [$perm_key, $set_also]; - } + [$set_perm, $set_op] = str_contains((string) $set_also, '.') ? explode('.', (string) $set_also) : [$perm_key, $set_also]; //Check if we change the value of the permission if ($this->dontInherit($user, $set_perm, $set_op) !== true) { @@ -237,9 +227,6 @@ class PermissionManager /** * Sets all possible operations of all possible permissions of the given entity to the given value. - * @param HasPermissionsInterface $perm_holder - * @param bool|null $new_value - * @return void */ public function setAllPermissions(HasPermissionsInterface $perm_holder, ?bool $new_value): void { @@ -253,11 +240,6 @@ class PermissionManager /** * Sets all operations of the given permissions to the given value. * Please note that you have to call ensureCorrectSetOperations() after this function, to ensure that all alsoSet values are set. - * - * @param HasPermissionsInterface $perm_holder - * @param string $permission - * @param bool|null $new_value - * @return void */ public function setAllOperationsOfPermission(HasPermissionsInterface $perm_holder, string $permission, ?bool $new_value): void { @@ -272,11 +254,6 @@ class PermissionManager /** * This function sets all operations of the given permission to the given value, except the ones listed in the except array. - * @param HasPermissionsInterface $perm_holder - * @param string $permission - * @param bool|null $new_value - * @param array $except - * @return void */ public function setAllOperationsOfPermissionExcept(HasPermissionsInterface $perm_holder, string $permission, ?bool $new_value, array $except): void { diff --git a/src/Services/UserSystem/PermissionPresetsHelper.php b/src/Services/UserSystem/PermissionPresetsHelper.php index 7f7dc405..bf9aad8a 100644 --- a/src/Services/UserSystem/PermissionPresetsHelper.php +++ b/src/Services/UserSystem/PermissionPresetsHelper.php @@ -25,18 +25,15 @@ use App\Security\Interfaces\HasPermissionsInterface; class PermissionPresetsHelper { - public const PRESET_ALL_INHERIT = 'all_inherit'; - public const PRESET_ALL_FORBID = 'all_forbid'; - public const PRESET_ALL_ALLOW = 'all_allow'; - public const PRESET_READ_ONLY = 'read_only'; - public const PRESET_EDITOR = 'editor'; - public const PRESET_ADMIN = 'admin'; + final public const PRESET_ALL_INHERIT = 'all_inherit'; + final public const PRESET_ALL_FORBID = 'all_forbid'; + final public const PRESET_ALL_ALLOW = 'all_allow'; + final public const PRESET_READ_ONLY = 'read_only'; + final public const PRESET_EDITOR = 'editor'; + final public const PRESET_ADMIN = 'admin'; - private PermissionManager $permissionResolver; - - public function __construct(PermissionManager $permissionResolver) + public function __construct(private readonly PermissionManager $permissionResolver) { - $this->permissionResolver = $permissionResolver; } /** @@ -44,7 +41,6 @@ class PermissionPresetsHelper * The permission data will be reset during the process and then the preset will be applied. * * @param string $preset_name The name of the preset to use - * @return HasPermissionsInterface */ public function applyPreset(HasPermissionsInterface $perm_holder, string $preset_name): HasPermissionsInterface { diff --git a/src/Services/UserSystem/PermissionSchemaUpdater.php b/src/Services/UserSystem/PermissionSchemaUpdater.php index f182c018..72231bcb 100644 --- a/src/Services/UserSystem/PermissionSchemaUpdater.php +++ b/src/Services/UserSystem/PermissionSchemaUpdater.php @@ -29,7 +29,6 @@ class PermissionSchemaUpdater { /** * Check if the given user/group needs an update of its permission schema. - * @param HasPermissionsInterface $holder * @return bool True if the permission schema needs an update, false otherwise. */ public function isSchemaUpdateNeeded(HasPermissionsInterface $holder): bool @@ -42,12 +41,11 @@ class PermissionSchemaUpdater /** * Upgrades the permission schema of the given user/group to the chosen version. * Please note that this function does not flush the changes to DB! - * @param HasPermissionsInterface $holder - * @param int $target_version * @return bool True, if an upgrade was done, false if it was not needed. */ public function upgradeSchema(HasPermissionsInterface $holder, int $target_version = PermissionData::CURRENT_SCHEMA_VERSION): bool { + $e = null; if ($target_version > PermissionData::CURRENT_SCHEMA_VERSION) { throw new \InvalidArgumentException('The target version is higher than the maximum possible schema version!'); } @@ -66,7 +64,7 @@ class PermissionSchemaUpdater $method->setAccessible(true); $method->invoke($this, $holder); } catch (\ReflectionException $e) { - throw new \RuntimeException('Could not find update method for schema version '.($n + 1)); + throw new \RuntimeException('Could not find update method for schema version '.($n + 1), $e->getCode(), $e); } //Bump the schema version @@ -80,8 +78,6 @@ class PermissionSchemaUpdater /** * Upgrades the permission schema of the given group and all of its parent groups to the chosen version. * Please note that this function does not flush the changes to DB! - * @param Group $group - * @param int $target_version * @return bool True if an upgrade was done, false if it was not needed. */ public function groupUpgradeSchemaRecursively(Group $group, int $target_version = PermissionData::CURRENT_SCHEMA_VERSION): bool @@ -101,14 +97,12 @@ class PermissionSchemaUpdater /** * Upgrades the permissions schema of the given users and its parent (including parent groups) to the chosen version. * Please note that this function does not flush the changes to DB! - * @param User $user - * @param int $target_version * @return bool True if an upgrade was done, false if it was not needed. */ public function userUpgradeSchemaRecursively(User $user, int $target_version = PermissionData::CURRENT_SCHEMA_VERSION): bool { $updated = $this->upgradeSchema($user, $target_version); - if ($user->getGroup()) { + if ($user->getGroup() instanceof \App\Entity\UserSystem\Group) { $updated = $this->groupUpgradeSchemaRecursively($user->getGroup(), $target_version) || $updated; } diff --git a/src/Services/UserSystem/TFA/BackupCodeGenerator.php b/src/Services/UserSystem/TFA/BackupCodeGenerator.php index 942dd050..9beddf39 100644 --- a/src/Services/UserSystem/TFA/BackupCodeGenerator.php +++ b/src/Services/UserSystem/TFA/BackupCodeGenerator.php @@ -31,7 +31,6 @@ use RuntimeException; class BackupCodeGenerator { protected int $code_length; - protected int $code_count; /** * BackupCodeGenerator constructor. @@ -39,7 +38,7 @@ class BackupCodeGenerator * @param int $code_length how many characters a single code should have * @param int $code_count how many codes are generated for a whole backup set */ - public function __construct(int $code_length, int $code_count) + public function __construct(int $code_length, protected int $code_count) { if ($code_length > 32) { throw new RuntimeException('Backup code can have maximum 32 digits!'); @@ -47,8 +46,6 @@ class BackupCodeGenerator if ($code_length < 6) { throw new RuntimeException('Code must have at least 6 digits to ensure security!'); } - - $this->code_count = $code_count; $this->code_length = $code_length; } diff --git a/src/Services/UserSystem/TFA/BackupCodeManager.php b/src/Services/UserSystem/TFA/BackupCodeManager.php index fb98a33e..1fb572c6 100644 --- a/src/Services/UserSystem/TFA/BackupCodeManager.php +++ b/src/Services/UserSystem/TFA/BackupCodeManager.php @@ -29,11 +29,8 @@ use App\Entity\UserSystem\User; */ class BackupCodeManager { - protected BackupCodeGenerator $backupCodeGenerator; - - public function __construct(BackupCodeGenerator $backupCodeGenerator) + public function __construct(protected BackupCodeGenerator $backupCodeGenerator) { - $this->backupCodeGenerator = $backupCodeGenerator; } /** diff --git a/src/Services/UserSystem/UserAvatarHelper.php b/src/Services/UserSystem/UserAvatarHelper.php index 95b94dca..026cdcd5 100644 --- a/src/Services/UserSystem/UserAvatarHelper.php +++ b/src/Services/UserSystem/UserAvatarHelper.php @@ -33,34 +33,18 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; class UserAvatarHelper { - private bool $use_gravatar; - private Packages $packages; - private AttachmentURLGenerator $attachmentURLGenerator; - private FilterService $filterService; - private EntityManagerInterface $entityManager; - private AttachmentSubmitHandler $submitHandler; - - public function __construct(bool $use_gravatar, Packages $packages, AttachmentURLGenerator $attachmentURLGenerator, - FilterService $filterService, EntityManagerInterface $entityManager, AttachmentSubmitHandler $attachmentSubmitHandler) + public function __construct(private readonly bool $use_gravatar, private readonly Packages $packages, private readonly AttachmentURLGenerator $attachmentURLGenerator, private readonly FilterService $filterService, private readonly EntityManagerInterface $entityManager, private readonly AttachmentSubmitHandler $submitHandler) { - $this->use_gravatar = $use_gravatar; - $this->packages = $packages; - $this->attachmentURLGenerator = $attachmentURLGenerator; - $this->filterService = $filterService; - $this->entityManager = $entityManager; - $this->submitHandler = $attachmentSubmitHandler; } /** * Returns the URL to the profile picture of the given user (in big size) - * @param User $user - * @return string */ public function getAvatarURL(User $user): string { //Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture) - if ($user->getMasterPictureAttachment() !== null) { + if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_md'); } @@ -76,7 +60,7 @@ class UserAvatarHelper public function getAvatarSmURL(User $user): string { //Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture) - if ($user->getMasterPictureAttachment() !== null) { + if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_xs'); } @@ -88,7 +72,7 @@ class UserAvatarHelper try { //Otherwise we can serve the relative path via Asset component return $this->filterService->getUrlOfFilteredImage('/img/default_avatar.png', 'thumbnail_xs'); - } catch (\Imagine\Exception\RuntimeException $e) { + } catch (\Imagine\Exception\RuntimeException) { //If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning return $this->packages->getUrl('/img/default_avatar.png'); } @@ -97,7 +81,7 @@ class UserAvatarHelper public function getAvatarMdURL(User $user): string { //Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture) - if ($user->getMasterPictureAttachment() !== null) { + if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_sm'); } @@ -109,7 +93,7 @@ class UserAvatarHelper try { //Otherwise we can serve the relative path via Asset component return $this->filterService->getUrlOfFilteredImage('/img/default_avatar.png', 'thumbnail_xs'); - } catch (\Imagine\Exception\RuntimeException $e) { + } catch (\Imagine\Exception\RuntimeException) { //If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning return $this->packages->getUrl('/img/default_avatar.png'); } @@ -136,22 +120,18 @@ class UserAvatarHelper $url = 'https://www.gravatar.com/avatar/'; $url .= md5(strtolower(trim($email))); - $url .= "?s=${s}&d=${d}&r=${r}"; - return $url; + return $url . "?s=${s}&d=${d}&r=${r}"; } /** * Handles the upload of the user avatar. - * @param User $user - * @param UploadedFile $file - * @return Attachment */ public function handleAvatarUpload(User $user, UploadedFile $file): Attachment { //Determine which attachment to user //If the user already has a master attachment, we use this one - if ($user->getMasterPictureAttachment()) { + if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { $attachment = $user->getMasterPictureAttachment(); } else { //Otherwise we have to create one $attachment = new UserAttachment(); diff --git a/src/Services/UserSystem/UserCacheKeyGenerator.php b/src/Services/UserSystem/UserCacheKeyGenerator.php index dd9e6ccb..69caeff3 100644 --- a/src/Services/UserSystem/UserCacheKeyGenerator.php +++ b/src/Services/UserSystem/UserCacheKeyGenerator.php @@ -32,13 +32,8 @@ use Symfony\Component\Security\Core\Security; */ class UserCacheKeyGenerator { - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected RequestStack $requestStack; - - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, RequestStack $requestStack) + public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected RequestStack $requestStack) { - $this->security = $security; - $this->requestStack = $requestStack; } /** @@ -51,10 +46,10 @@ class UserCacheKeyGenerator { $request = $this->requestStack->getCurrentRequest(); //Retrieve the locale from the request, if possible, otherwise use the default locale - $locale = $request ? $request->getLocale() : Locale::getDefault(); + $locale = $request instanceof \Symfony\Component\HttpFoundation\Request ? $request->getLocale() : Locale::getDefault(); //If no user was specified, use the currently used one. - if (null === $user) { + if (!$user instanceof \App\Entity\UserSystem\User) { $user = $this->security->getUser(); } diff --git a/src/Twig/AttachmentExtension.php b/src/Twig/AttachmentExtension.php index b02f749d..c0897ab2 100644 --- a/src/Twig/AttachmentExtension.php +++ b/src/Twig/AttachmentExtension.php @@ -27,22 +27,17 @@ use Twig\TwigFunction; final class AttachmentExtension extends AbstractExtension { - protected AttachmentURLGenerator $attachmentURLGenerator; - protected FAIconGenerator $FAIconGenerator; - - public function __construct(AttachmentURLGenerator $attachmentURLGenerator, FAIconGenerator $FAIconGenerator) + public function __construct(protected AttachmentURLGenerator $attachmentURLGenerator, protected FAIconGenerator $FAIconGenerator) { - $this->attachmentURLGenerator = $attachmentURLGenerator; - $this->FAIconGenerator = $FAIconGenerator; } public function getFunctions(): array { return [ /* Returns the URL to a thumbnail of the given attachment */ - new TwigFunction('attachment_thumbnail', [$this->attachmentURLGenerator, 'getThumbnailURL']), + new TwigFunction('attachment_thumbnail', fn(\App\Entity\Attachments\Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)), /* Returns the font awesome icon class which is representing the given file extension */ - new TwigFunction('ext_to_fa_icon', [$this->FAIconGenerator, 'fileExtensionToFAType']), + new TwigFunction('ext_to_fa_icon', fn(string $extension): string => $this->FAIconGenerator->fileExtensionToFAType($extension)), ]; } } \ No newline at end of file diff --git a/src/Twig/BarcodeExtension.php b/src/Twig/BarcodeExtension.php index 6020b65e..5e8984d2 100644 --- a/src/Twig/BarcodeExtension.php +++ b/src/Twig/BarcodeExtension.php @@ -30,7 +30,7 @@ final class BarcodeExtension extends AbstractExtension { return [ /* Generates a barcode with the given Type and Data and returns it as an SVG represenation */ - new TwigFunction('barcode_svg', [$this, 'barcodeSVG']), + new TwigFunction('barcode_svg', fn(string $content, string $type = 'QRCODE'): string => $this->barcodeSVG($content, $type)), ]; } diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php index 402a28b3..1a8f5d37 100644 --- a/src/Twig/EntityExtension.php +++ b/src/Twig/EntityExtension.php @@ -44,24 +44,15 @@ use Twig\TwigTest; final class EntityExtension extends AbstractExtension { - protected EntityURLGenerator $entityURLGenerator; - protected TreeViewGenerator $treeBuilder; - private ElementTypeNameGenerator $nameGenerator; - - public function __construct(EntityURLGenerator $entityURLGenerator, TreeViewGenerator $treeBuilder, ElementTypeNameGenerator $elementTypeNameGenerator) + public function __construct(protected EntityURLGenerator $entityURLGenerator, protected TreeViewGenerator $treeBuilder, private readonly ElementTypeNameGenerator $nameGenerator) { - $this->entityURLGenerator = $entityURLGenerator; - $this->treeBuilder = $treeBuilder; - $this->nameGenerator = $elementTypeNameGenerator; } public function getTests(): array { return [ /* Checks if the given variable is an entitity (instance of AbstractDBElement) */ - new TwigTest('entity', static function ($var) { - return $var instanceof AbstractDBElement; - }), + new TwigTest('entity', static fn($var) => $var instanceof AbstractDBElement), ]; } @@ -69,16 +60,16 @@ final class EntityExtension extends AbstractExtension { return [ /* Returns a string representation of the given entity */ - new TwigFunction('entity_type', [$this, 'getEntityType']), + new TwigFunction('entity_type', fn(object $entity): ?string => $this->getEntityType($entity)), /* Returns the URL to the given entity */ - new TwigFunction('entity_url', [$this, 'generateEntityURL']), + new TwigFunction('entity_url', fn(\App\Entity\Base\AbstractDBElement $entity, string $method = 'info'): string => $this->generateEntityURL($entity, $method)), /* Returns the URL to the given entity in timetravel mode */ - new TwigFunction('timetravel_url', [$this, 'timeTravelURL']), + new TwigFunction('timetravel_url', fn(\App\Entity\Base\AbstractDBElement $element, \DateTimeInterface $dateTime): ?string => $this->timeTravelURL($element, $dateTime)), /* Generates a JSON array of the given tree */ - new TwigFunction('tree_data', [$this, 'treeData']), + new TwigFunction('tree_data', fn(\App\Entity\Base\AbstractDBElement $element, string $type = 'newEdit'): string => $this->treeData($element, $type)), /* Gets a human readable label for the type of the given entity */ - new TwigFunction('entity_type_label', [$this->nameGenerator, 'getLocalizedTypeLabel']), + new TwigFunction('entity_type_label', fn(object|string $entity): string => $this->nameGenerator->getLocalizedTypeLabel($entity)), ]; } @@ -86,14 +77,14 @@ final class EntityExtension extends AbstractExtension { try { return $this->entityURLGenerator->timeTravelURL($element, $dateTime); - } catch (EntityNotSupportedException $e) { + } catch (EntityNotSupportedException) { return null; } } public function treeData(AbstractDBElement $element, string $type = 'newEdit'): string { - $tree = $this->treeBuilder->getTreeView(get_class($element), null, $type, $element); + $tree = $this->treeBuilder->getTreeView($element::class, null, $type, $element); return json_encode($tree, JSON_THROW_ON_ERROR); } diff --git a/src/Twig/FormatExtension.php b/src/Twig/FormatExtension.php index 775a3fe4..d5fe0e91 100644 --- a/src/Twig/FormatExtension.php +++ b/src/Twig/FormatExtension.php @@ -34,37 +34,26 @@ use Twig\TwigFilter; final class FormatExtension extends AbstractExtension { - protected MarkdownParser $markdownParser; - protected MoneyFormatter $moneyFormatter; - protected SIFormatter $siformatter; - protected AmountFormatter $amountFormatter; - - - public function __construct(MarkdownParser $markdownParser, MoneyFormatter $moneyFormatter, - SIFormatter $SIFormatter, AmountFormatter $amountFormatter) + public function __construct(protected MarkdownParser $markdownParser, protected MoneyFormatter $moneyFormatter, protected SIFormatter $siformatter, protected AmountFormatter $amountFormatter) { - $this->markdownParser = $markdownParser; - $this->moneyFormatter = $moneyFormatter; - $this->siformatter = $SIFormatter; - $this->amountFormatter = $amountFormatter; } public function getFilters(): array { return [ /* Mark the given text as markdown, which will be rendered in the browser */ - new TwigFilter('format_markdown', [$this->markdownParser, 'markForRendering'], [ + new TwigFilter('format_markdown', fn(string $markdown, bool $inline_mode = false): string => $this->markdownParser->markForRendering($markdown, $inline_mode), [ 'pre_escape' => 'html', 'is_safe' => ['html'], ]), /* Format the given amount as money, using a given currency */ - new TwigFilter('format_money', [$this, 'formatCurrency']), + new TwigFilter('format_money', fn($amount, ?\App\Entity\PriceInformations\Currency $currency = null, int $decimals = 5): string => $this->formatCurrency($amount, $currency, $decimals)), /* Format the given number using SI prefixes and the given unit (string) */ - new TwigFilter('format_si', [$this, 'siFormat']), + new TwigFilter('format_si', fn($value, $unit, $decimals = 2, bool $show_all_digits = false): string => $this->siFormat($value, $unit, $decimals, $show_all_digits)), /** Format the given amount using the given MeasurementUnit */ - new TwigFilter('format_amount', [$this, 'amountFormat']), + new TwigFilter('format_amount', fn($value, ?\App\Entity\Parts\MeasurementUnit $unit, array $options = []): string => $this->amountFormat($value, $unit, $options)), /** Format the given number of bytes as human-readable number */ - new TwigFilter('format_bytes', [$this, 'formatBytes']), + new TwigFilter('format_bytes', fn(int $bytes, int $precision = 2): string => $this->formatBytes($bytes, $precision)), ]; } @@ -89,8 +78,6 @@ final class FormatExtension extends AbstractExtension /** * @param $bytes - * @param int $precision - * @return string */ public function formatBytes(int $bytes, int $precision = 2): string { diff --git a/src/Twig/LogExtension.php b/src/Twig/LogExtension.php index a56b9275..c8edb106 100644 --- a/src/Twig/LogExtension.php +++ b/src/Twig/LogExtension.php @@ -28,20 +28,15 @@ use Twig\TwigFunction; final class LogExtension extends AbstractExtension { - private LogDataFormatter $logDataFormatter; - private LogDiffFormatter $logDiffFormatter; - - public function __construct(LogDataFormatter $logDataFormatter, LogDiffFormatter $logDiffFormatter) + public function __construct(private readonly LogDataFormatter $logDataFormatter, private readonly LogDiffFormatter $logDiffFormatter) { - $this->logDataFormatter = $logDataFormatter; - $this->logDiffFormatter = $logDiffFormatter; } public function getFunctions() { return [ - new TwigFunction('format_log_data', [$this->logDataFormatter, 'formatData'], ['is_safe' => ['html']]), - new TwigFunction('format_log_diff', [$this->logDiffFormatter, 'formatDiff'], ['is_safe' => ['html']]), + new TwigFunction('format_log_data', fn($data, \App\Entity\LogSystem\AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]), + new TwigFunction('format_log_diff', fn($old_data, $new_data): string => $this->logDiffFormatter->formatDiff($old_data, $new_data), ['is_safe' => ['html']]), ]; } } \ No newline at end of file diff --git a/src/Twig/MiscExtension.php b/src/Twig/MiscExtension.php index 6181e9cd..54e34d09 100644 --- a/src/Twig/MiscExtension.php +++ b/src/Twig/MiscExtension.php @@ -25,11 +25,8 @@ use Twig\Extension\AbstractExtension; final class MiscExtension extends AbstractExtension { - private EventCommentNeededHelper $eventCommentNeededHelper; - - public function __construct(EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(private readonly EventCommentNeededHelper $eventCommentNeededHelper) { - $this->eventCommentNeededHelper = $eventCommentNeededHelper; } public function getFunctions(): array diff --git a/src/Twig/Sandbox/InheritanceSecurityPolicy.php b/src/Twig/Sandbox/InheritanceSecurityPolicy.php index b70be7a5..db1cd2b5 100644 --- a/src/Twig/Sandbox/InheritanceSecurityPolicy.php +++ b/src/Twig/Sandbox/InheritanceSecurityPolicy.php @@ -35,19 +35,11 @@ use function is_array; */ final class InheritanceSecurityPolicy implements SecurityPolicyInterface { - private array $allowedTags; - private array $allowedFilters; private array $allowedMethods; - private array $allowedProperties; - private array $allowedFunctions; - public function __construct(array $allowedTags = [], array $allowedFilters = [], array $allowedMethods = [], array $allowedProperties = [], array $allowedFunctions = []) + public function __construct(private array $allowedTags = [], private array $allowedFilters = [], array $allowedMethods = [], private array $allowedProperties = [], private array $allowedFunctions = []) { - $this->allowedTags = $allowedTags; - $this->allowedFilters = $allowedFilters; $this->setAllowedMethods($allowedMethods); - $this->allowedProperties = $allowedProperties; - $this->allowedFunctions = $allowedFunctions; } public function setAllowedTags(array $tags): void @@ -65,7 +57,7 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface $this->allowedMethods = []; foreach ($methods as $class => $m) { $this->allowedMethods[$class] = array_map( - static function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, is_array($m) ? $m : [$m]); + static fn($value): string => strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), is_array($m) ? $m : [$m]); } } @@ -120,7 +112,7 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface } if (!$allowed) { - $class = get_class($obj); + $class = $obj::class; throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is not allowed.', $method, $class), $class, $method); } @@ -141,7 +133,7 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface } if (!$allowed) { - $class = get_class($obj); + $class = $obj::class; throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is not allowed.', $property, $class), $class, $property); } diff --git a/src/Twig/TwigCoreExtension.php b/src/Twig/TwigCoreExtension.php index 6b12299a..dc63b2e1 100644 --- a/src/Twig/TwigCoreExtension.php +++ b/src/Twig/TwigCoreExtension.php @@ -30,11 +30,8 @@ use Twig\TwigTest; */ final class TwigCoreExtension extends AbstractExtension { - protected ObjectNormalizer $objectNormalizer; - - public function __construct(ObjectNormalizer $objectNormalizer) + public function __construct(protected ObjectNormalizer $objectNormalizer) { - $this->objectNormalizer = $objectNormalizer; } public function getTests(): array @@ -43,13 +40,9 @@ final class TwigCoreExtension extends AbstractExtension /* * Checks if a given variable is an instance of a given class. E.g. ` x is instanceof('App\Entity\Parts\Part')` */ - new TwigTest('instanceof', static function ($var, $instance) { - return $var instanceof $instance; - }), + new TwigTest('instanceof', static fn($var, $instance) => $var instanceof $instance), /* Checks if a given variable is an object. E.g. `x is object` */ - new TwigTest('object', static function ($var) { - return is_object($var); - }), + new TwigTest('object', static fn($var): object => is_object($var)), ]; } @@ -57,7 +50,7 @@ final class TwigCoreExtension extends AbstractExtension { return [ /* Converts the given object to an array representation of the public/accessible properties */ - new TwigFilter('to_array', [$this, 'toArray']), + new TwigFilter('to_array', fn($object) => $this->toArray($object)), ]; } diff --git a/src/Twig/UserExtension.php b/src/Twig/UserExtension.php index 3b0ec75c..d2c8880f 100644 --- a/src/Twig/UserExtension.php +++ b/src/Twig/UserExtension.php @@ -50,7 +50,7 @@ use Twig\TwigFunction; final class UserExtension extends AbstractExtension { - private LogEntryRepository $repo; + private readonly LogEntryRepository $repo; public function __construct(EntityManagerInterface $em) { @@ -60,7 +60,7 @@ final class UserExtension extends AbstractExtension public function getFilters(): array { return [ - new TwigFilter('remove_locale_from_path', [$this, 'removeLocaleFromPath']), + new TwigFilter('remove_locale_from_path', fn(string $path): string => $this->removeLocaleFromPath($path)), ]; } @@ -68,9 +68,9 @@ final class UserExtension extends AbstractExtension { return [ /* Returns the user which has edited the given entity the last time. */ - new TwigFunction('last_editing_user', [$this->repo, 'getLastEditingUser']), + new TwigFunction('last_editing_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getLastEditingUser($element)), /* Returns the user which has created the given entity. */ - new TwigFunction('creating_user', [$this->repo, 'getCreatingUser']), + new TwigFunction('creating_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getCreatingUser($element)), ]; } diff --git a/src/Validator/Constraints/Misc/ValidRangeValidator.php b/src/Validator/Constraints/Misc/ValidRangeValidator.php index 8385cc92..8bc5af0c 100644 --- a/src/Validator/Constraints/Misc/ValidRangeValidator.php +++ b/src/Validator/Constraints/Misc/ValidRangeValidator.php @@ -49,11 +49,8 @@ use Symfony\Component\Validator\Exception\UnexpectedValueException; class ValidRangeValidator extends ConstraintValidator { - protected RangeParser $rangeParser; - - public function __construct(RangeParser $rangeParser) + public function __construct(protected RangeParser $rangeParser) { - $this->rangeParser = $rangeParser; } public function validate($value, Constraint $constraint): void diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php index c2de80e2..0cf60f59 100644 --- a/src/Validator/Constraints/NoLockoutValidator.php +++ b/src/Validator/Constraints/NoLockoutValidator.php @@ -33,17 +33,11 @@ use Symfony\Component\Validator\ConstraintValidator; class NoLockoutValidator extends ConstraintValidator { - protected PermissionManager $resolver; protected array $perm_structure; - protected \Symfony\Bundle\SecurityBundle\Security $security; - protected EntityManagerInterface $entityManager; - public function __construct(PermissionManager $resolver, \Symfony\Bundle\SecurityBundle\Security $security, EntityManagerInterface $entityManager) + public function __construct(protected PermissionManager $resolver, protected \Symfony\Bundle\SecurityBundle\Security $security, protected EntityManagerInterface $entityManager) { - $this->resolver = $resolver; $this->perm_structure = $resolver->getPermissionStructure(); - $this->security = $security; - $this->entityManager = $entityManager; } /** @@ -64,12 +58,12 @@ class NoLockoutValidator extends ConstraintValidator if ($perm_holder instanceof User || $perm_holder instanceof Group) { $user = $this->security->getUser(); - if (null === $user) { + if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) { $user = $this->entityManager->getRepository(User::class)->getAnonymousUser(); } //Check if the change_permission permission has changed from allow to disallow - if (($user instanceof User) && false === ($this->resolver->inherit( + if (($user instanceof User) && !($this->resolver->inherit( $user, 'users', 'edit_permissions' diff --git a/src/Validator/Constraints/ValidFileFilterValidator.php b/src/Validator/Constraints/ValidFileFilterValidator.php index ccce30ce..d591a968 100644 --- a/src/Validator/Constraints/ValidFileFilterValidator.php +++ b/src/Validator/Constraints/ValidFileFilterValidator.php @@ -32,11 +32,8 @@ use function is_string; class ValidFileFilterValidator extends ConstraintValidator { - protected FileTypeFilterTools $filterTools; - - public function __construct(FileTypeFilterTools $filterTools) + public function __construct(protected FileTypeFilterTools $filterTools) { - $this->filterTools = $filterTools; } /** diff --git a/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php b/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php index bb66f395..276201f3 100644 --- a/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php +++ b/src/Validator/Constraints/ValidGoogleAuthCodeValidator.php @@ -36,11 +36,8 @@ use function strlen; class ValidGoogleAuthCodeValidator extends ConstraintValidator { - protected GoogleAuthenticatorInterface $googleAuthenticator; - - public function __construct(GoogleAuthenticatorInterface $googleAuthenticator) + public function __construct(protected GoogleAuthenticatorInterface $googleAuthenticator) { - $this->googleAuthenticator = $googleAuthenticator; } public function validate($value, Constraint $constraint): void diff --git a/src/Validator/Constraints/ValidPartLotValidator.php b/src/Validator/Constraints/ValidPartLotValidator.php index d77ecd0e..5e5b22d9 100644 --- a/src/Validator/Constraints/ValidPartLotValidator.php +++ b/src/Validator/Constraints/ValidPartLotValidator.php @@ -32,11 +32,8 @@ use Symfony\Component\Validator\ConstraintValidator; class ValidPartLotValidator extends ConstraintValidator { - protected EntityManagerInterface $em; - - public function __construct(EntityManagerInterface $em) + public function __construct(protected EntityManagerInterface $em) { - $this->em = $em; } /** @@ -56,7 +53,7 @@ class ValidPartLotValidator extends ConstraintValidator } //We can only validate the values if we know the storelocation - if ($value->getStorageLocation()) { + if ($value->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { $repo = $this->em->getRepository(Storelocation::class); //We can only determine associated parts, if the part have an ID //When the storage location is new (no ID), we can just assume there are no other parts diff --git a/src/Validator/Constraints/ValidPermissionValidator.php b/src/Validator/Constraints/ValidPermissionValidator.php index 9b31048f..7bc6c4e7 100644 --- a/src/Validator/Constraints/ValidPermissionValidator.php +++ b/src/Validator/Constraints/ValidPermissionValidator.php @@ -30,12 +30,10 @@ use Symfony\Component\Validator\ConstraintValidator; class ValidPermissionValidator extends ConstraintValidator { - protected PermissionManager $resolver; protected array $perm_structure; - public function __construct(PermissionManager $resolver) + public function __construct(protected PermissionManager $resolver) { - $this->resolver = $resolver; } /** diff --git a/src/Validator/Constraints/ValidThemeValidator.php b/src/Validator/Constraints/ValidThemeValidator.php index ec437b87..f83bb500 100644 --- a/src/Validator/Constraints/ValidThemeValidator.php +++ b/src/Validator/Constraints/ValidThemeValidator.php @@ -26,11 +26,8 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class ValidThemeValidator extends ConstraintValidator { - private array $available_themes; - - public function __construct(array $available_themes) + public function __construct(private readonly array $available_themes) { - $this->available_themes = $available_themes; } public function validate($value, Constraint $constraint) From 98dc5539388812a912a9ba3890abde62bdd424f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 14:18:53 +0200 Subject: [PATCH 37/91] Applied rector to test files --- .../AttachmentTypeControllerTest.php | 2 +- .../AdminPages/CategoryControllerTest.php | 2 +- .../AdminPages/FootprintControllerTest.php | 2 +- .../AdminPages/LabelProfileControllerTest.php | 2 +- .../AdminPages/ManufacturerControllerTest.php | 2 +- .../MeasurementUnitControllerTest.php | 2 +- .../AdminPages/ProjectControllerTest.php | 2 +- .../StorelocationControllerTest.php | 2 +- .../AdminPages/SupplierControllerTest.php | 2 +- tests/Controller/RedirectControllerTest.php | 8 ++----- .../Filters/CompoundFilterTraitTest.php | 24 ++++--------------- tests/Entity/Attachments/AttachmentTest.php | 2 +- .../Base/AbstractStructuralDBElementTest.php | 2 +- tests/Entity/Parts/PartTest.php | 6 ++--- .../Projects/ProjectBuildRequestTest.php | 6 ++--- tests/Security/SamlUserFactoryTest.php | 2 +- tests/Serializer/BigNumberNormalizerTest.php | 1 - tests/Serializer/PartNormalizerTest.php | 1 - .../StructuralElementDenormalizerTest.php | 1 - ...ucturalElementFromNameDenormalizerTest.php | 1 - .../StructuralElementNormalizerTest.php | 1 - .../AttachmentPathResolverTest.php | 3 --- .../Services/ElementTypeNameGeneratorTest.php | 2 -- .../Formatters/AmountFormatterTest.php | 4 ++-- .../ImportExportSystem/BOMImporterTest.php | 2 -- .../ImportExportSystem/EntityExporterTest.php | 1 - .../ImportExportSystem/EntityImporterTest.php | 2 -- .../Barcodes/BarcodeContentGeneratorTest.php | 5 +--- .../Barcodes/BarcodeNormalizerTest.php | 6 ++--- .../Barcodes/BarcodeRedirectorTest.php | 7 ++---- .../LabelSystem/LabelTextReplacerTest.php | 2 -- .../LabelSystem/SandboxedTwigProviderTest.php | 5 +--- .../LogSystem/EventCommentHelperTest.php | 2 +- tests/Services/LogSystem/EventLoggerTest.php | 2 +- tests/Services/Misc/FAIconGeneratorTest.php | 2 +- .../Parameters/ParameterExtractorTest.php | 1 - .../Parts/PartLotWithdrawAddHelperTest.php | 1 - .../Services/Parts/PricedetailHelperTest.php | 1 - .../ProjectSystem/ProjectBuildHelperTest.php | 1 - .../ProjectBuildPartHelperTest.php | 1 - .../Services/Trees/TreeViewGeneratorTest.php | 2 +- .../UserSystem/PermissionManagerTest.php | 2 +- .../PermissionSchemaUpdaterTest.php | 6 +---- tests/Twig/EntityExtensionTest.php | 2 +- tests/Twig/TwigCoreExtensionTest.php | 6 ++--- tests/Twig/UserExtensionTest.php | 3 --- 46 files changed, 42 insertions(+), 102 deletions(-) diff --git a/tests/Controller/AdminPages/AttachmentTypeControllerTest.php b/tests/Controller/AdminPages/AttachmentTypeControllerTest.php index e4b47069..b98650bf 100644 --- a/tests/Controller/AdminPages/AttachmentTypeControllerTest.php +++ b/tests/Controller/AdminPages/AttachmentTypeControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Attachments\AttachmentType; */ class AttachmentTypeControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/attachment_type'; + protected static string $base_path = '/en/attachment_type'; protected static string $entity_class = AttachmentType::class; } diff --git a/tests/Controller/AdminPages/CategoryControllerTest.php b/tests/Controller/AdminPages/CategoryControllerTest.php index df4de1bd..aa325b31 100644 --- a/tests/Controller/AdminPages/CategoryControllerTest.php +++ b/tests/Controller/AdminPages/CategoryControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Category; */ class CategoryControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/category'; + protected static string $base_path = '/en/category'; protected static string $entity_class = Category::class; } diff --git a/tests/Controller/AdminPages/FootprintControllerTest.php b/tests/Controller/AdminPages/FootprintControllerTest.php index 972248c9..6381ecd6 100644 --- a/tests/Controller/AdminPages/FootprintControllerTest.php +++ b/tests/Controller/AdminPages/FootprintControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Footprint; */ class FootprintControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/footprint'; + protected static string $base_path = '/en/footprint'; protected static string $entity_class = Footprint::class; } diff --git a/tests/Controller/AdminPages/LabelProfileControllerTest.php b/tests/Controller/AdminPages/LabelProfileControllerTest.php index 0a59ffcc..b4ce79cc 100644 --- a/tests/Controller/AdminPages/LabelProfileControllerTest.php +++ b/tests/Controller/AdminPages/LabelProfileControllerTest.php @@ -46,7 +46,7 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException; class LabelProfileControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/label_profile'; + protected static string $base_path = '/en/label_profile'; protected static string $entity_class = LabelProfile::class; /** diff --git a/tests/Controller/AdminPages/ManufacturerControllerTest.php b/tests/Controller/AdminPages/ManufacturerControllerTest.php index d66441c9..d454c604 100644 --- a/tests/Controller/AdminPages/ManufacturerControllerTest.php +++ b/tests/Controller/AdminPages/ManufacturerControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Manufacturer; */ class ManufacturerControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/manufacturer'; + protected static string $base_path = '/en/manufacturer'; protected static string $entity_class = Manufacturer::class; } diff --git a/tests/Controller/AdminPages/MeasurementUnitControllerTest.php b/tests/Controller/AdminPages/MeasurementUnitControllerTest.php index 62a90cc4..83eec70b 100644 --- a/tests/Controller/AdminPages/MeasurementUnitControllerTest.php +++ b/tests/Controller/AdminPages/MeasurementUnitControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\MeasurementUnit; */ class MeasurementUnitControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/measurement_unit'; + protected static string $base_path = '/en/measurement_unit'; protected static string $entity_class = MeasurementUnit::class; } diff --git a/tests/Controller/AdminPages/ProjectControllerTest.php b/tests/Controller/AdminPages/ProjectControllerTest.php index 01588e52..c0f5c288 100644 --- a/tests/Controller/AdminPages/ProjectControllerTest.php +++ b/tests/Controller/AdminPages/ProjectControllerTest.php @@ -31,6 +31,6 @@ use App\Entity\ProjectSystem\Project; */ class ProjectControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/project'; + protected static string $base_path = '/en/project'; protected static string $entity_class = Project::class; } diff --git a/tests/Controller/AdminPages/StorelocationControllerTest.php b/tests/Controller/AdminPages/StorelocationControllerTest.php index bcfd3212..fd8d1e8c 100644 --- a/tests/Controller/AdminPages/StorelocationControllerTest.php +++ b/tests/Controller/AdminPages/StorelocationControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Storelocation; */ class StorelocationControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/store_location'; + protected static string $base_path = '/en/store_location'; protected static string $entity_class = Storelocation::class; } diff --git a/tests/Controller/AdminPages/SupplierControllerTest.php b/tests/Controller/AdminPages/SupplierControllerTest.php index f2c3e066..d98a7f69 100644 --- a/tests/Controller/AdminPages/SupplierControllerTest.php +++ b/tests/Controller/AdminPages/SupplierControllerTest.php @@ -30,6 +30,6 @@ use App\Entity\Parts\Supplier; */ class SupplierControllerTest extends AbstractAdminControllerTest { - protected static string $base_path = '/en'.'/supplier'; + protected static string $base_path = '/en/supplier'; protected static string $entity_class = Supplier::class; } diff --git a/tests/Controller/RedirectControllerTest.php b/tests/Controller/RedirectControllerTest.php index 70dd6f14..90fa63b1 100644 --- a/tests/Controller/RedirectControllerTest.php +++ b/tests/Controller/RedirectControllerTest.php @@ -75,7 +75,7 @@ class RedirectControllerTest extends WebTestCase $this->client->request('GET', $url); $response = $this->client->getResponse(); if ($expect_redirect) { - $this->assertSame(302, $response->getStatusCode()); + $this->assertResponseStatusCodeSame(302); } $this->assertSame($expect_redirect, $response->isRedirect()); } @@ -104,10 +104,6 @@ class RedirectControllerTest extends WebTestCase * @dataProvider urlAddLocaleDataProvider * @group slow * @depends testUrlMatch - * - * @param string|null $user_locale - * @param string $input_path - * @param string $redirect_path */ public function testAddLocale(?string $user_locale, string $input_path, string $redirect_path): void { @@ -122,6 +118,6 @@ class RedirectControllerTest extends WebTestCase $this->client->followRedirects(false); $this->client->request('GET', $input_path); - $this->assertSame($redirect_path, $this->client->getResponse()->headers->get('Location')); + $this->assertResponseRedirects($redirect_path); } } diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index 455d7da5..e73e639a 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -54,16 +54,8 @@ class CompoundFilterTraitTest extends TestCase $filter = new class($f1, $f2, $f3, null) { use CompoundFilterTrait; - protected $filter1; - private $filter2; - public $filter3; - protected $filter4; - - public function __construct($f1, $f2, $f3, $f4) { - $this->filter1 = $f1; - $this->filter2 = $f2; - $this->filter3 = $f3; - $this->filter4 = $f4; + public function __construct(protected $filter1, private $filter2, public $filter3, protected $filter4) + { } public function _findAllChildFilters() @@ -104,16 +96,8 @@ class CompoundFilterTraitTest extends TestCase $filter = new class($f1, $f2, $f3, null) { use CompoundFilterTrait; - protected $filter1; - private $filter2; - public $filter3; - protected $filter4; - - public function __construct($f1, $f2, $f3, $f4) { - $this->filter1 = $f1; - $this->filter2 = $f2; - $this->filter3 = $f3; - $this->filter4 = $f4; + public function __construct(protected $filter1, private $filter2, public $filter3, protected $filter4) + { } public function _applyAllChildFilters(QueryBuilder $queryBuilder): void diff --git a/tests/Entity/Attachments/AttachmentTest.php b/tests/Entity/Attachments/AttachmentTest.php index 3ef8f4da..ef10dc24 100644 --- a/tests/Entity/Attachments/AttachmentTest.php +++ b/tests/Entity/Attachments/AttachmentTest.php @@ -282,7 +282,7 @@ class AttachmentTest extends TestCase * @param string $property - property on instance being modified * @param mixed $value - new value of the property being modified */ - public function setProtectedProperty(object $object, string $property, $value): void + public function setProtectedProperty(object $object, string $property, mixed $value): void { $reflection = new ReflectionClass($object); $reflection_property = $reflection->getProperty($property); diff --git a/tests/Entity/Base/AbstractStructuralDBElementTest.php b/tests/Entity/Base/AbstractStructuralDBElementTest.php index dca3f25b..3f8157ad 100644 --- a/tests/Entity/Base/AbstractStructuralDBElementTest.php +++ b/tests/Entity/Base/AbstractStructuralDBElementTest.php @@ -42,7 +42,7 @@ class AbstractStructuralDBElementTest extends TestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Build a simple hierachy $this->root = new AttachmentType(); diff --git a/tests/Entity/Parts/PartTest.php b/tests/Entity/Parts/PartTest.php index 2adc264c..275d39d2 100644 --- a/tests/Entity/Parts/PartTest.php +++ b/tests/Entity/Parts/PartTest.php @@ -104,9 +104,9 @@ class PartTest extends TestCase $this->assertSame(13.141, $part->getAmountSum()); //1 billion part lot - $part->addPartLot((new PartLot())->setAmount(1000000000)); - $this->assertSame(1000000013.141, $part->getAmountSum()); + $part->addPartLot((new PartLot())->setAmount(1_000_000_000)); + $this->assertSame(1_000_000_013.141, $part->getAmountSum()); $measurement_unit->setIsInteger(true); - $this->assertSame(1000000013.0, $part->getAmountSum()); + $this->assertSame(1_000_000_013.0, $part->getAmountSum()); } } diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index ad14035c..25446697 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -43,10 +43,8 @@ class ProjectBuildRequestTest extends TestCase /** @var ProjectBOMEntry */ private ProjectBOMEntry $bom_entry1c; - /** @var PartLot $lot1a */ - private $lot1a; - /** @var PartLot $lot1b */ - private $lot1b; + private \App\Entity\Parts\PartLot $lot1a; + private \App\Entity\Parts\PartLot $lot1b; private PartLot $lot2; /** @var Part */ diff --git a/tests/Security/SamlUserFactoryTest.php b/tests/Security/SamlUserFactoryTest.php index cb6fbfac..57031c5d 100644 --- a/tests/Security/SamlUserFactoryTest.php +++ b/tests/Security/SamlUserFactoryTest.php @@ -47,7 +47,7 @@ class SamlUserFactoryTest extends WebTestCase $this->assertInstanceOf(User::class, $user); - $this->assertEquals('sso_user', $user->getUsername()); + $this->assertEquals('sso_user', $user->getUserIdentifier()); //User must not change his password $this->assertFalse($user->isNeedPwChange()); //And must not be disabled diff --git a/tests/Serializer/BigNumberNormalizerTest.php b/tests/Serializer/BigNumberNormalizerTest.php index b98968fe..c0cb6070 100644 --- a/tests/Serializer/BigNumberNormalizerTest.php +++ b/tests/Serializer/BigNumberNormalizerTest.php @@ -33,7 +33,6 @@ class BigNumberNormalizerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get an service instance. self::bootKernel(); $this->service = self::getContainer()->get(BigNumberNormalizer::class); diff --git a/tests/Serializer/PartNormalizerTest.php b/tests/Serializer/PartNormalizerTest.php index e9abca16..f19d4c6b 100644 --- a/tests/Serializer/PartNormalizerTest.php +++ b/tests/Serializer/PartNormalizerTest.php @@ -34,7 +34,6 @@ class PartNormalizerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(PartNormalizer::class); diff --git a/tests/Serializer/StructuralElementDenormalizerTest.php b/tests/Serializer/StructuralElementDenormalizerTest.php index d9000fb9..624b30d4 100644 --- a/tests/Serializer/StructuralElementDenormalizerTest.php +++ b/tests/Serializer/StructuralElementDenormalizerTest.php @@ -32,7 +32,6 @@ class StructuralElementDenormalizerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(StructuralElementDenormalizer::class); diff --git a/tests/Serializer/StructuralElementFromNameDenormalizerTest.php b/tests/Serializer/StructuralElementFromNameDenormalizerTest.php index f4b4b7d5..4349c2a7 100644 --- a/tests/Serializer/StructuralElementFromNameDenormalizerTest.php +++ b/tests/Serializer/StructuralElementFromNameDenormalizerTest.php @@ -32,7 +32,6 @@ class StructuralElementFromNameDenormalizerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(StructuralElementFromNameDenormalizer::class); diff --git a/tests/Serializer/StructuralElementNormalizerTest.php b/tests/Serializer/StructuralElementNormalizerTest.php index cc5f996d..0974e670 100644 --- a/tests/Serializer/StructuralElementNormalizerTest.php +++ b/tests/Serializer/StructuralElementNormalizerTest.php @@ -36,7 +36,6 @@ class StructuralElementNormalizerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get an service instance. self::bootKernel(); $this->service = self::getContainer()->get(StructuralElementNormalizer::class); diff --git a/tests/Services/Attachments/AttachmentPathResolverTest.php b/tests/Services/Attachments/AttachmentPathResolverTest.php index 6827e90a..22809390 100644 --- a/tests/Services/Attachments/AttachmentPathResolverTest.php +++ b/tests/Services/Attachments/AttachmentPathResolverTest.php @@ -40,8 +40,6 @@ class AttachmentPathResolverTest extends WebTestCase public function setUp(): void { - parent::setUp(); - //Get a service instance. self::bootKernel(); @@ -161,7 +159,6 @@ class AttachmentPathResolverTest extends WebTestCase /** * @dataProvider germanFootprintPathdDataProvider - * @return void */ public function testConversionOfGermanFootprintPaths(string $expected, string $input): void { diff --git a/tests/Services/ElementTypeNameGeneratorTest.php b/tests/Services/ElementTypeNameGeneratorTest.php index a8a385b6..934a3bbd 100644 --- a/tests/Services/ElementTypeNameGeneratorTest.php +++ b/tests/Services/ElementTypeNameGeneratorTest.php @@ -41,8 +41,6 @@ class ElementTypeNameGeneratorTest extends WebTestCase protected function setUp(): void { - parent::setUp(); - //Get an service instance. $this->service = self::getContainer()->get(ElementTypeNameGenerator::class); } diff --git a/tests/Services/Formatters/AmountFormatterTest.php b/tests/Services/Formatters/AmountFormatterTest.php index 62ded8fe..40f9b7cf 100644 --- a/tests/Services/Formatters/AmountFormatterTest.php +++ b/tests/Services/Formatters/AmountFormatterTest.php @@ -36,7 +36,7 @@ class AmountFormatterTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); @@ -47,7 +47,7 @@ class AmountFormatterTest extends WebTestCase { $this->assertSame('2', $this->service->format(2.321)); $this->assertSame('1002', $this->service->format(1002.356)); - $this->assertSame('1000454', $this->service->format(1000454.0)); + $this->assertSame('1000454', $this->service->format(1_000_454.0)); $this->assertSame('0', $this->service->format(0.01)); $this->assertSame('0', $this->service->format(0)); } diff --git a/tests/Services/ImportExportSystem/BOMImporterTest.php b/tests/Services/ImportExportSystem/BOMImporterTest.php index 2a0013e5..194e23f1 100644 --- a/tests/Services/ImportExportSystem/BOMImporterTest.php +++ b/tests/Services/ImportExportSystem/BOMImporterTest.php @@ -36,8 +36,6 @@ class BOMImporterTest extends WebTestCase protected function setUp(): void { - parent::setUp(); - //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(BOMImporter::class); diff --git a/tests/Services/ImportExportSystem/EntityExporterTest.php b/tests/Services/ImportExportSystem/EntityExporterTest.php index cbe11ad3..b57b22a3 100644 --- a/tests/Services/ImportExportSystem/EntityExporterTest.php +++ b/tests/Services/ImportExportSystem/EntityExporterTest.php @@ -34,7 +34,6 @@ class EntityExporterTest extends WebTestCase protected function setUp(): void { - parent::setUp(); self::bootKernel(); $this->service = self::getContainer()->get(EntityExporter::class); } diff --git a/tests/Services/ImportExportSystem/EntityImporterTest.php b/tests/Services/ImportExportSystem/EntityImporterTest.php index 50060c13..d6eeeb09 100644 --- a/tests/Services/ImportExportSystem/EntityImporterTest.php +++ b/tests/Services/ImportExportSystem/EntityImporterTest.php @@ -42,8 +42,6 @@ class EntityImporterTest extends WebTestCase protected function setUp(): void { - parent::setUp(); - //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(EntityImporter::class); diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php index fe98ccdf..f6597ffb 100644 --- a/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php +++ b/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php @@ -49,10 +49,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class BarcodeContentGeneratorTest extends KernelTestCase { - /** - * @var BarcodeContentGenerator - */ - private $service; + private ?object $service = null; protected function setUp(): void { diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php index b8d34cc0..c1a8ea11 100644 --- a/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php +++ b/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php @@ -75,14 +75,14 @@ class BarcodeNormalizerTest extends WebTestCase [['lot', 10], 'Lß000010'], [['part', 123], 'P-000123'], [['location', 123], 'S-000123'], - [['lot', 12345678], 'L-12345678'], + [['lot', 12_345_678], 'L-12345678'], //Legacy storelocation format [['location', 336], '$L00336'], - [['location', 12345678], '$L12345678'], + [['location', 12_345_678], '$L12345678'], //Legacy Part format [['part', 123], '0000123'], [['part', 123], '00001236'], - [['part', 1234567], '12345678'], + [['part', 1_234_567], '12345678'], ]; } diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeRedirectorTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeRedirectorTest.php index 5e7a7ad8..dbbd958c 100644 --- a/tests/Services/LabelSystem/Barcodes/BarcodeRedirectorTest.php +++ b/tests/Services/LabelSystem/Barcodes/BarcodeRedirectorTest.php @@ -47,10 +47,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class BarcodeRedirectorTest extends KernelTestCase { - /** - * @var BarcodeRedirector - */ - private $service; + private ?object $service = null; protected function setUp(): void { @@ -81,7 +78,7 @@ class BarcodeRedirectorTest extends KernelTestCase { $this->expectException(EntityNotFoundException::class); //If we encounter an invalid lot, we must throw an exception - $this->service->getRedirectURL('lot', 12345678); + $this->service->getRedirectURL('lot', 12_345_678); } public function testInvalidType(): void diff --git a/tests/Services/LabelSystem/LabelTextReplacerTest.php b/tests/Services/LabelSystem/LabelTextReplacerTest.php index e965fcc1..0d9aa3ae 100644 --- a/tests/Services/LabelSystem/LabelTextReplacerTest.php +++ b/tests/Services/LabelSystem/LabelTextReplacerTest.php @@ -60,8 +60,6 @@ class LabelTextReplacerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); - //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(LabelTextReplacer::class); diff --git a/tests/Services/LabelSystem/SandboxedTwigProviderTest.php b/tests/Services/LabelSystem/SandboxedTwigProviderTest.php index 1d65d382..9127ea9f 100644 --- a/tests/Services/LabelSystem/SandboxedTwigProviderTest.php +++ b/tests/Services/LabelSystem/SandboxedTwigProviderTest.php @@ -51,10 +51,7 @@ use Twig\Sandbox\SecurityError; class SandboxedTwigProviderTest extends WebTestCase { - /** - * @var SandboxedTwigProvider - */ - private $service; + private ?object $service = null; protected function setUp(): void { diff --git a/tests/Services/LogSystem/EventCommentHelperTest.php b/tests/Services/LogSystem/EventCommentHelperTest.php index 62cca6a2..9c78d4c6 100644 --- a/tests/Services/LogSystem/EventCommentHelperTest.php +++ b/tests/Services/LogSystem/EventCommentHelperTest.php @@ -53,7 +53,7 @@ class EventCommentHelperTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); diff --git a/tests/Services/LogSystem/EventLoggerTest.php b/tests/Services/LogSystem/EventLoggerTest.php index 0c94d8c7..cb74adb4 100644 --- a/tests/Services/LogSystem/EventLoggerTest.php +++ b/tests/Services/LogSystem/EventLoggerTest.php @@ -56,7 +56,7 @@ class EventLoggerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); diff --git a/tests/Services/Misc/FAIconGeneratorTest.php b/tests/Services/Misc/FAIconGeneratorTest.php index 34806bf9..4ca318d0 100644 --- a/tests/Services/Misc/FAIconGeneratorTest.php +++ b/tests/Services/Misc/FAIconGeneratorTest.php @@ -34,7 +34,7 @@ class FAIconGeneratorTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); diff --git a/tests/Services/Parameters/ParameterExtractorTest.php b/tests/Services/Parameters/ParameterExtractorTest.php index 98393674..e82d99af 100644 --- a/tests/Services/Parameters/ParameterExtractorTest.php +++ b/tests/Services/Parameters/ParameterExtractorTest.php @@ -51,7 +51,6 @@ class ParameterExtractorTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(ParameterExtractor::class); diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index 269a06f9..e3f76785 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -46,7 +46,6 @@ class PartLotWithdrawAddHelperTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(PartLotWithdrawAddHelper::class); diff --git a/tests/Services/Parts/PricedetailHelperTest.php b/tests/Services/Parts/PricedetailHelperTest.php index 89931acf..cfb4a043 100644 --- a/tests/Services/Parts/PricedetailHelperTest.php +++ b/tests/Services/Parts/PricedetailHelperTest.php @@ -38,7 +38,6 @@ class PricedetailHelperTest extends WebTestCase protected function setUp(): void { - parent::setUp(); //Get a service instance. self::bootKernel(); $this->service = self::getContainer()->get(PricedetailHelper::class); diff --git a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php index 199a7dac..ef249deb 100644 --- a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php +++ b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php @@ -34,7 +34,6 @@ class ProjectBuildHelperTest extends WebTestCase protected function setUp(): void { - parent::setUp(); self::bootKernel(); $this->service = self::getContainer()->get(ProjectBuildHelper::class); } diff --git a/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php index d0ae8959..92c22b44 100644 --- a/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php +++ b/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php @@ -31,7 +31,6 @@ class ProjectBuildPartHelperTest extends WebTestCase protected function setUp(): void { - parent::setUp(); self::bootKernel(); $this->service = self::getContainer()->get(ProjectBuildPartHelper::class); } diff --git a/tests/Services/Trees/TreeViewGeneratorTest.php b/tests/Services/Trees/TreeViewGeneratorTest.php index 92ba196d..f34c855d 100644 --- a/tests/Services/Trees/TreeViewGeneratorTest.php +++ b/tests/Services/Trees/TreeViewGeneratorTest.php @@ -42,7 +42,7 @@ class TreeViewGeneratorTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); diff --git a/tests/Services/UserSystem/PermissionManagerTest.php b/tests/Services/UserSystem/PermissionManagerTest.php index 8e90715e..d9c694fe 100644 --- a/tests/Services/UserSystem/PermissionManagerTest.php +++ b/tests/Services/UserSystem/PermissionManagerTest.php @@ -43,7 +43,7 @@ class PermissionManagerTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); diff --git a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php index 8fe99b50..249c8f46 100644 --- a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php +++ b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php @@ -27,11 +27,8 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class TestPermissionHolder implements HasPermissionsInterface { - private PermissionData $perm_data; - - public function __construct(PermissionData $perm_data) + public function __construct(private readonly PermissionData $perm_data) { - $this->perm_data = $perm_data; } public function getPermissions(): PermissionData @@ -49,7 +46,6 @@ class PermissionSchemaUpdaterTest extends WebTestCase public function setUp(): void { - parent::setUp(); self::bootKernel(); $this->service = self::getContainer()->get(PermissionSchemaUpdater::class); diff --git a/tests/Twig/EntityExtensionTest.php b/tests/Twig/EntityExtensionTest.php index 122165bc..99ad8428 100644 --- a/tests/Twig/EntityExtensionTest.php +++ b/tests/Twig/EntityExtensionTest.php @@ -43,7 +43,7 @@ class EntityExtensionTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get a service instance. self::bootKernel(); diff --git a/tests/Twig/TwigCoreExtensionTest.php b/tests/Twig/TwigCoreExtensionTest.php index ed55dcbc..67961fe1 100644 --- a/tests/Twig/TwigCoreExtensionTest.php +++ b/tests/Twig/TwigCoreExtensionTest.php @@ -31,7 +31,7 @@ class TwigCoreExtensionTest extends WebTestCase protected function setUp(): void { - parent::setUp(); // TODO: Change the autogenerated stub + // TODO: Change the autogenerated stub //Get an service instance. self::bootKernel(); @@ -52,8 +52,8 @@ class TwigCoreExtensionTest extends WebTestCase $obj = new class { public $test = 1; protected $test2 = 3; - private $test3 = 5; - private $test4 = 7; + private int $test3 = 5; + private int $test4 = 7; public function getTest4(): int { diff --git a/tests/Twig/UserExtensionTest.php b/tests/Twig/UserExtensionTest.php index 04dd888f..1fa722f6 100644 --- a/tests/Twig/UserExtensionTest.php +++ b/tests/Twig/UserExtensionTest.php @@ -44,9 +44,6 @@ class UserExtensionTest extends WebTestCase /** * @dataProvider removeeLocaleFromPathDataSet - * @param string $expected - * @param string $input - * @return void */ public function testRemoveLocaleFromPath(string $expected, string $input): void { From f63b6d7207f384d355e6816a7b5aa1e0229d30e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 14:50:47 +0200 Subject: [PATCH 38/91] Fixed service wiring configuration --- config/parameters.yaml | 2 +- config/services.yaml | 10 +++++----- docs/configuration.md | 2 +- src/Controller/ToolsController.php | 2 +- .../Filters/Constraints/NumberConstraint.php | 2 +- .../Part/ParameterValueConstraint.php | 2 +- .../LogSystem/LogLogoutEventListener.php | 16 +++++----------- .../LogSystem/SecurityEventLoggerSubscriber.php | 4 ++-- .../SymfonyDebugToolbarSubscriber.php | 4 ++-- .../UserSystem/LoginSuccessSubscriber.php | 4 ++-- .../UserSystem/SetUserTimezoneSubscriber.php | 4 ++-- src/Form/AdminPages/CurrencyAdminForm.php | 4 ++-- src/Form/AdminPages/SupplierForm.php | 4 ++-- src/Services/UserSystem/PermissionManager.php | 4 ++-- 14 files changed, 29 insertions(+), 35 deletions(-) rename src/{EventSubscriber => EventListener}/LogSystem/LogLogoutEventListener.php (80%) diff --git a/config/parameters.yaml b/config/parameters.yaml index ba63a202..1cfa41a4 100644 --- a/config/parameters.yaml +++ b/config/parameters.yaml @@ -19,7 +19,7 @@ parameters: ###################################################################################################################### # Users and Privacy ###################################################################################################################### - partdb.gpdr_compliance: true # If this option is activated, IP addresses are anonymized to be GPDR compliant + partdb.gdpr_compliance: true # If this option is activated, IP addresses are anonymized to be GDPR compliant partdb.users.use_gravatar: '%env(bool:USE_GRAVATAR)%' # Set to false, if no Gravatar images should be used for user profiles. partdb.users.email_pw_reset: '%env(bool:ALLOW_EMAIL_PW_RESET)%' # Config if users are able, to reset their password by email. By default this enabled, when a mail server is configured. diff --git a/config/services.yaml b/config/services.yaml index cba39569..26c35cba 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -14,11 +14,11 @@ services: autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. bind: bool $demo_mode: '%partdb.demo_mode%' - bool $gpdr_compliance : '%partdb.gpdr_compliance%' - bool $kernel_debug: '%kernel.debug%' + bool $gdpr_compliance: '%partdb.gdpr_compliance%' + bool $kernel_debug_enabled: '%kernel.debug%' string $kernel_cache_dir: '%kernel.cache_dir%' string $partdb_title: '%partdb.title%' - string $default_currency: '%partdb.default_currency%' + string $base_currency: '%partdb.default_currency%' _instanceof: App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface: @@ -88,7 +88,7 @@ services: App\Form\AttachmentFormType: arguments: - $allow_attachments_downloads: '%partdb.attachments.allow_downloads%' + $allow_attachments_download: '%partdb.attachments.allow_downloads%' $max_file_size: '%partdb.attachments.max_file_size%' App\Services\Attachments\AttachmentSubmitHandler: @@ -177,7 +177,7 @@ services: App\EventSubscriber\UserSystem\SetUserTimezoneSubscriber: arguments: - $timezone: '%partdb.timezone%' + $default_timezone: '%partdb.timezone%' App\Controller\SecurityController: arguments: diff --git a/docs/configuration.md b/docs/configuration.md index 39a714e7..f7748195 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -98,7 +98,7 @@ The following options are available: * `partdb.global_theme`: The default theme to use, when no user specific theme is set. Should be one of the themes from the `partdb.available_themes` config option. * `partdb.locale_menu`: The codes of the languages, which should be shown in the language chooser menu (the one with the user icon in the navbar). The first language in the list will be the default language. -* `partdb.gpdr_compliance`: When set to true (default value), IP addresses which are saved in the database will be anonymized, by removing the last byte of the IP. This is required by the GDPR (General Data Protection Regulation) in the EU. +* `partdb.gdpr_compliance`: When set to true (default value), IP addresses which are saved in the database will be anonymized, by removing the last byte of the IP. This is required by the GDPR (General Data Protection Regulation) in the EU. * `partdb.sidebar.items`: The panel contents which should be shown in the sidebar by default. You can also change the number of sidebar panels by changing the number of items in this list. * `partdb.sidebar.root_node_enable`: Show a root node in the sidebar trees, of which all nodes are children of * `partdb.sidebar.root_expanded`: Expand the root node in the sidebar trees by default diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index 65321a19..a40b9440 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -59,7 +59,7 @@ class ToolsController extends AbstractController 'default_theme' => $this->getParameter('partdb.global_theme'), 'enabled_locales' => $this->getParameter('partdb.locale_menu'), 'demo_mode' => $this->getParameter('partdb.demo_mode'), - 'gpdr_compliance' => $this->getParameter('partdb.gpdr_compliance'), + 'gpdr_compliance' => $this->getParameter('partdb.gdpr_compliance'), 'use_gravatar' => $this->getParameter('partdb.users.use_gravatar'), 'email_password_reset' => $this->getParameter('partdb.users.email_pw_reset'), 'enviroment' => $this->getParameter('kernel.environment'), diff --git a/src/DataTables/Filters/Constraints/NumberConstraint.php b/src/DataTables/Filters/Constraints/NumberConstraint.php index 81ab26a6..b87a6cc4 100644 --- a/src/DataTables/Filters/Constraints/NumberConstraint.php +++ b/src/DataTables/Filters/Constraints/NumberConstraint.php @@ -25,7 +25,7 @@ use RuntimeException; class NumberConstraint extends AbstractConstraint { - final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN']; + protected const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN']; public function getValue1(): float|int|null|\DateTimeInterface { diff --git a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php index 0b4d5271..1451713b 100644 --- a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php @@ -25,7 +25,7 @@ use Doctrine\ORM\QueryBuilder; class ParameterValueConstraint extends NumberConstraint { - final public const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN', + protected const ALLOWED_OPERATOR_VALUES = ['=', '!=', '<', '>', '<=', '>=', 'BETWEEN', //Additional operators 'IN_RANGE', 'NOT_IN_RANGE', 'GREATER_THAN_RANGE', 'GREATER_EQUAL_RANGE', 'LESS_THAN_RANGE', 'LESS_EQUAL_RANGE', 'RANGE_IN_RANGE', 'RANGE_INTERSECT_RANGE']; diff --git a/src/EventSubscriber/LogSystem/LogLogoutEventListener.php b/src/EventListener/LogSystem/LogLogoutEventListener.php similarity index 80% rename from src/EventSubscriber/LogSystem/LogLogoutEventListener.php rename to src/EventListener/LogSystem/LogLogoutEventListener.php index 80dfb98f..eab278b4 100644 --- a/src/EventSubscriber/LogSystem/LogLogoutEventListener.php +++ b/src/EventListener/LogSystem/LogLogoutEventListener.php @@ -20,7 +20,7 @@ declare(strict_types=1); -namespace App\EventSubscriber\LogSystem; +namespace App\EventListener\LogSystem; use App\Entity\LogSystem\UserLogoutLogEntry; use App\Entity\UserSystem\User; @@ -32,9 +32,9 @@ use Symfony\Component\Security\Http\Event\LogoutEvent; * This handler logs to event log, if a user logs out. */ #[AsEventListener] -final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface +final class LogLogoutEventListener { - public function __construct(protected EventLogger $logger, protected bool $gpdr_compliance) + public function __construct(private EventLogger $logger, private readonly bool $gdpr_compliance) { } @@ -47,7 +47,7 @@ final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDis return; } - $log = new UserLogoutLogEntry($request->getClientIp(), $this->gpdr_compliance); + $log = new UserLogoutLogEntry($request->getClientIp(), $this->gdpr_compliance); $user = $token->getUser(); if ($user instanceof User) { $log->setTargetElement($user); @@ -55,11 +55,5 @@ final class LogLogoutEventEventSubscriber implements \Symfony\Component\EventDis $this->logger->logAndFlush($log); } - /** - * @return array - */ - public static function getSubscribedEvents(): array - { - return ['' => '']; - } + } diff --git a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php index 66fb9fde..28cf7b48 100644 --- a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php @@ -53,7 +53,7 @@ use Symfony\Component\HttpFoundation\RequestStack; */ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface { - public function __construct(private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliant) + public function __construct(private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gdpr_compliance) { } @@ -119,7 +119,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface private function addLog(string $type, SecurityEvent $event): void { - $anonymize = $this->gpdr_compliant; + $anonymize = $this->gdpr_compliance; $request = $this->requestStack->getCurrentRequest(); if ($request instanceof \Symfony\Component\HttpFoundation\Request) { diff --git a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php index c404ffc0..6f17e399 100644 --- a/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php +++ b/src/EventSubscriber/SymfonyDebugToolbarSubscriber.php @@ -30,7 +30,7 @@ use Symfony\Component\HttpKernel\Event\ResponseEvent; */ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface { - public function __construct(private readonly bool $kernel_debug) + public function __construct(private readonly bool $kernel_debug_enabled) { } @@ -59,7 +59,7 @@ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface public function onKernelResponse(ResponseEvent $event): void { - if (!$this->kernel_debug) { + if (!$this->kernel_debug_enabled) { return; } diff --git a/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php b/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php index e1cdfd84..d67a8e14 100644 --- a/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php +++ b/src/EventSubscriber/UserSystem/LoginSuccessSubscriber.php @@ -37,14 +37,14 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ final class LoginSuccessSubscriber implements EventSubscriberInterface { - public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gpdr_compliance) + public function __construct(private readonly TranslatorInterface $translator, private readonly RequestStack $requestStack, private readonly EventLogger $eventLogger, private readonly bool $gdpr_compliance) { } public function onLogin(InteractiveLoginEvent $event): void { $ip = $event->getRequest()->getClientIp(); - $log = new UserLoginLogEntry($ip, $this->gpdr_compliance); + $log = new UserLoginLogEntry($ip, $this->gdpr_compliance); $user = $event->getAuthenticationToken()->getUser(); if ($user instanceof User && $user->getID()) { $log->setTargetElement($user); diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php index cf1206c1..277cf62d 100644 --- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php +++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php @@ -23,17 +23,17 @@ declare(strict_types=1); namespace App\EventSubscriber\UserSystem; use App\Entity\UserSystem\User; +use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\ControllerEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Security\Core\Security; /** * The purpose of this event listener is to set the timezone to the one preferred by the user. */ final class SetUserTimezoneSubscriber implements EventSubscriberInterface { - public function __construct(private readonly string $default_timezone, private readonly \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly string $default_timezone, private readonly Security $security) { } diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php index 7ebe08bb..d6c5f590 100644 --- a/src/Form/AdminPages/CurrencyAdminForm.php +++ b/src/Form/AdminPages/CurrencyAdminForm.php @@ -32,7 +32,7 @@ use Symfony\Component\Security\Core\Security; class CurrencyAdminForm extends BaseEntityAdminForm { - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $base_currency) { parent::__construct($security, $eventCommentNeededHelper); } @@ -51,7 +51,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm $builder->add('exchange_rate', BigDecimalMoneyType::class, [ 'required' => false, 'label' => 'currency.edit.exchange_rate', - 'currency' => $this->default_currency, + 'currency' => $this->base_currency, 'scale' => 6, 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]); diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php index d5253c1a..02efd45f 100644 --- a/src/Form/AdminPages/SupplierForm.php +++ b/src/Form/AdminPages/SupplierForm.php @@ -32,7 +32,7 @@ use Symfony\Component\Security\Core\Security; class SupplierForm extends CompanyForm { - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $default_currency) + public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $base_currency) { parent::__construct($security, $eventCommentNeededHelper); } @@ -53,7 +53,7 @@ class SupplierForm extends CompanyForm $builder->add('shipping_costs', BigDecimalMoneyType::class, [ 'required' => false, - 'currency' => $this->default_currency, + 'currency' => $this->base_currency, 'scale' => 3, 'label' => 'supplier.shipping_costs.label', 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php index 5ef71d4c..cf3e1455 100644 --- a/src/Services/UserSystem/PermissionManager.php +++ b/src/Services/UserSystem/PermissionManager.php @@ -45,7 +45,7 @@ class PermissionManager /** * PermissionResolver constructor. */ - public function __construct(protected bool $is_debug, string $kernel_cache_dir) + public function __construct(protected readonly bool $kernel_debug_enabled, string $kernel_cache_dir) { $cache_dir = $kernel_cache_dir; //Here the cached structure will be saved. @@ -271,7 +271,7 @@ class PermissionManager protected function generatePermissionStructure() { - $cache = new ConfigCache($this->cache_file, $this->is_debug); + $cache = new ConfigCache($this->cache_file, $this->kernel_debug_enabled); //Check if the cache is fresh, else regenerate it. if (!$cache->isFresh()) { From 5629215ce4f21b59fa6ab1c78a02c74bfced1737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 14:55:06 +0200 Subject: [PATCH 39/91] Use imports instead of FQNs --- rector.php | 5 ++ .../Attachments/CleanAttachmentsCommand.php | 7 +- src/Command/BackupCommand.php | 6 +- src/Command/CheckRequirementsCommand.php | 3 +- .../Currencies/UpdateExchangeRatesCommand.php | 7 +- src/Command/Logs/ShowEventLogCommand.php | 12 ++-- .../Migrations/ConvertBBCodeCommand.php | 5 +- .../Migrations/ImportPartKeeprCommand.php | 7 +- src/Command/User/ConvertToSAMLUserCommand.php | 5 +- src/Command/User/SetPasswordCommand.php | 13 ++-- .../User/UpgradePermissionsSchemaCommand.php | 7 +- src/Command/User/UserEnableCommand.php | 5 +- src/Command/User/UserListCommand.php | 6 +- src/Command/User/UsersPermissionsCommand.php | 5 +- src/Command/VersionCommand.php | 5 +- .../AdminPages/BaseAdminController.php | 2 +- src/Controller/LabelController.php | 8 +-- src/Controller/LogController.php | 2 +- src/Controller/PartController.php | 18 ++--- src/Controller/ProjectController.php | 4 +- src/Controller/SecurityController.php | 4 +- src/Controller/TreeController.php | 13 ++-- src/Controller/TypeaheadController.php | 14 ++-- src/Controller/UserController.php | 5 +- src/Controller/UserSettingsController.php | 11 +-- src/DataTables/Column/EntityColumn.php | 2 +- src/DataTables/Column/RevertLogColumn.php | 4 +- .../Filters/Constraints/EntityConstraint.php | 6 +- .../Constraints/Part/TagsConstraint.php | 3 +- src/DataTables/Filters/LogFilter.php | 2 +- .../Helpers/PartDataTableHelper.php | 6 +- src/DataTables/LogDataTable.php | 8 +-- src/DataTables/PartsDataTable.php | 7 +- src/DataTables/ProjectBomEntriesDataTable.php | 10 +-- .../Purger/ResetAutoIncrementORMPurger.php | 2 +- .../SetSQLMode/SetSQLModeMiddlewareDriver.php | 3 +- src/Doctrine/Types/BigDecimalType.php | 2 +- src/Entity/Attachments/Attachment.php | 15 +++-- src/Entity/Attachments/AttachmentType.php | 21 +++--- .../Attachments/AttachmentTypeAttachment.php | 2 +- src/Entity/Attachments/CategoryAttachment.php | 2 +- src/Entity/Attachments/CurrencyAttachment.php | 2 +- .../Attachments/FootprintAttachment.php | 2 +- src/Entity/Attachments/GroupAttachment.php | 2 +- src/Entity/Attachments/LabelAttachment.php | 2 +- .../Attachments/ManufacturerAttachment.php | 2 +- .../Attachments/MeasurementUnitAttachment.php | 2 +- src/Entity/Attachments/PartAttachment.php | 2 +- src/Entity/Attachments/ProjectAttachment.php | 2 +- .../Attachments/StorelocationAttachment.php | 2 +- src/Entity/Attachments/SupplierAttachment.php | 2 +- src/Entity/Attachments/UserAttachment.php | 2 +- src/Entity/Base/AbstractCompany.php | 13 ++-- src/Entity/Base/AbstractDBElement.php | 37 +++++++++- src/Entity/Base/AbstractNamedDBElement.php | 3 +- .../Base/AbstractPartsContainingDBElement.php | 3 +- .../Base/AbstractStructuralDBElement.php | 15 +++-- src/Entity/Base/MasterAttachmentTrait.php | 2 +- src/Entity/Base/TimestampTrait.php | 5 +- src/Entity/LabelSystem/LabelOptions.php | 17 ++--- src/Entity/LabelSystem/LabelProfile.php | 16 +++-- src/Entity/LogSystem/AbstractLogEntry.php | 15 +++-- .../LogSystem/PartStockChangedLogEntry.php | 2 +- src/Entity/Parameters/AbstractParameter.php | 18 ++--- .../Parameters/AttachmentTypeParameter.php | 5 +- src/Entity/Parameters/CategoryParameter.php | 5 +- src/Entity/Parameters/CurrencyParameter.php | 5 +- src/Entity/Parameters/FootprintParameter.php | 5 +- src/Entity/Parameters/GroupParameter.php | 5 +- .../Parameters/ManufacturerParameter.php | 5 +- .../Parameters/MeasurementUnitParameter.php | 5 +- src/Entity/Parameters/PartParameter.php | 5 +- src/Entity/Parameters/ProjectParameter.php | 5 +- .../Parameters/StorelocationParameter.php | 5 +- src/Entity/Parameters/SupplierParameter.php | 5 +- src/Entity/Parts/Category.php | 31 +++++---- src/Entity/Parts/Footprint.php | 19 +++--- src/Entity/Parts/Manufacturer.php | 17 +++-- src/Entity/Parts/MeasurementUnit.php | 24 ++++--- src/Entity/Parts/Part.php | 16 +++-- src/Entity/Parts/PartLot.php | 15 +++-- .../PartTraits/AdvancedPropertyTrait.php | 9 +-- .../Parts/PartTraits/BasicPropertyTrait.php | 9 +-- src/Entity/Parts/PartTraits/InstockTrait.php | 5 +- .../Parts/PartTraits/ManufacturerTrait.php | 7 +- src/Entity/Parts/PartTraits/OrderTrait.php | 11 +-- src/Entity/Parts/PartTraits/ProjectTrait.php | 11 +-- src/Entity/Parts/Storelocation.php | 25 ++++--- src/Entity/Parts/Supplier.php | 28 +++++--- src/Entity/PriceInformations/Currency.php | 19 +++--- src/Entity/PriceInformations/Orderdetail.php | 13 ++-- src/Entity/PriceInformations/Pricedetail.php | 9 +-- src/Entity/ProjectSystem/Project.php | 28 ++++---- src/Entity/ProjectSystem/ProjectBOMEntry.php | 23 ++++--- src/Entity/UserSystem/Group.php | 13 ++-- src/Entity/UserSystem/PermissionData.php | 3 +- src/Entity/UserSystem/U2FKey.php | 15 +++-- src/Entity/UserSystem/User.php | 67 ++++++++++--------- src/Entity/UserSystem/WebauthnKey.php | 7 +- .../AttachmentDeleteListener.php | 3 +- .../LogSystem/LogLogoutEventSubscriber.php} | 20 ++++-- .../SecurityEventLoggerSubscriber.php | 3 +- .../LogoutDisabledUserSubscriber.php | 4 +- .../PasswordChangeNeededSubscriber.php | 7 +- .../UpgradePermissionsSchemaSubscriber.php | 7 +- .../AdminPages/AttachmentTypeAdminForm.php | 4 +- src/Form/AdminPages/BaseEntityAdminForm.php | 4 +- src/Form/AdminPages/CurrencyAdminForm.php | 4 +- src/Form/AdminPages/ImportType.php | 4 +- src/Form/AdminPages/MassCreationForm.php | 4 +- src/Form/AdminPages/SupplierForm.php | 4 +- src/Form/AttachmentFormType.php | 4 +- src/Form/LabelOptionsType.php | 4 +- src/Form/LabelSystem/LabelDialogType.php | 4 +- src/Form/Part/OrderdetailType.php | 6 +- src/Form/Part/PartBaseType.php | 4 +- src/Form/Part/PartLotType.php | 4 +- src/Form/ProjectSystem/ProjectBuildType.php | 9 +-- .../Helper/StructuralEntityChoiceHelper.php | 13 ++-- src/Form/Type/PartLotSelectType.php | 3 +- src/Form/Type/PartSelectType.php | 13 ++-- src/Form/UserAdminForm.php | 4 +- src/Form/UserSettingsType.php | 4 +- src/Helpers/Projects/ProjectBuildRequest.php | 13 ++-- src/Helpers/Trees/TreeViewNode.php | 8 +-- .../StructuralDBElementRepository.php | 4 +- src/Repository/UserRepository.php | 2 +- src/Security/SamlUserFactory.php | 2 +- src/Security/Voter/AttachmentVoter.php | 7 +- src/Security/Voter/ExtendedVoter.php | 2 +- src/Security/Voter/LogEntryVoter.php | 4 +- src/Security/Voter/OrderdetailVoter.php | 7 +- src/Security/Voter/ParameterVoter.php | 7 +- src/Security/Voter/PartLotVoter.php | 7 +- src/Security/Voter/PricedetailVoter.php | 8 ++- .../StructuralElementDenormalizer.php | 3 +- .../Attachments/AttachmentSubmitHandler.php | 6 +- .../Attachments/AttachmentURLGenerator.php | 3 +- .../Attachments/PartPreviewGenerator.php | 24 ++++--- src/Services/ElementTypeNameGenerator.php | 13 ++-- src/Services/Formatters/MoneyFormatter.php | 2 +- .../ImportExportSystem/EntityExporter.php | 4 +- .../ImportExportSystem/EntityImporter.php | 8 +-- .../PartKeeprImporter/PKImportHelperTrait.php | 3 +- .../PartKeeprImporter/PKPartImporter.php | 8 +-- .../Barcodes/BarcodeRedirector.php | 2 +- .../LabelSystem/LabelHTMLGenerator.php | 4 +- .../PlaceholderProviders/GlobalProviders.php | 4 +- .../PlaceholderProviders/PartLotProvider.php | 10 +-- .../PlaceholderProviders/PartProvider.php | 15 +++-- .../StorelocationProvider.php | 5 +- .../StructuralDBElementProvider.php | 4 +- src/Services/LogSystem/EventLogger.php | 11 +-- src/Services/LogSystem/LogTargetHelper.php | 2 +- src/Services/Misc/DBInfoHelper.php | 11 +-- .../Parameters/ParameterExtractor.php | 2 +- .../Parts/PartLotWithdrawAddHelper.php | 3 +- .../Parts/PartsTableActionHandler.php | 4 +- src/Services/Parts/PricedetailHelper.php | 12 ++-- .../ProjectSystem/ProjectBuildHelper.php | 5 +- src/Services/Trees/NodesListBuilder.php | 2 +- src/Services/Trees/ToolsTreeBuilder.php | 4 +- src/Services/Trees/TreeViewGenerator.php | 8 +-- .../UserSystem/PasswordResetManager.php | 4 +- src/Services/UserSystem/PermissionManager.php | 3 +- .../UserSystem/PermissionSchemaUpdater.php | 2 +- src/Services/UserSystem/UserAvatarHelper.php | 13 ++-- .../UserSystem/UserCacheKeyGenerator.php | 9 +-- src/Twig/AttachmentExtension.php | 3 +- src/Twig/EntityExtension.php | 6 +- src/Twig/FormatExtension.php | 4 +- src/Twig/LogExtension.php | 3 +- src/Twig/MiscExtension.php | 3 +- src/Twig/UserExtension.php | 6 +- .../Constraints/NoLockoutValidator.php | 7 +- .../Constraints/ValidPartLotValidator.php | 2 +- tests/Controller/RedirectControllerTest.php | 3 +- .../Projects/ProjectBuildRequestTest.php | 4 +- .../PlaceholderProviders/PartProviderTest.php | 3 +- 179 files changed, 792 insertions(+), 597 deletions(-) rename src/{EventListener/LogSystem/LogLogoutEventListener.php => EventSubscriber/LogSystem/LogLogoutEventSubscriber.php} (71%) diff --git a/rector.php b/rector.php index 04ab0e5a..b90d120a 100644 --- a/rector.php +++ b/rector.php @@ -14,6 +14,11 @@ return static function (RectorConfig $rectorConfig): void { $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'); $rectorConfig->symfonyContainerPhp(__DIR__ . '/tests/symfony-container.php'); + //Import class names instead of using fully qualified class names + $rectorConfig->importNames(); + //But keep the fully qualified class names for classes in the global namespace + $rectorConfig->importShortClasses(false); + $rectorConfig->paths([ __DIR__ . '/config', __DIR__ . '/public', diff --git a/src/Command/Attachments/CleanAttachmentsCommand.php b/src/Command/Attachments/CleanAttachmentsCommand.php index d0e37825..e9ffd286 100644 --- a/src/Command/Attachments/CleanAttachmentsCommand.php +++ b/src/Command/Attachments/CleanAttachmentsCommand.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Command\Attachments; +use Symfony\Component\Console\Attribute\AsCommand; use App\Services\Attachments\AttachmentManager; use App\Services\Attachments\AttachmentPathResolver; use App\Services\Attachments\AttachmentReverseSearch; @@ -40,7 +41,7 @@ use function count; use const DIRECTORY_SEPARATOR; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')] +#[AsCommand('partdb:attachments:clean-unused|app:clean-attachments', 'Lists (and deletes if wanted) attachments files that are not used anymore (abandoned files).')] class CleanAttachmentsCommand extends Command { protected MimeTypes $mimeTypeGuesser; @@ -99,7 +100,7 @@ class CleanAttachmentsCommand extends Command if (!$continue) { //We are finished here, when no files should be deleted - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } //Delete the files @@ -112,7 +113,7 @@ class CleanAttachmentsCommand extends Command $io->success('No abandoned files found.'); } - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } /** diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php index ccc5763e..d68afb67 100644 --- a/src/Command/BackupCommand.php +++ b/src/Command/BackupCommand.php @@ -2,6 +2,8 @@ namespace App\Command; +use Symfony\Component\Console\Attribute\AsCommand; +use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\ORM\EntityManagerInterface; use PhpZip\Constants\ZipCompressionMethod; @@ -16,7 +18,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:backup', 'Backup the files and the database of Part-DB')] +#[AsCommand('partdb:backup', 'Backup the files and the database of Part-DB')] class BackupCommand extends Command { public function __construct(private readonly string $project_dir, private readonly EntityManagerInterface $entityManager) @@ -153,7 +155,7 @@ class BackupCommand extends Command $io->error('Could not dump database: '.$e->getMessage()); $io->error('This can maybe be fixed by installing the mysqldump binary and adding it to the PATH variable!'); } - } elseif ($connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { + } elseif ($connection->getDatabasePlatform() instanceof SqlitePlatform) { $io->note('SQLite database detected. Copy DB file to ZIP...'); $params = $connection->getParams(); $zip->addFile($params['path'], 'var/app.db'); diff --git a/src/Command/CheckRequirementsCommand.php b/src/Command/CheckRequirementsCommand.php index 38f599e3..a2fde8b9 100644 --- a/src/Command/CheckRequirementsCommand.php +++ b/src/Command/CheckRequirementsCommand.php @@ -20,6 +20,7 @@ namespace App\Command; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -27,7 +28,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')] +#[AsCommand('partdb:check-requirements', 'Checks if the requirements Part-DB needs or recommends are fulfilled.')] class CheckRequirementsCommand extends Command { public function __construct(protected ContainerBagInterface $params) diff --git a/src/Command/Currencies/UpdateExchangeRatesCommand.php b/src/Command/Currencies/UpdateExchangeRatesCommand.php index 4a6b88f1..0f3eb11f 100644 --- a/src/Command/Currencies/UpdateExchangeRatesCommand.php +++ b/src/Command/Currencies/UpdateExchangeRatesCommand.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Command\Currencies; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\PriceInformations\Currency; use App\Services\Tools\ExchangeRateUpdater; use Doctrine\ORM\EntityManagerInterface; @@ -35,7 +36,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use function count; use function strlen; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')] +#[AsCommand('partdb:currencies:update-exchange-rates|partdb:update-exchange-rates|app:update-exchange-rates', 'Updates the currency exchange rates.')] class UpdateExchangeRatesCommand extends Command { public function __construct(protected string $base_current, protected EntityManagerInterface $em, protected ExchangeRateUpdater $exchangeRateUpdater) @@ -56,7 +57,7 @@ class UpdateExchangeRatesCommand extends Command if (3 !== strlen($this->base_current)) { $io->error('Chosen Base current is not valid. Check your settings!'); - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } $io->note('Update currency exchange rates with base currency: '.$this->base_current); @@ -89,6 +90,6 @@ class UpdateExchangeRatesCommand extends Command $io->success(sprintf('%d (of %d) currency exchange rates were updated.', $success_counter, count($candidates))); - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } } diff --git a/src/Command/Logs/ShowEventLogCommand.php b/src/Command/Logs/ShowEventLogCommand.php index 0fc78d46..2d11b359 100644 --- a/src/Command/Logs/ShowEventLogCommand.php +++ b/src/Command/Logs/ShowEventLogCommand.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Command\Logs; +use Symfony\Component\Console\Attribute\AsCommand; +use App\Entity\UserSystem\User; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\LogSystem\AbstractLogEntry; use App\Repository\LogEntryRepository; @@ -36,7 +38,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Contracts\Translation\TranslatorInterface; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')] +#[AsCommand('partdb:logs:show|app:show-logs', 'List the last event log entries.')] class ShowEventLogCommand extends Command { protected LogEntryRepository $repo; @@ -65,7 +67,7 @@ class ShowEventLogCommand extends Command if ($page > $max_page && $max_page > 0) { $io->error("There is no page ${page}! The maximum page is ${max_page}."); - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } $io->note("There are a total of ${total_count} log entries in the DB."); @@ -75,14 +77,14 @@ class ShowEventLogCommand extends Command $this->showPage($output, $desc, $limit, $page, $max_page, $showExtra); if ($onePage) { - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } $continue = $io->confirm('Do you want to show the next page?'); ++$page; } - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } protected function configure(): void @@ -136,7 +138,7 @@ class ShowEventLogCommand extends Command $target_class = $this->elementTypeNameGenerator->getLocalizedTypeLabel($entry->getTargetClass()); } - if ($entry->getUser() instanceof \App\Entity\UserSystem\User) { + if ($entry->getUser() instanceof User) { $user = $entry->getUser()->getFullName(true); } elseif ($entry->isCLIEntry()) { $user = $entry->getCLIUsername() . ' [CLI]'; diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php index 50e5b011..2297cbdd 100644 --- a/src/Command/Migrations/ConvertBBCodeCommand.php +++ b/src/Command/Migrations/ConvertBBCodeCommand.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Command\Migrations; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\ProjectSystem\Project; @@ -47,7 +48,7 @@ use function count; /** * This command converts the BBCode used by old Part-DB versions (<1.0), to the current used Markdown format. */ -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:migrations:convert-bbcode|app:convert-bbcode', 'Converts BBCode used in old Part-DB versions to newly used Markdown')] +#[AsCommand('partdb:migrations:convert-bbcode|app:convert-bbcode', 'Converts BBCode used in old Part-DB versions to newly used Markdown')] class ConvertBBCodeCommand extends Command { /** @@ -159,6 +160,6 @@ class ConvertBBCodeCommand extends Command $io->success('Changes saved to DB successfully!'); } - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } } diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index 1ba2e8db..f1c7b47c 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -20,6 +20,7 @@ namespace App\Command\Migrations; +use Symfony\Component\Console\Attribute\AsCommand; use App\Services\ImportExportSystem\PartKeeprImporter\PKDatastructureImporter; use App\Services\ImportExportSystem\PartKeeprImporter\MySQLDumpXMLConverter; use App\Services\ImportExportSystem\PartKeeprImporter\PKImportHelper; @@ -33,7 +34,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:migrations:import-partkeepr', 'Import a PartKeepr database XML dump into Part-DB')] +#[AsCommand('partdb:migrations:import-partkeepr', 'Import a PartKeepr database XML dump into Part-DB')] class ImportPartKeeprCommand extends Command { @@ -85,7 +86,7 @@ class ImportPartKeeprCommand extends Command if (!$this->importHelper->checkVersion($data)) { $db_version = $this->importHelper->getDatabaseSchemaVersion($data); $io->error('The version of the imported database is not supported! (Version: '.$db_version.')'); - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } //Import the mandatory data @@ -103,7 +104,7 @@ class ImportPartKeeprCommand extends Command $io->success('Imported '.$count.' users.'); } - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } private function doImport(SymfonyStyle $io, array $data): void diff --git a/src/Command/User/ConvertToSAMLUserCommand.php b/src/Command/User/ConvertToSAMLUserCommand.php index 4461bb58..d59b00a4 100644 --- a/src/Command/User/ConvertToSAMLUserCommand.php +++ b/src/Command/User/ConvertToSAMLUserCommand.php @@ -20,6 +20,7 @@ namespace App\Command\User; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\UserSystem\User; use App\Security\SamlUserFactory; use Doctrine\ORM\EntityManagerInterface; @@ -30,7 +31,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')] +#[AsCommand('partdb:user:convert-to-saml-user|partdb:users:convert-to-saml-user', 'Converts a local user to a SAML user (and vice versa)')] class ConvertToSAMLUserCommand extends Command { public function __construct(protected EntityManagerInterface $entityManager, protected bool $saml_enabled) @@ -62,7 +63,7 @@ class ConvertToSAMLUserCommand extends Command if (!$user) { $io->error('User not found!'); - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } $io->info('User found: '.$user->getFullName(true) . ': '.$user->getEmail().' [ID: ' . $user->getID() . ']'); diff --git a/src/Command/User/SetPasswordCommand.php b/src/Command/User/SetPasswordCommand.php index 90f045b5..822277f1 100644 --- a/src/Command/User/SetPasswordCommand.php +++ b/src/Command/User/SetPasswordCommand.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Command\User; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\UserSystem\User; use App\Events\SecurityEvent; use App\Events\SecurityEvents; @@ -34,7 +35,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')] +#[AsCommand('partdb:users:set-password|app:set-password|users:set-password|partdb:user:set-password', 'Sets the password of a user')] class SetPasswordCommand extends Command { public function __construct(protected EntityManagerInterface $entityManager, protected UserPasswordHasherInterface $encoder, protected EventDispatcherInterface $eventDispatcher) @@ -56,17 +57,17 @@ class SetPasswordCommand extends Command $user = $this->entityManager->getRepository(User::class)->findByEmailOrName($user_name); - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { $io->error(sprintf('No user with the given username %s found in the database!', $user_name)); - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } $io->note('User found!'); if ($user->isSamlUser()) { $io->error('This user is a SAML user, so you can not change the password!'); - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } $proceed = $io->confirm( @@ -74,7 +75,7 @@ class SetPasswordCommand extends Command $user->getFullName(true), $user->getID())); if (!$proceed) { - return \Symfony\Component\Console\Command\Command::FAILURE; + return Command::FAILURE; } $success = false; @@ -105,6 +106,6 @@ class SetPasswordCommand extends Command $security_event = new SecurityEvent($user); $this->eventDispatcher->dispatch($security_event, SecurityEvents::PASSWORD_CHANGED); - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } } diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index 219ddb2f..758a7903 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -20,6 +20,7 @@ namespace App\Command\User; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\UserSystem\Group; use App\Entity\UserSystem\PermissionData; use App\Entity\UserSystem\User; @@ -31,7 +32,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:upgrade-permissions-schema', '(Manually) upgrades the permissions schema of all users to the latest version.')] +#[AsCommand('partdb:users:upgrade-permissions-schema', '(Manually) upgrades the permissions schema of all users to the latest version.')] final class UpgradePermissionsSchemaCommand extends Command { public function __construct(private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $em, private readonly EventCommentHelper $eventCommentHelper) @@ -74,7 +75,7 @@ final class UpgradePermissionsSchemaCommand extends Command if ($groups_to_upgrade === [] && $users_to_upgrade === []) { $io->success('All users and group permissions schemas are up-to-date. No update needed.'); - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } //List all users and groups that need an update @@ -86,7 +87,7 @@ final class UpgradePermissionsSchemaCommand extends Command if(!$io->confirm('Continue with the update?', false)) { $io->warning('Update aborted.'); - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } //Update all users and groups diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index ddb43513..182e8558 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -20,6 +20,7 @@ namespace App\Command\User; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\UserSystem\User; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Command\Command; @@ -29,7 +30,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')] +#[AsCommand('partdb:users:enable|partdb:user:enable', 'Enables/Disable the login of one or more users')] class UserEnableCommand extends Command { public function __construct(protected EntityManagerInterface $entityManager, string $name = null) @@ -66,7 +67,7 @@ class UserEnableCommand extends Command } else { //Otherwise, fetch the users from DB foreach ($usernames as $username) { $user = $repo->findByEmailOrName($username); - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { $io->error('No user found with username: '.$username); return self::FAILURE; } diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php index 8a2265fd..cec70461 100644 --- a/src/Command/User/UserListCommand.php +++ b/src/Command/User/UserListCommand.php @@ -20,6 +20,8 @@ namespace App\Command\User; +use Symfony\Component\Console\Attribute\AsCommand; +use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Command\Command; @@ -28,7 +30,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:list|users:list', 'Lists all users')] +#[AsCommand('partdb:users:list|users:list', 'Lists all users')] class UserListCommand extends Command { public function __construct(protected EntityManagerInterface $entityManager) @@ -79,7 +81,7 @@ class UserListCommand extends Command $user->getUsername(), $user->getFullName(), $user->getEmail(), - $user->getGroup() instanceof \App\Entity\UserSystem\Group ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group', + $user->getGroup() instanceof Group ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group', $user->isDisabled() ? 'Yes' : 'No', $user->isSAMLUser() ? 'SAML' : 'Local', ]); diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php index 6be134ed..d78b0725 100644 --- a/src/Command/User/UsersPermissionsCommand.php +++ b/src/Command/User/UsersPermissionsCommand.php @@ -20,6 +20,7 @@ namespace App\Command\User; +use Symfony\Component\Console\Attribute\AsCommand; use App\Entity\UserSystem\User; use App\Repository\UserRepository; use App\Services\UserSystem\PermissionManager; @@ -34,7 +35,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Contracts\Translation\TranslatorInterface; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:users:permissions|partdb:user:permissions', 'View and edit the permissions of a given user')] +#[AsCommand('partdb:users:permissions|partdb:user:permissions', 'View and edit the permissions of a given user')] class UsersPermissionsCommand extends Command { protected UserRepository $userRepository; @@ -65,7 +66,7 @@ class UsersPermissionsCommand extends Command //Find user $io->note('Finding user with username: ' . $username); $user = $this->userRepository->findByEmailOrName($username); - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { $io->error('No user found with username: ' . $username); return Command::FAILURE; } diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php index feecc6ee..76f7db70 100644 --- a/src/Command/VersionCommand.php +++ b/src/Command/VersionCommand.php @@ -20,6 +20,7 @@ namespace App\Command; +use Symfony\Component\Console\Attribute\AsCommand; use App\Services\Misc\GitVersionInfo; use Shivas\VersioningBundle\Service\VersionManagerInterface; use Symfony\Component\Console\Command\Command; @@ -27,7 +28,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -#[\Symfony\Component\Console\Attribute\AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')] +#[AsCommand('partdb:version|app:version', 'Shows the currently installed version of Part-DB.')] class VersionCommand extends Command { public function __construct(protected VersionManagerInterface $versionManager, protected GitVersionInfo $gitVersionInfo) @@ -57,6 +58,6 @@ class VersionCommand extends Command $io->info('OS: '. php_uname()); $io->info('PHP extension: '. implode(', ', get_loaded_extensions())); - return \Symfony\Component\Console\Command\Command::SUCCESS; + return Command::SUCCESS; } } \ No newline at end of file diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index 8aaaf6f1..8fb35ae0 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -245,7 +245,7 @@ abstract class BaseAdminController extends AbstractController protected function _new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AbstractNamedDBElement $entity = null) { - $new_entity = $entity instanceof \App\Entity\Base\AbstractNamedDBElement ? clone $entity : new $this->entity_class(); + $new_entity = $entity instanceof AbstractNamedDBElement ? clone $entity : new $this->entity_class(); $this->denyAccessUnlessGranted('read', $new_entity); diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php index d74376ec..8f55b37c 100644 --- a/src/Controller/LabelController.php +++ b/src/Controller/LabelController.php @@ -73,11 +73,11 @@ class LabelController extends AbstractController $this->denyAccessUnlessGranted('@labels.create_labels'); //If we inherit a LabelProfile, the user need to have access to it... - if ($profile instanceof \App\Entity\LabelSystem\LabelProfile) { + if ($profile instanceof LabelProfile) { $this->denyAccessUnlessGranted('read', $profile); } - $label_options = $profile instanceof \App\Entity\LabelSystem\LabelProfile ? $profile->getOptions() : new LabelOptions(); + $label_options = $profile instanceof LabelProfile ? $profile->getOptions() : new LabelOptions(); //We have to disable the options, if twig mode is selected and user is not allowed to use it. $disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig'); @@ -91,7 +91,7 @@ class LabelController extends AbstractController $target_id = $request->query->get('target_id', null); $generate = $request->query->getBoolean('generate', false); - if (!$profile instanceof \App\Entity\LabelSystem\LabelProfile && is_string($target_type)) { + if (!$profile instanceof LabelProfile && is_string($target_type)) { $label_options->setSupportedElement($target_type); } if (is_string($target_id)) { @@ -108,7 +108,7 @@ class LabelController extends AbstractController $filename = 'invalid.pdf'; //Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set - if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile instanceof \App\Entity\LabelSystem\LabelProfile)) { + if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && $profile instanceof LabelProfile)) { $target_id = (string) $form->get('target_id')->getData(); $targets = $this->findObjects($form_options->getSupportedElement(), $target_id); if ($targets !== []) { diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index 2c6b6625..60fac14b 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -141,7 +141,7 @@ class LogController extends AbstractController } $log_element = $this->entityManager->find(AbstractLogEntry::class, $id); - if (!$log_element instanceof \App\Entity\LogSystem\AbstractLogEntry) { + if (!$log_element instanceof AbstractLogEntry) { throw new InvalidArgumentException('No log entry with the given ID is existing!'); } diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index c10858ac..2434415e 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -210,13 +210,13 @@ class PartController extends AbstractController ?Part $part = null, ?Project $project = null): Response { - if ($part instanceof \App\Entity\Parts\Part) { + if ($part instanceof Part) { //Clone part $new_part = clone $part; - } elseif ($project instanceof \App\Entity\ProjectSystem\Project) { + } elseif ($project instanceof Project) { //Initialize a new part for a build part from the given project //Ensure that the project has not already a build part - if ($project->getBuildPart() instanceof \App\Entity\Parts\Part) { + if ($project->getBuildPart() instanceof Part) { $this->addFlash('error', 'part.new_build_part.error.build_part_already_exists'); return $this->redirectToRoute('part_edit', ['id' => $project->getBuildPart()->getID()]); } @@ -229,7 +229,7 @@ class PartController extends AbstractController $cid = $request->get('category', null); $category = $cid ? $em->find(Category::class, $cid) : null; - if ($category instanceof \App\Entity\Parts\Category && !$new_part->getCategory() instanceof \App\Entity\Parts\Category) { + if ($category instanceof Category && !$new_part->getCategory() instanceof Category) { $new_part->setCategory($category); $new_part->setDescription($category->getDefaultDescription()); $new_part->setComment($category->getDefaultComment()); @@ -237,19 +237,19 @@ class PartController extends AbstractController $fid = $request->get('footprint', null); $footprint = $fid ? $em->find(Footprint::class, $fid) : null; - if ($footprint instanceof \App\Entity\Parts\Footprint && !$new_part->getFootprint() instanceof \App\Entity\Parts\Footprint) { + if ($footprint instanceof Footprint && !$new_part->getFootprint() instanceof Footprint) { $new_part->setFootprint($footprint); } $mid = $request->get('manufacturer', null); $manufacturer = $mid ? $em->find(Manufacturer::class, $mid) : null; - if ($manufacturer instanceof \App\Entity\Parts\Manufacturer && !$new_part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer) { + if ($manufacturer instanceof Manufacturer && !$new_part->getManufacturer() instanceof Manufacturer) { $new_part->setManufacturer($manufacturer); } $store_id = $request->get('storelocation', null); $storelocation = $store_id ? $em->find(Storelocation::class, $store_id) : null; - if ($storelocation instanceof \App\Entity\Parts\Storelocation && $new_part->getPartLots()->isEmpty()) { + if ($storelocation instanceof Storelocation && $new_part->getPartLots()->isEmpty()) { $partLot = new PartLot(); $partLot->setStorageLocation($storelocation); $partLot->setInstockUnknown(true); @@ -258,7 +258,7 @@ class PartController extends AbstractController $supplier_id = $request->get('supplier', null); $supplier = $supplier_id ? $em->find(Supplier::class, $supplier_id) : null; - if ($supplier instanceof \App\Entity\Parts\Supplier && $new_part->getOrderdetails()->isEmpty()) { + if ($supplier instanceof Supplier && $new_part->getOrderdetails()->isEmpty()) { $orderdetail = new Orderdetail(); $orderdetail->setSupplier($supplier); $new_part->addOrderdetail($orderdetail); @@ -329,7 +329,7 @@ class PartController extends AbstractController if ($this->isCsrfTokenValid('part_withraw' . $part->getID(), $request->request->get('_csfr'))) { //Retrieve partlot from the request $partLot = $em->find(PartLot::class, $request->request->get('lot_id')); - if(!$partLot instanceof \App\Entity\Parts\PartLot) { + if(!$partLot instanceof PartLot) { throw new \RuntimeException('Part lot not found!'); } //Ensure that the partlot belongs to the part diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index a8fae5df..44e770e3 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -193,7 +193,7 @@ class ProjectController extends AbstractController #[Route(path: '/{id}/add_parts', name: 'project_add_parts', requirements: ['id' => '\d+'])] public function addPart(Request $request, EntityManagerInterface $entityManager, ?Project $project): Response { - if($project instanceof \App\Entity\ProjectSystem\Project) { + if($project instanceof Project) { $this->denyAccessUnlessGranted('edit', $project); } else { $this->denyAccessUnlessGranted('@projects.edit'); @@ -203,7 +203,7 @@ class ProjectController extends AbstractController $builder->add('project', StructuralEntityType::class, [ 'class' => Project::class, 'required' => true, - 'disabled' => $project instanceof \App\Entity\ProjectSystem\Project, //If a project is given, disable the field + 'disabled' => $project instanceof Project, //If a project is given, disable the field 'data' => $project, 'constraints' => [ new NotNull() diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index 4ad6b772..480d5f58 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -71,7 +71,7 @@ class SecurityController extends AbstractController * @return RedirectResponse|Response */ #[Route(path: '/pw_reset/request', name: 'pw_reset_request')] - public function requestPwReset(PasswordResetManager $passwordReset, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + public function requestPwReset(PasswordResetManager $passwordReset, Request $request): RedirectResponse|Response { if (!$this->allow_email_pw_reset) { throw new AccessDeniedHttpException('The password reset via email is disabled!'); @@ -114,7 +114,7 @@ class SecurityController extends AbstractController * @return RedirectResponse|Response */ #[Route(path: '/pw_reset/new_pw/{user}/{token}', name: 'pw_reset_new_pw')] - public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null): RedirectResponse|Response { if (!$this->allow_email_pw_reset) { throw new AccessDeniedHttpException('The password reset via email is disabled!'); diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php index 3d8e9074..e7ce0b72 100644 --- a/src/Controller/TreeController.php +++ b/src/Controller/TreeController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Controller; +use Symfony\Component\HttpFoundation\Response; use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -59,7 +60,7 @@ class TreeController extends AbstractController if ($this->isGranted('@parts.read') && $this->isGranted('@categories.read')) { $tree = $this->treeGenerator->getTreeView(Category::class, $category, 'list_parts_root'); } else { - return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); + return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); @@ -72,7 +73,7 @@ class TreeController extends AbstractController if ($this->isGranted('@parts.read') && $this->isGranted('@footprints.read')) { $tree = $this->treeGenerator->getTreeView(Footprint::class, $footprint, 'list_parts_root'); } else { - return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); + return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); } @@ -84,7 +85,7 @@ class TreeController extends AbstractController if ($this->isGranted('@parts.read') && $this->isGranted('@storelocations.read')) { $tree = $this->treeGenerator->getTreeView(Storelocation::class, $location, 'list_parts_root'); } else { - return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); + return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); @@ -97,7 +98,7 @@ class TreeController extends AbstractController if ($this->isGranted('@parts.read') && $this->isGranted('@manufacturers.read')) { $tree = $this->treeGenerator->getTreeView(Manufacturer::class, $manufacturer, 'list_parts_root'); } else { - return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); + return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); @@ -110,7 +111,7 @@ class TreeController extends AbstractController if ($this->isGranted('@parts.read') && $this->isGranted('@suppliers.read')) { $tree = $this->treeGenerator->getTreeView(Supplier::class, $supplier, 'list_parts_root'); } else { - return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); + return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); @@ -123,7 +124,7 @@ class TreeController extends AbstractController if ($this->isGranted('@projects.read')) { $tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices'); } else { - return new JsonResponse("Access denied", \Symfony\Component\HttpFoundation\Response::HTTP_FORBIDDEN); + return new JsonResponse("Access denied", Response::HTTP_FORBIDDEN); } return new JsonResponse($tree); diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index 791cb793..3c0d76e9 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -22,6 +22,10 @@ declare(strict_types=1); namespace App\Controller; +use Symfony\Component\HttpFoundation\Response; +use App\Entity\Attachments\Attachment; +use App\Entity\Parts\Category; +use App\Entity\Parts\Footprint; use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\ProjectParameter; @@ -83,7 +87,7 @@ class TypeaheadController extends AbstractController $serializer = new Serializer($normalizers, $encoders); $data = $serializer->serialize($result, 'json'); - return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true); + return new JsonResponse($data, Response::HTTP_OK, [], true); } /** @@ -122,7 +126,7 @@ class TypeaheadController extends AbstractController foreach ($parts as $part) { //Determine the picture to show: $preview_attachment = $previewGenerator->getTablePreviewAttachment($part); - if($preview_attachment instanceof \App\Entity\Attachments\Attachment) { + if($preview_attachment instanceof Attachment) { $preview_url = $attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm'); } else { $preview_url = ''; @@ -132,8 +136,8 @@ class TypeaheadController extends AbstractController $data[] = [ 'id' => $part->getID(), 'name' => $part->getName(), - 'category' => $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : 'Unknown', - 'footprint' => $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '', + 'category' => $part->getCategory() instanceof Category ? $part->getCategory()->getName() : 'Unknown', + 'footprint' => $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getName() : '', 'description' => mb_strimwidth($part->getDescription(), 0, 127, '...'), 'image' => $preview_url, ]; @@ -176,6 +180,6 @@ class TypeaheadController extends AbstractController $serializer = new Serializer($normalizers, $encoders); $data = $serializer->serialize($array, 'json'); - return new JsonResponse($data, \Symfony\Component\HttpFoundation\Response::HTTP_OK, [], true); + return new JsonResponse($data, Response::HTTP_OK, [], true); } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index ceb86802..9eb8cd23 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Controller; +use App\Controller\AdminPages\BaseAdminController; use App\DataTables\LogDataTable; use App\Entity\Attachments\UserAttachment; use App\Entity\Base\AbstractNamedDBElement; @@ -47,7 +48,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; #[Route(path: '/user')] -class UserController extends AdminPages\BaseAdminController +class UserController extends BaseAdminController { protected string $entity_class = User::class; protected string $twig_template = 'admin/user_admin.html.twig'; @@ -180,7 +181,7 @@ class UserController extends AdminPages\BaseAdminController public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response { //If no user id was passed, then we show info about the current user - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { $tmp = $this->getUser(); if (!$tmp instanceof User) { throw new InvalidArgumentException('Userinfo only works for database users!'); diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php index d21d0bbd..2d36d368 100644 --- a/src/Controller/UserSettingsController.php +++ b/src/Controller/UserSettingsController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Controller; +use App\Entity\Attachments\Attachment; use App\Entity\UserSystem\U2FKey; use App\Entity\UserSystem\User; use App\Entity\UserSystem\WebauthnKey; @@ -118,7 +119,7 @@ class UserSettingsController extends AbstractController $key_repo = $entityManager->getRepository(U2FKey::class); /** @var U2FKey|null $u2f */ $u2f = $key_repo->find($key_id); - if (!$u2f instanceof \App\Entity\UserSystem\U2FKey) { + if (!$u2f instanceof U2FKey) { $this->addFlash('danger', 'tfa_u2f.u2f_delete.not_existing'); return $this->redirectToRoute('user_settings'); @@ -140,7 +141,7 @@ class UserSettingsController extends AbstractController $key_repo = $entityManager->getRepository(WebauthnKey::class); /** @var WebauthnKey|null $key */ $key = $key_repo->find($key_id); - if (!$key instanceof \App\Entity\UserSystem\WebauthnKey) { + if (!$key instanceof WebauthnKey) { $this->addFlash('error', 'tfa_u2f.u2f_delete.not_existing'); return $this->redirectToRoute('user_settings'); @@ -166,7 +167,7 @@ class UserSettingsController extends AbstractController } #[Route(path: '/invalidate_trustedDevices', name: 'tfa_trustedDevices_invalidate', methods: ['DELETE'])] - public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager): \RuntimeException|\Symfony\Component\HttpFoundation\RedirectResponse + public function resetTrustedDevices(Request $request, EntityManagerInterface $entityManager): \RuntimeException|RedirectResponse { if ($this->demo_mode) { throw new RuntimeException('You can not do 2FA things in demo mode'); @@ -203,7 +204,7 @@ class UserSettingsController extends AbstractController * @return RedirectResponse|Response */ #[Route(path: '/settings', name: 'user_settings')] - public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response + public function userSettings(Request $request, EntityManagerInterface $em, UserPasswordHasherInterface $passwordEncoder, GoogleAuthenticator $googleAuthenticator, BackupCodeManager $backupCodeManager, FormFactoryInterface $formFactory, UserAvatarHelper $avatarHelper): RedirectResponse|Response { /** @var User $user */ $user = $this->getUser(); @@ -243,7 +244,7 @@ class UserSettingsController extends AbstractController /** @var Form $form We need a form implementation for the next calls */ //Remove the avatar attachment from the user if requested - if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName() && $user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + if ($form->getClickedButton() && 'remove_avatar' === $form->getClickedButton()->getName() && $user->getMasterPictureAttachment() instanceof Attachment) { $em->remove($user->getMasterPictureAttachment()); $user->setMasterPictureAttachment(null); $page_need_reload = true; diff --git a/src/DataTables/Column/EntityColumn.php b/src/DataTables/Column/EntityColumn.php index c14eabe9..1636827a 100644 --- a/src/DataTables/Column/EntityColumn.php +++ b/src/DataTables/Column/EntityColumn.php @@ -64,7 +64,7 @@ class EntityColumn extends AbstractColumn /** @var AbstractNamedDBElement|null $entity */ - if ($entity instanceof \App\Entity\Base\AbstractNamedDBElement) { + if ($entity instanceof AbstractNamedDBElement) { if (null !== $entity->getID()) { return sprintf( '%s', diff --git a/src/DataTables/Column/RevertLogColumn.php b/src/DataTables/Column/RevertLogColumn.php index b61c0a87..a4d8eb3e 100644 --- a/src/DataTables/Column/RevertLogColumn.php +++ b/src/DataTables/Column/RevertLogColumn.php @@ -41,17 +41,17 @@ declare(strict_types=1); namespace App\DataTables\Column; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\LogSystem\CollectionElementDeleted; use App\Entity\LogSystem\ElementCreatedLogEntry; use App\Entity\LogSystem\ElementDeletedLogEntry; use App\Entity\LogSystem\ElementEditedLogEntry; use Omines\DataTablesBundle\Column\AbstractColumn; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; class RevertLogColumn extends AbstractColumn { - public function __construct(protected TranslatorInterface $translator, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected TranslatorInterface $translator, protected Security $security) { } diff --git a/src/DataTables/Filters/Constraints/EntityConstraint.php b/src/DataTables/Filters/Constraints/EntityConstraint.php index 3fc002b3..2a17552d 100644 --- a/src/DataTables/Filters/Constraints/EntityConstraint.php +++ b/src/DataTables/Filters/Constraints/EntityConstraint.php @@ -41,9 +41,9 @@ class EntityConstraint extends AbstractConstraint * @param null $value * @param string $operator */ - public function __construct(protected ?\App\Services\Trees\NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '') + public function __construct(protected ?NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '') { - if (!$nodesListBuilder instanceof \App\Services\Trees\NodesListBuilder && $this->isStructural()) { + if (!$nodesListBuilder instanceof NodesListBuilder && $this->isStructural()) { throw new \InvalidArgumentException('NodesListBuilder must be provided for structural entities'); } @@ -128,7 +128,7 @@ class EntityConstraint extends AbstractConstraint } //We need to handle null values differently, as they can not be compared with == or != - if (!$this->value instanceof \App\Entity\Base\AbstractDBElement) { + if (!$this->value instanceof AbstractDBElement) { if($this->operator === '=' || $this->operator === 'INCLUDING_CHILDREN') { $queryBuilder->andWhere(sprintf("%s IS NULL", $this->property)); return; diff --git a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php index dfd15259..1c44255f 100644 --- a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php @@ -20,6 +20,7 @@ namespace App\DataTables\Filters\Constraints\Part; +use Doctrine\ORM\Query\Expr\Orx; use App\DataTables\Filters\Constraints\AbstractConstraint; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; @@ -88,7 +89,7 @@ class TagsConstraint extends AbstractConstraint /** * Builds an expression to query for a single tag */ - protected function getExpressionForTag(QueryBuilder $queryBuilder, string $tag): Expr\Orx + protected function getExpressionForTag(QueryBuilder $queryBuilder, string $tag): Orx { $tag_identifier_prefix = uniqid($this->identifier . '_', false); diff --git a/src/DataTables/Filters/LogFilter.php b/src/DataTables/Filters/LogFilter.php index 1751d565..416a9464 100644 --- a/src/DataTables/Filters/LogFilter.php +++ b/src/DataTables/Filters/LogFilter.php @@ -66,7 +66,7 @@ class LogFilter implements FilterInterface /** * @return IntConstraint|NumberConstraint */ - public function getDbId(): \App\DataTables\Filters\Constraints\IntConstraint|\App\DataTables\Filters\Constraints\NumberConstraint + public function getDbId(): IntConstraint|NumberConstraint { return $this->dbId; } diff --git a/src/DataTables/Helpers/PartDataTableHelper.php b/src/DataTables/Helpers/PartDataTableHelper.php index 9e7c9686..df29f35b 100644 --- a/src/DataTables/Helpers/PartDataTableHelper.php +++ b/src/DataTables/Helpers/PartDataTableHelper.php @@ -20,6 +20,8 @@ namespace App\DataTables\Helpers; +use App\Entity\ProjectSystem\Project; +use App\Entity\Attachments\Attachment; use App\Entity\Parts\Part; use App\Services\Attachments\AttachmentURLGenerator; use App\Services\Attachments\PartPreviewGenerator; @@ -46,7 +48,7 @@ class PartDataTableHelper if ($context->isNeedsReview()) { $icon = sprintf('', $this->translator->trans('part.needs_review.badge')); } - if ($context->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { + if ($context->getBuiltProject() instanceof Project) { $icon = sprintf('', $this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName()); } @@ -63,7 +65,7 @@ class PartDataTableHelper public function renderPicture(Part $context): string { $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($context); - if (!$preview_attachment instanceof \App\Entity\Attachments\Attachment) { + if (!$preview_attachment instanceof Attachment) { return ''; } diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php index 5bf3febc..3070e237 100644 --- a/src/DataTables/LogDataTable.php +++ b/src/DataTables/LogDataTable.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\DataTables; +use Symfony\Bundle\SecurityBundle\Security; use App\DataTables\Column\IconLinkColumn; use App\DataTables\Column\LocaleDateTimeColumn; use App\DataTables\Column\LogEntryExtraColumn; @@ -56,7 +57,6 @@ use Psr\Log\LogLevel; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; class LogDataTable implements DataTableTypeInterface @@ -65,7 +65,7 @@ class LogDataTable implements DataTableTypeInterface public function __construct(protected ElementTypeNameGenerator $elementTypeNameGenerator, protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected EntityURLGenerator $entityURLGenerator, EntityManagerInterface $entityManager, - protected \Symfony\Bundle\SecurityBundle\Security $security, protected UserAvatarHelper $userAvatarHelper, protected LogLevelHelper $logLevelHelper) + protected Security $security, protected UserAvatarHelper $userAvatarHelper, protected LogLevelHelper $logLevelHelper) { $this->logRepo = $entityManager->getRepository(AbstractLogEntry::class); } @@ -158,7 +158,7 @@ class LogDataTable implements DataTableTypeInterface $user = $context->getUser(); //If user was deleted, show the info from the username field - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { if ($context->isCLIEntry()) { return sprintf('%s [%s]', htmlentities($context->getCLIUsername()), @@ -219,7 +219,7 @@ class LogDataTable implements DataTableTypeInterface ) { try { $target = $this->logRepo->getTargetElement($context); - if ($target instanceof \App\Entity\Base\AbstractDBElement) { + if ($target instanceof AbstractDBElement) { return $this->entityURLGenerator->timeTravelURL($target, $context->getTimestamp()); } } catch (EntityNotSupportedException) { diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index c1f8296c..82259cdd 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\DataTables; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\Parts\Storelocation; use App\DataTables\Adapters\CustomFetchJoinORMAdapter; use App\DataTables\Column\EntityColumn; use App\DataTables\Column\IconLinkColumn; @@ -49,12 +51,11 @@ use Omines\DataTablesBundle\Column\TextColumn; use Omines\DataTablesBundle\DataTable; use Omines\DataTablesBundle\DataTableTypeInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; final class PartsDataTable implements DataTableTypeInterface { - public function __construct(private readonly EntityURLGenerator $urlGenerator, private readonly TranslatorInterface $translator, private readonly AmountFormatter $amountFormatter, private readonly PartDataTableHelper $partDataTableHelper, private readonly \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly EntityURLGenerator $urlGenerator, private readonly TranslatorInterface $translator, private readonly AmountFormatter $amountFormatter, private readonly PartDataTableHelper $partDataTableHelper, private readonly Security $security) { } @@ -139,7 +140,7 @@ final class PartsDataTable implements DataTableTypeInterface $tmp = []; foreach ($context->getPartLots() as $lot) { //Ignore lots without storelocation - if (!$lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { + if (!$lot->getStorageLocation() instanceof Storelocation) { continue; } $tmp[] = sprintf( diff --git a/src/DataTables/ProjectBomEntriesDataTable.php b/src/DataTables/ProjectBomEntriesDataTable.php index 5c44caf1..6397ae06 100644 --- a/src/DataTables/ProjectBomEntriesDataTable.php +++ b/src/DataTables/ProjectBomEntriesDataTable.php @@ -53,7 +53,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface 'label' => '', 'className' => 'no-colvis', 'render' => function ($value, ProjectBOMEntry $context) { - if(!$context->getPart() instanceof \App\Entity\Parts\Part) { + if(!$context->getPart() instanceof Part) { return ''; } return $this->partDataTableHelper->renderPicture($context->getPart()); @@ -71,7 +71,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface 'orderField' => 'bom_entry.quantity', 'render' => function ($value, ProjectBOMEntry $context): float|string { //If we have a non-part entry, only show the rounded quantity - if (!$context->getPart() instanceof \App\Entity\Parts\Part) { + if (!$context->getPart() instanceof Part) { return round($context->getQuantity()); } //Otherwise use the unit of the part to format the quantity @@ -83,10 +83,10 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface 'label' => $this->translator->trans('part.table.name'), 'orderField' => 'part.name', 'render' => function ($value, ProjectBOMEntry $context) { - if(!$context->getPart() instanceof \App\Entity\Parts\Part) { + if(!$context->getPart() instanceof Part) { return htmlspecialchars($context->getName()); } - if($context->getPart() instanceof \App\Entity\Parts\Part) { + if($context->getPart() instanceof Part) { $tmp = $this->partDataTableHelper->renderName($context->getPart()); if(!empty($context->getName())) { $tmp .= '
'.htmlspecialchars($context->getName()).''; @@ -100,7 +100,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface ->add('description', MarkdownColumn::class, [ 'label' => $this->translator->trans('part.table.description'), 'data' => function (ProjectBOMEntry $context) { - if($context->getPart() instanceof \App\Entity\Parts\Part) { + if($context->getPart() instanceof Part) { return $context->getPart()->getDescription(); } //For non-part BOM entries show the comment field diff --git a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php index 4d3b9f6c..db717c3f 100644 --- a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php +++ b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php @@ -64,7 +64,7 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface * @param string[] $excluded array of table/view names to be excluded from purge */ public function __construct( - private ?\Doctrine\ORM\EntityManagerInterface $em = null, + private ?EntityManagerInterface $em = null, /** * Table/view names to be excluded from purge */ diff --git a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php index 4b91ab57..046672d9 100644 --- a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php +++ b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php @@ -20,6 +20,7 @@ namespace App\Doctrine\SetSQLMode; +use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver\Middleware\AbstractDriverMiddleware; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; @@ -29,7 +30,7 @@ use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; */ class SetSQLModeMiddlewareDriver extends AbstractDriverMiddleware { - public function connect(array $params): \Doctrine\DBAL\Driver\Connection + public function connect(array $params): Connection { //Only set this on MySQL connections, as other databases don't support this parameter if($this->getDatabasePlatform() instanceof AbstractMySQLPlatform) { diff --git a/src/Doctrine/Types/BigDecimalType.php b/src/Doctrine/Types/BigDecimalType.php index 4dcabbb3..83307ee8 100644 --- a/src/Doctrine/Types/BigDecimalType.php +++ b/src/Doctrine/Types/BigDecimalType.php @@ -53,7 +53,7 @@ class BigDecimalType extends Type */ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string { - if (!$value instanceof \Brick\Math\BigDecimal) { + if (!$value instanceof BigDecimal) { return null; } diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 5fd1de14..f2c6253e 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Attachments; +use App\Repository\AttachmentRepository; +use App\EntityListeners\AttachmentDeleteListener; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractNamedDBElement; use App\Validator\Constraints\Selectable; use Doctrine\ORM\Mapping as ORM; @@ -34,11 +37,11 @@ use LogicException; /** * Class Attachment. */ -#[ORM\Entity(repositoryClass: \App\Repository\AttachmentRepository::class)] +#[ORM\Entity(repositoryClass: AttachmentRepository::class)] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'class_name', type: 'string')] #[ORM\DiscriminatorMap(['PartDB\Part' => 'PartAttachment', 'Part' => 'PartAttachment', 'PartDB\Device' => 'ProjectAttachment', 'Device' => 'ProjectAttachment', 'AttachmentType' => 'AttachmentTypeAttachment', 'Category' => 'CategoryAttachment', 'Footprint' => 'FootprintAttachment', 'Manufacturer' => 'ManufacturerAttachment', 'Currency' => 'CurrencyAttachment', 'Group' => 'GroupAttachment', 'MeasurementUnit' => 'MeasurementUnitAttachment', 'Storelocation' => 'StorelocationAttachment', 'Supplier' => 'SupplierAttachment', 'User' => 'UserAttachment', 'LabelProfile' => 'LabelAttachment'])] -#[ORM\EntityListeners([\App\EntityListeners\AttachmentDeleteListener::class])] +#[ORM\EntityListeners([AttachmentDeleteListener::class])] #[ORM\Table(name: '`attachments`')] #[ORM\Index(name: 'attachments_idx_id_element_id_class_name', columns: ['id', 'element_id', 'class_name'])] #[ORM\Index(name: 'attachments_idx_class_name_id', columns: ['class_name', 'id'])] @@ -78,13 +81,13 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var string|null the original filename the file had, when the user uploaded it */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] protected ?string $original_filename = null; /** * @var string The path to the file relative to a placeholder path like %MEDIA% */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'path')] + #[ORM\Column(type: Types::STRING, name: 'path')] protected string $path = ''; /** @@ -92,7 +95,7 @@ abstract class Attachment extends AbstractNamedDBElement */ #[Assert\NotBlank(message: 'validator.attachment.name_not_blank')] #[Groups(['simple', 'extended', 'full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $name = ''; /** @@ -103,7 +106,7 @@ abstract class Attachment extends AbstractNamedDBElement /** * @var bool */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $show_in_table = false; /** diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index bac4ecc4..ed59a2da 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Entity\Attachments; +use App\Repository\StructuralDBElementRepository; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Parameters\AttachmentTypeParameter; use App\Validator\Constraints\ValidFileFilter; @@ -33,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. */ -#[ORM\Entity(repositoryClass: \App\Repository\StructuralDBElementRepository::class)] +#[ORM\Entity(repositoryClass: StructuralDBElementRepository::class)] #[ORM\Table(name: '`attachment_types`')] #[ORM\Index(name: 'attachment_types_idx_name', columns: ['name'])] #[ORM\Index(name: 'attachment_types_idx_parent_name', columns: ['parent_id', 'name'])] @@ -51,33 +53,36 @@ class AttachmentType extends AbstractStructuralDBElement * @var string * @ValidFileFilter */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $filetype_filter = ''; /** * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** - * @var \Doctrine\Common\Collections\Collection<\App\Entity\Attachments\Attachment> + * @var Collection + */ + /** + * @var Collection */ #[ORM\OneToMany(targetEntity: 'Attachment', mappedBy: 'attachment_type')] - protected \Doctrine\Common\Collections\Collection $attachments_with_type; + protected Collection $attachments_with_type; public function __construct() { - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->parameters = new ArrayCollection(); parent::__construct(); $this->attachments = new ArrayCollection(); $this->attachments_with_type = new ArrayCollection(); diff --git a/src/Entity/Attachments/AttachmentTypeAttachment.php b/src/Entity/Attachments/AttachmentTypeAttachment.php index a8e441c2..3c81b464 100644 --- a/src/Entity/Attachments/AttachmentTypeAttachment.php +++ b/src/Entity/Attachments/AttachmentTypeAttachment.php @@ -36,7 +36,7 @@ class AttachmentTypeAttachment extends Attachment /** * @var AttachmentContainingDBElement|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/CategoryAttachment.php b/src/Entity/Attachments/CategoryAttachment.php index 854d628f..ea987b64 100644 --- a/src/Entity/Attachments/CategoryAttachment.php +++ b/src/Entity/Attachments/CategoryAttachment.php @@ -37,7 +37,7 @@ class CategoryAttachment extends Attachment /** * @var AttachmentContainingDBElement|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/CurrencyAttachment.php b/src/Entity/Attachments/CurrencyAttachment.php index d3b06654..419be619 100644 --- a/src/Entity/Attachments/CurrencyAttachment.php +++ b/src/Entity/Attachments/CurrencyAttachment.php @@ -37,7 +37,7 @@ class CurrencyAttachment extends Attachment /** * @var Currency|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/FootprintAttachment.php b/src/Entity/Attachments/FootprintAttachment.php index 2cd60bfb..3ac5ec8e 100644 --- a/src/Entity/Attachments/FootprintAttachment.php +++ b/src/Entity/Attachments/FootprintAttachment.php @@ -37,7 +37,7 @@ class FootprintAttachment extends Attachment /** * @var Footprint|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Footprint::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/GroupAttachment.php b/src/Entity/Attachments/GroupAttachment.php index e10d17f6..a6558dfa 100644 --- a/src/Entity/Attachments/GroupAttachment.php +++ b/src/Entity/Attachments/GroupAttachment.php @@ -38,7 +38,7 @@ class GroupAttachment extends Attachment /** * @var Group|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Group::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/LabelAttachment.php b/src/Entity/Attachments/LabelAttachment.php index ddb13283..7616194c 100644 --- a/src/Entity/Attachments/LabelAttachment.php +++ b/src/Entity/Attachments/LabelAttachment.php @@ -57,7 +57,7 @@ class LabelAttachment extends Attachment /** * @var LabelProfile the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\LabelSystem\LabelProfile::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: LabelProfile::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/ManufacturerAttachment.php b/src/Entity/Attachments/ManufacturerAttachment.php index 620d5c58..65ac461c 100644 --- a/src/Entity/Attachments/ManufacturerAttachment.php +++ b/src/Entity/Attachments/ManufacturerAttachment.php @@ -38,7 +38,7 @@ class ManufacturerAttachment extends Attachment /** * @var Manufacturer|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Manufacturer::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/MeasurementUnitAttachment.php b/src/Entity/Attachments/MeasurementUnitAttachment.php index 0df01536..d79b40a7 100644 --- a/src/Entity/Attachments/MeasurementUnitAttachment.php +++ b/src/Entity/Attachments/MeasurementUnitAttachment.php @@ -38,7 +38,7 @@ class MeasurementUnitAttachment extends Attachment /** * @var Manufacturer|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/PartAttachment.php b/src/Entity/Attachments/PartAttachment.php index fbc7479c..54f12180 100644 --- a/src/Entity/Attachments/PartAttachment.php +++ b/src/Entity/Attachments/PartAttachment.php @@ -37,7 +37,7 @@ class PartAttachment extends Attachment /** * @var Part the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/ProjectAttachment.php b/src/Entity/Attachments/ProjectAttachment.php index 6dfa9dcd..76c77bc2 100644 --- a/src/Entity/Attachments/ProjectAttachment.php +++ b/src/Entity/Attachments/ProjectAttachment.php @@ -37,7 +37,7 @@ class ProjectAttachment extends Attachment /** * @var Project|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/StorelocationAttachment.php b/src/Entity/Attachments/StorelocationAttachment.php index f1ac9090..3831630c 100644 --- a/src/Entity/Attachments/StorelocationAttachment.php +++ b/src/Entity/Attachments/StorelocationAttachment.php @@ -38,7 +38,7 @@ class StorelocationAttachment extends Attachment /** * @var Storelocation|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/SupplierAttachment.php b/src/Entity/Attachments/SupplierAttachment.php index 241f401a..deba7480 100644 --- a/src/Entity/Attachments/SupplierAttachment.php +++ b/src/Entity/Attachments/SupplierAttachment.php @@ -38,7 +38,7 @@ class SupplierAttachment extends Attachment /** * @var Supplier|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Attachments/UserAttachment.php b/src/Entity/Attachments/UserAttachment.php index c08b38f8..8d8c2e04 100644 --- a/src/Entity/Attachments/UserAttachment.php +++ b/src/Entity/Attachments/UserAttachment.php @@ -38,7 +38,7 @@ class UserAttachment extends Attachment /** * @var User|null the element this attachment is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'attachments')] + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; } diff --git a/src/Entity/Base/AbstractCompany.php b/src/Entity/Base/AbstractCompany.php index f265349a..4d0678c4 100644 --- a/src/Entity/Base/AbstractCompany.php +++ b/src/Entity/Base/AbstractCompany.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Base; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use function is_string; @@ -37,21 +38,21 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement * @var string The address of the company */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $address = ''; /** * @var string The phone number of the company */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $phone_number = ''; /** * @var string The fax number of the company */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $fax_number = ''; /** @@ -59,7 +60,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement */ #[Assert\Email] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $email_address = ''; /** @@ -67,13 +68,13 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement */ #[Assert\Url] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $website = ''; /** * @var string */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $auto_product_url = ''; /******************************************************************************** diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index 101493fe..30fcab06 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -22,6 +22,37 @@ declare(strict_types=1); namespace App\Entity\Base; +use App\Entity\Attachments\AttachmentType; +use App\Entity\Attachments\Attachment; +use App\Entity\Attachments\AttachmentTypeAttachment; +use App\Entity\Attachments\CategoryAttachment; +use App\Entity\Attachments\CurrencyAttachment; +use App\Entity\Attachments\FootprintAttachment; +use App\Entity\Attachments\GroupAttachment; +use App\Entity\Attachments\LabelAttachment; +use App\Entity\Attachments\ManufacturerAttachment; +use App\Entity\Attachments\MeasurementUnitAttachment; +use App\Entity\Attachments\PartAttachment; +use App\Entity\Attachments\ProjectAttachment; +use App\Entity\Attachments\StorelocationAttachment; +use App\Entity\Attachments\SupplierAttachment; +use App\Entity\Attachments\UserAttachment; +use App\Entity\Parts\Category; +use App\Entity\ProjectSystem\Project; +use App\Entity\ProjectSystem\ProjectBOMEntry; +use App\Entity\Parts\Footprint; +use App\Entity\UserSystem\Group; +use App\Entity\Parts\Manufacturer; +use App\Entity\PriceInformations\Orderdetail; +use App\Entity\Parts\Part; +use App\Entity\Parts\Storelocation; +use App\Entity\Parts\PartLot; +use App\Entity\PriceInformations\Currency; +use App\Entity\Parts\MeasurementUnit; +use App\Entity\Parts\Supplier; +use App\Entity\UserSystem\User; +use App\Repository\DBElementRepository; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use JsonSerializable; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; @@ -35,15 +66,15 @@ use Symfony\Component\Serializer\Annotation\Groups; * Every database table which are managed with this class (or a subclass of it) * must have the table row "id"!! The ID is the unique key to identify the elements. */ -#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => \App\Entity\Attachments\AttachmentType::class, 'attachment' => \App\Entity\Attachments\Attachment::class, 'attachment_type_attachment' => \App\Entity\Attachments\AttachmentTypeAttachment::class, 'category_attachment' => \App\Entity\Attachments\CategoryAttachment::class, 'currency_attachment' => \App\Entity\Attachments\CurrencyAttachment::class, 'footprint_attachment' => \App\Entity\Attachments\FootprintAttachment::class, 'group_attachment' => \App\Entity\Attachments\GroupAttachment::class, 'label_attachment' => \App\Entity\Attachments\LabelAttachment::class, 'manufacturer_attachment' => \App\Entity\Attachments\ManufacturerAttachment::class, 'measurement_unit_attachment' => \App\Entity\Attachments\MeasurementUnitAttachment::class, 'part_attachment' => \App\Entity\Attachments\PartAttachment::class, 'project_attachment' => \App\Entity\Attachments\ProjectAttachment::class, 'storelocation_attachment' => \App\Entity\Attachments\StorelocationAttachment::class, 'supplier_attachment' => \App\Entity\Attachments\SupplierAttachment::class, 'user_attachment' => \App\Entity\Attachments\UserAttachment::class, 'category' => \App\Entity\Parts\Category::class, 'project' => \App\Entity\ProjectSystem\Project::class, 'project_bom_entry' => \App\Entity\ProjectSystem\ProjectBOMEntry::class, 'footprint' => \App\Entity\Parts\Footprint::class, 'group' => \App\Entity\UserSystem\Group::class, 'manufacturer' => \App\Entity\Parts\Manufacturer::class, 'orderdetail' => \App\Entity\PriceInformations\Orderdetail::class, 'part' => \App\Entity\Parts\Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => \App\Entity\Parts\Storelocation::class, 'part_lot' => \App\Entity\Parts\PartLot::class, 'currency' => \App\Entity\PriceInformations\Currency::class, 'measurement_unit' => \App\Entity\Parts\MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => \App\Entity\Parts\Supplier::class, 'user' => \App\Entity\UserSystem\User::class])] -#[ORM\MappedSuperclass(repositoryClass: \App\Repository\DBElementRepository::class)] +#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorelocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => Storelocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => Supplier::class, 'user' => User::class])] +#[ORM\MappedSuperclass(repositoryClass: DBElementRepository::class)] abstract class AbstractDBElement implements JsonSerializable { /** @var int|null The Identification number for this part. This value is unique for the element in this table. * Null if the element is not saved to DB yet. */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] #[ORM\Id] #[ORM\GeneratedValue] protected ?int $id = null; diff --git a/src/Entity/Base/AbstractNamedDBElement.php b/src/Entity/Base/AbstractNamedDBElement.php index f286e6b8..20009658 100644 --- a/src/Entity/Base/AbstractNamedDBElement.php +++ b/src/Entity/Base/AbstractNamedDBElement.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Base; +use Doctrine\DBAL\Types\Types; use App\Entity\Contracts\NamedElementInterface; use App\Entity\Contracts\TimeStampableInterface; use Doctrine\ORM\Mapping as ORM; @@ -42,7 +43,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named */ #[Assert\NotBlank] #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $name = ''; /****************************************************************************** diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index 1885bfb9..211340bc 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Base; +use App\Repository\AbstractPartsContainingRepository; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -29,7 +30,7 @@ use Symfony\Component\Serializer\Annotation\Groups; /** * Class PartsContainingDBElement. */ -#[ORM\MappedSuperclass(repositoryClass: \App\Repository\AbstractPartsContainingRepository::class)] +#[ORM\MappedSuperclass(repositoryClass: AbstractPartsContainingRepository::class)] abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement { #[Groups(['full'])] diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 847c5ff3..a1dc80dd 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Base; +use App\Repository\StructuralDBElementRepository; +use App\EntityListeners\TreeCacheInvalidationListener; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Parameters\ParametersTrait; use App\Validator\Constraints\NoneOfItsChildren; @@ -46,24 +49,24 @@ use Symfony\Component\Serializer\Annotation\Groups; * */ #[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')] -#[ORM\MappedSuperclass(repositoryClass: \App\Repository\StructuralDBElementRepository::class)] -#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])] +#[ORM\MappedSuperclass(repositoryClass: StructuralDBElementRepository::class)] +#[ORM\EntityListeners([TreeCacheInvalidationListener::class])] abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement { use ParametersTrait; - public const ID_ROOT_ELEMENT = 0; + final public const ID_ROOT_ELEMENT = 0; /** * This is a not standard character, so build a const, so a dev can easily use it. */ - public const PATH_DELIMITER_ARROW = ' → '; + final public const PATH_DELIMITER_ARROW = ' → '; /** * @var string The comment info for this element */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $comment = ''; /** @@ -71,7 +74,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement * Useful if this element should be used only for grouping, sorting. */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $not_selectable = false; /** diff --git a/src/Entity/Base/MasterAttachmentTrait.php b/src/Entity/Base/MasterAttachmentTrait.php index e3801fb6..21168282 100644 --- a/src/Entity/Base/MasterAttachmentTrait.php +++ b/src/Entity/Base/MasterAttachmentTrait.php @@ -35,7 +35,7 @@ trait MasterAttachmentTrait * @var Attachment|null */ #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] - #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)] + #[ORM\ManyToOne(targetEntity: Attachment::class)] #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] protected ?Attachment $master_picture_attachment = null; diff --git a/src/Entity/Base/TimestampTrait.php b/src/Entity/Base/TimestampTrait.php index 9091fe70..93e58cb7 100644 --- a/src/Entity/Base/TimestampTrait.php +++ b/src/Entity/Base/TimestampTrait.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Base; +use Doctrine\DBAL\Types\Types; use DateTime; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -35,14 +36,14 @@ trait TimestampTrait * @var \DateTimeInterface|null the date when this element was modified the last time */ #[Groups(['extended', 'full'])] - #[ORM\Column(name: 'last_modified', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])] + #[ORM\Column(name: 'last_modified', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])] protected ?\DateTimeInterface $lastModified = null; /** * @var \DateTimeInterface|null the date when this element was created */ #[Groups(['extended', 'full'])] - #[ORM\Column(name: 'datetime_added', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])] + #[ORM\Column(name: 'datetime_added', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])] protected ?\DateTimeInterface $addedDate = null; /** diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index b50230e8..1ee86079 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\Entity\LabelSystem; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; @@ -57,53 +58,53 @@ class LabelOptions * @var float The page size of the label in mm */ #[Assert\Positive] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: Types::FLOAT)] protected float $width = 50.0; /** * @var float The page size of the label in mm */ #[Assert\Positive] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: Types::FLOAT)] protected float $height = 30.0; /** * @var string The type of the barcode that should be used in the label (e.g. 'qr') */ #[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $barcode_type = 'none'; /** * @var string What image should be shown along the */ #[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $picture_type = 'none'; /** * @var string */ #[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $supported_element = 'part'; /** * @var string any additional CSS for the label */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $additional_css = ''; /** @var string The mode that will be used to interpret the lines */ #[Assert\Choice(choices: LabelOptions::LINES_MODES)] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $lines_mode = 'html'; /** * @var string */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $lines = ''; public function getWidth(): float diff --git a/src/Entity/LabelSystem/LabelProfile.php b/src/Entity/LabelSystem/LabelProfile.php index c7fd4a26..9b13e165 100644 --- a/src/Entity/LabelSystem/LabelProfile.php +++ b/src/Entity/LabelSystem/LabelProfile.php @@ -41,6 +41,10 @@ declare(strict_types=1); namespace App\Entity\LabelSystem; +use App\Repository\LabelProfileRepository; +use App\EntityListeners\TreeCacheInvalidationListener; +use Doctrine\DBAL\Types\Types; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\LabelAttachment; use Doctrine\Common\Collections\Collection; @@ -49,15 +53,15 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Validator\Constraints as Assert; #[UniqueEntity(['name', 'options.supported_element'])] -#[ORM\Entity(repositoryClass: \App\Repository\LabelProfileRepository::class)] -#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])] +#[ORM\Entity(repositoryClass: LabelProfileRepository::class)] +#[ORM\EntityListeners([TreeCacheInvalidationListener::class])] #[ORM\Table(name: 'label_profiles')] class LabelProfile extends AttachmentContainingDBElement { /** * @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -71,18 +75,18 @@ class LabelProfile extends AttachmentContainingDBElement /** * @var string The comment info for this element */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $comment = ''; /** * @var bool determines, if this label profile should be shown in the dropdown quick menu */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $show_in_dropdown = true; public function __construct() { - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new ArrayCollection(); parent::__construct(); $this->options = new LabelOptions(); } diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index fe94ec81..7cc064b7 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\LogSystem; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractDBElement; @@ -129,19 +130,19 @@ abstract class AbstractLogEntry extends AbstractDBElement /** @var User|null The user which has caused this log entry */ - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, fetch: 'EAGER')] + #[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')] #[ORM\JoinColumn(name: 'id_user', onDelete: 'SET NULL')] protected ?User $user = null; /** * @var string The username of the user which has caused this log entry (shown if the user is deleted) */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $username = ''; /** @var \DateTimeInterface|null The datetime the event associated with this log entry has occured */ - #[ORM\Column(name: 'datetime', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)] + #[ORM\Column(name: 'datetime', type: Types::DATETIME_MUTABLE)] protected ?\DateTimeInterface $timestamp = null; /** @var int The priority level of the associated level. 0 is highest, 7 lowest @@ -151,12 +152,12 @@ abstract class AbstractLogEntry extends AbstractDBElement /** @var int The ID of the element targeted by this event */ - #[ORM\Column(name: 'target_id', type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(name: 'target_id', type: Types::INTEGER)] protected int $target_id = 0; /** @var int The Type of the targeted element */ - #[ORM\Column(name: 'target_type', type: \Doctrine\DBAL\Types\Types::SMALLINT)] + #[ORM\Column(name: 'target_type', type: Types::SMALLINT)] protected int $target_type = 0; /** @var string The type of this log entry, aka the description what has happened. @@ -167,7 +168,7 @@ abstract class AbstractLogEntry extends AbstractDBElement /** @var array The extra data in raw (short form) saved in the DB */ - #[ORM\Column(name: 'extra', type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(name: 'extra', type: Types::JSON)] protected array $extra = []; public function __construct() @@ -370,7 +371,7 @@ abstract class AbstractLogEntry extends AbstractDBElement */ public function setTargetElement(?AbstractDBElement $element): self { - if (!$element instanceof \App\Entity\Base\AbstractDBElement) { + if (!$element instanceof AbstractDBElement) { $this->target_id = 0; $this->target_type = self::TARGET_TYPE_NONE; diff --git a/src/Entity/LogSystem/PartStockChangedLogEntry.php b/src/Entity/LogSystem/PartStockChangedLogEntry.php index 22c7a9ee..5ac1c953 100644 --- a/src/Entity/LogSystem/PartStockChangedLogEntry.php +++ b/src/Entity/LogSystem/PartStockChangedLogEntry.php @@ -68,7 +68,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry $this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...'); } - if ($move_to_target instanceof \App\Entity\Parts\PartLot) { + if ($move_to_target instanceof PartLot) { if ($type !== self::TYPE_MOVE) { throw new \InvalidArgumentException('The move_to_target parameter can only be set if the type is "move"!'); } diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index dd080d5a..6e4a77f3 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -41,6 +41,8 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractNamedDBElement; use Doctrine\ORM\Mapping as ORM; @@ -51,7 +53,7 @@ use Symfony\Component\Validator\Constraints as Assert; use function sprintf; -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')] #[ORM\DiscriminatorMap([0 => 'CategoryParameter', 1 => 'CurrencyParameter', 2 => 'ProjectParameter', 3 => 'FootprintParameter', 4 => 'GroupParameter', 5 => 'ManufacturerParameter', 6 => 'MeasurementUnitParameter', 7 => 'PartParameter', 8 => 'StorelocationParameter', 9 => 'SupplierParameter', 10 => 'AttachmentTypeParameter'])] @@ -71,7 +73,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement */ #[Assert\Length(max: 20)] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $symbol = ''; /** @@ -81,7 +83,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement #[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')] #[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] protected ?float $value_min = null; /** @@ -89,7 +91,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement */ #[Assert\Type([null, 'float'])] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] protected ?float $value_typical = null; /** @@ -98,21 +100,21 @@ abstract class AbstractParameter extends AbstractNamedDBElement #[Assert\Type(['float', null])] #[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] protected ?float $value_max = null; /** * @var string The unit in which the value values are given (e.g. V) */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $unit = ''; /** * @var string a text value for the given property */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $value_text = ''; /** @@ -120,7 +122,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement */ #[Groups(['full'])] #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'param_group')] + #[ORM\Column(type: Types::STRING, name: 'param_group')] protected string $group = ''; /** diff --git a/src/Entity/Parameters/AttachmentTypeParameter.php b/src/Entity/Parameters/AttachmentTypeParameter.php index f06c26aa..2ac9dc09 100644 --- a/src/Entity/Parameters/AttachmentTypeParameter.php +++ b/src/Entity/Parameters/AttachmentTypeParameter.php @@ -41,20 +41,21 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractDBElement; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class AttachmentTypeParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = AttachmentType::class; /** * @var AttachmentType the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/CategoryParameter.php b/src/Entity/Parameters/CategoryParameter.php index 94004355..8aa4f29c 100644 --- a/src/Entity/Parameters/CategoryParameter.php +++ b/src/Entity/Parameters/CategoryParameter.php @@ -41,20 +41,21 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\Category; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class CategoryParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Category::class; /** * @var Category the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/CurrencyParameter.php b/src/Entity/Parameters/CurrencyParameter.php index 3db70701..3540f5cb 100644 --- a/src/Entity/Parameters/CurrencyParameter.php +++ b/src/Entity/Parameters/CurrencyParameter.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\PriceInformations\Currency; use Doctrine\ORM\Mapping as ORM; @@ -50,7 +51,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * An attachment attached to a category element. */ #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class CurrencyParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Currency::class; @@ -58,7 +59,7 @@ class CurrencyParameter extends AbstractParameter /** * @var Currency the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/FootprintParameter.php b/src/Entity/Parameters/FootprintParameter.php index ca632a8f..2a978b04 100644 --- a/src/Entity/Parameters/FootprintParameter.php +++ b/src/Entity/Parameters/FootprintParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\Footprint; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class FootprintParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Footprint::class; @@ -55,7 +56,7 @@ class FootprintParameter extends AbstractParameter /** * @var Footprint the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Footprint::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/GroupParameter.php b/src/Entity/Parameters/GroupParameter.php index eb838e99..1bc23ea8 100644 --- a/src/Entity/Parameters/GroupParameter.php +++ b/src/Entity/Parameters/GroupParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\UserSystem\Group; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class GroupParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Group::class; @@ -55,7 +56,7 @@ class GroupParameter extends AbstractParameter /** * @var Group the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Group::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/ManufacturerParameter.php b/src/Entity/Parameters/ManufacturerParameter.php index d4a59793..6f33dce8 100644 --- a/src/Entity/Parameters/ManufacturerParameter.php +++ b/src/Entity/Parameters/ManufacturerParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\Manufacturer; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class ManufacturerParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Manufacturer::class; @@ -55,7 +56,7 @@ class ManufacturerParameter extends AbstractParameter /** * @var Manufacturer the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Manufacturer::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/MeasurementUnitParameter.php b/src/Entity/Parameters/MeasurementUnitParameter.php index a32910be..7332474e 100644 --- a/src/Entity/Parameters/MeasurementUnitParameter.php +++ b/src/Entity/Parameters/MeasurementUnitParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\MeasurementUnit; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class MeasurementUnitParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class; @@ -55,7 +56,7 @@ class MeasurementUnitParameter extends AbstractParameter /** * @var MeasurementUnit the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index 65aba267..36fc71fb 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class PartParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Part::class; @@ -55,7 +56,7 @@ class PartParameter extends AbstractParameter /** * @var Part the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/ProjectParameter.php b/src/Entity/Parameters/ProjectParameter.php index 11462e38..7413ca8a 100644 --- a/src/Entity/Parameters/ProjectParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\ProjectSystem\Project; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class ProjectParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Project::class; @@ -55,7 +56,7 @@ class ProjectParameter extends AbstractParameter /** * @var Project the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/StorelocationParameter.php b/src/Entity/Parameters/StorelocationParameter.php index f6ed82e2..098d3a5e 100644 --- a/src/Entity/Parameters/StorelocationParameter.php +++ b/src/Entity/Parameters/StorelocationParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\Storelocation; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class StorelocationParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Storelocation::class; @@ -55,7 +56,7 @@ class StorelocationParameter extends AbstractParameter /** * @var Storelocation the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parameters/SupplierParameter.php b/src/Entity/Parameters/SupplierParameter.php index 6ffcbcfa..5c87ac08 100644 --- a/src/Entity/Parameters/SupplierParameter.php +++ b/src/Entity/Parameters/SupplierParameter.php @@ -41,13 +41,14 @@ declare(strict_types=1); namespace App\Entity\Parameters; +use App\Repository\ParameterRepository; use App\Entity\Base\AbstractDBElement; use App\Entity\Parts\Supplier; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; #[UniqueEntity(fields: ['name', 'group', 'element'])] -#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] class SupplierParameter extends AbstractParameter { final public const ALLOWED_ELEMENT_CLASS = Supplier::class; @@ -55,7 +56,7 @@ class SupplierParameter extends AbstractParameter /** * @var Supplier the element this para is associated with */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'parameters')] + #[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'parameters')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AbstractDBElement $element = null; } diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index ba5c5750..7ac0b209 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\Parts\CategoryRepository; +use Doctrine\DBAL\Types\Types; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Base\AbstractStructuralDBElement; @@ -34,7 +37,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. */ -#[ORM\Entity(repositoryClass: \App\Repository\Parts\CategoryRepository::class)] +#[ORM\Entity(repositoryClass: CategoryRepository::class)] #[ORM\Table(name: '`categories`')] #[ORM\Index(name: 'category_idx_name', columns: ['name'])] #[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])] @@ -55,56 +58,56 @@ class Category extends AbstractPartsContainingDBElement * @var string */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $partname_hint = ''; /** * @var string */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $partname_regex = ''; /** * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $disable_footprints = false; /** * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $disable_manufacturers = false; /** * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $disable_autodatasheets = false; /** * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $disable_properties = false; /** * @var string */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $default_description = ''; /** * @var string */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $default_comment = ''; /** @@ -112,7 +115,7 @@ class Category extends AbstractPartsContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -120,7 +123,7 @@ class Category extends AbstractPartsContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -222,8 +225,8 @@ class Category extends AbstractPartsContainingDBElement public function __construct() { parent::__construct(); - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); } } diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index b228141f..13edd726 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\Parts\FootprintRepository; +use App\Entity\Base\AbstractStructuralDBElement; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Parameters\FootprintParameter; @@ -32,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Footprint. */ -#[ORM\Entity(repositoryClass: \App\Repository\Parts\FootprintRepository::class)] +#[ORM\Entity(repositoryClass: FootprintRepository::class)] #[ORM\Table('`footprints`')] #[ORM\Index(name: 'footprint_idx_name', columns: ['name'])] #[ORM\Index(name: 'footprint_idx_parent_name', columns: ['parent_id', 'name'])] @@ -40,7 +43,7 @@ class Footprint extends AbstractPartsContainingDBElement { #[ORM\ManyToOne(targetEntity: 'Footprint', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null; + protected ?AbstractStructuralDBElement $parent = null; /** * @var Collection @@ -53,21 +56,21 @@ class Footprint extends AbstractPartsContainingDBElement * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** * @var FootprintAttachment|null */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\FootprintAttachment::class)] + #[ORM\ManyToOne(targetEntity: FootprintAttachment::class)] #[ORM\JoinColumn(name: 'id_footprint_3d')] protected ?FootprintAttachment $footprint_3d = null; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -102,8 +105,8 @@ class Footprint extends AbstractPartsContainingDBElement public function __construct() { parent::__construct(); - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); } } diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index 0ff9d49c..ee595c38 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\Parts\ManufacturerRepository; +use App\Entity\Base\AbstractStructuralDBElement; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\ManufacturerAttachment; use App\Entity\Base\AbstractCompany; use App\Entity\Parameters\ManufacturerParameter; @@ -32,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Manufacturer. */ -#[ORM\Entity(repositoryClass: \App\Repository\Parts\ManufacturerRepository::class)] +#[ORM\Entity(repositoryClass: ManufacturerRepository::class)] #[ORM\Table('`manufacturers`')] #[ORM\Index(name: 'manufacturer_name', columns: ['name'])] #[ORM\Index(name: 'manufacturer_idx_parent_name', columns: ['parent_id', 'name'])] @@ -40,7 +43,7 @@ class Manufacturer extends AbstractCompany { #[ORM\ManyToOne(targetEntity: 'Manufacturer', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null; + protected ?AbstractStructuralDBElement $parent = null; /** * @var Collection @@ -53,21 +56,21 @@ class Manufacturer extends AbstractCompany * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; public function __construct() { parent::__construct(); - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); } } diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 1faac9e0..10259ace 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -22,6 +22,10 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\Parts\MeasurementUnitRepository; +use Doctrine\DBAL\Types\Types; +use App\Entity\Base\AbstractStructuralDBElement; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\MeasurementUnitAttachment; use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Parameters\MeasurementUnitParameter; @@ -36,7 +40,7 @@ use Symfony\Component\Validator\Constraints as Assert; * This could be something like N, grams, meters, etc... */ #[UniqueEntity('unit')] -#[ORM\Entity(repositoryClass: \App\Repository\Parts\MeasurementUnitRepository::class)] +#[ORM\Entity(repositoryClass: MeasurementUnitRepository::class)] #[ORM\Table(name: '`measurement_units`')] #[ORM\Index(name: 'unit_idx_name', columns: ['name'])] #[ORM\Index(name: 'unit_idx_parent_name', columns: ['parent_id', 'name'])] @@ -48,7 +52,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement */ #[Assert\Length(max: 10)] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'unit', nullable: true)] + #[ORM\Column(type: Types::STRING, name: 'unit', nullable: true)] protected ?string $unit = null; /** @@ -56,7 +60,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * Set to false, to measure continuous sizes likes masses or lengths. */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'is_integer')] + #[ORM\Column(type: Types::BOOLEAN, name: 'is_integer')] protected bool $is_integer = false; /** @@ -65,7 +69,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement */ #[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')] #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'use_si_prefix')] + #[ORM\Column(type: Types::BOOLEAN, name: 'use_si_prefix')] protected bool $use_si_prefix = false; /** @@ -77,20 +81,20 @@ class MeasurementUnit extends AbstractPartsContainingDBElement #[ORM\ManyToOne(targetEntity: 'MeasurementUnit', inversedBy: 'children')] #[ORM\JoinColumn(name: 'parent_id')] - protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null; + protected ?AbstractStructuralDBElement $parent = null; /** * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -135,8 +139,8 @@ class MeasurementUnit extends AbstractPartsContainingDBElement public function __construct() { parent::__construct(); - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); } } diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index a77f10e5..b8ff5abb 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\PartRepository; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\PartAttachment; @@ -49,7 +51,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * Otherwise, this class would be too big, to be maintained. */ #[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')] -#[ORM\Entity(repositoryClass: \App\Repository\PartRepository::class)] +#[ORM\Entity(repositoryClass: PartRepository::class)] #[ORM\Table('`parts`')] #[ORM\Index(name: 'parts_idx_datet_name_last_id_needs', columns: ['datetime_added', 'name', 'last_modified', 'id', 'needs_review'])] #[ORM\Index(name: 'parts_idx_name', columns: ['name'])] @@ -69,7 +71,7 @@ class Part extends AttachmentContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -81,7 +83,7 @@ class Part extends AttachmentContainingDBElement /** * @var string The name of this part */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $name = ''; /** @@ -89,7 +91,7 @@ class Part extends AttachmentContainingDBElement */ #[Assert\Valid] #[Groups(['full'])] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -97,13 +99,13 @@ class Part extends AttachmentContainingDBElement * @var Attachment|null */ #[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')] - #[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)] + #[ORM\ManyToOne(targetEntity: Attachment::class)] #[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')] protected ?Attachment $master_picture_attachment = null; public function __construct() { - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new ArrayCollection(); parent::__construct(); $this->partLots = new ArrayCollection(); $this->orderdetails = new ArrayCollection(); @@ -142,7 +144,7 @@ class Part extends AttachmentContainingDBElement public function validate(ExecutionContextInterface $context, $payload) { //Ensure that the part name fullfills the regex of the category - if ($this->category instanceof \App\Entity\Parts\Category) { + if ($this->category instanceof Category) { $regex = $this->category->getPartnameRegex(); if (!empty($regex) && !preg_match($regex, $this->name)) { $context->buildViolation('part.name.must_match_category_regex') diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index 58b30726..7bec9b9c 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Parts; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\TimestampTrait; use App\Entity\Contracts\NamedElementInterface; @@ -55,14 +56,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @var string A short description about this lot, shown in table */ #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $description = ''; /** * @var string a comment stored with this lot */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $comment = ''; /** @@ -70,7 +71,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * Set to null, if the lot can be used indefinitely. */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)] + #[ORM\Column(type: Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)] protected ?\DateTimeInterface $expiration_date = null; /** @@ -86,7 +87,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @var bool If this is set to true, the instock amount is marked as not known */ #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $instock_unknown = false; /** @@ -94,14 +95,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named */ #[Assert\PositiveOrZero] #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: Types::FLOAT)] protected float $amount = 0.0; /** * @var bool determines if this lot was manually marked for refilling */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $needs_refill = false; /** @@ -115,7 +116,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * @var User|null The owner of this part lot */ - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)] + #[ORM\ManyToOne(targetEntity: User::class)] #[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')] protected ?User $owner = null; diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index 9079c21d..633bf9d0 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Parts\PartTraits; +use Doctrine\DBAL\Types\Types; use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -36,14 +37,14 @@ trait AdvancedPropertyTrait * @var bool Determines if this part entry needs review (for example, because it is work in progress) */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $needs_review = false; /** * @var string a comma separated list of tags, associated with the part */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $tags = ''; /** @@ -51,7 +52,7 @@ trait AdvancedPropertyTrait */ #[Assert\PositiveOrZero] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] protected ?float $mass = null; /** @@ -59,7 +60,7 @@ trait AdvancedPropertyTrait */ #[Assert\Length(max: 100)] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100, nullable: true, unique: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true, unique: true)] protected ?string $ipn = null; /** diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php index 4d90a307..aa08f514 100644 --- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Parts\PartTraits; +use Doctrine\DBAL\Types\Types; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Validator\Constraints\Selectable; @@ -35,27 +36,27 @@ trait BasicPropertyTrait * @var string A text describing what this part does */ #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $description = ''; /** * @var string A comment/note related to this part */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $comment = ''; /** * @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions) */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $visible = true; /** * @var bool true, if the part is marked as favorite */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $favorite = false; /** diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 9ae170ab..f4a95e16 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Parts\PartTraits; +use Doctrine\DBAL\Types\Types; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\PartLot; use Doctrine\Common\Collections\Collection; @@ -41,7 +42,7 @@ trait InstockTrait #[Groups(['extended', 'full', 'import'])] #[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['amount' => 'DESC'])] - protected \Doctrine\Common\Collections\Collection $partLots; + protected Collection $partLots; /** * @var float The minimum amount of the part that has to be instock, otherwise more is ordered. @@ -49,7 +50,7 @@ trait InstockTrait */ #[Assert\PositiveOrZero] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: Types::FLOAT)] protected float $minamount = 0; /** diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php index d79a9128..0a66dfa0 100644 --- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php +++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Parts\PartTraits; +use Doctrine\DBAL\Types\Types; use App\Entity\Parts\Manufacturer; use App\Entity\Parts\Part; use App\Validator\Constraints\Selectable; @@ -48,14 +49,14 @@ trait ManufacturerTrait */ #[Assert\Url] #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $manufacturer_product_url = ''; /** * @var string The product number used by the manufacturer. If this is set to "", the name field is used. */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $manufacturer_product_number = ''; /** @@ -63,7 +64,7 @@ trait ManufacturerTrait */ #[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected ?string $manufacturing_status = ''; /** diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index 18b6698e..b17f014b 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\Parts\PartTraits; +use Doctrine\DBAL\Types\Types; use App\Entity\PriceInformations\Orderdetail; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -39,26 +40,26 @@ trait OrderTrait */ #[Assert\Valid] #[Groups(['extended', 'full', 'import'])] - #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['supplierpartnr' => 'ASC'])] - protected \Doctrine\Common\Collections\Collection $orderdetails; + protected Collection $orderdetails; /** * @var int */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] protected int $order_quantity = 0; /** * @var bool */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $manual_order = false; /** * @var Orderdetail|null */ - #[ORM\OneToOne(targetEntity: \App\Entity\PriceInformations\Orderdetail::class)] + #[ORM\OneToOne(targetEntity: Orderdetail::class)] #[ORM\JoinColumn(name: 'order_orderdetails_id')] protected ?Orderdetail $order_orderdetail = null; diff --git a/src/Entity/Parts/PartTraits/ProjectTrait.php b/src/Entity/Parts/PartTraits/ProjectTrait.php index 2a5cf6ed..5d627a70 100644 --- a/src/Entity/Parts/PartTraits/ProjectTrait.php +++ b/src/Entity/Parts/PartTraits/ProjectTrait.php @@ -11,15 +11,18 @@ use Doctrine\ORM\Mapping as ORM; trait ProjectTrait { /** - * @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries + * @var Collection $project_bom_entries */ - #[ORM\OneToMany(targetEntity: \App\Entity\ProjectSystem\ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)] - protected \Doctrine\Common\Collections\Collection $project_bom_entries; + /** + * @var Collection $project_bom_entries + */ + #[ORM\OneToMany(targetEntity: ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)] + protected Collection $project_bom_entries; /** * @var Project|null If a project is set here, then this part is special and represents the builds of a project. */ - #[ORM\OneToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'build_part')] + #[ORM\OneToOne(targetEntity: Project::class, inversedBy: 'build_part')] #[ORM\JoinColumn] protected ?Project $built_project = null; diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index 71ea2669..15eef200 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\Parts\StorelocationRepository; +use Doctrine\DBAL\Types\Types; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\StorelocationAttachment; use App\Entity\Base\AbstractPartsContainingDBElement; use App\Entity\Base\AbstractStructuralDBElement; @@ -35,7 +38,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Store location. */ -#[ORM\Entity(repositoryClass: \App\Repository\Parts\StorelocationRepository::class)] +#[ORM\Entity(repositoryClass: StorelocationRepository::class)] #[ORM\Table('`storelocations`')] #[ORM\Index(name: 'location_idx_name', columns: ['name'])] #[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])] @@ -62,7 +65,7 @@ class Storelocation extends AbstractPartsContainingDBElement /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -70,42 +73,42 @@ class Storelocation extends AbstractPartsContainingDBElement * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $is_full = false; /** * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $only_single_part = false; /** * @var bool */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $limit_to_existing_parts = false; /** * @var User|null The owner of this storage location */ #[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')] - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)] + #[ORM\ManyToOne(targetEntity: User::class)] #[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')] protected ?User $owner = null; /** * @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here. */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] + #[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])] protected bool $part_owner_must_match = false; /** * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $attachments; /******************************************************************************** @@ -229,8 +232,8 @@ class Storelocation extends AbstractPartsContainingDBElement public function __construct() { parent::__construct(); - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->parameters = new ArrayCollection(); + $this->attachments = new ArrayCollection(); } } diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index d0d4bd12..2746f131 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\Parts; +use App\Repository\Parts\SupplierRepository; +use App\Entity\PriceInformations\Orderdetail; +use Doctrine\Common\Collections\ArrayCollection; use App\Entity\Attachments\SupplierAttachment; use App\Entity\Base\AbstractCompany; use App\Entity\Base\AbstractStructuralDBElement; @@ -38,7 +41,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class Supplier. */ -#[ORM\Entity(repositoryClass: \App\Repository\Parts\SupplierRepository::class)] +#[ORM\Entity(repositoryClass: SupplierRepository::class)] #[ORM\Table('`suppliers`')] #[ORM\Index(name: 'supplier_idx_name', columns: ['name'])] #[ORM\Index(name: 'supplier_idx_parent_name', columns: ['parent_id', 'name'])] @@ -56,9 +59,12 @@ class Supplier extends AbstractCompany protected ?AbstractStructuralDBElement $parent = null; /** - * @var \Doctrine\Common\Collections\Collection|\App\Entity\PriceInformations\Orderdetail[] + * @var Collection|Orderdetail[] */ - #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'supplier')] + /** + * @var Collection|Orderdetail[] + */ + #[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'supplier')] protected Collection $orderdetails; /** @@ -66,7 +72,7 @@ class Supplier extends AbstractCompany * Set to null, to use global base currency. * @Selectable() */ - #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)] + #[ORM\ManyToOne(targetEntity: Currency::class)] #[ORM\JoinColumn(name: 'default_currency_id')] protected ?Currency $default_currency = null; @@ -82,14 +88,14 @@ class Supplier extends AbstractCompany * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -128,7 +134,7 @@ class Supplier extends AbstractCompany */ public function setShippingCosts(?BigDecimal $shipping_costs): self { - if (!$shipping_costs instanceof \Brick\Math\BigDecimal) { + if (!$shipping_costs instanceof BigDecimal) { $this->shipping_costs = null; } @@ -142,9 +148,9 @@ class Supplier extends AbstractCompany public function __construct() { parent::__construct(); - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->orderdetails = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->orderdetails = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); } } diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index 106cb052..ea14cfcc 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\PriceInformations; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\CurrencyAttachment; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Parameters\CurrencyParameter; @@ -60,7 +61,7 @@ class Currency extends AbstractStructuralDBElement */ #[Assert\Currency] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $iso_code = ""; #[ORM\OneToMany(targetEntity: 'Currency', mappedBy: 'parent', cascade: ['persist'])] @@ -75,27 +76,27 @@ class Currency extends AbstractStructuralDBElement * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; /** @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Pricedetail::class, mappedBy: 'currency')] + #[ORM\OneToMany(targetEntity: Pricedetail::class, mappedBy: 'currency')] protected Collection $pricedetails; public function __construct() { - $this->children = new \Doctrine\Common\Collections\ArrayCollection(); - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->children = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); $this->pricedetails = new ArrayCollection(); parent::__construct(); } @@ -129,7 +130,7 @@ class Currency extends AbstractStructuralDBElement { $tmp = $this->getExchangeRate(); - if (!$tmp instanceof \Brick\Math\BigDecimal || $tmp->isZero()) { + if (!$tmp instanceof BigDecimal || $tmp->isZero()) { return null; } @@ -153,7 +154,7 @@ class Currency extends AbstractStructuralDBElement */ public function setExchangeRate(?BigDecimal $exchange_rate): self { - if (!$exchange_rate instanceof \Brick\Math\BigDecimal) { + if (!$exchange_rate instanceof BigDecimal) { $this->exchange_rate = null; } $tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP); diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index 9feec023..f39690d4 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace App\Entity\PriceInformations; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\TimestampTrait; use App\Entity\Contracts\NamedElementInterface; @@ -59,14 +60,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * @var string */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $supplierpartnr = ''; /** * @var bool */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $obsolete = false; /** @@ -74,14 +75,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N */ #[Assert\Url] #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $supplier_product_url = ''; /** * @var Part|null */ #[Assert\NotNull] - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'orderdetails')] + #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'orderdetails')] #[ORM\JoinColumn(name: 'part_id', nullable: false, onDelete: 'CASCADE')] protected ?Part $part = null; @@ -90,7 +91,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N */ #[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')] #[Groups(['extended', 'full', 'import'])] - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'orderdetails')] + #[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'orderdetails')] #[ORM\JoinColumn(name: 'id_supplier')] protected ?Supplier $supplier = null; @@ -194,7 +195,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N return $this->supplier_product_url; } - if (!$this->getSupplier() instanceof \App\Entity\Parts\Supplier) { + if (!$this->getSupplier() instanceof Supplier) { return ''; } diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index d0f97929..9847b41a 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\PriceInformations; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\TimestampTrait; use App\Entity\Contracts\TimeStampableInterface; @@ -73,7 +74,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface */ #[Assert\Positive] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: Types::FLOAT)] protected float $price_related_quantity = 1.0; /** @@ -81,13 +82,13 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface */ #[Assert\Positive] #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)] + #[ORM\Column(type: Types::FLOAT)] protected float $min_discount_quantity = 1.0; /** * @var bool */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $manual_input = true; /** @@ -166,7 +167,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * * @return BigDecimal the price as a bcmath string */ - public function getPricePerUnit(float|string|\Brick\Math\BigDecimal $multiplier = 1.0): BigDecimal + public function getPricePerUnit(float|string|BigDecimal $multiplier = 1.0): BigDecimal { $tmp = BigDecimal::of($multiplier); $tmp = $tmp->multipliedBy($this->price); diff --git a/src/Entity/ProjectSystem/Project.php b/src/Entity/ProjectSystem/Project.php index a2b920ca..24cc2b25 100644 --- a/src/Entity/ProjectSystem/Project.php +++ b/src/Entity/ProjectSystem/Project.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Entity\ProjectSystem; +use App\Repository\Parts\DeviceRepository; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\ProjectAttachment; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Parameters\ProjectParameter; @@ -37,7 +39,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; /** * Class AttachmentType. */ -#[ORM\Entity(repositoryClass: \App\Repository\Parts\DeviceRepository::class)] +#[ORM\Entity(repositoryClass: DeviceRepository::class)] #[ORM\Table(name: 'projects')] class Project extends AbstractStructuralDBElement { @@ -57,7 +59,7 @@ class Project extends AbstractStructuralDBElement #[ORM\OneToMany(targetEntity: 'ProjectBOMEntry', mappedBy: 'project', cascade: ['persist', 'remove'], orphanRemoval: true)] protected Collection $bom_entries; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] protected int $order_quantity = 0; /** @@ -65,33 +67,33 @@ class Project extends AbstractStructuralDBElement */ #[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])] #[Groups(['extended', 'full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 64, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 64, nullable: true)] protected ?string $status = null; /** * @var Part|null The (optional) part that represents the builds of this project in the stock */ - #[ORM\OneToOne(targetEntity: \App\Entity\Parts\Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)] + #[ORM\OneToOne(targetEntity: Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)] protected ?Part $build_part = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $order_only_missing_parts = false; #[Groups(['simple', 'extended', 'full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $description = ''; /** * @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; @@ -103,8 +105,8 @@ class Project extends AbstractStructuralDBElement public function __construct() { - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); parent::__construct(); $this->bom_entries = new ArrayCollection(); $this->children = new ArrayCollection(); @@ -241,7 +243,7 @@ class Project extends AbstractStructuralDBElement */ public function hasBuildPart(): bool { - return $this->build_part instanceof \App\Entity\Parts\Part; + return $this->build_part instanceof Part; } /** @@ -258,7 +260,7 @@ class Project extends AbstractStructuralDBElement public function setBuildPart(?Part $build_part): void { $this->build_part = $build_part; - if ($build_part instanceof \App\Entity\Parts\Part) { + if ($build_part instanceof Part) { $build_part->setBuiltProject($this); } } @@ -269,7 +271,7 @@ class Project extends AbstractStructuralDBElement //If this project has subprojects, and these have builds part, they must be included in the BOM foreach ($this->getChildren() as $child) { /** @var $child Project */ - if (!$child->getBuildPart() instanceof \App\Entity\Parts\Part) { + if (!$child->getBuildPart() instanceof Part) { continue; } //We have to search all bom entries for the build part diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index 4d432f75..0898f69f 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\ProjectSystem; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\TimestampTrait; use App\Entity\Parts\Part; @@ -50,26 +51,26 @@ class ProjectBOMEntry extends AbstractDBElement * @var float */ #[Assert\Positive] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'quantity')] + #[ORM\Column(type: Types::FLOAT, name: 'quantity')] protected float $quantity; /** * @var string A comma separated list of the names, where this parts should be placed */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'mountnames')] + #[ORM\Column(type: Types::TEXT, name: 'mountnames')] protected string $mountnames = ''; /** * @var string|null An optional name describing this BOM entry (useful for non-part entries) */ #[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] protected ?string $name = null; /** * @var string An optional comment for this BOM entry */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $comment; /** @@ -82,7 +83,7 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var Part|null The part associated with this */ - #[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'project_bom_entries')] + #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'project_bom_entries')] #[ORM\JoinColumn(name: 'id_part')] protected ?Part $part = null; @@ -97,7 +98,7 @@ class ProjectBOMEntry extends AbstractDBElement * @var ?Currency The currency for the price of this non-part BOM entry * @Selectable() */ - #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)] + #[ORM\ManyToOne(targetEntity: Currency::class)] #[ORM\JoinColumn] protected ?Currency $price_currency = null; @@ -213,18 +214,18 @@ class ProjectBOMEntry extends AbstractDBElement */ public function isPartBomEntry(): bool { - return $this->part instanceof \App\Entity\Parts\Part; + return $this->part instanceof Part; } #[Assert\Callback] public function validate(ExecutionContextInterface $context, $payload): void { //Round quantity to whole numbers, if the part is not a decimal part - if ($this->part instanceof \App\Entity\Parts\Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) { + if ($this->part instanceof Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) { $this->quantity = round($this->quantity); } //Non-Part BOM entries are rounded - if (!$this->part instanceof \App\Entity\Parts\Part) { + if (!$this->part instanceof Part) { $this->quantity = round($this->quantity); } @@ -248,14 +249,14 @@ class ProjectBOMEntry extends AbstractDBElement } //Prices are only allowed on non-part BOM entries - if ($this->part instanceof \App\Entity\Parts\Part && $this->price instanceof \Brick\Math\BigDecimal) { + if ($this->part instanceof Part && $this->price instanceof BigDecimal) { $context->buildViolation('project.bom_entry.price_not_allowed_on_parts') ->atPath('price') ->addViolation(); } //Check that the part is not the build representation part of this device or one of its parents - if ($this->part && $this->part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { + if ($this->part && $this->part->getBuiltProject() instanceof Project) { //Get the associated project $associated_project = $this->part->getBuiltProject(); //Check that it is not the same as the current project neither one of its parents diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 6207e25c..6dceec58 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\UserSystem; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\GroupAttachment; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Parameters\GroupParameter; @@ -63,13 +64,13 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa * @var bool If true all users associated with this group must have enabled some kind of two-factor authentication */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'enforce_2fa')] + #[ORM\Column(type: Types::BOOLEAN, name: 'enforce_2fa')] protected bool $enforce2FA = false; /** * @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; @@ -84,14 +85,14 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(targetEntity: \App\Entity\Parameters\GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])] protected Collection $parameters; public function __construct() { - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); - $this->parameters = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); parent::__construct(); $this->permissions = new PermissionData(); $this->users = new ArrayCollection(); @@ -122,7 +123,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa public function getPermissions(): PermissionData { - if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) { + if (!$this->permissions instanceof PermissionData) { $this->permissions = new PermissionData(); } diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index 65101ee9..5c4e84c5 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -20,6 +20,7 @@ namespace App\Entity\UserSystem; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; /** @@ -52,7 +53,7 @@ final class PermissionData implements \JsonSerializable * operation => value, * ] */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'data')] + #[ORM\Column(type: Types::JSON, name: 'data')] protected array $data = []) { //If the passed data did not contain a schema version, we set it to the current version diff --git a/src/Entity/UserSystem/U2FKey.php b/src/Entity/UserSystem/U2FKey.php index fefbbe20..5cf5b7da 100644 --- a/src/Entity/UserSystem/U2FKey.php +++ b/src/Entity/UserSystem/U2FKey.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\UserSystem; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\TimestampTrait; use Doctrine\ORM\Mapping as ORM; use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface; @@ -41,39 +42,39 @@ class U2FKey implements LegacyU2FKeyInterface * * @var string **/ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 128)] + #[ORM\Column(type: Types::STRING, length: 128)] public string $keyHandle; /** * @var string **/ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] public string $publicKey; /** * @var string **/ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] public string $certificate; /** * @var int **/ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] public int $counter; #[ORM\Id] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] #[ORM\GeneratedValue] protected int $id; /** * @var string **/ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $name; - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'u2fKeys')] + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'u2fKeys')] protected ?User $user = null; public function getKeyHandle(): string diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index b7badde3..c1cd9a26 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -22,6 +22,9 @@ declare(strict_types=1); namespace App\Entity\UserSystem; +use App\Repository\UserRepository; +use App\EntityListeners\TreeCacheInvalidationListener; +use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\UserAttachment; use App\Entity\Base\AbstractNamedDBElement; @@ -56,8 +59,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface * Also, this entity is able to save some information about the user, like the names, email-address and other info. */ #[UniqueEntity('name', message: 'validator.user.username_already_used')] -#[ORM\Entity(repositoryClass: \App\Repository\UserRepository::class)] -#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])] +#[ORM\Entity(repositoryClass: UserRepository::class)] +#[ORM\EntityListeners([TreeCacheInvalidationListener::class])] #[ORM\Table('`users`')] #[ORM\Index(name: 'user_idx_username', columns: ['name'])] class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, @@ -74,7 +77,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @var bool Determines if the user is disabled (user can not log in) */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $disabled = false; /** @@ -82,42 +85,42 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @ValidTheme() */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_theme', nullable: true)] + #[ORM\Column(type: Types::STRING, name: 'config_theme', nullable: true)] protected ?string $theme = null; /** * @var string|null the hash of a token the user must provide when he wants to reset his password */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] protected ?string $pw_reset_token = null; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_a')] + #[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_a')] protected string $instock_comment_a = ''; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_w')] + #[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_w')] protected string $instock_comment_w = ''; /** * @var string A self-description of the user */ #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)] + #[ORM\Column(type: Types::TEXT)] protected string $aboutMe = ''; /** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once. */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] protected int $trustedDeviceCookieVersion = 0; /** * @var string[]|null A list of backup codes that can be used, if the user has no access to its Google Authenticator device */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: Types::JSON)] protected ?array $backupCodes = []; #[ORM\Id] #[ORM\GeneratedValue] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] protected ?int $id = null; /** @@ -133,7 +136,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string|null The secret used for Google authenticator */ - #[ORM\Column(name: 'google_authenticator_secret', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] + #[ORM\Column(name: 'google_authenticator_secret', type: Types::STRING, nullable: true)] protected ?string $googleAuthenticatorSecret = null; /** @@ -141,7 +144,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe */ #[Assert\Timezone] #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_timezone', nullable: true)] + #[ORM\Column(type: Types::STRING, name: 'config_timezone', nullable: true)] protected ?string $timezone = ''; /** @@ -149,7 +152,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe */ #[Assert\Language] #[Groups(['full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_language', nullable: true)] + #[ORM\Column(type: Types::STRING, name: 'config_language', nullable: true)] protected ?string $language = ''; /** @@ -157,82 +160,82 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe */ #[Assert\Email] #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected ?string $email = ''; /** * @var bool True if the user wants to show his email address on his (public) profile */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])] + #[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])] protected bool $show_email_on_profile = false; /** * @var string|null The department the user is working */ #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected ?string $department = ''; /** * @var string|null The last name of the User */ #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected ?string $last_name = ''; /** * @var string|null The first name of the User */ #[Groups(['simple', 'extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected ?string $first_name = ''; /** * @var bool True if the user needs to change password after log in */ #[Groups(['extended', 'full', 'import'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $need_pw_change = true; /** * @var string|null The hashed password */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] protected ?string $password = null; #[Assert\NotBlank] #[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180, unique: true)] + #[ORM\Column(type: Types::STRING, length: 180, unique: true)] protected string $name = ''; /** * @var array|null */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)] + #[ORM\Column(type: Types::JSON)] protected ?array $settings = []; /** * @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\Attachments\UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; /** @var \DateTimeInterface|null The time when the backup codes were generated */ #[Groups(['full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] + #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] protected ?\DateTimeInterface $backupCodesGenerationDate = null; /** @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] protected Collection $u2fKeys; /** * @var Collection */ - #[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] + #[ORM\OneToMany(targetEntity: WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)] protected Collection $webauthn_keys; /** @@ -243,7 +246,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * @Selectable() */ #[Groups(['extended', 'full', 'import'])] - #[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)] + #[ORM\ManyToOne(targetEntity: Currency::class)] #[ORM\JoinColumn(name: 'currency_id')] protected ?Currency $currency = null; @@ -258,19 +261,19 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var \DateTimeInterface|null the time until the password reset token is valid */ - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)] + #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)] protected ?\DateTimeInterface $pw_reset_expires = null; /** * @var bool True if the user was created by a SAML provider (and therefore cannot change its password) */ #[Groups(['extended', 'full'])] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)] + #[ORM\Column(type: Types::BOOLEAN)] protected bool $saml_user = false; public function __construct() { - $this->attachments = new \Doctrine\Common\Collections\ArrayCollection(); + $this->attachments = new ArrayCollection(); parent::__construct(); $this->permissions = new PermissionData(); $this->u2fKeys = new ArrayCollection(); @@ -419,7 +422,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe public function getPermissions(): PermissionData { - if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) { + if (!$this->permissions instanceof PermissionData) { $this->permissions = new PermissionData(); } diff --git a/src/Entity/UserSystem/WebauthnKey.php b/src/Entity/UserSystem/WebauthnKey.php index 82a0a5fe..2098bd67 100644 --- a/src/Entity/UserSystem/WebauthnKey.php +++ b/src/Entity/UserSystem/WebauthnKey.php @@ -20,6 +20,7 @@ namespace App\Entity\UserSystem; +use Doctrine\DBAL\Types\Types; use App\Entity\Base\TimestampTrait; use Doctrine\ORM\Mapping as ORM; use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource; @@ -32,14 +33,14 @@ class WebauthnKey extends BasePublicKeyCredentialSource use TimestampTrait; #[ORM\Id] - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)] + #[ORM\Column(type: Types::INTEGER)] #[ORM\GeneratedValue] protected int $id; - #[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)] + #[ORM\Column(type: Types::STRING)] protected string $name; - #[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'webauthn_keys')] + #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'webauthn_keys')] protected ?User $user = null; public function getName(): string diff --git a/src/EntityListeners/AttachmentDeleteListener.php b/src/EntityListeners/AttachmentDeleteListener.php index 11ddd794..e9df5972 100644 --- a/src/EntityListeners/AttachmentDeleteListener.php +++ b/src/EntityListeners/AttachmentDeleteListener.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\EntityListeners; +use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\Attachment; use App\Services\Attachments\AttachmentManager; use App\Services\Attachments\AttachmentPathResolver; @@ -80,7 +81,7 @@ class AttachmentDeleteListener //Ensure that the attachment that will be deleted, is not used as preview picture anymore... $attachment_holder = $attachment->getElement(); - if (!$attachment_holder instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { + if (!$attachment_holder instanceof AttachmentContainingDBElement) { return; } diff --git a/src/EventListener/LogSystem/LogLogoutEventListener.php b/src/EventSubscriber/LogSystem/LogLogoutEventSubscriber.php similarity index 71% rename from src/EventListener/LogSystem/LogLogoutEventListener.php rename to src/EventSubscriber/LogSystem/LogLogoutEventSubscriber.php index eab278b4..87d97b1e 100644 --- a/src/EventListener/LogSystem/LogLogoutEventListener.php +++ b/src/EventSubscriber/LogSystem/LogLogoutEventSubscriber.php @@ -20,8 +20,10 @@ declare(strict_types=1); -namespace App\EventListener\LogSystem; +namespace App\EventSubscriber\LogSystem; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use App\Entity\LogSystem\UserLogoutLogEntry; use App\Entity\UserSystem\User; use App\Services\LogSystem\EventLogger; @@ -31,19 +33,18 @@ use Symfony\Component\Security\Http\Event\LogoutEvent; /** * This handler logs to event log, if a user logs out. */ -#[AsEventListener] -final class LogLogoutEventListener +final class LogLogoutEventSubscriber implements EventSubscriberInterface { - public function __construct(private EventLogger $logger, private readonly bool $gdpr_compliance) + public function __construct(private readonly EventLogger $logger, private readonly bool $gdpr_compliance) { } - public function __invoke(LogoutEvent $event): void + public function logLogout(LogoutEvent $event): void { $request = $event->getRequest(); $token = $event->getToken(); - if (!$token instanceof \Symfony\Component\Security\Core\Authentication\Token\TokenInterface) { + if (!$token instanceof TokenInterface) { return; } @@ -55,5 +56,12 @@ final class LogLogoutEventListener $this->logger->logAndFlush($log); } + /** + * @return array + */ + public static function getSubscribedEvents(): array + { + return [LogoutEvent::class => 'logLogout']; + } } diff --git a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php index 28cf7b48..78941cd5 100644 --- a/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/SecurityEventLoggerSubscriber.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\EventSubscriber\LogSystem; +use Symfony\Component\HttpFoundation\Request; use App\Entity\LogSystem\SecurityEventLogEntry; use App\Events\SecurityEvent; use App\Events\SecurityEvents; @@ -122,7 +123,7 @@ final class SecurityEventLoggerSubscriber implements EventSubscriberInterface $anonymize = $this->gdpr_compliance; $request = $this->requestStack->getCurrentRequest(); - if ($request instanceof \Symfony\Component\HttpFoundation\Request) { + if ($request instanceof Request) { $ip = $request->getClientIp() ?? 'unknown'; } else { $ip = 'Console'; diff --git a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php index da8d3b94..33c5e919 100644 --- a/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php +++ b/src/EventSubscriber/UserSystem/LogoutDisabledUserSubscriber.php @@ -22,13 +22,13 @@ declare(strict_types=1); namespace App\EventSubscriber\UserSystem; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\UserSystem\User; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Security; /** * This subscriber is used to log out a disabled user, as soon as he to do a request. @@ -36,7 +36,7 @@ use Symfony\Component\Security\Core\Security; */ final class LogoutDisabledUserSubscriber implements EventSubscriberInterface { - public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php index db8b6575..0f12c6d9 100644 --- a/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php +++ b/src/EventSubscriber/UserSystem/PasswordChangeNeededSubscriber.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\EventSubscriber\UserSystem; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; @@ -29,7 +31,6 @@ use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Http\HttpUtils; /** @@ -56,7 +57,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface */ public const REDIRECT_TARGET = 'user_settings'; - public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly HttpUtils $httpUtils) + public function __construct(private readonly Security $security, private readonly HttpUtils $httpUtils) { } @@ -125,7 +126,7 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface { $tfa_enabled = $user->isWebAuthnAuthenticatorEnabled() || $user->isGoogleAuthenticatorEnabled(); - return $user->getGroup() instanceof \App\Entity\UserSystem\Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled; + return $user->getGroup() instanceof Group && $user->getGroup()->isEnforce2FA() && !$tfa_enabled; } public static function getSubscribedEvents(): array diff --git a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php index b2f30b01..3997c050 100644 --- a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php +++ b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php @@ -20,6 +20,8 @@ namespace App\EventSubscriber\UserSystem; +use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\User\UserInterface; use App\Entity\UserSystem\User; use App\Services\LogSystem\EventCommentHelper; use App\Services\UserSystem\PermissionSchemaUpdater; @@ -28,14 +30,13 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Security\Core\Security; /** * The purpose of this event subscriber is to check if the permission schema of the current user is up-to-date and upgrade it automatically if needed. */ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface { - public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper) + public function __construct(private readonly Security $security, private readonly PermissionSchemaUpdater $permissionSchemaUpdater, private readonly EntityManagerInterface $entityManager, private readonly EventCommentHelper $eventCommentHelper) { } @@ -46,7 +47,7 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface } $user = $this->security->getUser(); - if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) { + if (!$user instanceof UserInterface) { //Retrieve anonymous user $user = $this->entityManager->getRepository(User::class)->getAnonymousUser(); } diff --git a/src/Form/AdminPages/AttachmentTypeAdminForm.php b/src/Form/AdminPages/AttachmentTypeAdminForm.php index c2ea1c00..d777d4d4 100644 --- a/src/Form/AdminPages/AttachmentTypeAdminForm.php +++ b/src/Form/AdminPages/AttachmentTypeAdminForm.php @@ -22,17 +22,17 @@ declare(strict_types=1); namespace App\Form\AdminPages; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractNamedDBElement; use App\Services\Attachments\FileTypeFilterTools; use App\Services\LogSystem\EventCommentNeededHelper; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Security\Core\Security; class AttachmentTypeAdminForm extends BaseEntityAdminForm { - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, protected FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(Security $security, protected FileTypeFilterTools $filterTools, EventCommentNeededHelper $eventCommentNeededHelper) { parent::__construct($security, $eventCommentNeededHelper); } diff --git a/src/Form/AdminPages/BaseEntityAdminForm.php b/src/Form/AdminPages/BaseEntityAdminForm.php index 464e32ad..268ea630 100644 --- a/src/Form/AdminPages/BaseEntityAdminForm.php +++ b/src/Form/AdminPages/BaseEntityAdminForm.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form\AdminPages; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\LabelSystem\LabelProfile; @@ -40,11 +41,10 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; class BaseEntityAdminForm extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected EventCommentNeededHelper $eventCommentNeededHelper) + public function __construct(protected Security $security, protected EventCommentNeededHelper $eventCommentNeededHelper) { } diff --git a/src/Form/AdminPages/CurrencyAdminForm.php b/src/Form/AdminPages/CurrencyAdminForm.php index d6c5f590..a3514b80 100644 --- a/src/Form/AdminPages/CurrencyAdminForm.php +++ b/src/Form/AdminPages/CurrencyAdminForm.php @@ -22,17 +22,17 @@ declare(strict_types=1); namespace App\Form\AdminPages; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractNamedDBElement; use App\Form\Type\BigDecimalMoneyType; use App\Services\LogSystem\EventCommentNeededHelper; use Symfony\Component\Form\Extension\Core\Type\CurrencyType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Security\Core\Security; class CurrencyAdminForm extends BaseEntityAdminForm { - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $base_currency) + public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, private readonly string $base_currency) { parent::__construct($security, $eventCommentNeededHelper); } diff --git a/src/Form/AdminPages/ImportType.php b/src/Form/AdminPages/ImportType.php index ceaa0c0c..3e87812c 100644 --- a/src/Form/AdminPages/ImportType.php +++ b/src/Form/AdminPages/ImportType.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form\AdminPages; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Parts\Category; use App\Entity\Parts\Part; @@ -33,11 +34,10 @@ use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Security\Core\Security; class ImportType extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected Security $security) { } diff --git a/src/Form/AdminPages/MassCreationForm.php b/src/Form/AdminPages/MassCreationForm.php index dbf3fbcb..4948cdd5 100644 --- a/src/Form/AdminPages/MassCreationForm.php +++ b/src/Form/AdminPages/MassCreationForm.php @@ -22,17 +22,17 @@ declare(strict_types=1); namespace App\Form\AdminPages; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractStructuralDBElement; use App\Form\Type\StructuralEntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Security\Core\Security; class MassCreationForm extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected Security $security) { } diff --git a/src/Form/AdminPages/SupplierForm.php b/src/Form/AdminPages/SupplierForm.php index 02efd45f..34b3b27a 100644 --- a/src/Form/AdminPages/SupplierForm.php +++ b/src/Form/AdminPages/SupplierForm.php @@ -22,17 +22,17 @@ declare(strict_types=1); namespace App\Form\AdminPages; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\PriceInformations\Currency; use App\Form\Type\BigDecimalMoneyType; use App\Form\Type\StructuralEntityType; use App\Services\LogSystem\EventCommentNeededHelper; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Security\Core\Security; class SupplierForm extends CompanyForm { - public function __construct(\Symfony\Bundle\SecurityBundle\Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $base_currency) + public function __construct(Security $security, EventCommentNeededHelper $eventCommentNeededHelper, protected string $base_currency) { parent::__construct($security, $eventCommentNeededHelper); } diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index 88d4d3d1..ea96666a 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Form\Type\StructuralEntityType; @@ -41,14 +42,13 @@ use Symfony\Component\Form\FormView; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Constraints\File; use Symfony\Component\Validator\Constraints\Url; use Symfony\Contracts\Translation\TranslatorInterface; class AttachmentFormType extends AbstractType { - public function __construct(protected AttachmentManager $attachment_helper, protected UrlGeneratorInterface $urlGenerator, protected \Symfony\Bundle\SecurityBundle\Security $security, protected AttachmentSubmitHandler $submitHandler, protected TranslatorInterface $translator, protected bool $allow_attachments_download, protected string $max_file_size) + public function __construct(protected AttachmentManager $attachment_helper, protected UrlGeneratorInterface $urlGenerator, protected Security $security, protected AttachmentSubmitHandler $submitHandler, protected TranslatorInterface $translator, protected bool $allow_attachments_download, protected string $max_file_size) { } diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php index 25c3c646..38490c2b 100644 --- a/src/Form/LabelOptionsType.php +++ b/src/Form/LabelOptionsType.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\Form; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\LabelSystem\LabelOptions; use App\Form\Type\RichTextEditorType; use Symfony\Component\Form\AbstractType; @@ -49,11 +50,10 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; class LabelOptionsType extends AbstractType { - public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly Security $security) { } diff --git a/src/Form/LabelSystem/LabelDialogType.php b/src/Form/LabelSystem/LabelDialogType.php index faf12adb..33c79797 100644 --- a/src/Form/LabelSystem/LabelDialogType.php +++ b/src/Form/LabelSystem/LabelDialogType.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\Form\LabelSystem; +use Symfony\Bundle\SecurityBundle\Security; use App\Form\LabelOptionsType; use App\Validator\Constraints\Misc\ValidRange; use Symfony\Component\Form\AbstractType; @@ -48,11 +49,10 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; class LabelDialogType extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected Security $security) { } diff --git a/src/Form/Part/OrderdetailType.php b/src/Form/Part/OrderdetailType.php index 67d2aa82..53240821 100644 --- a/src/Form/Part/OrderdetailType.php +++ b/src/Form/Part/OrderdetailType.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form\Part; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\Supplier; use App\Entity\PriceInformations\Orderdetail; @@ -36,11 +37,10 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; class OrderdetailType extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected Security $security) { } @@ -79,7 +79,7 @@ class OrderdetailType extends AbstractType $orderdetail = $event->getData(); $dummy_pricedetail = new Pricedetail(); - if ($orderdetail instanceof \App\Entity\PriceInformations\Orderdetail && $orderdetail->getSupplier() instanceof \App\Entity\Parts\Supplier) { + if ($orderdetail instanceof Orderdetail && $orderdetail->getSupplier() instanceof Supplier) { $dummy_pricedetail->setCurrency($orderdetail->getSupplier()->getDefaultCurrency()); } diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php index 53205e1f..309197ab 100644 --- a/src/Form/Part/PartBaseType.php +++ b/src/Form/Part/PartBaseType.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form\Part; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Attachments\PartAttachment; use App\Entity\Parameters\PartParameter; use App\Entity\Parts\Category; @@ -48,11 +49,10 @@ use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Security; class PartBaseType extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected UrlGeneratorInterface $urlGenerator, protected EventCommentNeededHelper $event_comment_needed_helper) + public function __construct(protected Security $security, protected UrlGeneratorInterface $urlGenerator, protected EventCommentNeededHelper $event_comment_needed_helper) { } diff --git a/src/Form/Part/PartLotType.php b/src/Form/Part/PartLotType.php index d845b2c4..707caf28 100644 --- a/src/Form/Part/PartLotType.php +++ b/src/Form/Part/PartLotType.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form\Part; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\PartLot; use App\Entity\Parts\Storelocation; @@ -34,11 +35,10 @@ use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; class PartLotType extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected Security $security) { } diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 6d6a194a..28c7c18a 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -20,6 +20,8 @@ namespace App\Form\ProjectSystem; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\Parts\Part; use App\Entity\Parts\PartLot; use App\Form\Type\PartLotSelectType; use App\Form\Type\SIUnitType; @@ -34,11 +36,10 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; class ProjectBuildType extends AbstractType implements DataMapperInterface { - public function __construct(private readonly \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(private readonly Security $security) { } @@ -76,10 +77,10 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface $form->add('addBuildsToBuildsPart', CheckboxType::class, [ 'label' => 'project.build.add_builds_to_builds_part', 'required' => false, - 'disabled' => !$build_request->getProject()->getBuildPart() instanceof \App\Entity\Parts\Part, + 'disabled' => !$build_request->getProject()->getBuildPart() instanceof Part, ]); - if ($build_request->getProject()->getBuildPart() instanceof \App\Entity\Parts\Part) { + if ($build_request->getProject()->getBuildPart() instanceof Part) { $form->add('buildsPartLot', PartLotSelectType::class, [ 'label' => 'project.build.builds_part_lot', 'required' => false, diff --git a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php index 3540e892..57fb9237 100644 --- a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php +++ b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php @@ -20,6 +20,7 @@ namespace App\Form\Type\Helper; +use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractNamedDBElement; @@ -42,7 +43,7 @@ class StructuralEntityChoiceHelper * Generates the choice attributes for the given AbstractStructuralDBElement. * @return array|string[] */ - public function generateChoiceAttr(AbstractNamedDBElement $choice, \Symfony\Component\OptionsResolver\Options|array $options): array + public function generateChoiceAttr(AbstractNamedDBElement $choice, Options|array $options): array { $tmp = [ 'data-level' => 0, @@ -62,19 +63,19 @@ class StructuralEntityChoiceHelper $level = $choice->getLevel(); /** @var AbstractStructuralDBElement|null $parent */ $parent = $options['subentities_of'] ?? null; - if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { + if ($parent instanceof AbstractStructuralDBElement) { $level -= $parent->getLevel() - 1; } $tmp += [ 'data-level' => $level, - 'data-parent' => $choice->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $choice->getParent()->getFullPath() : null, + 'data-parent' => $choice->getParent() instanceof AbstractStructuralDBElement ? $choice->getParent()->getFullPath() : null, 'data-path' => $choice->getFullPath('->'), ]; } if ($choice instanceof HasMasterAttachmentInterface) { - $tmp['data-image'] = $choice->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment ? + $tmp['data-image'] = $choice->getMasterPictureAttachment() instanceof Attachment ? $this->attachmentURLGenerator->getThumbnailURL($choice->getMasterPictureAttachment(), 'thumbnail_xs') : null @@ -92,7 +93,7 @@ class StructuralEntityChoiceHelper * Generates the choice attributes for the given AbstractStructuralDBElement. * @return array|string[] */ - public function generateChoiceAttrCurrency(Currency $choice, \Symfony\Component\OptionsResolver\Options|array $options): array + public function generateChoiceAttrCurrency(Currency $choice, Options|array $options): array { $tmp = $this->generateChoiceAttr($choice, $options); $symbol = empty($choice->getIsoCode()) ? null : Currencies::getSymbol($choice->getIsoCode()); @@ -116,7 +117,7 @@ class StructuralEntityChoiceHelper */ public function generateChoiceValue(?AbstractNamedDBElement $element): string|int|null { - if (!$element instanceof \App\Entity\Base\AbstractNamedDBElement) { + if (!$element instanceof AbstractNamedDBElement) { return null; } diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php index 2f15443e..bc8d0d84 100644 --- a/src/Form/Type/PartLotSelectType.php +++ b/src/Form/Type/PartLotSelectType.php @@ -20,6 +20,7 @@ namespace App\Form\Type; +use App\Entity\Parts\Storelocation; use App\Entity\Parts\Part; use App\Entity\Parts\PartLot; use Doctrine\ORM\EntityRepository; @@ -43,7 +44,7 @@ class PartLotSelectType extends AbstractType $resolver->setDefaults([ 'class' => PartLot::class, - 'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $part_lot->getStorageLocation()->getFullPath() : '') + 'choice_label' => ChoiceList::label($this, static fn(PartLot $part_lot): string => ($part_lot->getStorageLocation() instanceof Storelocation ? $part_lot->getStorageLocation()->getFullPath() : '') . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount()), 'query_builder' => fn(Options $options) => static fn(EntityRepository $er) => $er->createQueryBuilder('l') ->where('l.part = :part') diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index d81f70cd..cbbe9668 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -2,6 +2,9 @@ namespace App\Form\Type; +use App\Entity\Attachments\Attachment; +use App\Entity\Parts\Category; +use App\Entity\Parts\Footprint; use App\Entity\Parts\Part; use App\Services\Attachments\AttachmentURLGenerator; use App\Services\Attachments\PartPreviewGenerator; @@ -86,10 +89,10 @@ class PartSelectType extends AbstractType implements DataMapperInterface $resolver->setDefaults([ //Prefill the selected choice with the needed data, so the user can see it without an additional Ajax request 'choice_attr' => ChoiceList::attr($this, function (?Part $part) { - if($part instanceof \App\Entity\Parts\Part) { + if($part instanceof Part) { //Determine the picture to show: $preview_attachment = $this->previewGenerator->getTablePreviewAttachment($part); - if ($preview_attachment instanceof \App\Entity\Attachments\Attachment) { + if ($preview_attachment instanceof Attachment) { $preview_url = $this->attachmentURLGenerator->getThumbnailURL($preview_attachment, 'thumbnail_sm'); } else { @@ -97,10 +100,10 @@ class PartSelectType extends AbstractType implements DataMapperInterface } } - return $part instanceof \App\Entity\Parts\Part ? [ + return $part instanceof Part ? [ 'data-description' => mb_strimwidth($part->getDescription(), 0, 127, '...'), - 'data-category' => $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : '', - 'data-footprint' => $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : '', + 'data-category' => $part->getCategory() instanceof Category ? $part->getCategory()->getName() : '', + 'data-footprint' => $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getName() : '', 'data-image' => $preview_url, ] : []; }) diff --git a/src/Form/UserAdminForm.php b/src/Form/UserAdminForm.php index 2b690619..f8fcc7c6 100644 --- a/src/Form/UserAdminForm.php +++ b/src/Form/UserAdminForm.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; @@ -43,12 +44,11 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TimezoneType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Constraints\Length; class UserAdminForm extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected Security $security) { } diff --git a/src/Form/UserSettingsType.php b/src/Form/UserSettingsType.php index 07b4a38a..53ca8cf8 100644 --- a/src/Form/UserSettingsType.php +++ b/src/Form/UserSettingsType.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Form; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\UserSystem\User; use App\Form\Type\CurrencyEntityType; use App\Form\Type\RichTextEditorType; @@ -39,12 +40,11 @@ use Symfony\Component\Form\Extension\Core\Type\TimezoneType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvents; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Constraints\File; class UserSettingsType extends AbstractType { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected bool $demo_mode) + public function __construct(protected Security $security, protected bool $demo_mode) { } diff --git a/src/Helpers/Projects/ProjectBuildRequest.php b/src/Helpers/Projects/ProjectBuildRequest.php index d29cf303..f231c50f 100644 --- a/src/Helpers/Projects/ProjectBuildRequest.php +++ b/src/Helpers/Projects/ProjectBuildRequest.php @@ -20,6 +20,7 @@ namespace App\Helpers\Projects; +use App\Entity\Parts\Part; use App\Entity\Parts\PartLot; use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\ProjectBOMEntry; @@ -57,7 +58,7 @@ final class ProjectBuildRequest $this->initializeArray(); //By default, use the first available lot of builds part if there is one. - if($project->getBuildPart() instanceof \App\Entity\Parts\Part) { + if($project->getBuildPart() instanceof Part) { $this->add_build_to_builds_part = true; foreach( $project->getBuildPart()->getPartLots() as $lot) { if (!$lot->isInstockUnknown()) { @@ -133,11 +134,11 @@ final class ProjectBuildRequest public function setBuildsPartLot(?PartLot $new_part_lot): self { //Ensure that this new_part_lot belongs to the project - if (($new_part_lot instanceof \App\Entity\Parts\PartLot && $new_part_lot->getPart() !== $this->project->getBuildPart()) || !$this->project->getBuildPart() instanceof \App\Entity\Parts\Part) { + if (($new_part_lot instanceof PartLot && $new_part_lot->getPart() !== $this->project->getBuildPart()) || !$this->project->getBuildPart() instanceof Part) { throw new \InvalidArgumentException('The given part lot does not belong to the projects build part!'); } - if ($new_part_lot instanceof \App\Entity\Parts\PartLot) { + if ($new_part_lot instanceof PartLot) { $this->setAddBuildsToBuildsPart(true); } @@ -166,7 +167,7 @@ final class ProjectBuildRequest * Returns the amount of parts that should be withdrawn from the given lot for the corresponding BOM entry. * @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got */ - public function getLotWithdrawAmount(\App\Entity\Parts\PartLot|int $lot): float + public function getLotWithdrawAmount(PartLot|int $lot): float { if ($lot instanceof PartLot) { $lot_id = $lot->getID(); @@ -188,7 +189,7 @@ final class ProjectBuildRequest * @param PartLot|int $lot The part lot (or the ID of the part lot) for which the withdrawal amount should be got * @return $this */ - public function setLotWithdrawAmount(\App\Entity\Parts\PartLot|int $lot, float $amount): self + public function setLotWithdrawAmount(PartLot|int $lot, float $amount): self { if ($lot instanceof PartLot) { $lot_id = $lot->getID(); @@ -230,7 +231,7 @@ final class ProjectBuildRequest { $this->ensureBOMEntryValid($projectBOMEntry); - if (!$projectBOMEntry->getPart() instanceof \App\Entity\Parts\Part) { + if (!$projectBOMEntry->getPart() instanceof Part) { return null; } diff --git a/src/Helpers/Trees/TreeViewNode.php b/src/Helpers/Trees/TreeViewNode.php index 8fa328a3..0c5fcdce 100644 --- a/src/Helpers/Trees/TreeViewNode.php +++ b/src/Helpers/Trees/TreeViewNode.php @@ -151,7 +151,7 @@ final class TreeViewNode implements JsonSerializable public function setDisabled(?bool $disabled): self { //Lazy loading of state, so it does not need to get serialized and transfered, when it is empty. - if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { + if (!$this->state instanceof TreeViewNodeState) { $this->state = new TreeViewNodeState(); } @@ -163,7 +163,7 @@ final class TreeViewNode implements JsonSerializable public function setSelected(?bool $selected): self { //Lazy loading of state, so it does not need to get serialized and transfered, when it is empty. - if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { + if (!$this->state instanceof TreeViewNodeState) { $this->state = new TreeViewNodeState(); } @@ -175,7 +175,7 @@ final class TreeViewNode implements JsonSerializable public function setExpanded(?bool $selected = true): self { //Lazy loading of state, so it does not need to get serialized and transfered, when it is empty. - if (!$this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { + if (!$this->state instanceof TreeViewNodeState) { $this->state = new TreeViewNodeState(); } @@ -232,7 +232,7 @@ final class TreeViewNode implements JsonSerializable $ret['nodes'] = $this->nodes; } - if ($this->state instanceof \App\Helpers\Trees\TreeViewNodeState) { + if ($this->state instanceof TreeViewNodeState) { $ret['state'] = $this->state; } diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php index dbecfc2f..19143def 100644 --- a/src/Repository/StructuralDBElementRepository.php +++ b/src/Repository/StructuralDBElementRepository.php @@ -116,7 +116,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository $entity = $this->getNewEntityFromCache($name, $parent); //See if we already have an element with this name and parent in the database - if (!$entity instanceof \App\Entity\Base\AbstractStructuralDBElement) { + if (!$entity instanceof AbstractStructuralDBElement) { $entity = $this->findOneBy(['name' => $name, 'parent' => $parent]); } if (null === $entity) { @@ -138,7 +138,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository private function getNewEntityFromCache(string $name, ?AbstractStructuralDBElement $parent): ?AbstractStructuralDBElement { - $key = $parent instanceof \App\Entity\Base\AbstractStructuralDBElement ? $parent->getFullPath('%->%').'%->%'.$name : $name; + $key = $parent instanceof AbstractStructuralDBElement ? $parent->getFullPath('%->%').'%->%'.$name : $name; if (isset($this->new_entity_cache[$key])) { return $this->new_entity_cache[$key]; } diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index 4cb51b64..62bf71f9 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -44,7 +44,7 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU */ public function getAnonymousUser(): ?User { - if (!$this->anonymous_user instanceof \App\Entity\UserSystem\User) { + if (!$this->anonymous_user instanceof User) { $this->anonymous_user = $this->findOneBy([ 'id' => User::ID_ANONYMOUS, ]); diff --git a/src/Security/SamlUserFactory.php b/src/Security/SamlUserFactory.php index 84704987..4bfefc88 100644 --- a/src/Security/SamlUserFactory.php +++ b/src/Security/SamlUserFactory.php @@ -98,7 +98,7 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf //Check if we can find a group with the given ID if ($group_id !== null) { $group = $this->em->find(Group::class, $group_id); - if ($group instanceof \App\Entity\UserSystem\Group) { + if ($group instanceof Group) { return $group; } } diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index 2f27d232..b482a1f3 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Security\Voter; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; @@ -39,13 +41,12 @@ use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; use RuntimeException; -use Symfony\Component\Security\Core\Security; use function in_array; class AttachmentVoter extends ExtendedVoter { - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security) { parent::__construct($resolver, $entityManager); } @@ -73,7 +74,7 @@ class AttachmentVoter extends ExtendedVoter if (is_object($subject)) { //If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element $target_element = $subject->getElement(); - if ($target_element instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { + if ($target_element instanceof AttachmentContainingDBElement) { return $this->security->isGranted($this->mapOperation($attribute), $target_element); } } diff --git a/src/Security/Voter/ExtendedVoter.php b/src/Security/Voter/ExtendedVoter.php index 2474d02b..279944fc 100644 --- a/src/Security/Voter/ExtendedVoter.php +++ b/src/Security/Voter/ExtendedVoter.php @@ -52,7 +52,7 @@ abstract class ExtendedVoter extends Voter /** @var UserRepository $repo */ $repo = $this->entityManager->getRepository(User::class); $user = $repo->getAnonymousUser(); - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { return false; } } diff --git a/src/Security/Voter/LogEntryVoter.php b/src/Security/Voter/LogEntryVoter.php index 0c9f86da..4ffecc5a 100644 --- a/src/Security/Voter/LogEntryVoter.php +++ b/src/Security/Voter/LogEntryVoter.php @@ -22,17 +22,17 @@ declare(strict_types=1); namespace App\Security\Voter; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\LogSystem\AbstractLogEntry; use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; class LogEntryVoter extends ExtendedVoter { final public const ALLOWED_OPS = ['read', 'show_details', 'delete']; - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, private readonly \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, private readonly Security $security) { parent::__construct($resolver, $entityManager); } diff --git a/src/Security/Voter/OrderdetailVoter.php b/src/Security/Voter/OrderdetailVoter.php index f550807d..96ff609e 100644 --- a/src/Security/Voter/OrderdetailVoter.php +++ b/src/Security/Voter/OrderdetailVoter.php @@ -41,15 +41,16 @@ declare(strict_types=1); namespace App\Security\Voter; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\Parts\Part; use App\Entity\PriceInformations\Orderdetail; use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; class OrderdetailVoter extends ExtendedVoter { - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security) { parent::__construct($resolver, $entityManager); } @@ -71,7 +72,7 @@ class OrderdetailVoter extends ExtendedVoter }; //If we have no part associated use the generic part permission - if (is_string($subject) || !$subject->getPart() instanceof \App\Entity\Parts\Part) { + if (is_string($subject) || !$subject->getPart() instanceof Part) { return $this->resolver->inherit($user, 'parts', $operation) ?? false; } diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index edc096a2..486decda 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -20,6 +20,8 @@ namespace App\Security\Voter; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\Base\AbstractDBElement; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\CategoryParameter; @@ -36,12 +38,11 @@ use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; use RuntimeException; -use Symfony\Component\Security\Core\Security; class ParameterVoter extends ExtendedVoter { - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security) { parent::__construct($resolver, $entityManager); } @@ -57,7 +58,7 @@ class ParameterVoter extends ExtendedVoter if (is_object($subject)) { //If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element $target_element = $subject->getElement(); - if ($target_element instanceof \App\Entity\Base\AbstractDBElement) { + if ($target_element instanceof AbstractDBElement) { $operation = match ($attribute) { 'read', 'view' => 'read', 'edit', 'create', 'delete' => 'edit', diff --git a/src/Security/Voter/PartLotVoter.php b/src/Security/Voter/PartLotVoter.php index 8293e234..fbdb5ad1 100644 --- a/src/Security/Voter/PartLotVoter.php +++ b/src/Security/Voter/PartLotVoter.php @@ -41,15 +41,16 @@ declare(strict_types=1); namespace App\Security\Voter; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\Parts\Part; use App\Entity\Parts\PartLot; use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; class PartLotVoter extends ExtendedVoter { - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security) { parent::__construct($resolver, $entityManager); } @@ -84,7 +85,7 @@ class PartLotVoter extends ExtendedVoter }; //If we have no part associated use the generic part permission - if (is_string($subject) || !$subject->getPart() instanceof \App\Entity\Parts\Part) { + if (is_string($subject) || !$subject->getPart() instanceof Part) { return $this->resolver->inherit($user, 'parts', $operation) ?? false; } diff --git a/src/Security/Voter/PricedetailVoter.php b/src/Security/Voter/PricedetailVoter.php index 98898ecf..c4def709 100644 --- a/src/Security/Voter/PricedetailVoter.php +++ b/src/Security/Voter/PricedetailVoter.php @@ -41,15 +41,17 @@ declare(strict_types=1); namespace App\Security\Voter; +use Symfony\Bundle\SecurityBundle\Security; +use App\Entity\PriceInformations\Orderdetail; +use App\Entity\Parts\Part; use App\Entity\PriceInformations\Pricedetail; use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; class PricedetailVoter extends ExtendedVoter { - public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(PermissionManager $resolver, EntityManagerInterface $entityManager, protected Security $security) { parent::__construct($resolver, $entityManager); } @@ -71,7 +73,7 @@ class PricedetailVoter extends ExtendedVoter }; //If we have no part associated use the generic part permission - if (is_string($subject) || !$subject->getOrderdetail() instanceof \App\Entity\PriceInformations\Orderdetail || !$subject->getOrderdetail()->getPart() instanceof \App\Entity\Parts\Part) { + if (is_string($subject) || !$subject->getOrderdetail() instanceof Orderdetail || !$subject->getOrderdetail()->getPart() instanceof Part) { return $this->resolver->inherit($user, 'parts', $operation) ?? false; } diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index e7b90744..8de72fde 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -24,11 +24,10 @@ use App\Entity\Base\AbstractStructuralDBElement; use App\Repository\StructuralDBElementRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; -use Symfony\Component\Serializer\Normalizer\ContextAwareDenormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; -class StructuralElementDenormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface, CacheableSupportsMethodInterface +class StructuralElementDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface { private array $object_cache = []; diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index c85470d8..1266ae27 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -148,7 +148,7 @@ class AttachmentSubmitHandler throw new InvalidArgumentException('The given attachment class is not known! The passed class was: '.$attachment::class); } //Ensure the attachment has an assigned element - if (!$attachment->getElement() instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { + if (!$attachment->getElement() instanceof AttachmentContainingDBElement) { throw new InvalidArgumentException('The given attachment is not assigned to an element! An element is needed to generate a path!'); } @@ -176,7 +176,7 @@ class AttachmentSubmitHandler $options = $resolver->resolve($options); //When a file is given then upload it, otherwise check if we need to download the URL - if ($file instanceof \Symfony\Component\HttpFoundation\File\UploadedFile) { + if ($file instanceof UploadedFile) { $this->upload($attachment, $file, $options); } elseif ($options['download_url'] && $attachment->isExternal()) { $this->downloadURL($attachment, $options); @@ -192,7 +192,7 @@ class AttachmentSubmitHandler //this is only possible if the attachment is new (not yet persisted to DB) if ($options['become_preview_if_empty'] && null === $attachment->getID() && $attachment->isPicture()) { $element = $attachment->getElement(); - if ($element instanceof AttachmentContainingDBElement && !$element->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + if ($element instanceof AttachmentContainingDBElement && !$element->getMasterPictureAttachment() instanceof Attachment) { $element->setMasterPictureAttachment($attachment); } } diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index 7108cf12..c2a3b433 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Services\Attachments; +use Imagine\Exception\RuntimeException; use App\Entity\Attachments\Attachment; use InvalidArgumentException; use Liip\ImagineBundle\Imagine\Cache\CacheManager; @@ -140,7 +141,7 @@ class AttachmentURLGenerator $tmp = $this->thumbnailManager->getBrowserPath($asset_path, $filter_name, [], null, UrlGeneratorInterface::NETWORK_PATH); //So we remove the schema manually return preg_replace('/^https?:/', '', $tmp); - } catch (\Imagine\Exception\RuntimeException $e) { + } catch (RuntimeException $e) { //If the filter fails, we can not serve the thumbnail and fall back to the original image and log a warning $this->logger->warning('Could not open thumbnail for attachment with ID ' . $attachment->getID() . ': ' . $e->getMessage()); return $this->assets->getUrl($asset_path); diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php index 5917e88b..a9273586 100644 --- a/src/Services/Attachments/PartPreviewGenerator.php +++ b/src/Services/Attachments/PartPreviewGenerator.php @@ -22,6 +22,12 @@ declare(strict_types=1); namespace App\Services\Attachments; +use App\Entity\Parts\Footprint; +use App\Entity\ProjectSystem\Project; +use App\Entity\Parts\Category; +use App\Entity\Parts\Storelocation; +use App\Entity\Parts\MeasurementUnit; +use App\Entity\Parts\Manufacturer; use App\Entity\Attachments\Attachment; use App\Entity\Parts\Part; @@ -52,21 +58,21 @@ class PartPreviewGenerator $list[] = $attachment; } - if ($part->getFootprint() instanceof \App\Entity\Parts\Footprint) { + if ($part->getFootprint() instanceof Footprint) { $attachment = $part->getFootprint()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; } } - if ($part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { + if ($part->getBuiltProject() instanceof Project) { $attachment = $part->getBuiltProject()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; } } - if ($part->getCategory() instanceof \App\Entity\Parts\Category) { + if ($part->getCategory() instanceof Category) { $attachment = $part->getCategory()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; @@ -74,7 +80,7 @@ class PartPreviewGenerator } foreach ($part->getPartLots() as $lot) { - if ($lot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { + if ($lot->getStorageLocation() instanceof Storelocation) { $attachment = $lot->getStorageLocation()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; @@ -82,14 +88,14 @@ class PartPreviewGenerator } } - if ($part->getPartUnit() instanceof \App\Entity\Parts\MeasurementUnit) { + if ($part->getPartUnit() instanceof MeasurementUnit) { $attachment = $part->getPartUnit()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; } } - if ($part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer) { + if ($part->getManufacturer() instanceof Manufacturer) { $attachment = $part->getManufacturer()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { $list[] = $attachment; @@ -114,7 +120,7 @@ class PartPreviewGenerator } //Otherwise check if the part has a footprint with a valid master attachment - if ($part->getFootprint() instanceof \App\Entity\Parts\Footprint) { + if ($part->getFootprint() instanceof Footprint) { $attachment = $part->getFootprint()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { return $attachment; @@ -122,7 +128,7 @@ class PartPreviewGenerator } //With lowest priority use the master attachment of the project this part represents (when existing) - if ($part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) { + if ($part->getBuiltProject() instanceof Project) { $attachment = $part->getBuiltProject()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { return $attachment; @@ -142,7 +148,7 @@ class PartPreviewGenerator */ protected function isAttachmentValidPicture(?Attachment $attachment): bool { - return $attachment instanceof \App\Entity\Attachments\Attachment + return $attachment instanceof Attachment && $attachment->isPicture() && $this->attachmentHelper->isFileExisting($attachment); } diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index b31ecf07..dc8c94a6 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Services; +use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractDBElement; @@ -162,17 +163,17 @@ class ElementTypeNameGenerator //Add a hint to the associated element if possible if ($include_associated) { - if ($entity instanceof Attachment && $entity->getElement() instanceof \App\Entity\Attachments\AttachmentContainingDBElement) { + if ($entity instanceof Attachment && $entity->getElement() instanceof AttachmentContainingDBElement) { $on = $entity->getElement(); - } elseif ($entity instanceof AbstractParameter && $entity->getElement() instanceof \App\Entity\Base\AbstractDBElement) { + } elseif ($entity instanceof AbstractParameter && $entity->getElement() instanceof AbstractDBElement) { $on = $entity->getElement(); - } elseif ($entity instanceof PartLot && $entity->getPart() instanceof \App\Entity\Parts\Part) { + } elseif ($entity instanceof PartLot && $entity->getPart() instanceof Part) { $on = $entity->getPart(); - } elseif ($entity instanceof Orderdetail && $entity->getPart() instanceof \App\Entity\Parts\Part) { + } elseif ($entity instanceof Orderdetail && $entity->getPart() instanceof Part) { $on = $entity->getPart(); - } elseif ($entity instanceof Pricedetail && $entity->getOrderdetail() instanceof \App\Entity\PriceInformations\Orderdetail && $entity->getOrderdetail()->getPart() instanceof \App\Entity\Parts\Part) { + } elseif ($entity instanceof Pricedetail && $entity->getOrderdetail() instanceof Orderdetail && $entity->getOrderdetail()->getPart() instanceof Part) { $on = $entity->getOrderdetail()->getPart(); - } elseif ($entity instanceof ProjectBOMEntry && $entity->getProject() instanceof \App\Entity\ProjectSystem\Project) { + } elseif ($entity instanceof ProjectBOMEntry && $entity->getProject() instanceof Project) { $on = $entity->getProject(); } diff --git a/src/Services/Formatters/MoneyFormatter.php b/src/Services/Formatters/MoneyFormatter.php index 3e65e159..fbe4fc39 100644 --- a/src/Services/Formatters/MoneyFormatter.php +++ b/src/Services/Formatters/MoneyFormatter.php @@ -46,7 +46,7 @@ class MoneyFormatter public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string { $iso_code = $this->base_currency; - if ($currency instanceof \App\Entity\PriceInformations\Currency && !empty($currency->getIsoCode())) { + if ($currency instanceof Currency && !empty($currency->getIsoCode())) { $iso_code = $currency->getIsoCode(); } diff --git a/src/Services/ImportExportSystem/EntityExporter.php b/src/Services/ImportExportSystem/EntityExporter.php index a4c3b48e..89b0e946 100644 --- a/src/Services/ImportExportSystem/EntityExporter.php +++ b/src/Services/ImportExportSystem/EntityExporter.php @@ -64,7 +64,7 @@ class EntityExporter * @param array $options The options to use for exporting * @return string The serialized data */ - public function exportEntities(\App\Entity\Base\AbstractNamedDBElement|array $entities, array $options): string + public function exportEntities(AbstractNamedDBElement|array $entities, array $options): string { if (!is_array($entities)) { $entities = [$entities]; @@ -108,7 +108,7 @@ class EntityExporter * * @throws ReflectionException */ - public function exportEntityFromRequest(\App\Entity\Base\AbstractNamedDBElement|array $entities, Request $request): Response + public function exportEntityFromRequest(AbstractNamedDBElement|array $entities, Request $request): Response { $options = [ 'format' => $request->get('format') ?? 'json', diff --git a/src/Services/ImportExportSystem/EntityImporter.php b/src/Services/ImportExportSystem/EntityImporter.php index 60014554..60d064f3 100644 --- a/src/Services/ImportExportSystem/EntityImporter.php +++ b/src/Services/ImportExportSystem/EntityImporter.php @@ -61,7 +61,7 @@ class EntityImporter if (!is_a($class_name, AbstractNamedDBElement::class, true)) { throw new InvalidArgumentException('$class_name must be a StructuralDBElement type!'); } - if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement && !$parent instanceof $class_name) { + if ($parent instanceof AbstractStructuralDBElement && !$parent instanceof $class_name) { throw new InvalidArgumentException('$parent must have the same type as specified in $class_name!'); } @@ -85,11 +85,7 @@ class EntityImporter } while ($identSize < end($indentations)) { //If the line is intendet less than the last line, we have to go up in the tree - if ($current_parent instanceof AbstractStructuralDBElement) { - $current_parent = $current_parent->getParent(); - } else { - $current_parent = null; - } + $current_parent = $current_parent instanceof AbstractStructuralDBElement ? $current_parent->getParent() : null; array_pop($indentations); } diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php index 76326ebd..54ecae63 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php @@ -20,6 +20,7 @@ namespace App\Services\ImportExportSystem\PartKeeprImporter; +use Doctrine\ORM\Id\AssignedGenerator; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\AttachmentType; @@ -210,7 +211,7 @@ trait PKImportHelperTrait $metadata = $this->em->getClassMetadata($element::class); $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_NONE); - $metadata->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator()); + $metadata->setIdGenerator(new AssignedGenerator()); $metadata->setIdentifierValues($element, ['id' => $id]); } diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php index 3690ccbc..c3d1f31e 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php @@ -143,7 +143,7 @@ class PKPartImporter throw new \RuntimeException(sprintf('Could not find part with ID %s', $partmanufacturer['part_id'])); } $manufacturer = $this->em->find(Manufacturer::class, (int) $partmanufacturer['manufacturer_id']); - if (!$manufacturer instanceof \App\Entity\Parts\Manufacturer) { + if (!$manufacturer instanceof Manufacturer) { throw new \RuntimeException(sprintf('Could not find manufacturer with ID %s', $partmanufacturer['manufacturer_id'])); } $part->setManufacturer($manufacturer); @@ -187,7 +187,7 @@ class PKPartImporter } $part = $this->em->find(Part::class, (int) $partparameter['part_id']); - if (!$part instanceof \App\Entity\Parts\Part) { + if (!$part instanceof Part) { throw new \RuntimeException(sprintf('Could not find part with ID %s', $partparameter['part_id'])); } @@ -235,12 +235,12 @@ class PKPartImporter foreach ($data['partdistributor'] as $partdistributor) { //Retrieve the part $part = $this->em->find(Part::class, (int) $partdistributor['part_id']); - if (!$part instanceof \App\Entity\Parts\Part) { + if (!$part instanceof Part) { throw new \RuntimeException(sprintf('Could not find part with ID %s', $partdistributor['part_id'])); } //Retrieve the distributor $supplier = $this->em->find(Supplier::class, (int) $partdistributor['distributor_id']); - if (!$supplier instanceof \App\Entity\Parts\Supplier) { + if (!$supplier instanceof Supplier) { throw new \RuntimeException(sprintf('Could not find supplier with ID %s', $partdistributor['distributor_id'])); } diff --git a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php index f9b289b3..ba425483 100644 --- a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php +++ b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php @@ -71,7 +71,7 @@ final class BarcodeRedirector case 'lot': //Try to determine the part to the given lot $lot = $this->em->find(PartLot::class, $id); - if (!$lot instanceof \App\Entity\Parts\PartLot) { + if (!$lot instanceof PartLot) { throw new EntityNotFoundException(); } diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php index 6fd28aef..98c3423a 100644 --- a/src/Services/LabelSystem/LabelHTMLGenerator.php +++ b/src/Services/LabelSystem/LabelHTMLGenerator.php @@ -41,18 +41,18 @@ declare(strict_types=1); namespace App\Services\LabelSystem; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Contracts\NamedElementInterface; use App\Entity\LabelSystem\LabelOptions; use App\Exceptions\TwigModeException; use App\Services\ElementTypeNameGenerator; use InvalidArgumentException; -use Symfony\Component\Security\Core\Security; use Twig\Environment; use Twig\Error\Error; final class LabelHTMLGenerator { - public function __construct(private readonly ElementTypeNameGenerator $elementTypeNameGenerator, private readonly LabelTextReplacer $replacer, private readonly Environment $twig, private readonly BarcodeGenerator $barcodeGenerator, private readonly SandboxedTwigProvider $sandboxedTwigProvider, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly string $partdb_title) + public function __construct(private readonly ElementTypeNameGenerator $elementTypeNameGenerator, private readonly LabelTextReplacer $replacer, private readonly Environment $twig, private readonly BarcodeGenerator $barcodeGenerator, private readonly SandboxedTwigProvider $sandboxedTwigProvider, private readonly Security $security, private readonly string $partdb_title) { } diff --git a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php index 50efd563..1678bda1 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php +++ b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php @@ -41,19 +41,19 @@ declare(strict_types=1); namespace App\Services\LabelSystem\PlaceholderProviders; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\UserSystem\User; use DateTime; use IntlDateFormatter; use Locale; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Security; /** * Provides Placeholders for infos about global infos like Installation name or datetimes. */ final class GlobalProviders implements PlaceholderProviderInterface { - public function __construct(private readonly string $partdb_title, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $url_generator) + public function __construct(private readonly string $partdb_title, private readonly Security $security, private readonly UrlGeneratorInterface $url_generator) { } diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php index ce071e9f..f7ff0b45 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php @@ -41,6 +41,8 @@ declare(strict_types=1); namespace App\Services\LabelSystem\PlaceholderProviders; +use App\Entity\Parts\Storelocation; +use App\Entity\UserSystem\User; use App\Entity\Parts\PartLot; use App\Services\Formatters\AmountFormatter; use App\Services\LabelSystem\LabelTextReplacer; @@ -90,19 +92,19 @@ final class PartLotProvider implements PlaceholderProviderInterface } if ('[[LOCATION]]' === $placeholder) { - return $label_target->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $label_target->getStorageLocation()->getName() : ''; + return $label_target->getStorageLocation() instanceof Storelocation ? $label_target->getStorageLocation()->getName() : ''; } if ('[[LOCATION_FULL]]' === $placeholder) { - return $label_target->getStorageLocation() instanceof \App\Entity\Parts\Storelocation ? $label_target->getStorageLocation()->getFullPath() : ''; + return $label_target->getStorageLocation() instanceof Storelocation ? $label_target->getStorageLocation()->getFullPath() : ''; } if ('[[OWNER]]' === $placeholder) { - return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getFullName() : ''; + return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getFullName() : ''; } if ('[[OWNER_USERNAME]]' === $placeholder) { - return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getUsername() : ''; + return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getUsername() : ''; } return $this->labelTextReplacer->handlePlaceholder($placeholder, $label_target->getPart()); diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php index d794b855..dbbe6263 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php @@ -41,6 +41,9 @@ declare(strict_types=1); namespace App\Services\LabelSystem\PlaceholderProviders; +use App\Entity\Parts\Category; +use App\Entity\Parts\Manufacturer; +use App\Entity\Parts\Footprint; use App\Entity\Parts\Part; use App\Services\Formatters\SIFormatter; use Parsedown; @@ -59,27 +62,27 @@ final class PartProvider implements PlaceholderProviderInterface } if ('[[CATEGORY]]' === $placeholder) { - return $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getName() : ''; + return $part->getCategory() instanceof Category ? $part->getCategory()->getName() : ''; } if ('[[CATEGORY_FULL]]' === $placeholder) { - return $part->getCategory() instanceof \App\Entity\Parts\Category ? $part->getCategory()->getFullPath() : ''; + return $part->getCategory() instanceof Category ? $part->getCategory()->getFullPath() : ''; } if ('[[MANUFACTURER]]' === $placeholder) { - return $part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer ? $part->getManufacturer()->getName() : ''; + return $part->getManufacturer() instanceof Manufacturer ? $part->getManufacturer()->getName() : ''; } if ('[[MANUFACTURER_FULL]]' === $placeholder) { - return $part->getManufacturer() instanceof \App\Entity\Parts\Manufacturer ? $part->getManufacturer()->getFullPath() : ''; + return $part->getManufacturer() instanceof Manufacturer ? $part->getManufacturer()->getFullPath() : ''; } if ('[[FOOTPRINT]]' === $placeholder) { - return $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getName() : ''; + return $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getName() : ''; } if ('[[FOOTPRINT_FULL]]' === $placeholder) { - return $part->getFootprint() instanceof \App\Entity\Parts\Footprint ? $part->getFootprint()->getFullPath() : ''; + return $part->getFootprint() instanceof Footprint ? $part->getFootprint()->getFullPath() : ''; } if ('[[MASS]]' === $placeholder) { diff --git a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php index 85c1d13a..18a4c7d2 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php @@ -20,6 +20,7 @@ namespace App\Services\LabelSystem\PlaceholderProviders; +use App\Entity\UserSystem\User; use App\Entity\Parts\Storelocation; class StorelocationProvider implements PlaceholderProviderInterface @@ -28,11 +29,11 @@ class StorelocationProvider implements PlaceholderProviderInterface { if ($label_target instanceof Storelocation) { if ('[[OWNER]]' === $placeholder) { - return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getFullName() : ''; + return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getFullName() : ''; } if ('[[OWNER_USERNAME]]' === $placeholder) { - return $label_target->getOwner() instanceof \App\Entity\UserSystem\User ? $label_target->getOwner()->getUsername() : ''; + return $label_target->getOwner() instanceof User ? $label_target->getOwner()->getUsername() : ''; } } diff --git a/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php index 31d7618e..ca8088da 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/StructuralDBElementProvider.php @@ -58,10 +58,10 @@ final class StructuralDBElementProvider implements PlaceholderProviderInterface return $label_target->getFullPath(); } if ('[[PARENT]]' === $placeholder) { - return $label_target->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $label_target->getParent()->getName() : ''; + return $label_target->getParent() instanceof AbstractStructuralDBElement ? $label_target->getParent()->getName() : ''; } if ('[[PARENT_FULL_PATH]]' === $placeholder) { - return $label_target->getParent() instanceof \App\Entity\Base\AbstractStructuralDBElement ? $label_target->getParent()->getFullPath() : ''; + return $label_target->getParent() instanceof AbstractStructuralDBElement ? $label_target->getParent()->getFullPath() : ''; } } diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php index afc1c69b..82e2df3a 100644 --- a/src/Services/LogSystem/EventLogger.php +++ b/src/Services/LogSystem/EventLogger.php @@ -22,15 +22,16 @@ declare(strict_types=1); namespace App\Services\LogSystem; +use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\User\UserInterface; use App\Entity\LogSystem\AbstractLogEntry; use App\Entity\UserSystem\User; use App\Services\Misc\ConsoleInfoHelper; use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\Security\Core\Security; class EventLogger { - public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected \Symfony\Bundle\SecurityBundle\Security $security, protected ConsoleInfoHelper $console_info_helper) + public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected Security $security, protected ConsoleInfoHelper $console_info_helper) { } @@ -44,14 +45,14 @@ class EventLogger { $user = $this->security->getUser(); //If the user is not specified explicitly, set it to the current user - if ((!$user instanceof \Symfony\Component\Security\Core\User\UserInterface || $user instanceof User) && !$logEntry->getUser() instanceof \App\Entity\UserSystem\User) { - if (!$user instanceof \App\Entity\UserSystem\User) { + if ((!$user instanceof UserInterface || $user instanceof User) && !$logEntry->getUser() instanceof User) { + if (!$user instanceof User) { $repo = $this->em->getRepository(User::class); $user = $repo->getAnonymousUser(); } //If no anonymous user is available skip the log (needed for data fixtures) - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { return false; } $logEntry->setUser($user); diff --git a/src/Services/LogSystem/LogTargetHelper.php b/src/Services/LogSystem/LogTargetHelper.php index e8ea4a6b..abd57674 100644 --- a/src/Services/LogSystem/LogTargetHelper.php +++ b/src/Services/LogSystem/LogTargetHelper.php @@ -70,7 +70,7 @@ class LogTargetHelper $target = $this->entryRepository->getTargetElement($context); //If the target is null and the context has a target, that means that the target was deleted. Show it that way. - if (!$target instanceof \App\Entity\Base\AbstractDBElement) { + if (!$target instanceof AbstractDBElement) { if ($context->hasTarget()) { return $this->elementTypeNameGenerator->formatElementDeletedHTML($context->getTargetClass(), $context->getTargetId()); diff --git a/src/Services/Misc/DBInfoHelper.php b/src/Services/Misc/DBInfoHelper.php index 3d5c27a7..f2c638ff 100644 --- a/src/Services/Misc/DBInfoHelper.php +++ b/src/Services/Misc/DBInfoHelper.php @@ -20,6 +20,7 @@ namespace App\Services\Misc; +use Doctrine\DBAL\Exception; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\DBAL\Platforms\SqlitePlatform; @@ -56,7 +57,7 @@ class DBInfoHelper /** * Returns the database version of the used database. - * @throws \Doctrine\DBAL\Exception + * @throws Exception */ public function getDatabaseVersion(): ?string { @@ -74,14 +75,14 @@ class DBInfoHelper /** * Returns the database size in bytes. * @return int|null The database size in bytes or null if unknown - * @throws \Doctrine\DBAL\Exception + * @throws Exception */ public function getDatabaseSize(): ?int { if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) { try { return $this->connection->fetchOne('SELECT SUM(data_length + index_length) FROM information_schema.TABLES WHERE table_schema = DATABASE()'); - } catch (\Doctrine\DBAL\Exception) { + } catch (Exception) { return null; } } @@ -89,7 +90,7 @@ class DBInfoHelper if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { try { return $this->connection->fetchOne('SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size();'); - } catch (\Doctrine\DBAL\Exception) { + } catch (Exception) { return null; } } @@ -113,7 +114,7 @@ class DBInfoHelper if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) { try { return $this->connection->fetchOne('SELECT USER()'); - } catch (\Doctrine\DBAL\Exception) { + } catch (Exception) { return null; } } diff --git a/src/Services/Parameters/ParameterExtractor.php b/src/Services/Parameters/ParameterExtractor.php index c1151970..3257d96d 100644 --- a/src/Services/Parameters/ParameterExtractor.php +++ b/src/Services/Parameters/ParameterExtractor.php @@ -74,7 +74,7 @@ class ParameterExtractor $split = $this->splitString($input); foreach ($split as $param_string) { $tmp = $this->stringToParam($param_string, $class); - if ($tmp instanceof \App\Entity\Parameters\AbstractParameter) { + if ($tmp instanceof AbstractParameter) { $parameters[] = $tmp; } } diff --git a/src/Services/Parts/PartLotWithdrawAddHelper.php b/src/Services/Parts/PartLotWithdrawAddHelper.php index f63ae15f..9ffbbbe9 100644 --- a/src/Services/Parts/PartLotWithdrawAddHelper.php +++ b/src/Services/Parts/PartLotWithdrawAddHelper.php @@ -2,6 +2,7 @@ namespace App\Services\Parts; +use App\Entity\Parts\Storelocation; use App\Entity\LogSystem\PartStockChangedLogEntry; use App\Entity\Parts\PartLot; use App\Services\LogSystem\EventCommentHelper; @@ -24,7 +25,7 @@ final class PartLotWithdrawAddHelper } //So far all other restrictions are defined at the storelocation level - if(!$partLot->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { + if(!$partLot->getStorageLocation() instanceof Storelocation) { return true; } //We can not add parts if the storage location of the lot is marked as full diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index d5e1f8a1..d4af56ae 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -20,6 +20,7 @@ namespace App\Services\Parts; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -33,11 +34,10 @@ use InvalidArgumentException; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -use Symfony\Component\Security\Core\Security; final class PartsTableActionHandler { - public function __construct(private readonly EntityManagerInterface $entityManager, private readonly \Symfony\Bundle\SecurityBundle\Security $security, private readonly UrlGeneratorInterface $urlGenerator) + public function __construct(private readonly EntityManagerInterface $entityManager, private readonly Security $security, private readonly UrlGeneratorInterface $urlGenerator) { } diff --git a/src/Services/Parts/PricedetailHelper.php b/src/Services/Parts/PricedetailHelper.php index 14c914d4..d989593d 100644 --- a/src/Services/Parts/PricedetailHelper.php +++ b/src/Services/Parts/PricedetailHelper.php @@ -150,13 +150,13 @@ class PricedetailHelper $pricedetail = $orderdetail->findPriceForQty($amount); //When we don't have information about this amount, ignore it - if (!$pricedetail instanceof \App\Entity\PriceInformations\Pricedetail) { + if (!$pricedetail instanceof Pricedetail) { continue; } $converted = $this->convertMoneyToCurrency($pricedetail->getPricePerUnit(), $pricedetail->getCurrency(), $currency); //Ignore price information that can not be converted to base currency. - if ($converted instanceof \Brick\Math\BigDecimal) { + if ($converted instanceof BigDecimal) { $avg = $avg->plus($converted); ++$count; } @@ -189,9 +189,9 @@ class PricedetailHelper $val_base = $value; //Convert value to base currency - if ($originCurrency instanceof \App\Entity\PriceInformations\Currency) { + if ($originCurrency instanceof Currency) { //Without an exchange rate we can not calculate the exchange rate - if (!$originCurrency->getExchangeRate() instanceof \Brick\Math\BigDecimal || $originCurrency->getExchangeRate()->isZero()) { + if (!$originCurrency->getExchangeRate() instanceof BigDecimal || $originCurrency->getExchangeRate()->isZero()) { return null; } @@ -200,9 +200,9 @@ class PricedetailHelper $val_target = $val_base; //Convert value in base currency to target currency - if ($targetCurrency instanceof \App\Entity\PriceInformations\Currency) { + if ($targetCurrency instanceof Currency) { //Without an exchange rate we can not calculate the exchange rate - if (!$targetCurrency->getExchangeRate() instanceof \Brick\Math\BigDecimal) { + if (!$targetCurrency->getExchangeRate() instanceof BigDecimal) { return null; } diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php index 30f31c33..1ca2d0e8 100644 --- a/src/Services/ProjectSystem/ProjectBuildHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildHelper.php @@ -20,6 +20,7 @@ namespace App\Services\ProjectSystem; +use App\Entity\Parts\Part; use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Helpers\Projects\ProjectBuildRequest; @@ -39,7 +40,7 @@ class ProjectBuildHelper { $part = $projectBOMEntry->getPart(); - if (!$part instanceof \App\Entity\Parts\Part) { + if (!$part instanceof Part) { throw new \InvalidArgumentException('This function cannot determine the maximum buildable count for a BOM entry without a part!'); } @@ -108,7 +109,7 @@ class ProjectBuildHelper $part = $bomEntry->getPart(); //Skip BOM entries without a part (as we can not determine that) - if (!$part instanceof \App\Entity\Parts\Part) { + if (!$part instanceof Part) { continue; } diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php index 30b868d3..0196b215 100644 --- a/src/Services/Trees/NodesListBuilder.php +++ b/src/Services/Trees/NodesListBuilder.php @@ -49,7 +49,7 @@ class NodesListBuilder */ public function typeToNodesList(string $class_name, ?AbstractStructuralDBElement $parent = null): array { - $parent_id = $parent instanceof \App\Entity\Base\AbstractStructuralDBElement ? $parent->getID() : '0'; + $parent_id = $parent instanceof AbstractStructuralDBElement ? $parent->getID() : '0'; // Backslashes are not allowed in cache keys $secure_class_name = str_replace('\\', '_', $class_name); $key = 'list_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.$parent_id; diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index 37c84642..201c5fd3 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Services\Trees; +use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Attachments\AttachmentType; use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; @@ -38,7 +39,6 @@ use App\Entity\UserSystem\User; use App\Helpers\Trees\TreeViewNode; use App\Services\UserSystem\UserCacheKeyGenerator; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Cache\ItemInterface; use Symfony\Contracts\Cache\TagAwareCacheInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -49,7 +49,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class ToolsTreeBuilder { - public function __construct(protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected \Symfony\Bundle\SecurityBundle\Security $security) + public function __construct(protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected Security $security) { } diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index 61f32922..1ee0647b 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -74,7 +74,7 @@ class TreeViewGenerator $href = $this->urlGenerator->createURL(new $class()); $new_node = new TreeViewNode($this->translator->trans('entity.tree.new'), $href); //When the id of the selected element is null, then we have a new element, and we need to select "new" node - if (!$selectedElement instanceof \App\Entity\Base\AbstractDBElement || null === $selectedElement->getID()) { + if (!$selectedElement instanceof AbstractDBElement || null === $selectedElement->getID()) { $new_node->setSelected(true); } $head[] = $new_node; @@ -98,7 +98,7 @@ class TreeViewGenerator $recursiveIterator = new RecursiveIteratorIterator($treeIterator, RecursiveIteratorIterator::SELF_FIRST); foreach ($recursiveIterator as $item) { /** @var TreeViewNode $item */ - if ($selectedElement instanceof \App\Entity\Base\AbstractDBElement && $item->getId() === $selectedElement->getID()) { + if ($selectedElement instanceof AbstractDBElement && $item->getId() === $selectedElement->getID()) { $item->setSelected(true); } @@ -184,7 +184,7 @@ class TreeViewGenerator if (!is_a($class, AbstractNamedDBElement::class, true)) { throw new InvalidArgumentException('$class must be a class string that implements StructuralDBElement or NamedDBElement!'); } - if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement && !$parent instanceof $class) { + if ($parent instanceof AbstractStructuralDBElement && !$parent instanceof $class) { throw new InvalidArgumentException('$parent must be of the type $class!'); } @@ -192,7 +192,7 @@ class TreeViewGenerator $repo = $this->em->getRepository($class); //If we just want a part of a tree, don't cache it - if ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { + if ($parent instanceof AbstractStructuralDBElement) { return $repo->getGenericNodeTree($parent); } diff --git a/src/Services/UserSystem/PasswordResetManager.php b/src/Services/UserSystem/PasswordResetManager.php index 2a4c9274..d479fb51 100644 --- a/src/Services/UserSystem/PasswordResetManager.php +++ b/src/Services/UserSystem/PasswordResetManager.php @@ -51,7 +51,7 @@ class PasswordResetManager //Try to find a user by the given string $user = $repo->findByEmailOrName($name_or_email); //Do nothing if no user was found - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { return; } @@ -101,7 +101,7 @@ class PasswordResetManager $user = $repo->findOneBy(['name' => $username]); //If no user matching the name, show an error message - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { return false; } diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php index cf3e1455..ae3764d8 100644 --- a/src/Services/UserSystem/PermissionManager.php +++ b/src/Services/UserSystem/PermissionManager.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Services\UserSystem; +use App\Entity\Base\AbstractStructuralDBElement; use App\Configuration\PermissionsConfiguration; use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; @@ -110,7 +111,7 @@ class PermissionManager /** @var Group $parent */ $parent = $user->getGroup(); - while ($parent instanceof \App\Entity\Base\AbstractStructuralDBElement) { //The top group, has parent == null + while ($parent instanceof AbstractStructuralDBElement) { //The top group, has parent == null //Check if our current element gives an info about disallow/allow $allowed = $this->dontInherit($parent, $permission, $operation); if (null !== $allowed) { diff --git a/src/Services/UserSystem/PermissionSchemaUpdater.php b/src/Services/UserSystem/PermissionSchemaUpdater.php index 72231bcb..3c12d042 100644 --- a/src/Services/UserSystem/PermissionSchemaUpdater.php +++ b/src/Services/UserSystem/PermissionSchemaUpdater.php @@ -102,7 +102,7 @@ class PermissionSchemaUpdater public function userUpgradeSchemaRecursively(User $user, int $target_version = PermissionData::CURRENT_SCHEMA_VERSION): bool { $updated = $this->upgradeSchema($user, $target_version); - if ($user->getGroup() instanceof \App\Entity\UserSystem\Group) { + if ($user->getGroup() instanceof Group) { $updated = $this->groupUpgradeSchemaRecursively($user->getGroup(), $target_version) || $updated; } diff --git a/src/Services/UserSystem/UserAvatarHelper.php b/src/Services/UserSystem/UserAvatarHelper.php index 026cdcd5..73de40f7 100644 --- a/src/Services/UserSystem/UserAvatarHelper.php +++ b/src/Services/UserSystem/UserAvatarHelper.php @@ -20,6 +20,7 @@ namespace App\Services\UserSystem; +use Imagine\Exception\RuntimeException; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\UserAttachment; @@ -44,7 +45,7 @@ class UserAvatarHelper public function getAvatarURL(User $user): string { //Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture) - if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + if ($user->getMasterPictureAttachment() instanceof Attachment) { return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_md'); } @@ -60,7 +61,7 @@ class UserAvatarHelper public function getAvatarSmURL(User $user): string { //Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture) - if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + if ($user->getMasterPictureAttachment() instanceof Attachment) { return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_xs'); } @@ -72,7 +73,7 @@ class UserAvatarHelper try { //Otherwise we can serve the relative path via Asset component return $this->filterService->getUrlOfFilteredImage('/img/default_avatar.png', 'thumbnail_xs'); - } catch (\Imagine\Exception\RuntimeException) { + } catch (RuntimeException) { //If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning return $this->packages->getUrl('/img/default_avatar.png'); } @@ -81,7 +82,7 @@ class UserAvatarHelper public function getAvatarMdURL(User $user): string { //Check if the user has a master attachment defined (meaning he has explicitly defined a profile picture) - if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + if ($user->getMasterPictureAttachment() instanceof Attachment) { return $this->attachmentURLGenerator->getThumbnailURL($user->getMasterPictureAttachment(), 'thumbnail_sm'); } @@ -93,7 +94,7 @@ class UserAvatarHelper try { //Otherwise we can serve the relative path via Asset component return $this->filterService->getUrlOfFilteredImage('/img/default_avatar.png', 'thumbnail_xs'); - } catch (\Imagine\Exception\RuntimeException) { + } catch (RuntimeException) { //If the filter fails, we can not serve the thumbnail and fall back to the original image and log an warning return $this->packages->getUrl('/img/default_avatar.png'); } @@ -131,7 +132,7 @@ class UserAvatarHelper { //Determine which attachment to user //If the user already has a master attachment, we use this one - if ($user->getMasterPictureAttachment() instanceof \App\Entity\Attachments\Attachment) { + if ($user->getMasterPictureAttachment() instanceof Attachment) { $attachment = $user->getMasterPictureAttachment(); } else { //Otherwise we have to create one $attachment = new UserAttachment(); diff --git a/src/Services/UserSystem/UserCacheKeyGenerator.php b/src/Services/UserSystem/UserCacheKeyGenerator.php index 69caeff3..f8aec6a1 100644 --- a/src/Services/UserSystem/UserCacheKeyGenerator.php +++ b/src/Services/UserSystem/UserCacheKeyGenerator.php @@ -22,17 +22,18 @@ declare(strict_types=1); namespace App\Services\UserSystem; +use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\HttpFoundation\Request; use App\Entity\UserSystem\User; use Locale; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\Security\Core\Security; /** * Purpose of this service is to generate a key unique for a user, to use in Cache keys and tags. */ class UserCacheKeyGenerator { - public function __construct(protected \Symfony\Bundle\SecurityBundle\Security $security, protected RequestStack $requestStack) + public function __construct(protected Security $security, protected RequestStack $requestStack) { } @@ -46,10 +47,10 @@ class UserCacheKeyGenerator { $request = $this->requestStack->getCurrentRequest(); //Retrieve the locale from the request, if possible, otherwise use the default locale - $locale = $request instanceof \Symfony\Component\HttpFoundation\Request ? $request->getLocale() : Locale::getDefault(); + $locale = $request instanceof Request ? $request->getLocale() : Locale::getDefault(); //If no user was specified, use the currently used one. - if (!$user instanceof \App\Entity\UserSystem\User) { + if (!$user instanceof User) { $user = $this->security->getUser(); } diff --git a/src/Twig/AttachmentExtension.php b/src/Twig/AttachmentExtension.php index c0897ab2..beb1295c 100644 --- a/src/Twig/AttachmentExtension.php +++ b/src/Twig/AttachmentExtension.php @@ -20,6 +20,7 @@ namespace App\Twig; +use App\Entity\Attachments\Attachment; use App\Services\Attachments\AttachmentURLGenerator; use App\Services\Misc\FAIconGenerator; use Twig\Extension\AbstractExtension; @@ -35,7 +36,7 @@ final class AttachmentExtension extends AbstractExtension { return [ /* Returns the URL to a thumbnail of the given attachment */ - new TwigFunction('attachment_thumbnail', fn(\App\Entity\Attachments\Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)), + new TwigFunction('attachment_thumbnail', fn(Attachment $attachment, string $filter_name = 'thumbnail_sm'): ?string => $this->attachmentURLGenerator->getThumbnailURL($attachment, $filter_name)), /* Returns the font awesome icon class which is representing the given file extension */ new TwigFunction('ext_to_fa_icon', fn(string $extension): string => $this->FAIconGenerator->fileExtensionToFAType($extension)), ]; diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php index 1a8f5d37..393c4040 100644 --- a/src/Twig/EntityExtension.php +++ b/src/Twig/EntityExtension.php @@ -62,11 +62,11 @@ final class EntityExtension extends AbstractExtension /* Returns a string representation of the given entity */ new TwigFunction('entity_type', fn(object $entity): ?string => $this->getEntityType($entity)), /* Returns the URL to the given entity */ - new TwigFunction('entity_url', fn(\App\Entity\Base\AbstractDBElement $entity, string $method = 'info'): string => $this->generateEntityURL($entity, $method)), + new TwigFunction('entity_url', fn(AbstractDBElement $entity, string $method = 'info'): string => $this->generateEntityURL($entity, $method)), /* Returns the URL to the given entity in timetravel mode */ - new TwigFunction('timetravel_url', fn(\App\Entity\Base\AbstractDBElement $element, \DateTimeInterface $dateTime): ?string => $this->timeTravelURL($element, $dateTime)), + new TwigFunction('timetravel_url', fn(AbstractDBElement $element, \DateTimeInterface $dateTime): ?string => $this->timeTravelURL($element, $dateTime)), /* Generates a JSON array of the given tree */ - new TwigFunction('tree_data', fn(\App\Entity\Base\AbstractDBElement $element, string $type = 'newEdit'): string => $this->treeData($element, $type)), + new TwigFunction('tree_data', fn(AbstractDBElement $element, string $type = 'newEdit'): string => $this->treeData($element, $type)), /* Gets a human readable label for the type of the given entity */ new TwigFunction('entity_type_label', fn(object|string $entity): string => $this->nameGenerator->getLocalizedTypeLabel($entity)), diff --git a/src/Twig/FormatExtension.php b/src/Twig/FormatExtension.php index d5fe0e91..76628ccd 100644 --- a/src/Twig/FormatExtension.php +++ b/src/Twig/FormatExtension.php @@ -47,11 +47,11 @@ final class FormatExtension extends AbstractExtension 'is_safe' => ['html'], ]), /* Format the given amount as money, using a given currency */ - new TwigFilter('format_money', fn($amount, ?\App\Entity\PriceInformations\Currency $currency = null, int $decimals = 5): string => $this->formatCurrency($amount, $currency, $decimals)), + new TwigFilter('format_money', fn($amount, ?Currency $currency = null, int $decimals = 5): string => $this->formatCurrency($amount, $currency, $decimals)), /* Format the given number using SI prefixes and the given unit (string) */ new TwigFilter('format_si', fn($value, $unit, $decimals = 2, bool $show_all_digits = false): string => $this->siFormat($value, $unit, $decimals, $show_all_digits)), /** Format the given amount using the given MeasurementUnit */ - new TwigFilter('format_amount', fn($value, ?\App\Entity\Parts\MeasurementUnit $unit, array $options = []): string => $this->amountFormat($value, $unit, $options)), + new TwigFilter('format_amount', fn($value, ?MeasurementUnit $unit, array $options = []): string => $this->amountFormat($value, $unit, $options)), /** Format the given number of bytes as human-readable number */ new TwigFilter('format_bytes', fn(int $bytes, int $precision = 2): string => $this->formatBytes($bytes, $precision)), ]; diff --git a/src/Twig/LogExtension.php b/src/Twig/LogExtension.php index c8edb106..8a0be446 100644 --- a/src/Twig/LogExtension.php +++ b/src/Twig/LogExtension.php @@ -20,6 +20,7 @@ namespace App\Twig; +use App\Entity\LogSystem\AbstractLogEntry; use App\Services\LogSystem\LogDataFormatter; use App\Services\LogSystem\LogDiffFormatter; use Twig\Extension\AbstractExtension; @@ -35,7 +36,7 @@ final class LogExtension extends AbstractExtension public function getFunctions() { return [ - new TwigFunction('format_log_data', fn($data, \App\Entity\LogSystem\AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]), + new TwigFunction('format_log_data', fn($data, AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]), new TwigFunction('format_log_diff', fn($old_data, $new_data): string => $this->logDiffFormatter->formatDiff($old_data, $new_data), ['is_safe' => ['html']]), ]; } diff --git a/src/Twig/MiscExtension.php b/src/Twig/MiscExtension.php index 54e34d09..32080df2 100644 --- a/src/Twig/MiscExtension.php +++ b/src/Twig/MiscExtension.php @@ -20,6 +20,7 @@ namespace App\Twig; +use Twig\TwigFunction; use App\Services\LogSystem\EventCommentNeededHelper; use Twig\Extension\AbstractExtension; @@ -32,7 +33,7 @@ final class MiscExtension extends AbstractExtension public function getFunctions(): array { return [ - new \Twig\TwigFunction('event_comment_needed', + new TwigFunction('event_comment_needed', fn(string $operation_type) => $this->eventCommentNeededHelper->isCommentNeeded($operation_type) ), ]; diff --git a/src/Twig/UserExtension.php b/src/Twig/UserExtension.php index d2c8880f..012f975c 100644 --- a/src/Twig/UserExtension.php +++ b/src/Twig/UserExtension.php @@ -41,6 +41,8 @@ declare(strict_types=1); namespace App\Twig; +use App\Entity\Base\AbstractDBElement; +use App\Entity\UserSystem\User; use App\Entity\LogSystem\AbstractLogEntry; use App\Repository\LogEntryRepository; use Doctrine\ORM\EntityManagerInterface; @@ -68,9 +70,9 @@ final class UserExtension extends AbstractExtension { return [ /* Returns the user which has edited the given entity the last time. */ - new TwigFunction('last_editing_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getLastEditingUser($element)), + new TwigFunction('last_editing_user', fn(AbstractDBElement $element): ?User => $this->repo->getLastEditingUser($element)), /* Returns the user which has created the given entity. */ - new TwigFunction('creating_user', fn(\App\Entity\Base\AbstractDBElement $element): ?\App\Entity\UserSystem\User => $this->repo->getCreatingUser($element)), + new TwigFunction('creating_user', fn(AbstractDBElement $element): ?User => $this->repo->getCreatingUser($element)), ]; } diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php index 0cf60f59..7d7a3588 100644 --- a/src/Validator/Constraints/NoLockoutValidator.php +++ b/src/Validator/Constraints/NoLockoutValidator.php @@ -22,12 +22,13 @@ declare(strict_types=1); namespace App\Validator\Constraints; +use Symfony\Bundle\SecurityBundle\Security; +use Symfony\Component\Security\Core\User\UserInterface; use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; use App\Services\UserSystem\PermissionManager; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Form\Exception\UnexpectedTypeException; -use Symfony\Component\Security\Core\Security; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -35,7 +36,7 @@ class NoLockoutValidator extends ConstraintValidator { protected array $perm_structure; - public function __construct(protected PermissionManager $resolver, protected \Symfony\Bundle\SecurityBundle\Security $security, protected EntityManagerInterface $entityManager) + public function __construct(protected PermissionManager $resolver, protected Security $security, protected EntityManagerInterface $entityManager) { $this->perm_structure = $resolver->getPermissionStructure(); } @@ -58,7 +59,7 @@ class NoLockoutValidator extends ConstraintValidator if ($perm_holder instanceof User || $perm_holder instanceof Group) { $user = $this->security->getUser(); - if (!$user instanceof \Symfony\Component\Security\Core\User\UserInterface) { + if (!$user instanceof UserInterface) { $user = $this->entityManager->getRepository(User::class)->getAnonymousUser(); } diff --git a/src/Validator/Constraints/ValidPartLotValidator.php b/src/Validator/Constraints/ValidPartLotValidator.php index 5e5b22d9..4f988362 100644 --- a/src/Validator/Constraints/ValidPartLotValidator.php +++ b/src/Validator/Constraints/ValidPartLotValidator.php @@ -53,7 +53,7 @@ class ValidPartLotValidator extends ConstraintValidator } //We can only validate the values if we know the storelocation - if ($value->getStorageLocation() instanceof \App\Entity\Parts\Storelocation) { + if ($value->getStorageLocation() instanceof Storelocation) { $repo = $this->em->getRepository(Storelocation::class); //We can only determine associated parts, if the part have an ID //When the storage location is new (no ID), we can just assume there are no other parts diff --git a/tests/Controller/RedirectControllerTest.php b/tests/Controller/RedirectControllerTest.php index 90fa63b1..d7df73cc 100644 --- a/tests/Controller/RedirectControllerTest.php +++ b/tests/Controller/RedirectControllerTest.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Tests\Controller; +use Symfony\Bundle\FrameworkBundle\KernelBrowser; use App\Entity\UserSystem\User; use App\Repository\UserRepository; use Doctrine\ORM\EntityManagerInterface; @@ -35,7 +36,7 @@ class RedirectControllerTest extends WebTestCase { protected EntityManagerInterface $em; protected UserRepository $userRepo; - protected \Symfony\Bundle\FrameworkBundle\KernelBrowser $client; + protected KernelBrowser $client; protected function setUp(): void { diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index 25446697..8cc8dc2b 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -43,8 +43,8 @@ class ProjectBuildRequestTest extends TestCase /** @var ProjectBOMEntry */ private ProjectBOMEntry $bom_entry1c; - private \App\Entity\Parts\PartLot $lot1a; - private \App\Entity\Parts\PartLot $lot1b; + private PartLot $lot1a; + private PartLot $lot1b; private PartLot $lot2; /** @var Part */ diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php index 8e2b784e..51584edc 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\Tests\Services\LabelSystem\PlaceholderProviders; +use Doctrine\ORM\EntityManager; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Part; @@ -61,7 +62,7 @@ class PartProviderTest extends WebTestCase protected Part $target; /** - * @var \Doctrine\ORM\EntityManager + * @var EntityManager */ protected $em; From 684334ba22b9405456040e4e47b916e77f59a4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 15:02:59 +0200 Subject: [PATCH 40/91] Improved code style of tests --- rector.php | 7 +++ .../AdminPages/AttachmentTypeController.php | 3 ++ .../AdminPages/CategoryController.php | 3 ++ .../AdminPages/FootprintController.php | 3 ++ .../AdminPages/LabelProfileController.php | 3 ++ .../AdminPages/ManufacturerController.php | 3 ++ .../AdminPages/MeasurementUnitController.php | 3 ++ .../AdminPages/StorelocationController.php | 3 ++ .../AdminPages/SupplierController.php | 3 ++ src/Controller/PartListsController.php | 2 +- src/Controller/RedirectController.php | 5 +- src/Entity/Attachments/Attachment.php | 1 + src/Entity/Attachments/AttachmentType.php | 1 + .../Base/AbstractStructuralDBElement.php | 1 + src/Entity/LogSystem/AbstractLogEntry.php | 1 + src/Entity/Parameters/PartParameter.php | 3 ++ src/Entity/Parts/Part.php | 1 + src/Entity/Parts/PartLot.php | 1 + src/Entity/UserSystem/PermissionData.php | 1 + src/Entity/UserSystem/User.php | 1 + src/Helpers/BBCodeToMarkdownConverter.php | 3 ++ src/Helpers/Projects/ProjectBuildRequest.php | 1 + src/Repository/NamedDBElementRepository.php | 3 ++ .../StructuralDBElementRepository.php | 3 ++ .../EnsureSAMLUserForSAMLLoginChecker.php | 3 ++ src/Security/SamlUserFactory.php | 3 ++ src/Security/UserChecker.php | 3 ++ src/Serializer/BigNumberNormalizer.php | 3 ++ src/Serializer/PartNormalizer.php | 3 ++ .../StructuralElementDenormalizer.php | 3 ++ .../StructuralElementFromNameDenormalizer.php | 3 ++ .../StructuralElementNormalizer.php | 3 ++ .../Attachments/AttachmentPathResolver.php | 1 + .../Attachments/AttachmentURLGenerator.php | 3 ++ .../Attachments/BuiltinAttachmentsFinder.php | 3 +- .../Attachments/FileTypeFilterTools.php | 1 + src/Services/ElementTypeNameGenerator.php | 5 +- src/Services/Formatters/AmountFormatter.php | 1 + src/Services/Formatters/SIFormatter.php | 1 + .../ImportExportSystem/BOMImporter.php | 3 ++ .../ImportExportSystem/EntityExporter.php | 1 + .../ImportExportSystem/EntityImporter.php | 3 ++ src/Services/LabelSystem/BarcodeGenerator.php | 3 ++ .../Barcodes/BarcodeContentGenerator.php | 3 ++ .../Barcodes/BarcodeNormalizer.php | 3 ++ .../Barcodes/BarcodeRedirector.php | 3 ++ src/Services/LabelSystem/LabelGenerator.php | 3 ++ .../LabelSystem/LabelTextReplacer.php | 1 + .../PlaceholderProviders/GlobalProviders.php | 1 + .../NamedElementProvider.php | 3 ++ .../PlaceholderProviders/PartLotProvider.php | 3 ++ .../PlaceholderProviders/PartProvider.php | 3 ++ .../TimestampableElementProvider.php | 3 ++ .../LabelSystem/SandboxedTwigProvider.php | 3 ++ src/Services/LogSystem/EventCommentHelper.php | 3 ++ .../LogSystem/EventCommentNeededHelper.php | 1 + src/Services/LogSystem/EventLogger.php | 3 ++ src/Services/Misc/FAIconGenerator.php | 3 ++ src/Services/Misc/RangeParser.php | 1 + .../Parameters/ParameterExtractor.php | 3 ++ .../Parts/PartLotWithdrawAddHelper.php | 3 ++ src/Services/Parts/PricedetailHelper.php | 7 ++- .../ProjectSystem/ProjectBuildHelper.php | 3 ++ .../ProjectSystem/ProjectBuildPartHelper.php | 3 ++ src/Services/Trees/NodesListBuilder.php | 1 + src/Services/Trees/TreeViewGenerator.php | 53 ++++++++----------- src/Services/UserSystem/PermissionManager.php | 1 + .../UserSystem/PermissionSchemaUpdater.php | 3 ++ .../UserSystem/TFA/BackupCodeGenerator.php | 1 + .../UserSystem/TFA/BackupCodeManager.php | 1 + src/Twig/EntityExtension.php | 3 ++ src/Twig/TwigCoreExtension.php | 1 + src/Twig/UserExtension.php | 3 ++ 73 files changed, 196 insertions(+), 38 deletions(-) diff --git a/rector.php b/rector.php index b90d120a..db559491 100644 --- a/rector.php +++ b/rector.php @@ -5,6 +5,8 @@ declare(strict_types=1); use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Doctrine\Set\DoctrineSetList; +use Rector\PHPUnit\Set\PHPUnitLevelSetList; +use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Symfony\Set\SymfonyLevelSetList; @@ -42,5 +44,10 @@ return static function (RectorConfig $rectorConfig): void { //Doctrine rules DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, DoctrineSetList::DOCTRINE_CODE_QUALITY, + + //PHPUnit rules + PHPUnitLevelSetList::UP_TO_PHPUNIT_90, + PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, + PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); }; diff --git a/src/Controller/AdminPages/AttachmentTypeController.php b/src/Controller/AdminPages/AttachmentTypeController.php index 0b85f4a0..426e773c 100644 --- a/src/Controller/AdminPages/AttachmentTypeController.php +++ b/src/Controller/AdminPages/AttachmentTypeController.php @@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\AttachmentTypeControllerTest + */ #[Route(path: '/attachment_type')] class AttachmentTypeController extends BaseAdminController { diff --git a/src/Controller/AdminPages/CategoryController.php b/src/Controller/AdminPages/CategoryController.php index 622de1eb..153d46f3 100644 --- a/src/Controller/AdminPages/CategoryController.php +++ b/src/Controller/AdminPages/CategoryController.php @@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\CategoryControllerTest + */ #[Route(path: '/category')] class CategoryController extends BaseAdminController { diff --git a/src/Controller/AdminPages/FootprintController.php b/src/Controller/AdminPages/FootprintController.php index 8edd0b06..d1414d2a 100644 --- a/src/Controller/AdminPages/FootprintController.php +++ b/src/Controller/AdminPages/FootprintController.php @@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\FootprintControllerTest + */ #[Route(path: '/footprint')] class FootprintController extends BaseAdminController { diff --git a/src/Controller/AdminPages/LabelProfileController.php b/src/Controller/AdminPages/LabelProfileController.php index b89858dd..ee754436 100644 --- a/src/Controller/AdminPages/LabelProfileController.php +++ b/src/Controller/AdminPages/LabelProfileController.php @@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\LabelProfileControllerTest + */ #[Route(path: '/label_profile')] class LabelProfileController extends BaseAdminController { diff --git a/src/Controller/AdminPages/ManufacturerController.php b/src/Controller/AdminPages/ManufacturerController.php index c6db73ee..2a97d3f3 100644 --- a/src/Controller/AdminPages/ManufacturerController.php +++ b/src/Controller/AdminPages/ManufacturerController.php @@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\ManufacturerControllerTest + */ #[Route(path: '/manufacturer')] class ManufacturerController extends BaseAdminController { diff --git a/src/Controller/AdminPages/MeasurementUnitController.php b/src/Controller/AdminPages/MeasurementUnitController.php index b8a566ec..993c5dad 100644 --- a/src/Controller/AdminPages/MeasurementUnitController.php +++ b/src/Controller/AdminPages/MeasurementUnitController.php @@ -36,6 +36,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\MeasurementUnitControllerTest + */ #[Route(path: '/measurement_unit')] class MeasurementUnitController extends BaseAdminController { diff --git a/src/Controller/AdminPages/StorelocationController.php b/src/Controller/AdminPages/StorelocationController.php index 36e8da34..7a9850ab 100644 --- a/src/Controller/AdminPages/StorelocationController.php +++ b/src/Controller/AdminPages/StorelocationController.php @@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\StorelocationControllerTest + */ #[Route(path: '/store_location')] class StorelocationController extends BaseAdminController { diff --git a/src/Controller/AdminPages/SupplierController.php b/src/Controller/AdminPages/SupplierController.php index c28a114d..4cd5e46b 100644 --- a/src/Controller/AdminPages/SupplierController.php +++ b/src/Controller/AdminPages/SupplierController.php @@ -35,6 +35,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; +/** + * @see \App\Tests\Controller\AdminPages\SupplierControllerTest + */ #[Route(path: '/supplier')] class SupplierController extends BaseAdminController { diff --git a/src/Controller/PartListsController.php b/src/Controller/PartListsController.php index 322d2ebf..83d29ca6 100644 --- a/src/Controller/PartListsController.php +++ b/src/Controller/PartListsController.php @@ -97,7 +97,7 @@ class PartListsController extends AbstractController $attrs['disabled'] = $disabled; $parent = $form->getParent(); - if (!$parent instanceof \Symfony\Component\Form\FormInterface) { + if (!$parent instanceof FormInterface) { throw new \RuntimeException('This function can only be used on form fields that are children of another form!'); } diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index 16bed9ea..aef346d9 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -30,6 +30,9 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @see \App\Tests\Controller\RedirectControllerTest + */ class RedirectController extends AbstractController { public function __construct(protected string $default_locale, protected TranslatorInterface $translator, protected bool $enforce_index_php) @@ -55,7 +58,7 @@ class RedirectController extends AbstractController //If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable()) - && !str_contains($new_url, 'index.php')) { + && !str_contains((string) $new_url, 'index.php')) { //Like Request::getUriForPath only with index.php $new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo(); } diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index f2c6253e..ae701ccd 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -36,6 +36,7 @@ use LogicException; /** * Class Attachment. + * @see \App\Tests\Entity\Attachments\AttachmentTest */ #[ORM\Entity(repositoryClass: AttachmentRepository::class)] #[ORM\InheritanceType('SINGLE_TABLE')] diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index ed59a2da..9bff255a 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -34,6 +34,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Class AttachmentType. + * @see \App\Tests\Entity\Attachments\AttachmentTypeTest */ #[ORM\Entity(repositoryClass: StructuralDBElementRepository::class)] #[ORM\Table(name: '`attachment_types`')] diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index a1dc80dd..6e82a47d 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -47,6 +47,7 @@ use Symfony\Component\Serializer\Annotation\Groups; * an attribute of a root element, you will get an exception! * * + * @see \App\Tests\Entity\Base\AbstractStructuralDBElementTest */ #[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')] #[ORM\MappedSuperclass(repositoryClass: StructuralDBElementRepository::class)] diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index 7cc064b7..f6176e4f 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -51,6 +51,7 @@ use App\Repository\LogEntryRepository; /** * This entity describes an entry in the event log. + * @see \App\Tests\Entity\LogSystem\AbstractLogEntryTest */ #[ORM\Entity(repositoryClass: LogEntryRepository::class)] #[ORM\Table('log')] diff --git a/src/Entity/Parameters/PartParameter.php b/src/Entity/Parameters/PartParameter.php index 36fc71fb..6c150e6b 100644 --- a/src/Entity/Parameters/PartParameter.php +++ b/src/Entity/Parameters/PartParameter.php @@ -47,6 +47,9 @@ use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; +/** + * @see \App\Tests\Entity\Parameters\PartParameterTest + */ #[UniqueEntity(fields: ['name', 'group', 'element'])] #[ORM\Entity(repositoryClass: ParameterRepository::class)] class PartParameter extends AbstractParameter diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index b8ff5abb..4fef18f2 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -49,6 +49,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * * The class properties are split over various traits in directory PartTraits. * Otherwise, this class would be too big, to be maintained. + * @see \App\Tests\Entity\Parts\PartTest */ #[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')] #[ORM\Entity(repositoryClass: PartRepository::class)] diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index 7bec9b9c..f6a9d404 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -42,6 +42,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * It is the connection between a part and its store locations. * * @ValidPartLot() + * @see \App\Tests\Entity\Parts\PartLotTest */ #[ORM\Entity] #[ORM\HasLifecycleCallbacks] diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index 5c4e84c5..998dfead 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -26,6 +26,7 @@ use Doctrine\ORM\Mapping as ORM; /** * This class is used to store the permissions of a user. * This has to be an embeddable or otherwise doctrine could not track the changes of the underlying data array (which is serialized to JSON in the database) + * @see \App\Tests\Entity\UserSystem\PermissionDataTest */ #[ORM\Embeddable] final class PermissionData implements \JsonSerializable diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index c1cd9a26..98665781 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -57,6 +57,7 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface /** * This entity represents a user, which can log in and have permissions. * Also, this entity is able to save some information about the user, like the names, email-address and other info. + * @see \App\Tests\Entity\UserSystem\UserTest */ #[UniqueEntity('name', message: 'validator.user.username_already_used')] #[ORM\Entity(repositoryClass: UserRepository::class)] diff --git a/src/Helpers/BBCodeToMarkdownConverter.php b/src/Helpers/BBCodeToMarkdownConverter.php index f800006b..922e6a7e 100644 --- a/src/Helpers/BBCodeToMarkdownConverter.php +++ b/src/Helpers/BBCodeToMarkdownConverter.php @@ -25,6 +25,9 @@ namespace App\Helpers; use League\HTMLToMarkdown\HtmlConverter; use s9e\TextFormatter\Bundles\Forum as TextFormatter; +/** + * @see \App\Tests\Helpers\BBCodeToMarkdownConverterTest + */ class BBCodeToMarkdownConverter { protected HtmlConverter $html_to_markdown; diff --git a/src/Helpers/Projects/ProjectBuildRequest.php b/src/Helpers/Projects/ProjectBuildRequest.php index f231c50f..29b5f14f 100644 --- a/src/Helpers/Projects/ProjectBuildRequest.php +++ b/src/Helpers/Projects/ProjectBuildRequest.php @@ -28,6 +28,7 @@ use App\Validator\Constraints\ProjectSystem\ValidProjectBuildRequest; /** * @ValidProjectBuildRequest() + * @see \App\Tests\Helpers\Projects\ProjectBuildRequestTest */ final class ProjectBuildRequest { diff --git a/src/Repository/NamedDBElementRepository.php b/src/Repository/NamedDBElementRepository.php index 8485d50a..2168d92d 100644 --- a/src/Repository/NamedDBElementRepository.php +++ b/src/Repository/NamedDBElementRepository.php @@ -26,6 +26,9 @@ use App\Entity\Base\AbstractNamedDBElement; use App\Entity\UserSystem\User; use App\Helpers\Trees\TreeViewNode; +/** + * @see \App\Tests\Repository\NamedDBElementRepositoryTest + */ class NamedDBElementRepository extends DBElementRepository { /** diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php index 19143def..0f2dcdea 100644 --- a/src/Repository/StructuralDBElementRepository.php +++ b/src/Repository/StructuralDBElementRepository.php @@ -27,6 +27,9 @@ use App\Helpers\Trees\StructuralDBElementIterator; use App\Helpers\Trees\TreeViewNode; use RecursiveIteratorIterator; +/** + * @see \App\Tests\Repository\StructuralDBElementRepositoryTest + */ class StructuralDBElementRepository extends NamedDBElementRepository { /** diff --git a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php index 0d80630d..674d7e26 100644 --- a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php +++ b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php @@ -27,6 +27,9 @@ use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @see \App\Tests\Security\EnsureSAMLUserForSAMLLoginCheckerTest + */ class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface { public function __construct(private readonly TranslatorInterface $translator) diff --git a/src/Security/SamlUserFactory.php b/src/Security/SamlUserFactory.php index 4bfefc88..924e4e5e 100644 --- a/src/Security/SamlUserFactory.php +++ b/src/Security/SamlUserFactory.php @@ -29,6 +29,9 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; use Symfony\Component\Security\Core\User\UserInterface; +/** + * @see \App\Tests\Security\SamlUserFactoryTest + */ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterface { private readonly array $saml_role_mapping; diff --git a/src/Security/UserChecker.php b/src/Security/UserChecker.php index 55fa3db3..fd53a295 100644 --- a/src/Security/UserChecker.php +++ b/src/Security/UserChecker.php @@ -29,6 +29,9 @@ use Symfony\Component\Security\Core\User\UserCheckerInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @see \App\Tests\Security\UserCheckerTest + */ final class UserChecker implements UserCheckerInterface { public function __construct(private readonly TranslatorInterface $translator) diff --git a/src/Serializer/BigNumberNormalizer.php b/src/Serializer/BigNumberNormalizer.php index 89826962..49477725 100644 --- a/src/Serializer/BigNumberNormalizer.php +++ b/src/Serializer/BigNumberNormalizer.php @@ -24,6 +24,9 @@ use Brick\Math\BigNumber; use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; +/** + * @see \App\Tests\Serializer\BigNumberNormalizerTest + */ class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface { diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 740d9861..58158cfe 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -32,6 +32,9 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +/** + * @see \App\Tests\Serializer\PartNormalizerTest + */ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface { private const DENORMALIZE_KEY_MAPPING = [ diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index 8de72fde..4212fd5d 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -27,6 +27,9 @@ use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +/** + * @see \App\Tests\Serializer\StructuralElementDenormalizerTest + */ class StructuralElementDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface { diff --git a/src/Serializer/StructuralElementFromNameDenormalizer.php b/src/Serializer/StructuralElementFromNameDenormalizer.php index 9de31048..662e3afa 100644 --- a/src/Serializer/StructuralElementFromNameDenormalizer.php +++ b/src/Serializer/StructuralElementFromNameDenormalizer.php @@ -26,6 +26,9 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +/** + * @see \App\Tests\Serializer\StructuralElementFromNameDenormalizerTest + */ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface { public function __construct(private readonly EntityManagerInterface $em) diff --git a/src/Serializer/StructuralElementNormalizer.php b/src/Serializer/StructuralElementNormalizer.php index fb6a42b1..aeae9aae 100644 --- a/src/Serializer/StructuralElementNormalizer.php +++ b/src/Serializer/StructuralElementNormalizer.php @@ -25,6 +25,9 @@ use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +/** + * @see \App\Tests\Serializer\StructuralElementNormalizerTest + */ class StructuralElementNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface { public function __construct(private readonly ObjectNormalizer $normalizer) diff --git a/src/Services/Attachments/AttachmentPathResolver.php b/src/Services/Attachments/AttachmentPathResolver.php index 116072b5..0628a6a9 100644 --- a/src/Services/Attachments/AttachmentPathResolver.php +++ b/src/Services/Attachments/AttachmentPathResolver.php @@ -29,6 +29,7 @@ use Symfony\Component\Filesystem\Filesystem; /** * This service converts the relative pathes for attachments saved in database (like %MEDIA%/img.jpg) to real pathes * an vice versa. + * @see \App\Tests\Services\Attachments\AttachmentPathResolverTest */ class AttachmentPathResolver { diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index c2a3b433..0efbf1e6 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -31,6 +31,9 @@ use function strlen; use Symfony\Component\Asset\Packages; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +/** + * @see \App\Tests\Services\Attachments\AttachmentURLGeneratorTest + */ class AttachmentURLGenerator { protected string $public_path; diff --git a/src/Services/Attachments/BuiltinAttachmentsFinder.php b/src/Services/Attachments/BuiltinAttachmentsFinder.php index f3f8740f..21be0730 100644 --- a/src/Services/Attachments/BuiltinAttachmentsFinder.php +++ b/src/Services/Attachments/BuiltinAttachmentsFinder.php @@ -30,6 +30,7 @@ use Symfony\Contracts\Cache\CacheInterface; /** * This service is used to find builtin attachment ressources. + * @see \App\Tests\Services\Attachments\BuiltinAttachmentsFinderTest */ class BuiltinAttachmentsFinder { @@ -57,7 +58,7 @@ class BuiltinAttachmentsFinder foreach($finder as $file) { $folder = $file->getRelativePath(); //Normalize path (replace \ with /) - $folder = str_replace('\\', '/', $folder); + $folder = str_replace('\\', '/', (string) $folder); if(!isset($output[$folder])) { $output[$folder] = []; diff --git a/src/Services/Attachments/FileTypeFilterTools.php b/src/Services/Attachments/FileTypeFilterTools.php index 948b429b..c7ef3ab1 100644 --- a/src/Services/Attachments/FileTypeFilterTools.php +++ b/src/Services/Attachments/FileTypeFilterTools.php @@ -32,6 +32,7 @@ use Symfony\Contracts\Cache\ItemInterface; * A service that helps to work with filetype filters (based on the format accept uses). * See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers for * more details. + * @see \App\Tests\Services\Attachments\FileTypeFilterToolsTest */ class FileTypeFilterTools { diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index dc8c94a6..2fb81c1b 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -49,6 +49,9 @@ use Doctrine\ORM\Mapping\Entity; use function get_class; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @see \App\Tests\Services\ElementTypeNameGeneratorTest + */ class ElementTypeNameGenerator { protected array $mapping; @@ -127,7 +130,7 @@ class ElementTypeNameGenerator { $type = $this->getLocalizedTypeLabel($entity); if ($use_html) { - return ''.$type.': '.htmlspecialchars($entity->getName()); + return ''.$type.': '.htmlspecialchars((string) $entity->getName()); } return $type.': '.$entity->getName(); diff --git a/src/Services/Formatters/AmountFormatter.php b/src/Services/Formatters/AmountFormatter.php index d092f2cd..73d59113 100644 --- a/src/Services/Formatters/AmountFormatter.php +++ b/src/Services/Formatters/AmountFormatter.php @@ -29,6 +29,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; /** * This service formats a part amount using a Measurement Unit. + * @see \App\Tests\Services\Formatters\AmountFormatterTest */ class AmountFormatter { diff --git a/src/Services/Formatters/SIFormatter.php b/src/Services/Formatters/SIFormatter.php index a6d69d0b..a6325987 100644 --- a/src/Services/Formatters/SIFormatter.php +++ b/src/Services/Formatters/SIFormatter.php @@ -24,6 +24,7 @@ namespace App\Services\Formatters; /** * A service that helps you to format values using the SI prefixes. + * @see \App\Tests\Services\Formatters\SIFormatterTest */ class SIFormatter { diff --git a/src/Services/ImportExportSystem/BOMImporter.php b/src/Services/ImportExportSystem/BOMImporter.php index 72103436..7227c419 100644 --- a/src/Services/ImportExportSystem/BOMImporter.php +++ b/src/Services/ImportExportSystem/BOMImporter.php @@ -27,6 +27,9 @@ use League\Csv\Reader; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\OptionsResolver\OptionsResolver; +/** + * @see \App\Tests\Services\ImportExportSystem\BOMImporterTest + */ class BOMImporter { diff --git a/src/Services/ImportExportSystem/EntityExporter.php b/src/Services/ImportExportSystem/EntityExporter.php index 89b0e946..50b6b7cc 100644 --- a/src/Services/ImportExportSystem/EntityExporter.php +++ b/src/Services/ImportExportSystem/EntityExporter.php @@ -36,6 +36,7 @@ use function Symfony\Component\String\u; /** * Use this class to export an entity to multiple file formats. + * @see \App\Tests\Services\ImportExportSystem\EntityExporterTest */ class EntityExporter { diff --git a/src/Services/ImportExportSystem/EntityImporter.php b/src/Services/ImportExportSystem/EntityImporter.php index 60d064f3..1aa50db5 100644 --- a/src/Services/ImportExportSystem/EntityImporter.php +++ b/src/Services/ImportExportSystem/EntityImporter.php @@ -36,6 +36,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; +/** + * @see \App\Tests\Services\ImportExportSystem\EntityImporterTest + */ class EntityImporter { public function __construct(protected SerializerInterface $serializer, protected EntityManagerInterface $em, protected ValidatorInterface $validator) diff --git a/src/Services/LabelSystem/BarcodeGenerator.php b/src/Services/LabelSystem/BarcodeGenerator.php index 90cbc5d7..b8ab099e 100644 --- a/src/Services/LabelSystem/BarcodeGenerator.php +++ b/src/Services/LabelSystem/BarcodeGenerator.php @@ -48,6 +48,9 @@ use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator; use Com\Tecnick\Barcode\Barcode; use InvalidArgumentException; +/** + * @see \App\Tests\Services\LabelSystem\BarcodeGeneratorTest + */ final class BarcodeGenerator { public function __construct(private readonly BarcodeContentGenerator $barcodeContentGenerator) diff --git a/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php b/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php index 6930bd79..5acf98f1 100644 --- a/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php +++ b/src/Services/LabelSystem/Barcodes/BarcodeContentGenerator.php @@ -48,6 +48,9 @@ use App\Entity\Parts\Storelocation; use InvalidArgumentException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +/** + * @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeContentGeneratorTest + */ final class BarcodeContentGenerator { public const PREFIX_MAP = [ diff --git a/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php b/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php index 4e6d8cbd..a5b6cb5e 100644 --- a/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php +++ b/src/Services/LabelSystem/Barcodes/BarcodeNormalizer.php @@ -43,6 +43,9 @@ namespace App\Services\LabelSystem\Barcodes; use InvalidArgumentException; +/** + * @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeNormalizerTest + */ final class BarcodeNormalizer { private const PREFIX_TYPE_MAP = [ diff --git a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php index ba425483..0eba0ed4 100644 --- a/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php +++ b/src/Services/LabelSystem/Barcodes/BarcodeRedirector.php @@ -47,6 +47,9 @@ use Doctrine\ORM\EntityNotFoundException; use InvalidArgumentException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +/** + * @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeRedirectorTest + */ final class BarcodeRedirector { public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly EntityManagerInterface $em) diff --git a/src/Services/LabelSystem/LabelGenerator.php b/src/Services/LabelSystem/LabelGenerator.php index d5ae2718..9f5d666b 100644 --- a/src/Services/LabelSystem/LabelGenerator.php +++ b/src/Services/LabelSystem/LabelGenerator.php @@ -48,6 +48,9 @@ use App\Entity\Parts\Storelocation; use Dompdf\Dompdf; use InvalidArgumentException; +/** + * @see \App\Tests\Services\LabelSystem\LabelGeneratorTest + */ final class LabelGenerator { public const CLASS_SUPPORT_MAPPING = [ diff --git a/src/Services/LabelSystem/LabelTextReplacer.php b/src/Services/LabelSystem/LabelTextReplacer.php index 3c0b5f92..e352729c 100644 --- a/src/Services/LabelSystem/LabelTextReplacer.php +++ b/src/Services/LabelSystem/LabelTextReplacer.php @@ -46,6 +46,7 @@ use App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface; /** * This service replaces the Placeholders of the user provided lines with the proper informations. * It uses the PlaceholderProviders provided by PlaceholderProviderInterface classes. + * @see \App\Tests\Services\LabelSystem\LabelTextReplacerTest */ final class LabelTextReplacer { diff --git a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php index 1678bda1..5a9b2294 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php +++ b/src/Services/LabelSystem/PlaceholderProviders/GlobalProviders.php @@ -50,6 +50,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** * Provides Placeholders for infos about global infos like Installation name or datetimes. + * @see \App\Tests\Services\LabelSystem\PlaceholderProviders\GlobalProvidersTest */ final class GlobalProviders implements PlaceholderProviderInterface { diff --git a/src/Services/LabelSystem/PlaceholderProviders/NamedElementProvider.php b/src/Services/LabelSystem/PlaceholderProviders/NamedElementProvider.php index fc5fedfe..d8d38120 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/NamedElementProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/NamedElementProvider.php @@ -43,6 +43,9 @@ namespace App\Services\LabelSystem\PlaceholderProviders; use App\Entity\Contracts\NamedElementInterface; +/** + * @see \App\Tests\Services\LabelSystem\PlaceholderProviders\NamedElementProviderTest + */ final class NamedElementProvider implements PlaceholderProviderInterface { public function replace(string $placeholder, object $label_target, array $options = []): ?string diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php index f7ff0b45..fb9447ba 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/PartLotProvider.php @@ -49,6 +49,9 @@ use App\Services\LabelSystem\LabelTextReplacer; use IntlDateFormatter; use Locale; +/** + * @see \App\Tests\Services\LabelSystem\PlaceholderProviders\PartLotProviderTest + */ final class PartLotProvider implements PlaceholderProviderInterface { public function __construct(private readonly LabelTextReplacer $labelTextReplacer, private readonly AmountFormatter $amountFormatter) diff --git a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php index dbbe6263..4174c623 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/PartProvider.php @@ -49,6 +49,9 @@ use App\Services\Formatters\SIFormatter; use Parsedown; use Symfony\Contracts\Translation\TranslatorInterface; +/** + * @see \App\Tests\Services\LabelSystem\PlaceholderProviders\PartProviderTest + */ final class PartProvider implements PlaceholderProviderInterface { public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator) diff --git a/src/Services/LabelSystem/PlaceholderProviders/TimestampableElementProvider.php b/src/Services/LabelSystem/PlaceholderProviders/TimestampableElementProvider.php index ef5967b2..8588e133 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/TimestampableElementProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/TimestampableElementProvider.php @@ -46,6 +46,9 @@ use DateTime; use IntlDateFormatter; use Locale; +/** + * @see \App\Tests\Services\LabelSystem\PlaceholderProviders\TimestampableElementProviderTest + */ final class TimestampableElementProvider implements PlaceholderProviderInterface { public function replace(string $placeholder, object $label_target, array $options = []): ?string diff --git a/src/Services/LabelSystem/SandboxedTwigProvider.php b/src/Services/LabelSystem/SandboxedTwigProvider.php index 39b47bfb..6c1bbce1 100644 --- a/src/Services/LabelSystem/SandboxedTwigProvider.php +++ b/src/Services/LabelSystem/SandboxedTwigProvider.php @@ -68,6 +68,9 @@ use Twig\Extra\Intl\IntlExtension; use Twig\Loader\ArrayLoader; use Twig\Sandbox\SecurityPolicyInterface; +/** + * @see \App\Tests\Services\LabelSystem\SandboxedTwigProviderTest + */ final class SandboxedTwigProvider { private const ALLOWED_TAGS = ['apply', 'autoescape', 'do', 'for', 'if', 'set', 'verbatim', 'with']; diff --git a/src/Services/LogSystem/EventCommentHelper.php b/src/Services/LogSystem/EventCommentHelper.php index cf06b724..45e95b2c 100644 --- a/src/Services/LogSystem/EventCommentHelper.php +++ b/src/Services/LogSystem/EventCommentHelper.php @@ -41,6 +41,9 @@ declare(strict_types=1); namespace App\Services\LogSystem; +/** + * @see \App\Tests\Services\LogSystem\EventCommentHelperTest + */ class EventCommentHelper { protected const MAX_MESSAGE_LENGTH = 255; diff --git a/src/Services/LogSystem/EventCommentNeededHelper.php b/src/Services/LogSystem/EventCommentNeededHelper.php index 23e22072..3738b330 100644 --- a/src/Services/LogSystem/EventCommentNeededHelper.php +++ b/src/Services/LogSystem/EventCommentNeededHelper.php @@ -23,6 +23,7 @@ namespace App\Services\LogSystem; /** * This service is used to check if a log change comment is needed for a given operation type. * It is configured using the "enforce_change_comments_for" config parameter. + * @see \App\Tests\Services\LogSystem\EventCommentNeededHelperTest */ class EventCommentNeededHelper { diff --git a/src/Services/LogSystem/EventLogger.php b/src/Services/LogSystem/EventLogger.php index 82e2df3a..909c5ab2 100644 --- a/src/Services/LogSystem/EventLogger.php +++ b/src/Services/LogSystem/EventLogger.php @@ -29,6 +29,9 @@ use App\Entity\UserSystem\User; use App\Services\Misc\ConsoleInfoHelper; use Doctrine\ORM\EntityManagerInterface; +/** + * @see \App\Tests\Services\LogSystem\EventLoggerTest + */ class EventLogger { public function __construct(protected int $minimum_log_level, protected array $blacklist, protected array $whitelist, protected EntityManagerInterface $em, protected Security $security, protected ConsoleInfoHelper $console_info_helper) diff --git a/src/Services/Misc/FAIconGenerator.php b/src/Services/Misc/FAIconGenerator.php index b8ee4481..997e9f39 100644 --- a/src/Services/Misc/FAIconGenerator.php +++ b/src/Services/Misc/FAIconGenerator.php @@ -26,6 +26,9 @@ use App\Entity\Attachments\Attachment; use function in_array; use InvalidArgumentException; +/** + * @see \App\Tests\Services\Misc\FAIconGeneratorTest + */ class FAIconGenerator { protected const EXT_MAPPING = [ diff --git a/src/Services/Misc/RangeParser.php b/src/Services/Misc/RangeParser.php index ddd4fd3b..2ff98477 100644 --- a/src/Services/Misc/RangeParser.php +++ b/src/Services/Misc/RangeParser.php @@ -45,6 +45,7 @@ use InvalidArgumentException; /** * This Parser allows to parse number ranges like 1-3, 4, 5. + * @see \App\Tests\Services\Misc\RangeParserTest */ class RangeParser { diff --git a/src/Services/Parameters/ParameterExtractor.php b/src/Services/Parameters/ParameterExtractor.php index 3257d96d..077101c8 100644 --- a/src/Services/Parameters/ParameterExtractor.php +++ b/src/Services/Parameters/ParameterExtractor.php @@ -47,6 +47,9 @@ use InvalidArgumentException; use function preg_match; +/** + * @see \App\Tests\Services\Parameters\ParameterExtractorTest + */ class ParameterExtractor { protected const ALLOWED_PARAM_SEPARATORS = [', ', "\n"]; diff --git a/src/Services/Parts/PartLotWithdrawAddHelper.php b/src/Services/Parts/PartLotWithdrawAddHelper.php index 9ffbbbe9..07f4bc04 100644 --- a/src/Services/Parts/PartLotWithdrawAddHelper.php +++ b/src/Services/Parts/PartLotWithdrawAddHelper.php @@ -8,6 +8,9 @@ use App\Entity\Parts\PartLot; use App\Services\LogSystem\EventCommentHelper; use App\Services\LogSystem\EventLogger; +/** + * @see \App\Tests\Services\Parts\PartLotWithdrawAddHelperTest + */ final class PartLotWithdrawAddHelper { public function __construct(private readonly EventLogger $eventLogger, private readonly EventCommentHelper $eventCommentHelper) diff --git a/src/Services/Parts/PricedetailHelper.php b/src/Services/Parts/PricedetailHelper.php index d989593d..092cc278 100644 --- a/src/Services/Parts/PricedetailHelper.php +++ b/src/Services/Parts/PricedetailHelper.php @@ -32,6 +32,9 @@ use Locale; use function count; +/** + * @see \App\Tests\Services\Parts\PricedetailHelperTest + */ class PricedetailHelper { protected string $locale; @@ -54,7 +57,7 @@ class PricedetailHelper foreach ($orderdetails as $orderdetail) { $pricedetails = $orderdetail->getPricedetails(); //The orderdetail must have pricedetails, otherwise this will not work! - if (0 === count($pricedetails)) { + if (0 === (is_countable($pricedetails) ? count($pricedetails) : 0)) { continue; } @@ -99,7 +102,7 @@ class PricedetailHelper foreach ($orderdetails as $orderdetail) { $pricedetails = $orderdetail->getPricedetails(); //The orderdetail must have pricedetails, otherwise this will not work! - if (0 === count($pricedetails)) { + if (0 === (is_countable($pricedetails) ? count($pricedetails) : 0)) { continue; } diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php index 1ca2d0e8..b9ffc374 100644 --- a/src/Services/ProjectSystem/ProjectBuildHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildHelper.php @@ -26,6 +26,9 @@ use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Helpers\Projects\ProjectBuildRequest; use App\Services\Parts\PartLotWithdrawAddHelper; +/** + * @see \App\Tests\Services\ProjectSystem\ProjectBuildHelperTest + */ class ProjectBuildHelper { public function __construct(private readonly PartLotWithdrawAddHelper $withdraw_add_helper) diff --git a/src/Services/ProjectSystem/ProjectBuildPartHelper.php b/src/Services/ProjectSystem/ProjectBuildPartHelper.php index 80ab9395..446f5f55 100644 --- a/src/Services/ProjectSystem/ProjectBuildPartHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildPartHelper.php @@ -5,6 +5,9 @@ namespace App\Services\ProjectSystem; use App\Entity\Parts\Part; use App\Entity\ProjectSystem\Project; +/** + * @see \App\Tests\Services\ProjectSystem\ProjectBuildPartHelperTest + */ class ProjectBuildPartHelper { /** diff --git a/src/Services/Trees/NodesListBuilder.php b/src/Services/Trees/NodesListBuilder.php index 0196b215..49c0aa6b 100644 --- a/src/Services/Trees/NodesListBuilder.php +++ b/src/Services/Trees/NodesListBuilder.php @@ -31,6 +31,7 @@ use Symfony\Contracts\Cache\TagAwareCacheInterface; /** * This service gives you a flat list containing all structured entities in the order of the structure. + * @see \App\Tests\Services\Trees\NodesListBuilderTest */ class NodesListBuilder { diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index 1ee0647b..dd2db178 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -45,6 +45,9 @@ use Symfony\Contracts\Translation\TranslatorInterface; use function count; +/** + * @see \App\Tests\Services\Trees\TreeViewGeneratorTest + */ class TreeViewGenerator { public function __construct(protected EntityURLGenerator $urlGenerator, protected EntityManagerInterface $em, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected TranslatorInterface $translator, protected bool $rootNodeExpandedByDefault, protected bool $rootNodeEnabled) @@ -130,43 +133,29 @@ class TreeViewGenerator protected function entityClassToRootNodeString(string $class): string { - switch ($class) { - case Category::class: - return $this->translator->trans('category.labelp'); - case Storelocation::class: - return $this->translator->trans('storelocation.labelp'); - case Footprint::class: - return $this->translator->trans('footprint.labelp'); - case Manufacturer::class: - return $this->translator->trans('manufacturer.labelp'); - case Supplier::class: - return $this->translator->trans('supplier.labelp'); - case Project::class: - return $this->translator->trans('project.labelp'); - default: - return $this->translator->trans('tree.root_node.text'); - } + return match ($class) { + Category::class => $this->translator->trans('category.labelp'), + Storelocation::class => $this->translator->trans('storelocation.labelp'), + Footprint::class => $this->translator->trans('footprint.labelp'), + Manufacturer::class => $this->translator->trans('manufacturer.labelp'), + Supplier::class => $this->translator->trans('supplier.labelp'), + Project::class => $this->translator->trans('project.labelp'), + default => $this->translator->trans('tree.root_node.text'), + }; } protected function entityClassToRootNodeIcon(string $class): ?string { $icon = "fa-fw fa-treeview fa-solid "; - switch ($class) { - case Category::class: - return $icon . 'fa-tags'; - case Storelocation::class: - return $icon . 'fa-cube'; - case Footprint::class: - return $icon . 'fa-microchip'; - case Manufacturer::class: - return $icon . 'fa-industry'; - case Supplier::class: - return $icon . 'fa-truck'; - case Project::class: - return $icon . 'fa-archive'; - default: - return null; - } + return match ($class) { + Category::class => $icon . 'fa-tags', + Storelocation::class => $icon . 'fa-cube', + Footprint::class => $icon . 'fa-microchip', + Manufacturer::class => $icon . 'fa-industry', + Supplier::class => $icon . 'fa-truck', + Project::class => $icon . 'fa-archive', + default => null, + }; } /** diff --git a/src/Services/UserSystem/PermissionManager.php b/src/Services/UserSystem/PermissionManager.php index ae3764d8..333e6168 100644 --- a/src/Services/UserSystem/PermissionManager.php +++ b/src/Services/UserSystem/PermissionManager.php @@ -37,6 +37,7 @@ use Symfony\Component\Yaml\Yaml; * This class manages the permissions of users and groups. * Permissions are defined in the config/permissions.yaml file, and are parsed and resolved by this class using the * user and hierachical group PermissionData information. + * @see \App\Tests\Services\UserSystem\PermissionManagerTest */ class PermissionManager { diff --git a/src/Services/UserSystem/PermissionSchemaUpdater.php b/src/Services/UserSystem/PermissionSchemaUpdater.php index 3c12d042..b939fa86 100644 --- a/src/Services/UserSystem/PermissionSchemaUpdater.php +++ b/src/Services/UserSystem/PermissionSchemaUpdater.php @@ -25,6 +25,9 @@ use App\Entity\UserSystem\PermissionData; use App\Entity\UserSystem\User; use App\Security\Interfaces\HasPermissionsInterface; +/** + * @see \App\Tests\Services\UserSystem\PermissionSchemaUpdaterTest + */ class PermissionSchemaUpdater { /** diff --git a/src/Services/UserSystem/TFA/BackupCodeGenerator.php b/src/Services/UserSystem/TFA/BackupCodeGenerator.php index 9beddf39..a13b9804 100644 --- a/src/Services/UserSystem/TFA/BackupCodeGenerator.php +++ b/src/Services/UserSystem/TFA/BackupCodeGenerator.php @@ -27,6 +27,7 @@ use RuntimeException; /** * This class generates random backup codes for two-factor authentication. + * @see \App\Tests\Services\UserSystem\TFA\BackupCodeGeneratorTest */ class BackupCodeGenerator { diff --git a/src/Services/UserSystem/TFA/BackupCodeManager.php b/src/Services/UserSystem/TFA/BackupCodeManager.php index 1fb572c6..70226946 100644 --- a/src/Services/UserSystem/TFA/BackupCodeManager.php +++ b/src/Services/UserSystem/TFA/BackupCodeManager.php @@ -26,6 +26,7 @@ use App\Entity\UserSystem\User; /** * This services offers methods to manage backup codes for two-factor authentication. + * @see \App\Tests\Services\UserSystem\TFA\BackupCodeManagerTest */ class BackupCodeManager { diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php index 393c4040..92d69631 100644 --- a/src/Twig/EntityExtension.php +++ b/src/Twig/EntityExtension.php @@ -42,6 +42,9 @@ use Twig\Extension\AbstractExtension; use Twig\TwigFunction; use Twig\TwigTest; +/** + * @see \App\Tests\Twig\EntityExtensionTest + */ final class EntityExtension extends AbstractExtension { public function __construct(protected EntityURLGenerator $entityURLGenerator, protected TreeViewGenerator $treeBuilder, private readonly ElementTypeNameGenerator $nameGenerator) diff --git a/src/Twig/TwigCoreExtension.php b/src/Twig/TwigCoreExtension.php index dc63b2e1..d4b14c83 100644 --- a/src/Twig/TwigCoreExtension.php +++ b/src/Twig/TwigCoreExtension.php @@ -27,6 +27,7 @@ use Twig\TwigTest; /** * The functionalities here extend the Twig with some core functions, which are independently of Part-DB. + * @see \App\Tests\Twig\TwigCoreExtensionTest */ final class TwigCoreExtension extends AbstractExtension { diff --git a/src/Twig/UserExtension.php b/src/Twig/UserExtension.php index 012f975c..be5d3c41 100644 --- a/src/Twig/UserExtension.php +++ b/src/Twig/UserExtension.php @@ -50,6 +50,9 @@ use Twig\Extension\AbstractExtension; use Twig\TwigFilter; use Twig\TwigFunction; +/** + * @see \App\Tests\Twig\UserExtensionTest + */ final class UserExtension extends AbstractExtension { private readonly LogEntryRepository $repo; From fcbb1849ecb2c84c101ae6c312d74b6d3e62cba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 15:15:55 +0200 Subject: [PATCH 41/91] Applied rectors phpunit 9 migrations to tests --- rector.php | 1 - .../Filters/CompoundFilterTraitTest.php | 3 ++ .../Entity/UserSystem/PermissionDataTest.php | 4 +- .../Helpers/BBCodeToMarkdownConverterTest.php | 18 +++---- .../Projects/ProjectBuildRequestTest.php | 22 ++++---- tests/Security/SamlUserFactoryTest.php | 16 +++--- .../AttachmentURLGeneratorTest.php | 14 +++--- .../BuiltinAttachmentsFinderTest.php | 21 +++----- .../ImportExportSystem/BOMImporterTest.php | 8 +-- .../Barcodes/BarcodeNormalizerTest.php | 50 +++++++++---------- .../AbstractElementProviderTest.php | 6 +-- .../GlobalProvidersTest.php | 8 ++- .../NamedElementProviderTest.php | 6 +-- .../PartLotProviderTest.php | 28 +++++------ .../PlaceholderProviders/PartProviderTest.php | 33 ++++++------ .../TimestampableElementProviderTest.php | 9 ++-- tests/Services/Misc/RangeParserTest.php | 44 ++++++++-------- .../Parts/PartLotWithdrawAddHelperTest.php | 18 +++---- .../ProjectSystem/ProjectBuildHelperTest.php | 10 ++-- .../PermissionSchemaUpdaterTest.php | 2 +- tests/Twig/EntityExtensionTest.php | 26 +++++----- tests/Twig/UserExtensionTest.php | 2 +- 22 files changed, 162 insertions(+), 187 deletions(-) diff --git a/rector.php b/rector.php index db559491..dbcefaf6 100644 --- a/rector.php +++ b/rector.php @@ -47,7 +47,6 @@ return static function (RectorConfig $rectorConfig): void { //PHPUnit rules PHPUnitLevelSetList::UP_TO_PHPUNIT_90, - PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); }; diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index e73e639a..e52911eb 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -75,6 +75,9 @@ class CompoundFilterTraitTest extends TestCase ], $result); } + /** + * @doesNotPerformAssertions + */ public function testApplyAllChildFilters(): void { $f1 = $this->createMock(FilterInterface::class); diff --git a/tests/Entity/UserSystem/PermissionDataTest.php b/tests/Entity/UserSystem/PermissionDataTest.php index 0536cd5b..d1f0ed59 100644 --- a/tests/Entity/UserSystem/PermissionDataTest.php +++ b/tests/Entity/UserSystem/PermissionDataTest.php @@ -152,11 +152,11 @@ class PermissionDataTest extends TestCase $data = new PermissionData(); //By default the schema version must be the CURRENT_SCHEMA_VERSION - $this->assertEquals(PermissionData::CURRENT_SCHEMA_VERSION, $data->getSchemaVersion()); + $this->assertSame(PermissionData::CURRENT_SCHEMA_VERSION, $data->getSchemaVersion()); //Ensure that the schema version can be set $data->setSchemaVersion(12345); - $this->assertEquals(12345, $data->getSchemaVersion()); + $this->assertSame(12345, $data->getSchemaVersion()); } public function testIsAnyOperationOfPermissionSet(): void diff --git a/tests/Helpers/BBCodeToMarkdownConverterTest.php b/tests/Helpers/BBCodeToMarkdownConverterTest.php index a4703d95..093ff98f 100644 --- a/tests/Helpers/BBCodeToMarkdownConverterTest.php +++ b/tests/Helpers/BBCodeToMarkdownConverterTest.php @@ -34,17 +34,15 @@ class BBCodeToMarkdownConverterTest extends TestCase $this->converter = new BBCodeToMarkdownConverter(); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['[b]Bold[/b]', '**Bold**'], - ['[i]Italic[/i]', '*Italic*'], - ['[s]Strike[/s]', 'Strike'], - ['[url]https://foo.bar[/url]', ''], - ['[url=https://foo.bar]test[/url]', '[test](https://foo.bar)'], - ['[center]Centered[/center]', '
Centered
'], - ['test no change', 'test no change'], - ]; + yield ['[b]Bold[/b]', '**Bold**']; + yield ['[i]Italic[/i]', '*Italic*']; + yield ['[s]Strike[/s]', 'Strike']; + yield ['[url]https://foo.bar[/url]', '']; + yield ['[url=https://foo.bar]test[/url]', '[test](https://foo.bar)']; + yield ['[center]Centered[/center]', '
Centered
']; + yield ['test no change', 'test no change']; } /** diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index 8cc8dc2b..49bfede7 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -118,17 +118,17 @@ class ProjectBuildRequestTest extends TestCase //The values should be already prefilled correctly $request = new ProjectBuildRequest($this->project1, 10); //We need totally 20: Take 10 from the first (maximum 10) and 10 from the second (maximum 20) - $this->assertEquals(10, $request->getLotWithdrawAmount($this->lot1a)); - $this->assertEquals(10, $request->getLotWithdrawAmount($this->lot1b)); + $this->assertSame(10, $request->getLotWithdrawAmount($this->lot1a)); + $this->assertSame(10, $request->getLotWithdrawAmount($this->lot1b)); //If the needed amount is higher than the maximum, we should get the maximum - $this->assertEquals(2.5, $request->getLotWithdrawAmount($this->lot2)); + $this->assertSame(2.5, $request->getLotWithdrawAmount($this->lot2)); } public function testGetNumberOfBuilds(): void { $build_request = new ProjectBuildRequest($this->project1, 5); - $this->assertEquals(5, $build_request->getNumberOfBuilds()); + $this->assertSame(5, $build_request->getNumberOfBuilds()); } public function testGetProject(): void @@ -140,9 +140,9 @@ class ProjectBuildRequestTest extends TestCase public function testGetNeededAmountForBOMEntry(): void { $build_request = new ProjectBuildRequest($this->project1, 5); - $this->assertEquals(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a)); - $this->assertEquals(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b)); - $this->assertEquals(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c)); + $this->assertSame(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a)); + $this->assertSame(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b)); + $this->assertSame(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c)); } public function testGetSetLotWithdrawAmount(): void @@ -154,8 +154,8 @@ class ProjectBuildRequestTest extends TestCase $build_request->setLotWithdrawAmount($this->lot1b->getID(), 3); //And it should be possible to get the amount via the lot object or via the ID - $this->assertEquals(2, $build_request->getLotWithdrawAmount($this->lot1a->getID())); - $this->assertEquals(3, $build_request->getLotWithdrawAmount($this->lot1b)); + $this->assertSame(2, $build_request->getLotWithdrawAmount($this->lot1a->getID())); + $this->assertSame(3, $build_request->getLotWithdrawAmount($this->lot1b)); } public function testGetWithdrawAmountSum(): void @@ -166,9 +166,9 @@ class ProjectBuildRequestTest extends TestCase $build_request->setLotWithdrawAmount($this->lot1a, 2); $build_request->setLotWithdrawAmount($this->lot1b, 3); - $this->assertEquals(5, $build_request->getWithdrawAmountSum($this->bom_entry1a)); + $this->assertSame(5, $build_request->getWithdrawAmountSum($this->bom_entry1a)); $build_request->setLotWithdrawAmount($this->lot2, 1.5); - $this->assertEquals(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b)); + $this->assertSame(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b)); } diff --git a/tests/Security/SamlUserFactoryTest.php b/tests/Security/SamlUserFactoryTest.php index 57031c5d..663b8627 100644 --- a/tests/Security/SamlUserFactoryTest.php +++ b/tests/Security/SamlUserFactoryTest.php @@ -47,7 +47,7 @@ class SamlUserFactoryTest extends WebTestCase $this->assertInstanceOf(User::class, $user); - $this->assertEquals('sso_user', $user->getUserIdentifier()); + $this->assertSame('sso_user', $user->getUserIdentifier()); //User must not change his password $this->assertFalse($user->isNeedPwChange()); //And must not be disabled @@ -56,10 +56,10 @@ class SamlUserFactoryTest extends WebTestCase $this->assertSame('!!SAML!!', $user->getPassword()); //Info should be set - $this->assertEquals('John', $user->getFirstName()); - $this->assertEquals('Doe', $user->getLastName()); - $this->assertEquals('IT', $user->getDepartment()); - $this->assertEquals('j.doe@invalid.invalid', $user->getEmail()); + $this->assertSame('John', $user->getFirstName()); + $this->assertSame('Doe', $user->getLastName()); + $this->assertSame('IT', $user->getDepartment()); + $this->assertSame('j.doe@invalid.invalid', $user->getEmail()); } public function testMapSAMLRolesToLocalGroupID(): void @@ -80,10 +80,10 @@ class SamlUserFactoryTest extends WebTestCase $this->assertSame(1, $this->service->mapSAMLRolesToLocalGroupID(['employee', 'does_not_matter', 'manager'], $mapping)); $this->assertSame(3, $this->service->mapSAMLRolesToLocalGroupID(['administrator', 'does_not_matter', 'manager'], $mapping)); //Test if mapping is case-sensitive - $this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID(['ADMIN'], $mapping)); + $this->assertSame(4, $this->service->mapSAMLRolesToLocalGroupID(['ADMIN'], $mapping)); //Test that wildcard mapping works - $this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID(['entry1', 'entry2'], $mapping)); - $this->assertEquals(4, $this->service->mapSAMLRolesToLocalGroupID([], $mapping)); + $this->assertSame(4, $this->service->mapSAMLRolesToLocalGroupID(['entry1', 'entry2'], $mapping)); + $this->assertSame(4, $this->service->mapSAMLRolesToLocalGroupID([], $mapping)); } } diff --git a/tests/Services/Attachments/AttachmentURLGeneratorTest.php b/tests/Services/Attachments/AttachmentURLGeneratorTest.php index 9fac356f..0db57f29 100644 --- a/tests/Services/Attachments/AttachmentURLGeneratorTest.php +++ b/tests/Services/Attachments/AttachmentURLGeneratorTest.php @@ -38,15 +38,13 @@ class AttachmentURLGeneratorTest extends WebTestCase self::$service = self::getContainer()->get(AttachmentURLGenerator::class); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['/public/test.jpg', 'test.jpg'], - ['/public/folder/test.jpg', 'folder/test.jpg'], - ['/not/public/test.jpg', null], - ['/public/', ''], - ['not/absolute/test.jpg', null], - ]; + yield ['/public/test.jpg', 'test.jpg']; + yield ['/public/folder/test.jpg', 'folder/test.jpg']; + yield ['/not/public/test.jpg', null]; + yield ['/public/', '']; + yield ['not/absolute/test.jpg', null]; } /** diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php index 2ba317ed..5ca656e3 100644 --- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php +++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php @@ -43,20 +43,15 @@ class BuiltinAttachmentsFinderTest extends WebTestCase self::$service = self::getContainer()->get(BuiltinAttachmentsFinder::class); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - //No value should return empty array - ['', [], []], - ['', ['empty_returns_all' => true], static::$mock_list], - //Basic search for keyword - ['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']], - ['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']], - ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']], - //Filter extensions - //['test', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/123.jpeg', '%FOOTPRINTS_3D%/test.jpg']], - //['test.jpg', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS_3D%/test.jpg']] - ]; + //No value should return empty array + yield ['', [], []]; + yield ['', ['empty_returns_all' => true], static::$mock_list]; + //Basic search for keyword + yield ['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']]; + yield ['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']]; + yield ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']]; } /** diff --git a/tests/Services/ImportExportSystem/BOMImporterTest.php b/tests/Services/ImportExportSystem/BOMImporterTest.php index 194e23f1..1ccb8275 100644 --- a/tests/Services/ImportExportSystem/BOMImporterTest.php +++ b/tests/Services/ImportExportSystem/BOMImporterTest.php @@ -81,8 +81,8 @@ class BOMImporterTest extends WebTestCase $this->assertContainsOnlyInstancesOf(ProjectBOMEntry::class, $bom); $this->assertCount(4, $bom); - $this->assertEquals('R19,R17', $bom[0]->getMountnames()); - $this->assertEquals(2.0, $bom[0]->getQuantity()); + $this->assertSame('R19,R17', $bom[0]->getMountnames()); + $this->assertSame(2.0, $bom[0]->getQuantity()); $this->assertSame('4.7k (R_0805_2012Metric_Pad1.20x1.40mm_HandSolder)', $bom[0]->getName()); $this->assertSame('Test', $bom[0]->getComment()); @@ -100,8 +100,8 @@ class BOMImporterTest extends WebTestCase $this->assertContainsOnlyInstancesOf(ProjectBOMEntry::class, $bom); $this->assertCount(4, $bom); - $this->assertEquals('R19,R17', $bom[0]->getMountnames()); - $this->assertEquals(2.0, $bom[0]->getQuantity()); + $this->assertSame('R19,R17', $bom[0]->getMountnames()); + $this->assertSame(2.0, $bom[0]->getQuantity()); $this->assertSame('4.7k (R_0805_2012Metric_Pad1.20x1.40mm_HandSolder)', $bom[0]->getName()); $this->assertSame('Test', $bom[0]->getComment()); } diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php index c1a8ea11..45b50389 100644 --- a/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php +++ b/tests/Services/LabelSystem/Barcodes/BarcodeNormalizerTest.php @@ -57,33 +57,31 @@ class BarcodeNormalizerTest extends WebTestCase $this->service = self::getContainer()->get(BarcodeNormalizer::class); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - //QR URL content: - [['lot', 1], 'https://localhost:8000/scan/lot/1'], - [['part', 123], 'https://localhost:8000/scan/part/123'], - [['location', 4], 'http://foo.bar/part-db/scan/location/4'], - [['under_score', 10], 'http://test/part-db/sub/scan/under_score/10/'], - //Current Code39 format: - [['lot', 10], 'L0010'], - [['lot', 123], 'L0123'], - [['lot', 123456], 'L123456'], - [['part', 2], 'P0002'], - //Development phase Code39 barcodes: - [['lot', 10], 'L-000010'], - [['lot', 10], 'Lß000010'], - [['part', 123], 'P-000123'], - [['location', 123], 'S-000123'], - [['lot', 12_345_678], 'L-12345678'], - //Legacy storelocation format - [['location', 336], '$L00336'], - [['location', 12_345_678], '$L12345678'], - //Legacy Part format - [['part', 123], '0000123'], - [['part', 123], '00001236'], - [['part', 1_234_567], '12345678'], - ]; + //QR URL content: + yield [['lot', 1], 'https://localhost:8000/scan/lot/1']; + yield [['part', 123], 'https://localhost:8000/scan/part/123']; + yield [['location', 4], 'http://foo.bar/part-db/scan/location/4']; + yield [['under_score', 10], 'http://test/part-db/sub/scan/under_score/10/']; + //Current Code39 format: + yield [['lot', 10], 'L0010']; + yield [['lot', 123], 'L0123']; + yield [['lot', 123456], 'L123456']; + yield [['part', 2], 'P0002']; + //Development phase Code39 barcodes: + yield [['lot', 10], 'L-000010']; + yield [['lot', 10], 'Lß000010']; + yield [['part', 123], 'P-000123']; + yield [['location', 123], 'S-000123']; + yield [['lot', 12_345_678], 'L-12345678']; + //Legacy storelocation format + yield [['location', 336], '$L00336']; + yield [['location', 12_345_678], '$L12345678']; + //Legacy Part format + yield [['part', 123], '0000123']; + yield [['part', 123], '00001236']; + yield [['part', 1_234_567], '12345678']; } public function invalidDataProvider(): array diff --git a/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php index ee32ca94..3c40a9ac 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php @@ -63,11 +63,9 @@ class AbstractElementProviderTest extends WebTestCase }; } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['123', '[[ID]]'], - ]; + yield ['123', '[[ID]]']; } /** diff --git a/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php b/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php index 3a66aa87..854e7467 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php @@ -61,12 +61,10 @@ class GlobalProvidersTest extends WebTestCase $this->target = new Part(); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['Part-DB', '[[INSTALL_NAME]]'], - ['anonymous', '[[USERNAME]]'], - ]; + yield ['Part-DB', '[[INSTALL_NAME]]']; + yield ['anonymous', '[[USERNAME]]']; } /** diff --git a/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php index e5644515..7360b2d2 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php @@ -66,11 +66,9 @@ class NamedElementProviderTest extends WebTestCase }; } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['This is my Name', '[[NAME]]'], - ]; + yield ['This is my Name', '[[NAME]]']; } /** diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php index 83d7f3d9..537c6223 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php @@ -85,22 +85,20 @@ class PartLotProviderTest extends WebTestCase $this->target->setOwner($user); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['unknown', '[[LOT_ID]]'], - ['Lot description', '[[LOT_NAME]]'], - ['Lot comment', '[[LOT_COMMENT]]'], - ['4/13/99', '[[EXPIRATION_DATE]]'], - ['?', '[[AMOUNT]]'], - ['Location', '[[LOCATION]]'], - ['Parent → Location', '[[LOCATION_FULL]]'], - //Test part inheritance - ['Part', '[[NAME]]'], - ['Part description', '[[DESCRIPTION]]'], - ['John Doe', '[[OWNER]]'], - ['user', '[[OWNER_USERNAME]]'], - ]; + yield ['unknown', '[[LOT_ID]]']; + yield ['Lot description', '[[LOT_NAME]]']; + yield ['Lot comment', '[[LOT_COMMENT]]']; + yield ['4/13/99', '[[EXPIRATION_DATE]]']; + yield ['?', '[[AMOUNT]]']; + yield ['Location', '[[LOCATION]]']; + yield ['Parent → Location', '[[LOCATION_FULL]]']; + //Test part inheritance + yield ['Part', '[[NAME]]']; + yield ['Part description', '[[DESCRIPTION]]']; + yield ['John Doe', '[[OWNER]]']; + yield ['user', '[[OWNER_USERNAME]]']; } /** diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php index 51584edc..975a5fd5 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php @@ -86,25 +86,22 @@ class PartProviderTest extends WebTestCase $this->target->setComment('Bold *Italic*'); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - ['Node 2.1', '[[CATEGORY]]'], - ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]'], - ['Node 2.1', '[[FOOTPRINT]]'], - ['Node 2 → Node 2.1', '[[FOOTPRINT_FULL]]'], - ['', '[[MANUFACTURER]]'], - ['', '[[MANUFACTURER_FULL]]'], - - ['1.2 kg', '[[MASS]]'], - ['MPN123', '[[MPN]]'], - ['SMD, Tag1, Tag2', '[[TAGS]]'], - ['Active', '[[M_STATUS]]'], - ['Bold Italic', '[[DESCRIPTION]]'], - ['Bold Italic', '[[DESCRIPTION_T]]'], - ['Bold Italic', '[[COMMENT]]'], - ['Bold Italic', '[[COMMENT_T]]'], - ]; + yield ['Node 2.1', '[[CATEGORY]]']; + yield ['Node 2 → Node 2.1', '[[CATEGORY_FULL]]']; + yield ['Node 2.1', '[[FOOTPRINT]]']; + yield ['Node 2 → Node 2.1', '[[FOOTPRINT_FULL]]']; + yield ['', '[[MANUFACTURER]]']; + yield ['', '[[MANUFACTURER_FULL]]']; + yield ['1.2 kg', '[[MASS]]']; + yield ['MPN123', '[[MPN]]']; + yield ['SMD, Tag1, Tag2', '[[TAGS]]']; + yield ['Active', '[[M_STATUS]]']; + yield ['Bold Italic', '[[DESCRIPTION]]']; + yield ['Bold Italic', '[[DESCRIPTION_T]]']; + yield ['Bold Italic', '[[COMMENT]]']; + yield ['Bold Italic', '[[COMMENT_T]]']; } /** diff --git a/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php index 79b9a95f..07bb4270 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php @@ -74,14 +74,11 @@ class TimestampableElementProviderTest extends WebTestCase }; } - public function dataProvider(): array + public function dataProvider(): \Iterator { \Locale::setDefault('en'); - - return [ - ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]'], - ['1/1/00, 12:00 AM', '[[CREATION_DATE]]'], - ]; + yield ['1/1/00, 12:00 AM', '[[LAST_MODIFIED]]']; + yield ['1/1/00, 12:00 AM', '[[CREATION_DATE]]']; } /** diff --git a/tests/Services/Misc/RangeParserTest.php b/tests/Services/Misc/RangeParserTest.php index 2ffa5f04..27f45e98 100644 --- a/tests/Services/Misc/RangeParserTest.php +++ b/tests/Services/Misc/RangeParserTest.php @@ -57,30 +57,28 @@ class RangeParserTest extends WebTestCase $this->service = self::getContainer()->get(RangeParser::class); } - public function dataProvider(): array + public function dataProvider(): \Iterator { - return [ - [[], ''], - [[], ' '], - [[], "\t"], - [[1], '1'], - [[1, 2, 3], '1,2, 3'], - [[1, 2, 3], '1-3'], - [[1, 2, 3, 4], '1- 3, 4'], - [[1, 2, 3, 4], '1, 2,3 - 4'], - [[1, 2, 3], ' 1; 2, 3'], - [[-1, 0, 1, 2], '-1; 0; 1, 2'], - [[4, 3, 1, 2], '4,3, 1;2'], - [[1, 2, 3, 4], '2-1, 3-4'], - [[1], '1-1'], - [[-3, -2, -1], '-3--1'], - [[1, 2, 3], '1,,2;;,,3'], - [[100, 1000, 1], '100, 1000, 1'], - [[], 'test', true], - [[], '1-2-3-4,5', true], - [[], '1 2 3, 455, 23', true], - [[], '1, 2, test', true], - ]; + yield [[], '']; + yield [[], ' ']; + yield [[], "\t"]; + yield [[1], '1']; + yield [[1, 2, 3], '1,2, 3']; + yield [[1, 2, 3], '1-3']; + yield [[1, 2, 3, 4], '1- 3, 4']; + yield [[1, 2, 3, 4], '1, 2,3 - 4']; + yield [[1, 2, 3], ' 1; 2, 3']; + yield [[-1, 0, 1, 2], '-1; 0; 1, 2']; + yield [[4, 3, 1, 2], '4,3, 1;2']; + yield [[1, 2, 3, 4], '2-1, 3-4']; + yield [[1], '1-1']; + yield [[-3, -2, -1], '-3--1']; + yield [[1, 2, 3], '1,,2;;,,3']; + yield [[100, 1000, 1], '100, 1000, 1']; + yield [[], 'test', true]; + yield [[], '1-2-3-4,5', true]; + yield [[], '1 2 3, 455, 23', true]; + yield [[], '1, 2, test', true]; } public function validDataProvider(): array diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index e3f76785..090ccdfb 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -117,15 +117,15 @@ class PartLotWithdrawAddHelperTest extends WebTestCase { //Add 5 to lot 1 $this->service->add($this->partLot1, 5, "Test"); - $this->assertEquals(15, $this->partLot1->getAmount()); + $this->assertSame(15, $this->partLot1->getAmount()); //Add 3.2 to lot 2 $this->service->add($this->partLot2, 3.2, "Test"); - $this->assertEquals(5, $this->partLot2->getAmount()); + $this->assertSame(5, $this->partLot2->getAmount()); //Add 1.5 to lot 3 $this->service->add($this->partLot3, 1.5, "Test"); - $this->assertEquals(2, $this->partLot3->getAmount()); + $this->assertSame(2, $this->partLot3->getAmount()); } @@ -133,23 +133,23 @@ class PartLotWithdrawAddHelperTest extends WebTestCase { //Withdraw 5 from lot 1 $this->service->withdraw($this->partLot1, 5, "Test"); - $this->assertEquals(5, $this->partLot1->getAmount()); + $this->assertSame(5, $this->partLot1->getAmount()); //Withdraw 2.2 from lot 2 $this->service->withdraw($this->partLot2, 2.2, "Test"); - $this->assertEquals(0, $this->partLot2->getAmount()); + $this->assertSame(0, $this->partLot2->getAmount()); } public function testMove(): void { //Move 5 from lot 1 to lot 2 $this->service->move($this->partLot1, $this->partLot2, 5, "Test"); - $this->assertEquals(5, $this->partLot1->getAmount()); - $this->assertEquals(7, $this->partLot2->getAmount()); + $this->assertSame(5, $this->partLot1->getAmount()); + $this->assertSame(7, $this->partLot2->getAmount()); //Move 2.2 from lot 2 to lot 3 $this->service->move($this->partLot2, $this->partLot3, 2.2, "Test"); - $this->assertEquals(5, $this->partLot2->getAmount()); - $this->assertEquals(2, $this->partLot3->getAmount()); + $this->assertSame(5, $this->partLot2->getAmount()); + $this->assertSame(2, $this->partLot3->getAmount()); } } diff --git a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php index ef249deb..71a0c999 100644 --- a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php +++ b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php @@ -65,12 +65,12 @@ class ProjectBuildHelperTest extends WebTestCase $project_bom_entry->setPart($part); //We have 125 parts in stock, so we can build 12 times the project (125 / 10 = 12.5) - $this->assertEquals(12, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry)); + $this->assertSame(12, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry)); $lot1->setAmount(0); //We have 5 parts in stock, so we can build 0 times the project (5 / 10 = 0.5) - $this->assertEquals(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry)); + $this->assertSame(0, $this->service->getMaximumBuildableCountForBOMEntry($project_bom_entry)); } public function testGetMaximumBuildableCount(): void @@ -101,15 +101,15 @@ class ProjectBuildHelperTest extends WebTestCase $project->addBomEntry((new ProjectBOMEntry())->setName('Non part entry')->setQuantity(1)); //Restricted by the few parts in stock of part2 - $this->assertEquals(2, $this->service->getMaximumBuildableCount($project)); + $this->assertSame(2, $this->service->getMaximumBuildableCount($project)); $lot3->setAmount(1000); //Now the build count is restricted by the few parts in stock of part1 - $this->assertEquals(12, $this->service->getMaximumBuildableCount($project)); + $this->assertSame(12, $this->service->getMaximumBuildableCount($project)); $lot3->setAmount(0); //Now the build count must be 0, as we have no parts in stock - $this->assertEquals(0, $this->service->getMaximumBuildableCount($project)); + $this->assertSame(0, $this->service->getMaximumBuildableCount($project)); } } diff --git a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php index 249c8f46..82376298 100644 --- a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php +++ b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php @@ -73,7 +73,7 @@ class PermissionSchemaUpdaterTest extends WebTestCase //With schema version 0, an update should be done and the schema version should be updated self::assertTrue($this->service->upgradeSchema($user)); - self::assertEquals(PermissionData::CURRENT_SCHEMA_VERSION, $user->getPermissions()->getSchemaVersion()); + self::assertSame(PermissionData::CURRENT_SCHEMA_VERSION, $user->getPermissions()->getSchemaVersion()); //If we redo it with the same schema version, no update should be done self::assertFalse($this->service->upgradeSchema($user)); diff --git a/tests/Twig/EntityExtensionTest.php b/tests/Twig/EntityExtensionTest.php index 99ad8428..530047ef 100644 --- a/tests/Twig/EntityExtensionTest.php +++ b/tests/Twig/EntityExtensionTest.php @@ -52,19 +52,19 @@ class EntityExtensionTest extends WebTestCase public function testGetEntityType(): void { - $this->assertEquals('part', $this->service->getEntityType(new Part())); - $this->assertEquals('footprint', $this->service->getEntityType(new Footprint())); - $this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation())); - $this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer())); - $this->assertEquals('category', $this->service->getEntityType(new Category())); - $this->assertEquals('device', $this->service->getEntityType(new Project())); - $this->assertEquals('attachment', $this->service->getEntityType(new PartAttachment())); - $this->assertEquals('supplier', $this->service->getEntityType(new Supplier())); - $this->assertEquals('user', $this->service->getEntityType(new User())); - $this->assertEquals('group', $this->service->getEntityType(new Group())); - $this->assertEquals('currency', $this->service->getEntityType(new Currency())); - $this->assertEquals('measurement_unit', $this->service->getEntityType(new MeasurementUnit())); - $this->assertEquals('label_profile', $this->service->getEntityType(new LabelProfile())); + $this->assertSame('part', $this->service->getEntityType(new Part())); + $this->assertSame('footprint', $this->service->getEntityType(new Footprint())); + $this->assertSame('storelocation', $this->service->getEntityType(new Storelocation())); + $this->assertSame('manufacturer', $this->service->getEntityType(new Manufacturer())); + $this->assertSame('category', $this->service->getEntityType(new Category())); + $this->assertSame('device', $this->service->getEntityType(new Project())); + $this->assertSame('attachment', $this->service->getEntityType(new PartAttachment())); + $this->assertSame('supplier', $this->service->getEntityType(new Supplier())); + $this->assertSame('user', $this->service->getEntityType(new User())); + $this->assertSame('group', $this->service->getEntityType(new Group())); + $this->assertSame('currency', $this->service->getEntityType(new Currency())); + $this->assertSame('measurement_unit', $this->service->getEntityType(new MeasurementUnit())); + $this->assertSame('label_profile', $this->service->getEntityType(new LabelProfile())); } } diff --git a/tests/Twig/UserExtensionTest.php b/tests/Twig/UserExtensionTest.php index 1fa722f6..e818f447 100644 --- a/tests/Twig/UserExtensionTest.php +++ b/tests/Twig/UserExtensionTest.php @@ -47,7 +47,7 @@ class UserExtensionTest extends WebTestCase */ public function testRemoveLocaleFromPath(string $expected, string $input): void { - $this->assertEquals($expected, $this->service->removeLocaleFromPath($input)); + $this->assertSame($expected, $this->service->removeLocaleFromPath($input)); } public function testRemoveLocaleFromPathException(): void From df8f54f5a4581e3901ed90723c05e8b35f4c4468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 15:32:29 +0200 Subject: [PATCH 42/91] Fixed tests for stricter typing --- .../Filters/CompoundFilterTraitTest.php | 5 +---- .../Projects/ProjectBuildRequestTest.php | 14 +++++++------- .../Parts/PartLotWithdrawAddHelperTest.php | 18 +++++++++--------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index e52911eb..1249cfa2 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -74,10 +74,7 @@ class CompoundFilterTraitTest extends TestCase 'filter3' => $f3 ], $result); } - - /** - * @doesNotPerformAssertions - */ + public function testApplyAllChildFilters(): void { $f1 = $this->createMock(FilterInterface::class); diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index 49bfede7..801efd4b 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -118,8 +118,8 @@ class ProjectBuildRequestTest extends TestCase //The values should be already prefilled correctly $request = new ProjectBuildRequest($this->project1, 10); //We need totally 20: Take 10 from the first (maximum 10) and 10 from the second (maximum 20) - $this->assertSame(10, $request->getLotWithdrawAmount($this->lot1a)); - $this->assertSame(10, $request->getLotWithdrawAmount($this->lot1b)); + $this->assertSame(10.0, $request->getLotWithdrawAmount($this->lot1a)); + $this->assertSame(10.0, $request->getLotWithdrawAmount($this->lot1b)); //If the needed amount is higher than the maximum, we should get the maximum $this->assertSame(2.5, $request->getLotWithdrawAmount($this->lot2)); @@ -140,9 +140,9 @@ class ProjectBuildRequestTest extends TestCase public function testGetNeededAmountForBOMEntry(): void { $build_request = new ProjectBuildRequest($this->project1, 5); - $this->assertSame(10, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a)); + $this->assertSame(10.0, $build_request->getNeededAmountForBOMEntry($this->bom_entry1a)); $this->assertSame(7.5, $build_request->getNeededAmountForBOMEntry($this->bom_entry1b)); - $this->assertSame(20, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c)); + $this->assertSame(20.0, $build_request->getNeededAmountForBOMEntry($this->bom_entry1c)); } public function testGetSetLotWithdrawAmount(): void @@ -154,8 +154,8 @@ class ProjectBuildRequestTest extends TestCase $build_request->setLotWithdrawAmount($this->lot1b->getID(), 3); //And it should be possible to get the amount via the lot object or via the ID - $this->assertSame(2, $build_request->getLotWithdrawAmount($this->lot1a->getID())); - $this->assertSame(3, $build_request->getLotWithdrawAmount($this->lot1b)); + $this->assertSame(2.0, $build_request->getLotWithdrawAmount($this->lot1a->getID())); + $this->assertSame(3.0, $build_request->getLotWithdrawAmount($this->lot1b)); } public function testGetWithdrawAmountSum(): void @@ -166,7 +166,7 @@ class ProjectBuildRequestTest extends TestCase $build_request->setLotWithdrawAmount($this->lot1a, 2); $build_request->setLotWithdrawAmount($this->lot1b, 3); - $this->assertSame(5, $build_request->getWithdrawAmountSum($this->bom_entry1a)); + $this->assertSame(5.0, $build_request->getWithdrawAmountSum($this->bom_entry1a)); $build_request->setLotWithdrawAmount($this->lot2, 1.5); $this->assertSame(1.5, $build_request->getWithdrawAmountSum($this->bom_entry1b)); } diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index 090ccdfb..bbc9eb41 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -117,15 +117,15 @@ class PartLotWithdrawAddHelperTest extends WebTestCase { //Add 5 to lot 1 $this->service->add($this->partLot1, 5, "Test"); - $this->assertSame(15, $this->partLot1->getAmount()); + $this->assertSame(15.0, $this->partLot1->getAmount()); //Add 3.2 to lot 2 $this->service->add($this->partLot2, 3.2, "Test"); - $this->assertSame(5, $this->partLot2->getAmount()); + $this->assertSame(5.0, $this->partLot2->getAmount()); //Add 1.5 to lot 3 $this->service->add($this->partLot3, 1.5, "Test"); - $this->assertSame(2, $this->partLot3->getAmount()); + $this->assertSame(2.0, $this->partLot3->getAmount()); } @@ -133,23 +133,23 @@ class PartLotWithdrawAddHelperTest extends WebTestCase { //Withdraw 5 from lot 1 $this->service->withdraw($this->partLot1, 5, "Test"); - $this->assertSame(5, $this->partLot1->getAmount()); + $this->assertSame(5.0, $this->partLot1->getAmount()); //Withdraw 2.2 from lot 2 $this->service->withdraw($this->partLot2, 2.2, "Test"); - $this->assertSame(0, $this->partLot2->getAmount()); + $this->assertSame(0.0, $this->partLot2->getAmount()); } public function testMove(): void { //Move 5 from lot 1 to lot 2 $this->service->move($this->partLot1, $this->partLot2, 5, "Test"); - $this->assertSame(5, $this->partLot1->getAmount()); - $this->assertSame(7, $this->partLot2->getAmount()); + $this->assertSame(5.0, $this->partLot1->getAmount()); + $this->assertSame(7.0, $this->partLot2->getAmount()); //Move 2.2 from lot 2 to lot 3 $this->service->move($this->partLot2, $this->partLot3, 2.2, "Test"); - $this->assertSame(5, $this->partLot2->getAmount()); - $this->assertSame(2, $this->partLot3->getAmount()); + $this->assertSame(5.0, $this->partLot2->getAmount()); + $this->assertSame(2.0, $this->partLot3->getAmount()); } } From 219b57a362d43ceb7ecef17737138fbdc3b87523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 17:38:08 +0200 Subject: [PATCH 43/91] Fixed some deprecations --- config/packages/framework.yaml | 3 --- config/packages/security.yaml | 1 - src/Command/Migrations/ImportPartKeeprCommand.php | 2 +- src/Doctrine/SQLiteRegexExtension.php | 11 +++-------- src/Entity/Parameters/AbstractParameter.php | 1 - src/Form/AttachmentFormType.php | 2 +- src/Form/CollectionTypeExtension.php | 2 +- src/Form/Filters/AttachmentFilterType.php | 2 +- .../Filters/Constraints/BooleanConstraintType.php | 2 +- .../Filters/Constraints/DateTimeConstraintType.php | 2 +- .../Filters/Constraints/InstanceOfConstraintType.php | 2 +- src/Form/Filters/Constraints/NumberConstraintType.php | 4 +--- .../Constraints/StructuralEntityConstraintType.php | 2 +- src/Form/Filters/Constraints/TextConstraintType.php | 2 +- .../Filters/Constraints/UserEntityConstraintType.php | 2 +- src/Form/Filters/LogFilterType.php | 2 +- src/Form/Filters/PartFilterType.php | 2 +- src/Form/ParameterType.php | 2 +- .../ProjectSystem/ProjectBOMEntryCollectionType.php | 2 +- src/Form/ProjectSystem/ProjectBOMEntryType.php | 2 +- src/Form/ProjectSystem/ProjectBuildType.php | 8 ++++---- src/Form/Type/BigDecimalMoneyType.php | 2 +- src/Form/Type/BigDecimalNumberType.php | 2 +- src/Form/Type/PartLotSelectType.php | 2 +- src/Form/Type/PartSelectType.php | 8 ++++---- src/Form/Type/RichTextEditorType.php | 4 ++-- src/Form/Type/ThemeChoiceType.php | 2 +- src/Form/Type/UserSelectType.php | 2 +- src/Serializer/BigNumberNormalizer.php | 2 +- src/Serializer/PartNormalizer.php | 4 ++-- .../StructuralElementFromNameDenormalizer.php | 2 +- src/Serializer/StructuralElementNormalizer.php | 2 +- src/Twig/LogExtension.php | 2 +- .../ValidProjectBuildRequestValidator.php | 2 +- tests/DataTables/Filters/CompoundFilterTraitTest.php | 2 +- 35 files changed, 42 insertions(+), 54 deletions(-) diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 8ad7bf1a..05dc5d0e 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -30,9 +30,6 @@ framework: php_errors: log: true - form: - legacy_error_messages: false # Enable to use the new Form component validation messages - when@test: framework: test: true diff --git a/config/packages/security.yaml b/config/packages/security.yaml index f664e7f9..342e38bf 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,5 +1,4 @@ security: - enable_authenticator_manager: true # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index f1c7b47c..20269c0a 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -45,7 +45,7 @@ class ImportPartKeeprCommand extends Command parent::__construct(self::$defaultName); } - protected function configure() + protected function configure(): void { $this->setHelp('This command allows you to import a PartKeepr database exported by mysqldump as XML file into Part-DB'); diff --git a/src/Doctrine/SQLiteRegexExtension.php b/src/Doctrine/SQLiteRegexExtension.php index cc1ff5f8..3482348e 100644 --- a/src/Doctrine/SQLiteRegexExtension.php +++ b/src/Doctrine/SQLiteRegexExtension.php @@ -21,6 +21,7 @@ namespace App\Doctrine; use App\Exceptions\InvalidRegexException; +use Doctrine\Bundle\DoctrineBundle\Attribute\AsDoctrineListener; use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface; use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Events; @@ -31,7 +32,8 @@ use Doctrine\DBAL\Platforms\SqlitePlatform; * As a PHP callback is called for every entry to compare it is most likely much slower than using regex on MySQL. * But as regex is not often used, this should be fine for most use cases, also it is almost impossible to implement a better solution. */ -class SQLiteRegexExtension implements EventSubscriberInterface +#[AsDoctrineListener(Events::postConnect)] +class SQLiteRegexExtension { public function postConnect(ConnectionEventArgs $eventArgs): void { @@ -53,11 +55,4 @@ class SQLiteRegexExtension implements EventSubscriberInterface } } } - - public function getSubscribedEvents(): array - { - return[ - Events::postConnect - ]; - } } \ No newline at end of file diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 6e4a77f3..1a090b78 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -121,7 +121,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement * @var string the group this parameter belongs to */ #[Groups(['full'])] - #[Groups(['full'])] #[ORM\Column(type: Types::STRING, name: 'param_group')] protected string $group = ''; diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index ea96666a..dd05a0e5 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -170,7 +170,7 @@ class AttachmentFormType extends AbstractType ]); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->vars['max_upload_size'] = $this->submitHandler->getMaximumAllowedUploadSize(); } diff --git a/src/Form/CollectionTypeExtension.php b/src/Form/CollectionTypeExtension.php index a70576fd..38266315 100644 --- a/src/Form/CollectionTypeExtension.php +++ b/src/Form/CollectionTypeExtension.php @@ -98,7 +98,7 @@ class CollectionTypeExtension extends AbstractTypeExtension $resolver->setAllowedTypes('reindex_path', 'string'); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { parent::finishView($view, $form, $options); //Add prototype name to view, so that we can pass it to the stimulus controller diff --git a/src/Form/Filters/AttachmentFilterType.php b/src/Form/Filters/AttachmentFilterType.php index 1b4967f5..9908b542 100644 --- a/src/Form/Filters/AttachmentFilterType.php +++ b/src/Form/Filters/AttachmentFilterType.php @@ -58,7 +58,7 @@ class AttachmentFilterType extends AbstractType ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('dbId', NumberConstraintType::class, [ 'label' => 'part.filter.dbId', diff --git a/src/Form/Filters/Constraints/BooleanConstraintType.php b/src/Form/Filters/Constraints/BooleanConstraintType.php index ebc5ce09..0c431a21 100644 --- a/src/Form/Filters/Constraints/BooleanConstraintType.php +++ b/src/Form/Filters/Constraints/BooleanConstraintType.php @@ -46,7 +46,7 @@ class BooleanConstraintType extends AbstractType ]); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { //Remove the label from the compound form, as the checkbox already has a label $view->vars['label'] = false; diff --git a/src/Form/Filters/Constraints/DateTimeConstraintType.php b/src/Form/Filters/Constraints/DateTimeConstraintType.php index b24346ee..56cde796 100644 --- a/src/Form/Filters/Constraints/DateTimeConstraintType.php +++ b/src/Form/Filters/Constraints/DateTimeConstraintType.php @@ -84,7 +84,7 @@ class DateTimeConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/Filters/Constraints/InstanceOfConstraintType.php b/src/Form/Filters/Constraints/InstanceOfConstraintType.php index b88fa50f..af15117d 100644 --- a/src/Form/Filters/Constraints/InstanceOfConstraintType.php +++ b/src/Form/Filters/Constraints/InstanceOfConstraintType.php @@ -31,7 +31,7 @@ class InstanceOfConstraintType extends AbstractType { } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefault('data_class', InstanceOfConstraint::class); } diff --git a/src/Form/Filters/Constraints/NumberConstraintType.php b/src/Form/Filters/Constraints/NumberConstraintType.php index a04fc9a1..38b9539c 100644 --- a/src/Form/Filters/Constraints/NumberConstraintType.php +++ b/src/Form/Filters/Constraints/NumberConstraintType.php @@ -91,10 +91,8 @@ class NumberConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { - parent::buildView($view, $form, $options); - $view->vars['text_suffix'] = $options['text_suffix']; } } \ No newline at end of file diff --git a/src/Form/Filters/Constraints/StructuralEntityConstraintType.php b/src/Form/Filters/Constraints/StructuralEntityConstraintType.php index 1ef6a333..7396c54a 100644 --- a/src/Form/Filters/Constraints/StructuralEntityConstraintType.php +++ b/src/Form/Filters/Constraints/StructuralEntityConstraintType.php @@ -65,7 +65,7 @@ class StructuralEntityConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); $view->vars['text_suffix'] = $options['text_suffix']; diff --git a/src/Form/Filters/Constraints/TextConstraintType.php b/src/Form/Filters/Constraints/TextConstraintType.php index b9415977..517fe980 100644 --- a/src/Form/Filters/Constraints/TextConstraintType.php +++ b/src/Form/Filters/Constraints/TextConstraintType.php @@ -70,7 +70,7 @@ class TextConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); diff --git a/src/Form/Filters/Constraints/UserEntityConstraintType.php b/src/Form/Filters/Constraints/UserEntityConstraintType.php index 86c9eb97..cf646fe9 100644 --- a/src/Form/Filters/Constraints/UserEntityConstraintType.php +++ b/src/Form/Filters/Constraints/UserEntityConstraintType.php @@ -60,7 +60,7 @@ class UserEntityConstraintType extends AbstractType ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { parent::buildView($view, $form, $options); $view->vars['text_suffix'] = $options['text_suffix']; diff --git a/src/Form/Filters/LogFilterType.php b/src/Form/Filters/LogFilterType.php index ad1082b7..45e6cccf 100644 --- a/src/Form/Filters/LogFilterType.php +++ b/src/Form/Filters/LogFilterType.php @@ -101,7 +101,7 @@ class LogFilterType extends AbstractType ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('dbId', NumberConstraintType::class, [ 'label' => 'part.filter.dbId', diff --git a/src/Form/Filters/PartFilterType.php b/src/Form/Filters/PartFilterType.php index 249b0c1c..fceb3c16 100644 --- a/src/Form/Filters/PartFilterType.php +++ b/src/Form/Filters/PartFilterType.php @@ -59,7 +59,7 @@ class PartFilterType extends AbstractType ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { /* * Common tab diff --git a/src/Form/ParameterType.php b/src/Form/ParameterType.php index 09293b97..66e664be 100644 --- a/src/Form/ParameterType.php +++ b/src/Form/ParameterType.php @@ -148,7 +148,7 @@ class ParameterType extends AbstractType ]); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { //By default use part parameters for autocomplete $view->vars['type'] = 'part'; diff --git a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php index f92cf3a9..5f4e5210 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php @@ -13,7 +13,7 @@ class ProjectBOMEntryCollectionType extends AbstractType return CollectionType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'entry_type' => ProjectBOMEntryType::class, diff --git a/src/Form/ProjectSystem/ProjectBOMEntryType.php b/src/Form/ProjectSystem/ProjectBOMEntryType.php index 2350f61d..35a00e67 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryType.php @@ -18,7 +18,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class ProjectBOMEntryType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 28c7c18a..77260fcb 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -43,7 +43,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface { } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'compound' => true, @@ -51,7 +51,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface ]); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->setDataMapper($this); @@ -104,7 +104,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface }); } - public function mapDataToForms($data, \Traversable $forms) + public function mapDataToForms($data, \Traversable $forms): void { if (!$data instanceof ProjectBuildRequest) { throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class); @@ -129,7 +129,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface } - public function mapFormsToData(\Traversable $forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data): void { if (!$data instanceof ProjectBuildRequest) { throw new \RuntimeException('Data must be an instance of ' . ProjectBuildRequest::class); diff --git a/src/Form/Type/BigDecimalMoneyType.php b/src/Form/Type/BigDecimalMoneyType.php index 2fb8d7ee..3c7d252f 100644 --- a/src/Form/Type/BigDecimalMoneyType.php +++ b/src/Form/Type/BigDecimalMoneyType.php @@ -28,7 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BigDecimalMoneyType extends AbstractType implements DataTransformerInterface { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer($this); } diff --git a/src/Form/Type/BigDecimalNumberType.php b/src/Form/Type/BigDecimalNumberType.php index 8ee0911e..b236cfe0 100644 --- a/src/Form/Type/BigDecimalNumberType.php +++ b/src/Form/Type/BigDecimalNumberType.php @@ -28,7 +28,7 @@ use Symfony\Component\Form\FormBuilderInterface; class BigDecimalNumberType extends AbstractType implements DataTransformerInterface { - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->addModelTransformer($this); } diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php index bc8d0d84..6c1de117 100644 --- a/src/Form/Type/PartLotSelectType.php +++ b/src/Form/Type/PartLotSelectType.php @@ -37,7 +37,7 @@ class PartLotSelectType extends AbstractType return EntityType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('part'); $resolver->setAllowedTypes('part', Part::class); diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index cbbe9668..43f5c44d 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -26,7 +26,7 @@ class PartSelectType extends AbstractType implements DataMapperInterface { } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options): void { //At initialization, we have to fill the form element with our selected data, so the user can see it $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) { @@ -66,7 +66,7 @@ class PartSelectType extends AbstractType implements DataMapperInterface $builder->setDataMapper($this); } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'class' => Part::class, @@ -110,13 +110,13 @@ class PartSelectType extends AbstractType implements DataMapperInterface ]); } - public function mapDataToForms($data, \Traversable $forms) + public function mapDataToForms($data, \Traversable $forms): void { $form = current(iterator_to_array($forms, false)); $form->setData($data); } - public function mapFormsToData(\Traversable $forms, &$data) + public function mapFormsToData(\Traversable $forms, &$data): void { $form = current(iterator_to_array($forms, false)); $data = $form->getData(); diff --git a/src/Form/Type/RichTextEditorType.php b/src/Form/Type/RichTextEditorType.php index fd796e52..ab81eeb7 100644 --- a/src/Form/Type/RichTextEditorType.php +++ b/src/Form/Type/RichTextEditorType.php @@ -28,7 +28,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class RichTextEditorType extends AbstractType { - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { parent::configureOptions($resolver); // TODO: Change the autogenerated stub @@ -39,7 +39,7 @@ class RichTextEditorType extends AbstractType } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->vars['attr'] = array_merge($view->vars['attr'], $this->optionsToAttrArray($options)); diff --git a/src/Form/Type/ThemeChoiceType.php b/src/Form/Type/ThemeChoiceType.php index c5a45ac4..79e7644b 100644 --- a/src/Form/Type/ThemeChoiceType.php +++ b/src/Form/Type/ThemeChoiceType.php @@ -35,7 +35,7 @@ class ThemeChoiceType extends AbstractType return ChoiceType::class; } - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'choices' => $this->available_themes, diff --git a/src/Form/Type/UserSelectType.php b/src/Form/Type/UserSelectType.php index a089f66d..cfc501ee 100644 --- a/src/Form/Type/UserSelectType.php +++ b/src/Form/Type/UserSelectType.php @@ -28,7 +28,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class UserSelectType extends AbstractType { - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'class' => User::class, diff --git a/src/Serializer/BigNumberNormalizer.php b/src/Serializer/BigNumberNormalizer.php index 49477725..1f310810 100644 --- a/src/Serializer/BigNumberNormalizer.php +++ b/src/Serializer/BigNumberNormalizer.php @@ -30,7 +30,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerInterface; class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface { - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof BigNumber; } diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 58158cfe..634d6335 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -51,7 +51,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach { } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof Part; } @@ -74,7 +74,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach return $data; } - public function supportsDenormalization($data, string $type, string $format = null): bool + public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool { return is_array($data) && is_a($type, Part::class, true); } diff --git a/src/Serializer/StructuralElementFromNameDenormalizer.php b/src/Serializer/StructuralElementFromNameDenormalizer.php index 662e3afa..c5dbfdf2 100644 --- a/src/Serializer/StructuralElementFromNameDenormalizer.php +++ b/src/Serializer/StructuralElementFromNameDenormalizer.php @@ -35,7 +35,7 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, Ca { } - public function supportsDenormalization($data, string $type, string $format = null): bool + public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool { return is_string($data) && is_subclass_of($type, AbstractStructuralDBElement::class); } diff --git a/src/Serializer/StructuralElementNormalizer.php b/src/Serializer/StructuralElementNormalizer.php index aeae9aae..f71a56d5 100644 --- a/src/Serializer/StructuralElementNormalizer.php +++ b/src/Serializer/StructuralElementNormalizer.php @@ -34,7 +34,7 @@ class StructuralElementNormalizer implements NormalizerInterface, CacheableSuppo { } - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof AbstractStructuralDBElement; } diff --git a/src/Twig/LogExtension.php b/src/Twig/LogExtension.php index 8a0be446..dde70e18 100644 --- a/src/Twig/LogExtension.php +++ b/src/Twig/LogExtension.php @@ -33,7 +33,7 @@ final class LogExtension extends AbstractExtension { } - public function getFunctions() + public function getFunctions(): array { return [ new TwigFunction('format_log_data', fn($data, AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]), diff --git a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php index 03a9b81f..08350f55 100644 --- a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php +++ b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php @@ -36,7 +36,7 @@ class ValidProjectBuildRequestValidator extends ConstraintValidator ->setParameter('{{ lot }}', $partLot->getName()); } - public function validate($value, Constraint $constraint) + public function validate($value, Constraint $constraint): void { if (!$constraint instanceof ValidProjectBuildRequest) { throw new UnexpectedTypeException($constraint, ValidProjectBuildRequest::class); diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index 1249cfa2..e73e639a 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -74,7 +74,7 @@ class CompoundFilterTraitTest extends TestCase 'filter3' => $f3 ], $result); } - + public function testApplyAllChildFilters(): void { $f1 = $this->createMock(FilterInterface::class); From e57d6e508af412fea3a1656c9812b1b389dd5213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 18:12:22 +0200 Subject: [PATCH 44/91] Fixed some serializer deprecations --- src/Serializer/BigNumberNormalizer.php | 9 +++++---- src/Serializer/PartNormalizer.php | 17 +++++++++++++---- .../StructuralElementDenormalizer.php | 19 ++++++++++++++----- .../StructuralElementFromNameDenormalizer.php | 10 ++++++---- .../StructuralElementNormalizer.php | 16 ++++++++++++---- .../Constraints/ValidThemeValidator.php | 2 +- .../StructuralElementDenormalizerTest.php | 5 ----- 7 files changed, 51 insertions(+), 27 deletions(-) diff --git a/src/Serializer/BigNumberNormalizer.php b/src/Serializer/BigNumberNormalizer.php index 1f310810..87619849 100644 --- a/src/Serializer/BigNumberNormalizer.php +++ b/src/Serializer/BigNumberNormalizer.php @@ -21,13 +21,12 @@ namespace App\Serializer; use Brick\Math\BigNumber; -use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; /** * @see \App\Tests\Serializer\BigNumberNormalizerTest */ -class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface +class BigNumberNormalizer implements NormalizerInterface { public function supportsNormalization($data, string $format = null, array $context = []): bool @@ -44,8 +43,10 @@ class BigNumberNormalizer implements NormalizerInterface, CacheableSupportsMetho return (string) $object; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format) { - return true; + return [ + BigNumber::class => true, + ]; } } \ No newline at end of file diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 634d6335..67b4066f 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -27,16 +27,20 @@ use App\Entity\Parts\Supplier; use App\Entity\PriceInformations\Orderdetail; use App\Entity\PriceInformations\Pricedetail; use Brick\Math\BigDecimal; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; /** * @see \App\Tests\Serializer\PartNormalizerTest */ -class PartNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface +class PartNormalizer implements NormalizerInterface, DenormalizerInterface { + private const DENORMALIZE_KEY_MAPPING = [ 'notes' => 'comment', 'quantity' => 'instock', @@ -47,7 +51,10 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach 'storage_location' => 'storelocation', ]; - public function __construct(private readonly ObjectNormalizer $normalizer, private readonly StructuralElementFromNameDenormalizer $locationDenormalizer) + public function __construct( + private readonly StructuralElementFromNameDenormalizer $locationDenormalizer, + #[Autowire(service: ObjectNormalizer::class)] + private readonly NormalizerInterface $normalizer) { } @@ -166,9 +173,11 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach return $object; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format) { //Must be false, because we rely on is_array($data) in supportsDenormalization() - return false; + return [ + Part::class => false, + ]; } } \ No newline at end of file diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index 4212fd5d..c5130ef4 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -23,19 +23,25 @@ namespace App\Serializer; use App\Entity\Base\AbstractStructuralDBElement; use App\Repository\StructuralDBElementRepository; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; +use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; /** * @see \App\Tests\Serializer\StructuralElementDenormalizerTest */ -class StructuralElementDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface +class StructuralElementDenormalizer implements DenormalizerInterface { private array $object_cache = []; - public function __construct(private readonly ObjectNormalizer $normalizer, private readonly EntityManagerInterface $entityManager) + public function __construct( + private readonly EntityManagerInterface $entityManager, + #[Autowire(service: ObjectNormalizer::class)] + private readonly DenormalizerInterface $denormalizer) { } @@ -50,7 +56,7 @@ class StructuralElementDenormalizer implements DenormalizerInterface, CacheableS public function denormalize($data, string $type, string $format = null, array $context = []): ?AbstractStructuralDBElement { /** @var AbstractStructuralDBElement $deserialized_entity */ - $deserialized_entity = $this->normalizer->denormalize($data, $type, $format, $context); + $deserialized_entity = $this->denormalizer->denormalize($data, $type, $format, $context); //Check if we already have the entity in the database (via path) /** @var StructuralDBElementRepository $repo */ @@ -81,8 +87,11 @@ class StructuralElementDenormalizer implements DenormalizerInterface, CacheableS return $deserialized_entity; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(): array { - return false; + //Must be false, because we use in_array in supportsDenormalization + return [ + AbstractStructuralDBElement::class => false, + ]; } } \ No newline at end of file diff --git a/src/Serializer/StructuralElementFromNameDenormalizer.php b/src/Serializer/StructuralElementFromNameDenormalizer.php index c5dbfdf2..670bcdc1 100644 --- a/src/Serializer/StructuralElementFromNameDenormalizer.php +++ b/src/Serializer/StructuralElementFromNameDenormalizer.php @@ -29,7 +29,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; /** * @see \App\Tests\Serializer\StructuralElementFromNameDenormalizerTest */ -class StructuralElementFromNameDenormalizer implements DenormalizerInterface, CacheableSupportsMethodInterface +class StructuralElementFromNameDenormalizer implements DenormalizerInterface { public function __construct(private readonly EntityManagerInterface $em) { @@ -67,9 +67,11 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface, Ca return end($elements); } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format) { - //Must be false, because we do an is_string check on data in supportsDenormalization - return false; + //Cachable value Must be false, because we do an is_string check on data in supportsDenormalization + return [ + AbstractStructuralDBElement::class => false + ]; } } \ No newline at end of file diff --git a/src/Serializer/StructuralElementNormalizer.php b/src/Serializer/StructuralElementNormalizer.php index f71a56d5..c1931ffe 100644 --- a/src/Serializer/StructuralElementNormalizer.php +++ b/src/Serializer/StructuralElementNormalizer.php @@ -21,16 +21,22 @@ namespace App\Serializer; use App\Entity\Base\AbstractStructuralDBElement; +use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; /** * @see \App\Tests\Serializer\StructuralElementNormalizerTest */ -class StructuralElementNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface +class StructuralElementNormalizer implements NormalizerInterface { - public function __construct(private readonly ObjectNormalizer $normalizer) + public function __construct( + #[Autowire(service: ObjectNormalizer::class)] + private NormalizerInterface $normalizer + ) { } @@ -57,8 +63,10 @@ class StructuralElementNormalizer implements NormalizerInterface, CacheableSuppo return $data; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format) { - return true; + return [ + AbstractStructuralDBElement::class => true, + ]; } } \ No newline at end of file diff --git a/src/Validator/Constraints/ValidThemeValidator.php b/src/Validator/Constraints/ValidThemeValidator.php index f83bb500..03e6212f 100644 --- a/src/Validator/Constraints/ValidThemeValidator.php +++ b/src/Validator/Constraints/ValidThemeValidator.php @@ -30,7 +30,7 @@ class ValidThemeValidator extends ConstraintValidator { } - public function validate($value, Constraint $constraint) + public function validate($value, Constraint $constraint): void { if (!$constraint instanceof ValidTheme) { throw new UnexpectedTypeException($constraint, ValidTheme::class); diff --git a/tests/Serializer/StructuralElementDenormalizerTest.php b/tests/Serializer/StructuralElementDenormalizerTest.php index 624b30d4..be0a9e61 100644 --- a/tests/Serializer/StructuralElementDenormalizerTest.php +++ b/tests/Serializer/StructuralElementDenormalizerTest.php @@ -37,11 +37,6 @@ class StructuralElementDenormalizerTest extends WebTestCase $this->service = self::getContainer()->get(StructuralElementDenormalizer::class); } - public function testHasCacheableSupportsMethod(): void - { - $this->assertFalse($this->service->hasCacheableSupportsMethod()); - } - public function testSupportsDenormalization(): void { $this->assertFalse($this->service->supportsDenormalization('doesnt_matter', Category::class, 'json', ['groups' => ['import']])); From bea90a7d945e7174fe05a10f22b40ba9cd21de4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 18:27:49 +0200 Subject: [PATCH 45/91] Updated dependencies --- composer.json | 18 ++-- composer.lock | 223 ++++++++++++++++++++++++-------------------------- 2 files changed, 115 insertions(+), 126 deletions(-) diff --git a/composer.json b/composer.json index 88ffa898..be1f12d0 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "ext-mbstring": "*", "beberlei/doctrineextensions": "^1.2", "brick/math": "^0.11.0", - "composer/package-versions-deprecated": "1.11.99.4", + "composer/package-versions-deprecated": "^1.11.99.5", "doctrine/annotations": "^1.6", "doctrine/data-fixtures": "^1.6.6", "doctrine/dbal": "^3.4.6", @@ -50,7 +50,7 @@ "symfony/console": "6.3.*", "symfony/dotenv": "6.3.*", "symfony/expression-language": "6.3.*", - "symfony/flex": "^1.1", + "symfony/flex": "^v2.3.1", "symfony/form": "6.3.*", "symfony/framework-bundle": "6.3.*", "symfony/http-client": "6.3.*", @@ -70,7 +70,7 @@ "symfony/ux-turbo": "^2.0", "symfony/validator": "6.3.*", "symfony/web-link": "6.3.*", - "symfony/webpack-encore-bundle": "^1.1", + "symfony/webpack-encore-bundle": "^v2.0.1", "symfony/yaml": "6.3.*", "tecnickcom/tc-lib-barcode": "^1.15", "twig/cssinliner-extra": "^3.0", @@ -91,15 +91,15 @@ "phpstan/phpstan-doctrine": "^1.2.11", "phpstan/phpstan-symfony": "^1.1.7", "psalm/plugin-symfony": "^v5.0.1", - "rector/rector": "^0.16.0", + "rector/rector": "^0.17.0", "roave/security-advisories": "dev-latest", - "symfony/browser-kit": "^5.2", - "symfony/css-selector": "^5.2", - "symfony/debug-bundle": "^5.2", + "symfony/browser-kit": "6.3.*", + "symfony/css-selector": "6.3.*", + "symfony/debug-bundle": "6.3.*", "symfony/maker-bundle": "^1.13", "symfony/phpunit-bridge": "6.3.*", - "symfony/stopwatch": "^5.2", - "symfony/web-profiler-bundle": "^5.2", + "symfony/stopwatch": "6.3.*", + "symfony/web-profiler-bundle": "6.3.*", "symplify/easy-coding-standard": "^11.0", "vimeo/psalm": "^5.6.0" }, diff --git a/composer.lock b/composer.lock index 534c7064..c094f713 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": "e6a210fb5441cc3dd4b0cfa325503fc4", + "content-hash": "3a1f7b07108d0b82633975721493cc8a", "packages": [ { "name": "beberlei/assert", @@ -263,16 +263,16 @@ }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", + "version": "1.11.99.5", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", "shasum": "" }, "require": { @@ -316,7 +316,7 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "support": { "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" }, "funding": [ { @@ -332,7 +332,7 @@ "type": "tidelift" } ], - "time": "2021-09-13T08:41:34+00:00" + "time": "2022-01-17T14:14:24+00:00" }, { "name": "doctrine/annotations", @@ -6971,21 +6971,20 @@ }, { "name": "symfony/css-selector", - "version": "v5.4.21", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "95f3c7468db1da8cc360b24fa2a26e7cefcb355d" + "reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/95f3c7468db1da8cc360b24fa2a26e7cefcb355d", - "reference": "95f3c7468db1da8cc360b24fa2a26e7cefcb355d", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf", + "reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -7017,7 +7016,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v5.4.21" + "source": "https://github.com/symfony/css-selector/tree/v6.3.0" }, "funding": [ { @@ -7033,7 +7032,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-03-20T16:43:42+00:00" }, { "name": "symfony/dependency-injection", @@ -7790,28 +7789,28 @@ }, { "name": "symfony/flex", - "version": "v1.20.0", + "version": "v2.3.1", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "49059a10127ac8270957e116a2251ae535d202ac" + "reference": "3c9c3424efdafe33e0e3cfb5e87e50b34711fedf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/49059a10127ac8270957e116a2251ae535d202ac", - "reference": "49059a10127ac8270957e116a2251ae535d202ac", + "url": "https://api.github.com/repos/symfony/flex/zipball/3c9c3424efdafe33e0e3cfb5e87e50b34711fedf", + "reference": "3c9c3424efdafe33e0e3cfb5e87e50b34711fedf", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0|^2.0", - "php": ">=7.1" + "composer-plugin-api": "^2.1", + "php": ">=8.0" }, "require-dev": { - "composer/composer": "^1.0.2|^2.0", - "symfony/dotenv": "^4.4|^5.0|^6.0", - "symfony/filesystem": "^4.4|^5.0|^6.0", - "symfony/phpunit-bridge": "^4.4.12|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0" + "composer/composer": "^2.1", + "symfony/dotenv": "^5.4|^6.0", + "symfony/filesystem": "^5.4|^6.0", + "symfony/phpunit-bridge": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0" }, "type": "composer-plugin", "extra": { @@ -7835,7 +7834,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v1.20.0" + "source": "https://github.com/symfony/flex/tree/v2.3.1" }, "funding": [ { @@ -7851,7 +7850,7 @@ "type": "tidelift" } ], - "time": "2023-05-26T16:25:26+00:00" + "time": "2023-05-27T07:38:25+00:00" }, { "name": "symfony/form", @@ -11017,21 +11016,21 @@ }, { "name": "symfony/stopwatch", - "version": "v5.4.21", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee" + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/f83692cd869a6f2391691d40a01e8acb89e76fee", - "reference": "f83692cd869a6f2391691d40a01e8acb89e76fee", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", + "reference": "fc47f1015ec80927ff64ba9094dfe8b9d48fe9f2", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/service-contracts": "^1|^2|^3" + "php": ">=8.1", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", "autoload": { @@ -11059,7 +11058,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/v6.3.0" }, "funding": [ { @@ -11075,7 +11074,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-02-16T10:14:28+00:00" }, { "name": "symfony/string", @@ -12035,33 +12034,31 @@ }, { "name": "symfony/webpack-encore-bundle", - "version": "v1.17.1", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/symfony/webpack-encore-bundle.git", - "reference": "7e3b6f69bcfcbb40ecfe83ad7a77e44316d26573" + "reference": "150fe022740fef908f4ca3d5950ce85ab040ec76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/7e3b6f69bcfcbb40ecfe83ad7a77e44316d26573", - "reference": "7e3b6f69bcfcbb40ecfe83ad7a77e44316d26573", + "url": "https://api.github.com/repos/symfony/webpack-encore-bundle/zipball/150fe022740fef908f4ca3d5950ce85ab040ec76", + "reference": "150fe022740fef908f4ca3d5950ce85ab040ec76", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/asset": "^4.4 || ^5.0 || ^6.0", - "symfony/config": "^4.4 || ^5.0 || ^6.0", - "symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0", - "symfony/deprecation-contracts": "^2.1 || ^3.0", - "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0", - "symfony/polyfill-php80": "^1.25.0", - "symfony/service-contracts": "^1.0 || ^2.0 || ^3.0" + "php": ">=8.1.0", + "symfony/asset": "^5.4 || ^6.2", + "symfony/config": "^5.4 || ^6.2", + "symfony/dependency-injection": "^5.4 || ^6.2", + "symfony/http-kernel": "^5.4 || ^6.2", + "symfony/service-contracts": "^1.1.9 || ^2.1.3 || ^3.0" }, "require-dev": { - "symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0", - "symfony/phpunit-bridge": "^5.3 || ^6.0", - "symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0", - "symfony/web-link": "^4.4 || ^5.0 || ^6.0" + "symfony/framework-bundle": "^5.4 || ^6.2", + "symfony/phpunit-bridge": "^5.4 || ^6.2", + "symfony/twig-bundle": "^5.4 || ^6.2", + "symfony/web-link": "^5.4 || ^6.2" }, "type": "symfony-bundle", "extra": { @@ -12088,7 +12085,7 @@ "description": "Integration with your Symfony app & Webpack Encore!", "support": { "issues": "https://github.com/symfony/webpack-encore-bundle/issues", - "source": "https://github.com/symfony/webpack-encore-bundle/tree/v1.17.1" + "source": "https://github.com/symfony/webpack-encore-bundle/tree/v2.0.1" }, "funding": [ { @@ -12104,7 +12101,7 @@ "type": "tidelift" } ], - "time": "2023-05-29T00:18:01+00:00" + "time": "2023-05-31T14:28:33+00:00" }, { "name": "symfony/yaml", @@ -14623,21 +14620,21 @@ }, { "name": "rector/rector", - "version": "0.16.0", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f" + "reference": "d8da002b107c9b64d464bb48101290d4d078df4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2125ff71ea05b079562a8f59ca48a97eb78dc07f", - "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d8da002b107c9b64d464bb48101290d4d078df4b", + "reference": "d8da002b107c9b64d464bb48101290d4d078df4b", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.14" + "phpstan/phpstan": "^1.10.15" }, "conflict": { "rector/rector-doctrine": "*", @@ -14672,7 +14669,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.16.0" + "source": "https://github.com/rectorphp/rector/tree/0.17.0" }, "funding": [ { @@ -14680,7 +14677,7 @@ "type": "github" } ], - "time": "2023-05-05T12:12:17+00:00" + "time": "2023-06-01T09:42:59+00:00" }, { "name": "roave/security-advisories", @@ -15423,31 +15420,27 @@ }, { "name": "symfony/browser-kit", - "version": "v5.4.21", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "a866ca7e396f15d7efb6d74a8a7d364d4e05b704" + "reference": "0eb7228e7c435169e65c911ba8d107d56d850049" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/a866ca7e396f15d7efb6d74a8a7d364d4e05b704", - "reference": "a866ca7e396f15d7efb6d74a8a7d364d4e05b704", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/0eb7228e7c435169e65c911ba8d107d56d850049", + "reference": "0eb7228e7c435169e65c911ba8d107d56d850049", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/dom-crawler": "^4.4|^5.0|^6.0", - "symfony/polyfill-php80": "^1.16" + "php": ">=8.1", + "symfony/dom-crawler": "^5.4|^6.0" }, "require-dev": { - "symfony/css-selector": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/mime": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0" - }, - "suggest": { - "symfony/process": "" + "symfony/css-selector": "^5.4|^6.0", + "symfony/http-client": "^5.4|^6.0", + "symfony/mime": "^5.4|^6.0", + "symfony/process": "^5.4|^6.0" }, "type": "library", "autoload": { @@ -15475,7 +15468,7 @@ "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/browser-kit/tree/v5.4.21" + "source": "https://github.com/symfony/browser-kit/tree/v6.3.0" }, "funding": [ { @@ -15491,42 +15484,37 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-04-25T10:46:17+00:00" }, { "name": "symfony/debug-bundle", - "version": "v5.4.21", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/debug-bundle.git", - "reference": "8b4360bf8ce9a917ef8796c5e6065a185d8722bd" + "reference": "02fe831f7cdd472c561116189bcc30d0759665e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug-bundle/zipball/8b4360bf8ce9a917ef8796c5e6065a185d8722bd", - "reference": "8b4360bf8ce9a917ef8796c5e6065a185d8722bd", + "url": "https://api.github.com/repos/symfony/debug-bundle/zipball/02fe831f7cdd472c561116189bcc30d0759665e7", + "reference": "02fe831f7cdd472c561116189bcc30d0759665e7", "shasum": "" }, "require": { "ext-xml": "*", - "php": ">=7.2.5", - "symfony/http-kernel": "^4.4|^5.0|^6.0", - "symfony/polyfill-php80": "^1.16", - "symfony/twig-bridge": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" + "php": ">=8.1", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/twig-bridge": "^5.4|^6.0", + "symfony/var-dumper": "^5.4|^6.0" }, "conflict": { - "symfony/config": "<4.4", - "symfony/dependency-injection": "<5.2" + "symfony/config": "<5.4", + "symfony/dependency-injection": "<5.4" }, "require-dev": { - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/web-profiler-bundle": "^4.4|^5.0|^6.0" - }, - "suggest": { - "symfony/config": "For service container configuration", - "symfony/dependency-injection": "For using as a service from the container" + "symfony/config": "^5.4|^6.0", + "symfony/web-profiler-bundle": "^5.4|^6.0" }, "type": "symfony-bundle", "autoload": { @@ -15554,7 +15542,7 @@ "description": "Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/debug-bundle/tree/v5.4.21" + "source": "https://github.com/symfony/debug-bundle/tree/v6.3.0" }, "funding": [ { @@ -15570,7 +15558,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-05-25T12:58:06+00:00" }, { "name": "symfony/dom-crawler", @@ -15815,39 +15803,37 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v5.4.24", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "42dbb751c0363d75a3697775e662d6f21f3d8b83" + "reference": "bab614e12218a95a924685a1fbf662bd7ca2d746" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/42dbb751c0363d75a3697775e662d6f21f3d8b83", - "reference": "42dbb751c0363d75a3697775e662d6f21f3d8b83", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/bab614e12218a95a924685a1fbf662bd7ca2d746", + "reference": "bab614e12218a95a924685a1fbf662bd7ca2d746", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^5.3|^6.0", - "symfony/http-kernel": "^5.3|^6.0", - "symfony/polyfill-php80": "^1.16", - "symfony/routing": "^4.4|^5.0|^6.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0", + "php": ">=8.1", + "symfony/config": "^5.4|^6.0", + "symfony/framework-bundle": "^5.4|^6.0", + "symfony/http-kernel": "^6.3", + "symfony/routing": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, "conflict": { - "symfony/dependency-injection": "<5.2", - "symfony/form": "<4.4", + "symfony/form": "<5.4", "symfony/mailer": "<5.4", - "symfony/messenger": "<4.4" + "symfony/messenger": "<5.4" }, "require-dev": { - "symfony/browser-kit": "^4.4|^5.0|^6.0", - "symfony/console": "^4.4|^5.0|^6.0", - "symfony/css-selector": "^4.4|^5.0|^6.0", - "symfony/stopwatch": "^4.4|^5.0|^6.0" + "symfony/browser-kit": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/stopwatch": "^5.4|^6.0" }, "type": "symfony-bundle", "autoload": { @@ -15874,8 +15860,11 @@ ], "description": "Provides a development tool that gives detailed information about the execution of any request", "homepage": "https://symfony.com", + "keywords": [ + "dev" + ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v5.4.24" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.3.0" }, "funding": [ { @@ -15891,7 +15880,7 @@ "type": "tidelift" } ], - "time": "2023-05-02T16:38:36+00:00" + "time": "2023-05-22T17:08:58+00:00" }, { "name": "symplify/easy-coding-standard", From 6a2ff9d1539b70ca5e0b386e3b273f10994fbe58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 18:59:07 +0200 Subject: [PATCH 46/91] Added declare strict types to all files --- rector.php | 13 ++++++++++++- src/Command/BackupCommand.php | 2 ++ src/Command/CheckRequirementsCommand.php | 6 ++++-- .../Migrations/ImportPartKeeprCommand.php | 6 ++++-- src/Command/User/ConvertToSAMLUserCommand.php | 6 ++++-- .../User/UpgradePermissionsSchemaCommand.php | 4 +++- src/Command/User/UserEnableCommand.php | 6 ++++-- src/Command/User/UserListCommand.php | 6 ++++-- src/Command/User/UsersPermissionsCommand.php | 4 +++- src/Command/VersionCommand.php | 6 ++++-- src/Controller/PartImportExportController.php | 6 ++++-- src/Controller/ProjectController.php | 6 ++++-- src/Controller/RedirectController.php | 2 +- src/Controller/SelectAPIController.php | 4 +++- src/Controller/ToolsController.php | 4 +++- src/Controller/UserSettingsController.php | 4 ++-- .../WebauthnKeyRegistrationController.php | 6 ++++-- .../Adapters/CustomFetchJoinORMAdapter.php | 6 ++++-- src/DataTables/Column/PrettyBoolColumn.php | 6 ++++-- src/DataTables/Column/RowClassColumn.php | 6 ++++-- src/DataTables/Column/SIUnitNumberColumn.php | 6 ++++-- src/DataTables/Column/SelectColumn.php | 6 ++++-- src/DataTables/ErrorDataTable.php | 6 ++++-- src/DataTables/Filters/AttachmentFilter.php | 6 ++++-- src/DataTables/Filters/CompoundFilterTrait.php | 6 ++++-- .../Filters/Constraints/AbstractConstraint.php | 6 ++++-- .../Filters/Constraints/BooleanConstraint.php | 6 ++++-- .../Filters/Constraints/ChoiceConstraint.php | 8 +++++--- .../Filters/Constraints/DateTimeConstraint.php | 6 ++++-- .../Filters/Constraints/EntityConstraint.php | 8 +++++--- .../Filters/Constraints/FilterTrait.php | 6 ++++-- .../Constraints/InstanceOfConstraint.php | 8 +++++--- .../Filters/Constraints/IntConstraint.php | 6 ++++-- .../Filters/Constraints/NumberConstraint.php | 8 +++++--- .../Part/LessThanDesiredConstraint.php | 6 ++++-- .../Constraints/Part/ParameterConstraint.php | 12 +++++++----- .../Part/ParameterValueConstraint.php | 6 ++++-- .../Constraints/Part/TagsConstraint.php | 8 +++++--- .../Filters/Constraints/TextConstraint.php | 8 +++++--- src/DataTables/Filters/FilterInterface.php | 6 ++++-- src/DataTables/Filters/LogFilter.php | 6 ++++-- src/DataTables/Filters/PartFilter.php | 4 +++- src/DataTables/Filters/PartSearchFilter.php | 8 +++++--- src/DataTables/Helpers/PartDataTableHelper.php | 6 ++++-- src/DataTables/ProjectBomEntriesDataTable.php | 8 +++++--- .../Purger/ResetAutoIncrementPurgerFactory.php | 6 ++++-- src/Doctrine/SQLiteRegexExtension.php | 6 ++++-- .../SetSQLMode/SetSQLModeMiddlewareDriver.php | 6 ++++-- .../SetSQLMode/SetSQLModeMiddlewareWrapper.php | 6 ++++-- src/Doctrine/Types/BigDecimalType.php | 4 +++- src/Doctrine/Types/TinyIntType.php | 6 ++++-- src/Entity/Attachments/Attachment.php | 8 ++++---- .../PartsContainingRepositoryInterface.php | 4 +++- .../Contracts/LogWithNewDataInterface.php | 6 ++++-- .../LogSystem/PartStockChangedLogEntry.php | 8 +++++--- src/Entity/Parameters/AbstractParameter.php | 2 +- src/Entity/Parts/Part.php | 2 +- src/Entity/Parts/PartTraits/ProjectTrait.php | 4 +++- src/Entity/ProjectSystem/ProjectBOMEntry.php | 2 +- src/Entity/UserSystem/PermissionData.php | 6 ++++-- src/Entity/UserSystem/User.php | 2 +- src/Entity/UserSystem/WebauthnKey.php | 6 ++++-- .../LogSystem/EventLoggerSubscriber.php | 2 +- .../LogSystem/LogDBMigrationSubscriber.php | 4 ++-- .../UserSystem/SetUserTimezoneSubscriber.php | 4 ++-- .../UpgradePermissionsSchemaSubscriber.php | 6 ++++-- src/Exceptions/InvalidRegexException.php | 6 ++++-- src/Form/AdminPages/ProjectAdminForm.php | 6 ++++-- src/Form/AttachmentFormType.php | 2 +- src/Form/Filters/AttachmentFilterType.php | 6 ++++-- .../Constraints/BooleanConstraintType.php | 6 ++++-- .../Constraints/ChoiceConstraintType.php | 6 ++++-- .../Constraints/DateTimeConstraintType.php | 6 ++++-- .../Constraints/InstanceOfConstraintType.php | 6 ++++-- .../Constraints/NumberConstraintType.php | 6 ++++-- .../Constraints/ParameterConstraintType.php | 6 ++++-- .../ParameterValueConstraintType.php | 6 ++++-- .../StructuralEntityConstraintType.php | 6 ++++-- .../Filters/Constraints/TagsConstraintType.php | 6 ++++-- .../Filters/Constraints/TextConstraintType.php | 6 ++++-- .../Constraints/UserEntityConstraintType.php | 6 ++++-- src/Form/Filters/LogFilterType.php | 6 ++++-- src/Form/Filters/PartFilterType.php | 6 ++++-- .../ProjectBOMEntryCollectionType.php | 4 +++- src/Form/ProjectSystem/ProjectBOMEntryType.php | 4 +++- src/Form/ProjectSystem/ProjectBuildType.php | 8 +++++--- src/Form/Type/BigDecimalMoneyType.php | 4 +++- src/Form/Type/BigDecimalNumberType.php | 4 +++- .../Helper/StructuralEntityChoiceHelper.php | 10 ++++++---- .../Helper/StructuralEntityChoiceLoader.php | 6 ++++-- src/Form/Type/PartLotSelectType.php | 6 ++++-- src/Form/Type/PartSelectType.php | 4 +++- src/Form/Type/RichTextEditorType.php | 6 ++++-- src/Form/Type/ThemeChoiceType.php | 6 ++++-- src/Form/Type/UserSelectType.php | 6 ++++-- src/Helpers/Projects/ProjectBuildRequest.php | 6 ++++-- src/Helpers/Trees/TreeViewNodeIterator.php | 2 +- src/Kernel.php | 4 +++- .../AbstractMultiPlatformMigration.php | 8 +++++--- .../AbstractPartsContainingRepository.php | 4 +++- src/Repository/ParameterRepository.php | 6 ++++-- src/Repository/Parts/CategoryRepository.php | 4 +++- src/Repository/Parts/DeviceRepository.php | 6 ++++-- src/Repository/Parts/FootprintRepository.php | 4 +++- .../Parts/ManufacturerRepository.php | 4 +++- .../Parts/MeasurementUnitRepository.php | 4 +++- .../Parts/StorelocationRepository.php | 4 +++- src/Repository/Parts/SupplierRepository.php | 4 +++- .../StructuralDBElementRepository.php | 5 +---- src/Repository/UserRepository.php | 2 +- .../EnsureSAMLUserForSAMLLoginChecker.php | 6 ++++-- src/Security/SamlUserFactory.php | 6 ++++-- src/Security/Voter/ParameterVoter.php | 6 ++++-- src/Serializer/BigNumberNormalizer.php | 6 ++++-- src/Serializer/PartNormalizer.php | 6 ++++-- .../StructuralElementDenormalizer.php | 6 ++++-- .../StructuralElementFromNameDenormalizer.php | 6 ++++-- src/Serializer/StructuralElementNormalizer.php | 9 +++++---- src/Services/Attachments/AttachmentManager.php | 4 ++-- .../Attachments/AttachmentSubmitHandler.php | 6 +++--- .../Attachments/AttachmentURLGenerator.php | 2 +- .../Attachments/BuiltinAttachmentsFinder.php | 2 +- .../Attachments/FileTypeFilterTools.php | 2 +- src/Services/ElementTypeNameGenerator.php | 2 +- src/Services/Formatters/MoneyFormatter.php | 2 +- .../ImportExportSystem/BOMImporter.php | 6 ++++-- .../MySQLDumpXMLConverter.php | 6 ++++-- .../PKDatastructureImporter.php | 6 ++++-- .../PartKeeprImporter/PKImportHelper.php | 6 ++++-- .../PartKeeprImporter/PKImportHelperTrait.php | 6 ++++-- .../PartKeeprImporter/PKOptionalImporter.php | 6 ++++-- .../PartKeeprImporter/PKPartImporter.php | 6 ++++-- .../PlaceholderProviders/BarcodeProvider.php | 6 ++++-- .../StorelocationProvider.php | 6 ++++-- .../LogSystem/EventCommentNeededHelper.php | 6 ++++-- src/Services/LogSystem/LogDataFormatter.php | 6 ++++-- src/Services/LogSystem/LogDiffFormatter.php | 6 ++++-- .../LogSystem/LogEntryExtraFormatter.php | 6 +++--- src/Services/LogSystem/LogLevelHelper.php | 6 ++++-- src/Services/LogSystem/LogTargetHelper.php | 6 ++++-- src/Services/Misc/ConsoleInfoHelper.php | 18 +++++------------- src/Services/Misc/DBInfoHelper.php | 4 +++- src/Services/Misc/RangeParser.php | 2 +- src/Services/Parameters/ParameterExtractor.php | 2 +- .../Parts/PartLotWithdrawAddHelper.php | 10 ++++++---- src/Services/Parts/PartsTableActionHandler.php | 4 +++- .../ProjectSystem/ProjectBuildHelper.php | 6 ++++-- .../ProjectSystem/ProjectBuildPartHelper.php | 4 +++- src/Services/Tools/ExchangeRateUpdater.php | 4 +++- src/Services/Trees/SidebarTreeUpdater.php | 6 ++++-- src/Services/Trees/ToolsTreeBuilder.php | 8 ++++---- src/Services/Trees/TreeViewGenerator.php | 4 ++-- .../UserSystem/PasswordResetManager.php | 2 +- .../UserSystem/PermissionPresetsHelper.php | 6 ++++-- .../UserSystem/PermissionSchemaUpdater.php | 6 ++++-- .../UserSystem/TFA/BackupCodeManager.php | 2 +- src/Services/UserSystem/UserAvatarHelper.php | 8 +++++--- src/Twig/AttachmentExtension.php | 6 ++++-- src/Twig/BarcodeExtension.php | 4 +++- src/Twig/EntityExtension.php | 6 ++++-- src/Twig/LogExtension.php | 6 ++++-- src/Twig/MiscExtension.php | 6 ++++-- src/Twig/TwigCoreExtension.php | 6 ++++-- .../BigDecimalGreaterThanValidator.php | 4 +++- .../BigDecimalGreaterThenOrEqualValidator.php | 4 +++- .../BigDecimal/BigDecimalPositive.php | 4 +++- .../BigDecimal/BigDecimalPositiveOrZero.php | 4 +++- .../BigDecimal/BigNumberConstraintTrait.php | 6 ++++-- .../ProjectSystem/ValidProjectBuildRequest.php | 6 ++++-- .../ValidProjectBuildRequestValidator.php | 6 ++++-- src/Validator/Constraints/ValidTheme.php | 6 ++++-- .../Constraints/ValidThemeValidator.php | 6 ++++-- .../Filters/CompoundFilterTraitTest.php | 4 +++- .../Filters/Constraints/FilterTraitTest.php | 4 +++- tests/Entity/UserSystem/PermissionDataTest.php | 4 +++- .../Projects/ProjectBuildRequestTest.php | 4 +++- .../EnsureSAMLUserForSAMLLoginCheckerTest.php | 4 +++- tests/Security/SamlUserFactoryTest.php | 4 +++- tests/Serializer/BigNumberNormalizerTest.php | 4 +++- tests/Serializer/PartNormalizerTest.php | 4 +++- .../StructuralElementDenormalizerTest.php | 4 +++- ...ructuralElementFromNameDenormalizerTest.php | 4 +++- .../StructuralElementNormalizerTest.php | 4 +++- .../ImportExportSystem/BOMImporterTest.php | 4 +++- .../ImportExportSystem/EntityExporterTest.php | 4 +++- .../LogSystem/EventCommentNeededHelperTest.php | 4 +++- .../Misc/MySQLDumpXMLConverterTest.php | 4 +++- .../Parts/PartLotWithdrawAddHelperTest.php | 2 ++ .../ProjectSystem/ProjectBuildHelperTest.php | 4 +++- .../ProjectBuildPartHelperTest.php | 4 +++- .../UserSystem/PermissionSchemaUpdaterTest.php | 4 +++- tests/Twig/EntityExtensionTest.php | 4 +++- tests/Twig/TwigCoreExtensionTest.php | 4 +++- tests/Twig/UserExtensionTest.php | 4 +++- tests/bootstrap.php | 5 ++--- tests/symfony-container.php | 5 ++--- 196 files changed, 685 insertions(+), 360 deletions(-) diff --git a/rector.php b/rector.php index dbcefaf6..94ade3df 100644 --- a/rector.php +++ b/rector.php @@ -2,15 +2,17 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; +use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\Config\RectorConfig; use Rector\Doctrine\Set\DoctrineSetList; +use Rector\PHPUnit\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector; use Rector\PHPUnit\Set\PHPUnitLevelSetList; use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Rector\Symfony\Set\SymfonyLevelSetList; use Rector\Symfony\Set\SymfonySetList; +use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; return static function (RectorConfig $rectorConfig): void { $rectorConfig->symfonyContainerXml(__DIR__ . '/var/cache/dev/App_KernelDevDebugContainer.xml'); @@ -31,6 +33,10 @@ return static function (RectorConfig $rectorConfig): void { // register a single rule //$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + $rectorConfig->rules([ + DeclareStrictTypesRector::class, + ]); + // define sets of rules $rectorConfig->sets([ //PHP rules @@ -49,4 +55,9 @@ return static function (RectorConfig $rectorConfig): void { PHPUnitLevelSetList::UP_TO_PHPUNIT_90, PHPUnitSetList::PHPUNIT_CODE_QUALITY, ]); + + $rectorConfig->skip([ + AddDoesNotPerformAssertionToNonAssertingTestRector::class, + CountArrayToEmptyArrayComparisonRector::class, + ]); }; diff --git a/src/Command/BackupCommand.php b/src/Command/BackupCommand.php index d68afb67..ef7d038f 100644 --- a/src/Command/BackupCommand.php +++ b/src/Command/BackupCommand.php @@ -1,5 +1,7 @@ . */ - namespace App\Command; use Symfony\Component\Console\Attribute\AsCommand; @@ -187,4 +189,4 @@ class CheckRequirementsCommand extends Command } -} \ No newline at end of file +} diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index 20269c0a..98272440 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command\Migrations; use Symfony\Component\Console\Attribute\AsCommand; @@ -141,4 +143,4 @@ class ImportPartKeeprCommand extends Command $io->success('Imported '.$count.' parts.'); } -} \ No newline at end of file +} diff --git a/src/Command/User/ConvertToSAMLUserCommand.php b/src/Command/User/ConvertToSAMLUserCommand.php index d59b00a4..b023a1ba 100644 --- a/src/Command/User/ConvertToSAMLUserCommand.php +++ b/src/Command/User/ConvertToSAMLUserCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command\User; use Symfony\Component\Console\Attribute\AsCommand; @@ -105,4 +107,4 @@ class ConvertToSAMLUserCommand extends Command return 0; } -} \ No newline at end of file +} diff --git a/src/Command/User/UpgradePermissionsSchemaCommand.php b/src/Command/User/UpgradePermissionsSchemaCommand.php index 758a7903..4947fd5c 100644 --- a/src/Command/User/UpgradePermissionsSchemaCommand.php +++ b/src/Command/User/UpgradePermissionsSchemaCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command\User; use Symfony\Component\Console\Attribute\AsCommand; diff --git a/src/Command/User/UserEnableCommand.php b/src/Command/User/UserEnableCommand.php index 182e8558..00753e94 100644 --- a/src/Command/User/UserEnableCommand.php +++ b/src/Command/User/UserEnableCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command\User; use Symfony\Component\Console\Attribute\AsCommand; @@ -99,4 +101,4 @@ class UserEnableCommand extends Command return self::SUCCESS; } -} \ No newline at end of file +} diff --git a/src/Command/User/UserListCommand.php b/src/Command/User/UserListCommand.php index cec70461..ca56c994 100644 --- a/src/Command/User/UserListCommand.php +++ b/src/Command/User/UserListCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command\User; use Symfony\Component\Console\Attribute\AsCommand; @@ -93,4 +95,4 @@ class UserListCommand extends Command return self::SUCCESS; } -} \ No newline at end of file +} diff --git a/src/Command/User/UsersPermissionsCommand.php b/src/Command/User/UsersPermissionsCommand.php index d78b0725..b4bcd99a 100644 --- a/src/Command/User/UsersPermissionsCommand.php +++ b/src/Command/User/UsersPermissionsCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command\User; use Symfony\Component\Console\Attribute\AsCommand; diff --git a/src/Command/VersionCommand.php b/src/Command/VersionCommand.php index 76f7db70..d2ce75e1 100644 --- a/src/Command/VersionCommand.php +++ b/src/Command/VersionCommand.php @@ -1,4 +1,7 @@ . */ - namespace App\Command; use Symfony\Component\Console\Attribute\AsCommand; @@ -60,4 +62,4 @@ class VersionCommand extends Command return Command::SUCCESS; } -} \ No newline at end of file +} diff --git a/src/Controller/PartImportExportController.php b/src/Controller/PartImportExportController.php index b5d4c4e1..326ea923 100644 --- a/src/Controller/PartImportExportController.php +++ b/src/Controller/PartImportExportController.php @@ -1,4 +1,7 @@ . */ - namespace App\Controller; use App\Entity\Parts\Part; @@ -121,4 +123,4 @@ class PartImportExportController extends AbstractController return $entityExporter->exportEntityFromRequest($parts, $request); } -} \ No newline at end of file +} diff --git a/src/Controller/ProjectController.php b/src/Controller/ProjectController.php index 44e770e3..a15ce97f 100644 --- a/src/Controller/ProjectController.php +++ b/src/Controller/ProjectController.php @@ -1,4 +1,7 @@ . */ - namespace App\Controller; use App\DataTables\ProjectBomEntriesDataTable; @@ -262,4 +264,4 @@ class ProjectController extends AbstractController 'form' => $form, ]); } -} \ No newline at end of file +} diff --git a/src/Controller/RedirectController.php b/src/Controller/RedirectController.php index aef346d9..40c2c051 100644 --- a/src/Controller/RedirectController.php +++ b/src/Controller/RedirectController.php @@ -50,7 +50,7 @@ class RedirectController extends AbstractController //Check if a user has set a preferred language setting: $user = $this->getUser(); - if (($user instanceof User) && !empty($user->getLanguage())) { + if (($user instanceof User) && ($user->getLanguage() !== null && $user->getLanguage() !== '')) { $locale = $user->getLanguage(); } diff --git a/src/Controller/SelectAPIController.php b/src/Controller/SelectAPIController.php index 8691b967..c403ab82 100644 --- a/src/Controller/SelectAPIController.php +++ b/src/Controller/SelectAPIController.php @@ -1,4 +1,7 @@ . */ - namespace App\Controller; use App\Entity\Base\AbstractNamedDBElement; diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php index a40b9440..c14e1a13 100644 --- a/src/Controller/ToolsController.php +++ b/src/Controller/ToolsController.php @@ -1,4 +1,7 @@ . */ - namespace App\Controller; use App\Services\Attachments\AttachmentPathResolver; diff --git a/src/Controller/UserSettingsController.php b/src/Controller/UserSettingsController.php index 2d36d368..2597cfce 100644 --- a/src/Controller/UserSettingsController.php +++ b/src/Controller/UserSettingsController.php @@ -81,7 +81,7 @@ class UserSettingsController extends AbstractController throw new RuntimeException('You can not remove U2F keys from SAML users!'); } - if (empty($user->getBackupCodes())) { + if ($user->getBackupCodes() === []) { $this->addFlash('error', 'tfa_backup.no_codes_enabled'); throw new RuntimeException('You do not have any backup codes enabled, therefore you can not view them!'); @@ -361,7 +361,7 @@ class UserSettingsController extends AbstractController 'attr' => [ 'class' => 'btn-danger', ], - 'disabled' => empty($user->getBackupCodes()), + 'disabled' => $user->getBackupCodes() === [], ])->getForm(); $backup_form->handleRequest($request); diff --git a/src/Controller/WebauthnKeyRegistrationController.php b/src/Controller/WebauthnKeyRegistrationController.php index cf273626..f2323510 100644 --- a/src/Controller/WebauthnKeyRegistrationController.php +++ b/src/Controller/WebauthnKeyRegistrationController.php @@ -1,4 +1,7 @@ . */ - namespace App\Controller; use App\Entity\UserSystem\User; @@ -95,4 +97,4 @@ class WebauthnKeyRegistrationController extends AbstractController ] ); } -} \ No newline at end of file +} diff --git a/src/DataTables/Adapters/CustomFetchJoinORMAdapter.php b/src/DataTables/Adapters/CustomFetchJoinORMAdapter.php index 9f6d83d0..0c4d4349 100644 --- a/src/DataTables/Adapters/CustomFetchJoinORMAdapter.php +++ b/src/DataTables/Adapters/CustomFetchJoinORMAdapter.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Adapters; use Doctrine\ORM\QueryBuilder; @@ -50,4 +52,4 @@ class CustomFetchJoinORMAdapter extends FetchJoinORMAdapter return $paginator->count(); } -} \ No newline at end of file +} diff --git a/src/DataTables/Column/PrettyBoolColumn.php b/src/DataTables/Column/PrettyBoolColumn.php index ffddeac5..912a9122 100644 --- a/src/DataTables/Column/PrettyBoolColumn.php +++ b/src/DataTables/Column/PrettyBoolColumn.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Column; use Omines\DataTablesBundle\Column\AbstractColumn; @@ -60,4 +62,4 @@ class PrettyBoolColumn extends AbstractColumn throw new \RuntimeException('Unexpected value!'); } -} \ No newline at end of file +} diff --git a/src/DataTables/Column/RowClassColumn.php b/src/DataTables/Column/RowClassColumn.php index c583cf2f..1bfbecee 100644 --- a/src/DataTables/Column/RowClassColumn.php +++ b/src/DataTables/Column/RowClassColumn.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Column; use Omines\DataTablesBundle\Column\AbstractColumn; @@ -55,4 +57,4 @@ class RowClassColumn extends AbstractColumn { return $value; } -} \ No newline at end of file +} diff --git a/src/DataTables/Column/SIUnitNumberColumn.php b/src/DataTables/Column/SIUnitNumberColumn.php index 61e1999c..eec033dc 100644 --- a/src/DataTables/Column/SIUnitNumberColumn.php +++ b/src/DataTables/Column/SIUnitNumberColumn.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Column; use App\Services\Formatters\SIFormatter; @@ -49,4 +51,4 @@ class SIUnitNumberColumn extends AbstractColumn return htmlspecialchars($this->formatter->format((float) $value, $this->options['unit'], $this->options['precision'])); } -} \ No newline at end of file +} diff --git a/src/DataTables/Column/SelectColumn.php b/src/DataTables/Column/SelectColumn.php index c26e916c..18d4193d 100644 --- a/src/DataTables/Column/SelectColumn.php +++ b/src/DataTables/Column/SelectColumn.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Column; use Omines\DataTablesBundle\Column\AbstractColumn; @@ -56,4 +58,4 @@ class SelectColumn extends AbstractColumn //Return empty string, as it this column is filled by datatables on client side return ''; } -} \ No newline at end of file +} diff --git a/src/DataTables/ErrorDataTable.php b/src/DataTables/ErrorDataTable.php index 6bb66841..3aaf11d1 100644 --- a/src/DataTables/ErrorDataTable.php +++ b/src/DataTables/ErrorDataTable.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables; use App\DataTables\Column\RowClassColumn; @@ -78,4 +80,4 @@ class ErrorDataTable implements DataTableTypeInterface $error_table->handleRequest($request); return $error_table->getResponse(); } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/AttachmentFilter.php b/src/DataTables/Filters/AttachmentFilter.php index 5fc38296..9e32a840 100644 --- a/src/DataTables/Filters/AttachmentFilter.php +++ b/src/DataTables/Filters/AttachmentFilter.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters; use App\DataTables\Filters\Constraints\BooleanConstraint; @@ -102,4 +104,4 @@ class AttachmentFilter implements FilterInterface -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/CompoundFilterTrait.php b/src/DataTables/Filters/CompoundFilterTrait.php index 24a9f46c..dc16bc2b 100644 --- a/src/DataTables/Filters/CompoundFilterTrait.php +++ b/src/DataTables/Filters/CompoundFilterTrait.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters; use Doctrine\Common\Collections\Collection; @@ -70,4 +72,4 @@ trait CompoundFilterTrait $filter->apply($queryBuilder); } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/AbstractConstraint.php b/src/DataTables/Filters/Constraints/AbstractConstraint.php index 2ef89c8e..4dc79a41 100644 --- a/src/DataTables/Filters/Constraints/AbstractConstraint.php +++ b/src/DataTables/Filters/Constraints/AbstractConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use App\DataTables\Filters\FilterInterface; @@ -45,4 +47,4 @@ abstract class AbstractConstraint implements FilterInterface { $this->identifier = $identifier ?? $this->generateParameterIdentifier($property); } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/BooleanConstraint.php b/src/DataTables/Filters/Constraints/BooleanConstraint.php index 2810c26e..1f971b0a 100644 --- a/src/DataTables/Filters/Constraints/BooleanConstraint.php +++ b/src/DataTables/Filters/Constraints/BooleanConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -61,4 +63,4 @@ class BooleanConstraint extends AbstractConstraint $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier, '=', $this->value); } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/ChoiceConstraint.php b/src/DataTables/Filters/Constraints/ChoiceConstraint.php index 9aa6ebbc..aea35571 100644 --- a/src/DataTables/Filters/Constraints/ChoiceConstraint.php +++ b/src/DataTables/Filters/Constraints/ChoiceConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -68,7 +70,7 @@ class ChoiceConstraint extends AbstractConstraint public function isEnabled(): bool { - return !empty($this->operator); + return $this->operator !== ''; } public function apply(QueryBuilder $queryBuilder): void @@ -91,4 +93,4 @@ class ChoiceConstraint extends AbstractConstraint throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/DateTimeConstraint.php b/src/DataTables/Filters/Constraints/DateTimeConstraint.php index 39eaaa1d..1ded472e 100644 --- a/src/DataTables/Filters/Constraints/DateTimeConstraint.php +++ b/src/DataTables/Filters/Constraints/DateTimeConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; /** @@ -25,4 +27,4 @@ namespace App\DataTables\Filters\Constraints; */ class DateTimeConstraint extends NumberConstraint { -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/EntityConstraint.php b/src/DataTables/Filters/Constraints/EntityConstraint.php index 2a17552d..df8a670c 100644 --- a/src/DataTables/Filters/Constraints/EntityConstraint.php +++ b/src/DataTables/Filters/Constraints/EntityConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use App\Entity\Base\AbstractDBElement; @@ -112,7 +114,7 @@ class EntityConstraint extends AbstractConstraint public function isEnabled(): bool { - return !empty($this->operator); + return $this->operator !== null && $this->operator !== ''; } public function apply(QueryBuilder $queryBuilder): void @@ -167,4 +169,4 @@ class EntityConstraint extends AbstractConstraint } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/FilterTrait.php b/src/DataTables/Filters/Constraints/FilterTrait.php index 8244eac3..583fa98a 100644 --- a/src/DataTables/Filters/Constraints/FilterTrait.php +++ b/src/DataTables/Filters/Constraints/FilterTrait.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -71,4 +73,4 @@ trait FilterTrait $queryBuilder->setParameter($parameterIdentifier, $value); } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/InstanceOfConstraint.php b/src/DataTables/Filters/Constraints/InstanceOfConstraint.php index 879e2321..582a1b90 100644 --- a/src/DataTables/Filters/Constraints/InstanceOfConstraint.php +++ b/src/DataTables/Filters/Constraints/InstanceOfConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -75,7 +77,7 @@ class InstanceOfConstraint extends AbstractConstraint public function isEnabled(): bool { - return !empty($this->operator); + return $this->operator !== ''; } public function apply(QueryBuilder $queryBuilder): void @@ -107,4 +109,4 @@ class InstanceOfConstraint extends AbstractConstraint throw new \RuntimeException('Unknown operator '. $this->operator . ' provided. Valid operators are '. implode(', ', self::ALLOWED_OPERATOR_VALUES)); } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/IntConstraint.php b/src/DataTables/Filters/Constraints/IntConstraint.php index 601f6aa8..3fc5cce5 100644 --- a/src/DataTables/Filters/Constraints/IntConstraint.php +++ b/src/DataTables/Filters/Constraints/IntConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -35,4 +37,4 @@ class IntConstraint extends NumberConstraint parent::apply($queryBuilder); } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/NumberConstraint.php b/src/DataTables/Filters/Constraints/NumberConstraint.php index b87a6cc4..e1c741ea 100644 --- a/src/DataTables/Filters/Constraints/NumberConstraint.php +++ b/src/DataTables/Filters/Constraints/NumberConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -82,7 +84,7 @@ class NumberConstraint extends AbstractConstraint public function isEnabled(): bool { return $this->value1 !== null - && !empty($this->operator); + && ($this->operator !== null && $this->operator !== ''); } public function apply(QueryBuilder $queryBuilder): void @@ -108,4 +110,4 @@ class NumberConstraint extends AbstractConstraint $this->addSimpleAndConstraint($queryBuilder, $this->property, $this->identifier . '2', '<=', $this->value2); } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/Part/LessThanDesiredConstraint.php b/src/DataTables/Filters/Constraints/Part/LessThanDesiredConstraint.php index 34d5c157..3bdd7cf8 100644 --- a/src/DataTables/Filters/Constraints/Part/LessThanDesiredConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/LessThanDesiredConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints\Part; use App\DataTables\Filters\Constraints\BooleanConstraint; @@ -44,4 +46,4 @@ class LessThanDesiredConstraint extends BooleanConstraint $queryBuilder->andHaving('amountSum >= part.minamount'); } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php b/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php index 2d431faf..00eba1c2 100644 --- a/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/ParameterConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints\Part; use App\DataTables\Filters\Constraints\AbstractConstraint; @@ -72,19 +74,19 @@ class ParameterConstraint extends AbstractConstraint ->from(PartParameter::class, $this->alias) ->where($this->alias . '.element = part'); - if (!empty($this->name)) { + if ($this->name !== '') { $paramName = $this->generateParameterIdentifier('params.name'); $subqb->andWhere($this->alias . '.name = :' . $paramName); $queryBuilder->setParameter($paramName, $this->name); } - if (!empty($this->symbol)) { + if ($this->symbol !== '') { $paramName = $this->generateParameterIdentifier('params.symbol'); $subqb->andWhere($this->alias . '.symbol = :' . $paramName); $queryBuilder->setParameter($paramName, $this->symbol); } - if (!empty($this->unit)) { + if ($this->unit !== '') { $paramName = $this->generateParameterIdentifier('params.unit'); $subqb->andWhere($this->alias . '.unit = :' . $paramName); $queryBuilder->setParameter($paramName, $this->unit); @@ -147,4 +149,4 @@ class ParameterConstraint extends AbstractConstraint } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php index 1451713b..469c18c6 100644 --- a/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/ParameterValueConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints\Part; use App\DataTables\Filters\Constraints\NumberConstraint; @@ -141,4 +143,4 @@ class ParameterValueConstraint extends NumberConstraint //For all other cases use the default implementation parent::apply($queryBuilder); } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php index 1c44255f..acd04745 100644 --- a/src/DataTables/Filters/Constraints/Part/TagsConstraint.php +++ b/src/DataTables/Filters/Constraints/Part/TagsConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints\Part; use Doctrine\ORM\Query\Expr\Orx; @@ -74,7 +76,7 @@ class TagsConstraint extends AbstractConstraint public function isEnabled(): bool { return $this->value !== null - && !empty($this->operator); + && ($this->operator !== null && $this->operator !== ''); } /** @@ -141,4 +143,4 @@ class TagsConstraint extends AbstractConstraint return; } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/Constraints/TextConstraint.php b/src/DataTables/Filters/Constraints/TextConstraint.php index 22e02fea..60f83328 100644 --- a/src/DataTables/Filters/Constraints/TextConstraint.php +++ b/src/DataTables/Filters/Constraints/TextConstraint.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters\Constraints; use Doctrine\ORM\QueryBuilder; @@ -72,7 +74,7 @@ class TextConstraint extends AbstractConstraint public function isEnabled(): bool { return $this->value !== null - && !empty($this->operator); + && ($this->operator !== null && $this->operator !== ''); } public function apply(QueryBuilder $queryBuilder): void @@ -115,4 +117,4 @@ class TextConstraint extends AbstractConstraint $queryBuilder->setParameter($this->identifier, $this->value); } } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/FilterInterface.php b/src/DataTables/Filters/FilterInterface.php index 1abbdc30..bead3fda 100644 --- a/src/DataTables/Filters/FilterInterface.php +++ b/src/DataTables/Filters/FilterInterface.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters; use Doctrine\ORM\QueryBuilder; @@ -31,4 +33,4 @@ interface FilterInterface * @return void */ public function apply(QueryBuilder $queryBuilder): void; -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/LogFilter.php b/src/DataTables/Filters/LogFilter.php index 416a9464..db9576ae 100644 --- a/src/DataTables/Filters/LogFilter.php +++ b/src/DataTables/Filters/LogFilter.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters; use App\DataTables\Filters\Constraints\ChoiceConstraint; @@ -97,4 +99,4 @@ class LogFilter implements FilterInterface } -} \ No newline at end of file +} diff --git a/src/DataTables/Filters/PartFilter.php b/src/DataTables/Filters/PartFilter.php index 92032a28..1419687a 100644 --- a/src/DataTables/Filters/PartFilter.php +++ b/src/DataTables/Filters/PartFilter.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters; use App\DataTables\Filters\Constraints\BooleanConstraint; diff --git a/src/DataTables/Filters/PartSearchFilter.php b/src/DataTables/Filters/PartSearchFilter.php index 7ddaf86e..b94d805a 100644 --- a/src/DataTables/Filters/PartSearchFilter.php +++ b/src/DataTables/Filters/PartSearchFilter.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Filters; use Doctrine\ORM\Query\Expr; @@ -121,7 +123,7 @@ class PartSearchFilter implements FilterInterface $fields_to_search = $this->getFieldsToSearch(); //If we have nothing to search for, do nothing - if ($fields_to_search === [] || empty($this->keyword)) { + if ($fields_to_search === [] || $this->keyword === '') { return; } @@ -302,4 +304,4 @@ class PartSearchFilter implements FilterInterface } -} \ No newline at end of file +} diff --git a/src/DataTables/Helpers/PartDataTableHelper.php b/src/DataTables/Helpers/PartDataTableHelper.php index df29f35b..8499e303 100644 --- a/src/DataTables/Helpers/PartDataTableHelper.php +++ b/src/DataTables/Helpers/PartDataTableHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables\Helpers; use App\Entity\ProjectSystem\Project; @@ -83,4 +85,4 @@ class PartDataTableHelper $title ); } -} \ No newline at end of file +} diff --git a/src/DataTables/ProjectBomEntriesDataTable.php b/src/DataTables/ProjectBomEntriesDataTable.php index 6397ae06..1870c262 100644 --- a/src/DataTables/ProjectBomEntriesDataTable.php +++ b/src/DataTables/ProjectBomEntriesDataTable.php @@ -1,4 +1,7 @@ . */ - namespace App\DataTables; use App\DataTables\Column\EntityColumn; @@ -88,7 +90,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface } if($context->getPart() instanceof Part) { $tmp = $this->partDataTableHelper->renderName($context->getPart()); - if(!empty($context->getName())) { + if($context->getName() !== null && $context->getName() !== '') { $tmp .= '
'.htmlspecialchars($context->getName()).''; } return $tmp; @@ -183,4 +185,4 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface { } -} \ No newline at end of file +} diff --git a/src/Doctrine/Purger/ResetAutoIncrementPurgerFactory.php b/src/Doctrine/Purger/ResetAutoIncrementPurgerFactory.php index 00152718..4d78e0f0 100644 --- a/src/Doctrine/Purger/ResetAutoIncrementPurgerFactory.php +++ b/src/Doctrine/Purger/ResetAutoIncrementPurgerFactory.php @@ -1,4 +1,7 @@ . */ - namespace App\Doctrine\Purger; use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory; @@ -35,4 +37,4 @@ class ResetAutoIncrementPurgerFactory implements PurgerFactory return $purger; } -} \ No newline at end of file +} diff --git a/src/Doctrine/SQLiteRegexExtension.php b/src/Doctrine/SQLiteRegexExtension.php index 3482348e..b5839c63 100644 --- a/src/Doctrine/SQLiteRegexExtension.php +++ b/src/Doctrine/SQLiteRegexExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Doctrine; use App\Exceptions\InvalidRegexException; @@ -55,4 +57,4 @@ class SQLiteRegexExtension } } } -} \ No newline at end of file +} diff --git a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php index 046672d9..5501b231 100644 --- a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php +++ b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareDriver.php @@ -1,4 +1,7 @@ . */ - namespace App\Doctrine\SetSQLMode; use Doctrine\DBAL\Driver\Connection; @@ -40,4 +42,4 @@ class SetSQLModeMiddlewareDriver extends AbstractDriverMiddleware return parent::connect($params); } -} \ No newline at end of file +} diff --git a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareWrapper.php b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareWrapper.php index 20632b56..34320fa5 100644 --- a/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareWrapper.php +++ b/src/Doctrine/SetSQLMode/SetSQLModeMiddlewareWrapper.php @@ -1,4 +1,7 @@ . */ - namespace App\Doctrine\SetSQLMode; use Doctrine\DBAL\Driver; @@ -33,4 +35,4 @@ class SetSQLModeMiddlewareWrapper implements Middleware { return new SetSQLModeMiddlewareDriver($driver); } -} \ No newline at end of file +} diff --git a/src/Doctrine/Types/BigDecimalType.php b/src/Doctrine/Types/BigDecimalType.php index 83307ee8..6c7bf614 100644 --- a/src/Doctrine/Types/BigDecimalType.php +++ b/src/Doctrine/Types/BigDecimalType.php @@ -1,4 +1,7 @@ . */ - namespace App\Doctrine\Types; use Brick\Math\BigDecimal; diff --git a/src/Doctrine/Types/TinyIntType.php b/src/Doctrine/Types/TinyIntType.php index 951417db..9b2fc7a9 100644 --- a/src/Doctrine/Types/TinyIntType.php +++ b/src/Doctrine/Types/TinyIntType.php @@ -1,4 +1,7 @@ . */ - namespace App\Doctrine\Types; use Doctrine\DBAL\Platforms\AbstractPlatform; @@ -44,4 +46,4 @@ class TinyIntType extends Type //We use the comment, so that doctrine migrations can properly detect, that nothing has changed and no migration is needed. return true; } -} \ No newline at end of file +} diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index ae701ccd..cd979d78 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -182,7 +182,7 @@ abstract class Attachment extends AbstractNamedDBElement public function isExternal(): bool { //When path is empty, this attachment can not be external - if (empty($this->path)) { + if ($this->path === '') { return false; } @@ -236,7 +236,7 @@ abstract class Attachment extends AbstractNamedDBElement return null; } - if (!empty($this->original_filename)) { + if ($this->original_filename !== null && $this->original_filename !== '') { return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION)); } @@ -302,7 +302,7 @@ abstract class Attachment extends AbstractNamedDBElement } //If we have a stored original filename, then use it - if (!empty($this->original_filename)) { + if ($this->original_filename !== null && $this->original_filename !== '') { return $this->original_filename; } @@ -411,7 +411,7 @@ abstract class Attachment extends AbstractNamedDBElement public function setURL(?string $url): self { //Only set if the URL is not empty - if (!empty($url)) { + if ($url !== null && $url !== '') { if (str_contains($url, '%BASE%') || str_contains($url, '%MEDIA%')) { throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!'); } diff --git a/src/Entity/Base/PartsContainingRepositoryInterface.php b/src/Entity/Base/PartsContainingRepositoryInterface.php index 16932677..f852bc35 100644 --- a/src/Entity/Base/PartsContainingRepositoryInterface.php +++ b/src/Entity/Base/PartsContainingRepositoryInterface.php @@ -1,4 +1,7 @@ . */ - namespace App\Entity\Base; use App\Entity\Parts\Part; diff --git a/src/Entity/Contracts/LogWithNewDataInterface.php b/src/Entity/Contracts/LogWithNewDataInterface.php index 0ecad0f2..c4128cb7 100644 --- a/src/Entity/Contracts/LogWithNewDataInterface.php +++ b/src/Entity/Contracts/LogWithNewDataInterface.php @@ -1,4 +1,7 @@ . */ - namespace App\Entity\Contracts; interface LogWithNewDataInterface @@ -38,4 +40,4 @@ interface LogWithNewDataInterface * @return $this */ public function setNewData(array $new_data): self; -} \ No newline at end of file +} diff --git a/src/Entity/LogSystem/PartStockChangedLogEntry.php b/src/Entity/LogSystem/PartStockChangedLogEntry.php index 5ac1c953..9ffded62 100644 --- a/src/Entity/LogSystem/PartStockChangedLogEntry.php +++ b/src/Entity/LogSystem/PartStockChangedLogEntry.php @@ -1,4 +1,7 @@ . */ - namespace App\Entity\LogSystem; use App\Entity\Parts\PartLot; @@ -64,7 +66,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry 'n' => $new_stock, 'p' => $new_total_part_instock, ]); - if (!empty($comment)) { + if ($comment !== '') { $this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...'); } @@ -201,4 +203,4 @@ class PartStockChangedLogEntry extends AbstractLogEntry default => throw new \InvalidArgumentException('Invalid short type: '.$short_type), }; } -} \ No newline at end of file +} diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 1a090b78..4a5cb40a 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -394,7 +394,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement protected function formatWithUnit(float $value, string $format = '%g'): string { $str = sprintf($format, $value); - if (!empty($this->unit)) { + if ($this->unit !== '') { return $str.' '.$this->unit; } diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index 4fef18f2..04432f89 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -147,7 +147,7 @@ class Part extends AttachmentContainingDBElement //Ensure that the part name fullfills the regex of the category if ($this->category instanceof Category) { $regex = $this->category->getPartnameRegex(); - if (!empty($regex) && !preg_match($regex, $this->name)) { + if ($regex !== '' && !preg_match($regex, $this->name)) { $context->buildViolation('part.name.must_match_category_regex') ->atPath('name') ->setParameter('%regex%', $regex) diff --git a/src/Entity/Parts/PartTraits/ProjectTrait.php b/src/Entity/Parts/PartTraits/ProjectTrait.php index 5d627a70..6fd076bf 100644 --- a/src/Entity/Parts/PartTraits/ProjectTrait.php +++ b/src/Entity/Parts/PartTraits/ProjectTrait.php @@ -1,5 +1,7 @@ mountnames) && count($uniq_mountnames) !== (int) round ($this->quantity)) { + if ($this->mountnames !== '' && count($uniq_mountnames) !== (int) round ($this->quantity)) { $context->buildViolation('project.bom_entry.mountnames_quantity_mismatch') ->atPath('mountnames') ->addViolation(); diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index 998dfead..c8330f3b 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -1,4 +1,7 @@ . */ - namespace App\Entity\UserSystem; use Doctrine\DBAL\Types\Types; @@ -228,4 +230,4 @@ final class PermissionData implements \JsonSerializable return $this; } -} \ No newline at end of file +} diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 98665781..8f57c370 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -500,7 +500,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe { $tmp = $this->getFirstName(); //Don't add a space, if the name has only one part (it would look strange) - if (!empty($this->getFirstName()) && !empty($this->getLastName())) { + if ($this->getFirstName() !== null && $this->getFirstName() !== '' && ($this->getLastName() !== null && $this->getLastName() !== '')) { $tmp .= ' '; } $tmp .= $this->getLastName(); diff --git a/src/Entity/UserSystem/WebauthnKey.php b/src/Entity/UserSystem/WebauthnKey.php index 2098bd67..3acc6ba8 100644 --- a/src/Entity/UserSystem/WebauthnKey.php +++ b/src/Entity/UserSystem/WebauthnKey.php @@ -1,4 +1,7 @@ . */ - namespace App\Entity\UserSystem; use Doctrine\DBAL\Types\Types; @@ -89,4 +91,4 @@ class WebauthnKey extends BasePublicKeyCredentialSource $registration->getOtherUI() ); } -} \ No newline at end of file +} diff --git a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php index f66a96e5..262f196d 100644 --- a/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php +++ b/src/EventSubscriber/LogSystem/EventLoggerSubscriber.php @@ -146,7 +146,7 @@ class EventLoggerSubscriber implements EventSubscriber $uow = $em->getUnitOfWork(); // If we have added any ElementCreatedLogEntries added in postPersist, we flush them here. $uow->computeChangeSets(); - if ($uow->hasPendingInsertions() || !empty($uow->getScheduledEntityUpdates())) { + if ($uow->hasPendingInsertions() || $uow->getScheduledEntityUpdates() !== []) { $em->flush(); } diff --git a/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php b/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php index 8e3af891..07ec8ea4 100644 --- a/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php +++ b/src/EventSubscriber/LogSystem/LogDBMigrationSubscriber.php @@ -55,8 +55,8 @@ class LogDBMigrationSubscriber implements EventSubscriber $this->new_version = (string) $aliasResolver->resolveVersionAlias('current'); //After everything is done, write the results to DB log - $this->old_version = empty($this->old_version) ? 'legacy/empty' : $this->old_version; - $this->new_version = empty($this->new_version) ? 'unknown' : $this->new_version; + $this->old_version = $this->old_version === null || $this->old_version === '' ? 'legacy/empty' : $this->old_version; + $this->new_version = $this->new_version === '' ? 'unknown' : $this->new_version; try { $log = new DatabaseUpdatedLogEntry($this->old_version, $this->new_version); diff --git a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php index 277cf62d..10ecaddf 100644 --- a/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php +++ b/src/EventSubscriber/UserSystem/SetUserTimezoneSubscriber.php @@ -43,12 +43,12 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface //Check if the user has set a timezone $user = $this->security->getUser(); - if ($user instanceof User && !empty($user->getTimezone())) { + if ($user instanceof User && ($user->getTimezone() !== null && $user->getTimezone() !== '')) { $timezone = $user->getTimezone(); } //Fill with default value if needed - if (null === $timezone && !empty($this->default_timezone)) { + if (null === $timezone && $this->default_timezone !== '') { $timezone = $this->default_timezone; } diff --git a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php index 3997c050..6e81ec85 100644 --- a/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php +++ b/src/EventSubscriber/UserSystem/UpgradePermissionsSchemaSubscriber.php @@ -1,4 +1,7 @@ . */ - namespace App\EventSubscriber\UserSystem; use Symfony\Bundle\SecurityBundle\Security; @@ -68,4 +70,4 @@ class UpgradePermissionsSchemaSubscriber implements EventSubscriberInterface { return [KernelEvents::REQUEST => 'onRequest']; } -} \ No newline at end of file +} diff --git a/src/Exceptions/InvalidRegexException.php b/src/Exceptions/InvalidRegexException.php index e2dcd68e..aaa2a897 100644 --- a/src/Exceptions/InvalidRegexException.php +++ b/src/Exceptions/InvalidRegexException.php @@ -1,4 +1,7 @@ . */ - namespace App\Exceptions; use Doctrine\DBAL\Exception\DriverException; @@ -69,4 +71,4 @@ class InvalidRegexException extends \RuntimeException return new self($reason); } -} \ No newline at end of file +} diff --git a/src/Form/AdminPages/ProjectAdminForm.php b/src/Form/AdminPages/ProjectAdminForm.php index ebe01599..2d4683c9 100644 --- a/src/Form/AdminPages/ProjectAdminForm.php +++ b/src/Form/AdminPages/ProjectAdminForm.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\AdminPages; use App\Entity\Base\AbstractNamedDBElement; @@ -59,4 +61,4 @@ class ProjectAdminForm extends BaseEntityAdminForm ], ]); } -} \ No newline at end of file +} diff --git a/src/Form/AttachmentFormType.php b/src/Form/AttachmentFormType.php index dd05a0e5..71c0bedd 100644 --- a/src/Form/AttachmentFormType.php +++ b/src/Form/AttachmentFormType.php @@ -144,7 +144,7 @@ class AttachmentFormType extends AbstractType } //If the name is empty, use the original file name as attachment name - if (empty($attachment->getName())) { + if ($attachment->getName() === '') { $attachment->setName($file->getClientOriginalName()); } }, 100000); diff --git a/src/Form/Filters/AttachmentFilterType.php b/src/Form/Filters/AttachmentFilterType.php index 9908b542..92cb20b6 100644 --- a/src/Form/Filters/AttachmentFilterType.php +++ b/src/Form/Filters/AttachmentFilterType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters; use App\DataTables\Filters\AttachmentFilter; @@ -114,4 +116,4 @@ class AttachmentFilterType extends AbstractType 'label' => 'filter.discard', ]); } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/BooleanConstraintType.php b/src/Form/Filters/Constraints/BooleanConstraintType.php index 0c431a21..6669b5a7 100644 --- a/src/Form/Filters/Constraints/BooleanConstraintType.php +++ b/src/Form/Filters/Constraints/BooleanConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\BooleanConstraint; @@ -51,4 +53,4 @@ class BooleanConstraintType extends AbstractType //Remove the label from the compound form, as the checkbox already has a label $view->vars['label'] = false; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/ChoiceConstraintType.php b/src/Form/Filters/Constraints/ChoiceConstraintType.php index 16014c7f..70d37b08 100644 --- a/src/Form/Filters/Constraints/ChoiceConstraintType.php +++ b/src/Form/Filters/Constraints/ChoiceConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\ChoiceConstraint; @@ -63,4 +65,4 @@ class ChoiceConstraintType extends AbstractType ]); } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/DateTimeConstraintType.php b/src/Form/Filters/Constraints/DateTimeConstraintType.php index 56cde796..ffd3aafd 100644 --- a/src/Form/Filters/Constraints/DateTimeConstraintType.php +++ b/src/Form/Filters/Constraints/DateTimeConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\DateTimeConstraint; @@ -90,4 +92,4 @@ class DateTimeConstraintType extends AbstractType $view->vars['text_suffix'] = $options['text_suffix']; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/InstanceOfConstraintType.php b/src/Form/Filters/Constraints/InstanceOfConstraintType.php index af15117d..02de15e5 100644 --- a/src/Form/Filters/Constraints/InstanceOfConstraintType.php +++ b/src/Form/Filters/Constraints/InstanceOfConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\InstanceOfConstraint; @@ -40,4 +42,4 @@ class InstanceOfConstraintType extends AbstractType { return ChoiceConstraintType::class; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/NumberConstraintType.php b/src/Form/Filters/Constraints/NumberConstraintType.php index 38b9539c..ad792fa0 100644 --- a/src/Form/Filters/Constraints/NumberConstraintType.php +++ b/src/Form/Filters/Constraints/NumberConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\NumberConstraint; @@ -95,4 +97,4 @@ class NumberConstraintType extends AbstractType { $view->vars['text_suffix'] = $options['text_suffix']; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/ParameterConstraintType.php b/src/Form/Filters/Constraints/ParameterConstraintType.php index 10c58429..52fbc726 100644 --- a/src/Form/Filters/Constraints/ParameterConstraintType.php +++ b/src/Form/Filters/Constraints/ParameterConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\Part\ParameterConstraint; @@ -75,4 +77,4 @@ class ParameterConstraintType extends AbstractType } }); } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/ParameterValueConstraintType.php b/src/Form/Filters/Constraints/ParameterValueConstraintType.php index a99fd2a4..01fbca5c 100644 --- a/src/Form/Filters/Constraints/ParameterValueConstraintType.php +++ b/src/Form/Filters/Constraints/ParameterValueConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; class ParameterValueConstraintType extends NumberConstraintType @@ -48,4 +50,4 @@ class ParameterValueConstraintType extends NumberConstraintType { return NumberConstraintType::class; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/StructuralEntityConstraintType.php b/src/Form/Filters/Constraints/StructuralEntityConstraintType.php index 7396c54a..5191881b 100644 --- a/src/Form/Filters/Constraints/StructuralEntityConstraintType.php +++ b/src/Form/Filters/Constraints/StructuralEntityConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\EntityConstraint; @@ -70,4 +72,4 @@ class StructuralEntityConstraintType extends AbstractType parent::buildView($view, $form, $options); $view->vars['text_suffix'] = $options['text_suffix']; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/TagsConstraintType.php b/src/Form/Filters/Constraints/TagsConstraintType.php index 5fbf348c..0a7661dd 100644 --- a/src/Form/Filters/Constraints/TagsConstraintType.php +++ b/src/Form/Filters/Constraints/TagsConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\Part\TagsConstraint; @@ -68,4 +70,4 @@ class TagsConstraintType extends AbstractType 'required' => false, ]); } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/TextConstraintType.php b/src/Form/Filters/Constraints/TextConstraintType.php index 517fe980..492278d2 100644 --- a/src/Form/Filters/Constraints/TextConstraintType.php +++ b/src/Form/Filters/Constraints/TextConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\TextConstraint; @@ -76,4 +78,4 @@ class TextConstraintType extends AbstractType $view->vars['text_suffix'] = $options['text_suffix']; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/Constraints/UserEntityConstraintType.php b/src/Form/Filters/Constraints/UserEntityConstraintType.php index cf646fe9..8c82e0d8 100644 --- a/src/Form/Filters/Constraints/UserEntityConstraintType.php +++ b/src/Form/Filters/Constraints/UserEntityConstraintType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters\Constraints; use App\DataTables\Filters\Constraints\EntityConstraint; @@ -65,4 +67,4 @@ class UserEntityConstraintType extends AbstractType parent::buildView($view, $form, $options); $view->vars['text_suffix'] = $options['text_suffix']; } -} \ No newline at end of file +} diff --git a/src/Form/Filters/LogFilterType.php b/src/Form/Filters/LogFilterType.php index 45e6cccf..16d2c7aa 100644 --- a/src/Form/Filters/LogFilterType.php +++ b/src/Form/Filters/LogFilterType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters; use App\DataTables\Filters\LogFilter; @@ -168,4 +170,4 @@ class LogFilterType extends AbstractType 'label' => 'filter.discard', ]); } -} \ No newline at end of file +} diff --git a/src/Form/Filters/PartFilterType.php b/src/Form/Filters/PartFilterType.php index fceb3c16..5533189c 100644 --- a/src/Form/Filters/PartFilterType.php +++ b/src/Form/Filters/PartFilterType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Filters; use App\DataTables\Filters\Constraints\Part\ParameterConstraint; @@ -277,4 +279,4 @@ class PartFilterType extends AbstractType ]); } -} \ No newline at end of file +} diff --git a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php index 5f4e5210..53ec5f70 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryCollectionType.php @@ -1,5 +1,7 @@ false, ]); } -} \ No newline at end of file +} diff --git a/src/Form/ProjectSystem/ProjectBOMEntryType.php b/src/Form/ProjectSystem/ProjectBOMEntryType.php index 35a00e67..cac362fb 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryType.php @@ -1,5 +1,7 @@ ProjectBOMEntry::class, ]); } -} \ No newline at end of file +} diff --git a/src/Form/ProjectSystem/ProjectBuildType.php b/src/Form/ProjectSystem/ProjectBuildType.php index 77260fcb..82489471 100644 --- a/src/Form/ProjectSystem/ProjectBuildType.php +++ b/src/Form/ProjectSystem/ProjectBuildType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\ProjectSystem; use Symfony\Bundle\SecurityBundle\Security; @@ -153,7 +155,7 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface if (!$lot) { //When the user selected "Create new lot", create a new lot $lot = new PartLot(); $description = 'Build ' . date('Y-m-d H:i:s'); - if (!empty($data->getComment())) { + if ($data->getComment() !== '') { $description .= ' (' . $data->getComment() . ')'; } $lot->setDescription($description); @@ -166,4 +168,4 @@ class ProjectBuildType extends AbstractType implements DataMapperInterface //This has to be set after the builds part lot, so that it can disable the option $data->setAddBuildsToBuildsPart($forms['addBuildsToBuildsPart']->getData()); } -} \ No newline at end of file +} diff --git a/src/Form/Type/BigDecimalMoneyType.php b/src/Form/Type/BigDecimalMoneyType.php index 3c7d252f..189416ff 100644 --- a/src/Form/Type/BigDecimalMoneyType.php +++ b/src/Form/Type/BigDecimalMoneyType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type; use Brick\Math\BigDecimal; diff --git a/src/Form/Type/BigDecimalNumberType.php b/src/Form/Type/BigDecimalNumberType.php index b236cfe0..c225f0a4 100644 --- a/src/Form/Type/BigDecimalNumberType.php +++ b/src/Form/Type/BigDecimalNumberType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type; use Brick\Math\BigDecimal; diff --git a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php index 57fb9237..e1f9d4b7 100644 --- a/src/Form/Type/Helper/StructuralEntityChoiceHelper.php +++ b/src/Form/Type/Helper/StructuralEntityChoiceHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type\Helper; use App\Entity\Attachments\Attachment; @@ -82,7 +84,7 @@ class StructuralEntityChoiceHelper ; } - if ($choice instanceof AttachmentType && !empty($choice->getFiletypeFilter())) { + if ($choice instanceof AttachmentType && $choice->getFiletypeFilter() !== '') { $tmp += ['data-filetype_filter' => $choice->getFiletypeFilter()]; } @@ -96,7 +98,7 @@ class StructuralEntityChoiceHelper public function generateChoiceAttrCurrency(Currency $choice, Options|array $options): array { $tmp = $this->generateChoiceAttr($choice, $options); - $symbol = empty($choice->getIsoCode()) ? null : Currencies::getSymbol($choice->getIsoCode()); + $symbol = $choice->getIsoCode() === null || $choice->getIsoCode() === '' ? null : Currencies::getSymbol($choice->getIsoCode()); $tmp['data-short'] = $options['short'] ? $symbol : $choice->getName(); return $tmp + [ @@ -147,4 +149,4 @@ class StructuralEntityChoiceHelper return null; } -} \ No newline at end of file +} diff --git a/src/Form/Type/Helper/StructuralEntityChoiceLoader.php b/src/Form/Type/Helper/StructuralEntityChoiceLoader.php index fe7b71dd..c2d35d92 100644 --- a/src/Form/Type/Helper/StructuralEntityChoiceLoader.php +++ b/src/Form/Type/Helper/StructuralEntityChoiceLoader.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type\Helper; use App\Repository\StructuralDBElementRepository; @@ -84,4 +86,4 @@ class StructuralEntityChoiceLoader extends AbstractChoiceLoader return $this->additional_element; } -} \ No newline at end of file +} diff --git a/src/Form/Type/PartLotSelectType.php b/src/Form/Type/PartLotSelectType.php index 6c1de117..8eff5122 100644 --- a/src/Form/Type/PartLotSelectType.php +++ b/src/Form/Type/PartLotSelectType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type; use App\Entity\Parts\Storelocation; @@ -51,4 +53,4 @@ class PartLotSelectType extends AbstractType ->setParameter('part', $options['part']) ]); } -} \ No newline at end of file +} diff --git a/src/Form/Type/PartSelectType.php b/src/Form/Type/PartSelectType.php index 43f5c44d..34b8fc7c 100644 --- a/src/Form/Type/PartSelectType.php +++ b/src/Form/Type/PartSelectType.php @@ -1,5 +1,7 @@ getData(); } -} \ No newline at end of file +} diff --git a/src/Form/Type/RichTextEditorType.php b/src/Form/Type/RichTextEditorType.php index ab81eeb7..50683b0c 100644 --- a/src/Form/Type/RichTextEditorType.php +++ b/src/Form/Type/RichTextEditorType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type; use Symfony\Component\Form\AbstractType; @@ -61,4 +63,4 @@ class RichTextEditorType extends AbstractType { return TextareaType::class; } -} \ No newline at end of file +} diff --git a/src/Form/Type/ThemeChoiceType.php b/src/Form/Type/ThemeChoiceType.php index 79e7644b..7cdc0aa9 100644 --- a/src/Form/Type/ThemeChoiceType.php +++ b/src/Form/Type/ThemeChoiceType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type; use Symfony\Component\Form\AbstractType; @@ -45,4 +47,4 @@ class ThemeChoiceType extends AbstractType ]); } -} \ No newline at end of file +} diff --git a/src/Form/Type/UserSelectType.php b/src/Form/Type/UserSelectType.php index cfc501ee..cc16d724 100644 --- a/src/Form/Type/UserSelectType.php +++ b/src/Form/Type/UserSelectType.php @@ -1,4 +1,7 @@ . */ - namespace App\Form\Type; use App\Entity\UserSystem\User; @@ -40,4 +42,4 @@ class UserSelectType extends AbstractType { return StructuralEntityType::class; } -} \ No newline at end of file +} diff --git a/src/Helpers/Projects/ProjectBuildRequest.php b/src/Helpers/Projects/ProjectBuildRequest.php index 29b5f14f..09dca3aa 100644 --- a/src/Helpers/Projects/ProjectBuildRequest.php +++ b/src/Helpers/Projects/ProjectBuildRequest.php @@ -1,4 +1,7 @@ . */ - namespace App\Helpers\Projects; use App\Entity\Parts\Part; @@ -283,4 +285,4 @@ final class ProjectBuildRequest { return $this->number_of_builds; } -} \ No newline at end of file +} diff --git a/src/Helpers/Trees/TreeViewNodeIterator.php b/src/Helpers/Trees/TreeViewNodeIterator.php index 073218c0..ab8b4907 100644 --- a/src/Helpers/Trees/TreeViewNodeIterator.php +++ b/src/Helpers/Trees/TreeViewNodeIterator.php @@ -40,7 +40,7 @@ final class TreeViewNodeIterator extends ArrayIterator implements RecursiveItera /** @var TreeViewNode $element */ $element = $this->current(); - return !empty($element->getNodes()); + return $element->getNodes() !== null && $element->getNodes() !== []; } public function getChildren(): TreeViewNodeIterator diff --git a/src/Kernel.php b/src/Kernel.php index a406b6c8..97c7a69e 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -1,4 +1,7 @@ . */ - namespace App; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; diff --git a/src/Migration/AbstractMultiPlatformMigration.php b/src/Migration/AbstractMultiPlatformMigration.php index 48fff8bd..54e3b529 100644 --- a/src/Migration/AbstractMultiPlatformMigration.php +++ b/src/Migration/AbstractMultiPlatformMigration.php @@ -1,4 +1,7 @@ . */ - namespace App\Migration; use Doctrine\DBAL\Connection; @@ -88,7 +90,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration */ public function getInitalAdminPW(): string { - if (empty($this->admin_pw)) { + if ($this->admin_pw === '') { if (!empty($_ENV['INITIAL_ADMIN_PW'])) { $this->admin_pw = $_ENV['INITIAL_ADMIN_PW']; } else { @@ -104,7 +106,7 @@ abstract class AbstractMultiPlatformMigration extends AbstractMigration { parent::postUp($schema); - if (!empty($this->admin_pw)) { + if ($this->admin_pw !== '') { $this->logger->warning(''); $this->logger->warning('The initial password for the "admin" user is: '.$this->admin_pw.''); $this->logger->warning(''); diff --git a/src/Repository/AbstractPartsContainingRepository.php b/src/Repository/AbstractPartsContainingRepository.php index 0603ce06..cbfdee6a 100644 --- a/src/Repository/AbstractPartsContainingRepository.php +++ b/src/Repository/AbstractPartsContainingRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository; use App\Entity\Base\AbstractPartsContainingDBElement; diff --git a/src/Repository/ParameterRepository.php b/src/Repository/ParameterRepository.php index 694d6bb2..7c978bad 100644 --- a/src/Repository/ParameterRepository.php +++ b/src/Repository/ParameterRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository; class ParameterRepository extends DBElementRepository @@ -46,4 +48,4 @@ class ParameterRepository extends DBElementRepository return $qb->getQuery()->getArrayResult(); } -} \ No newline at end of file +} diff --git a/src/Repository/Parts/CategoryRepository.php b/src/Repository/Parts/CategoryRepository.php index c472d8d6..8e270047 100644 --- a/src/Repository/Parts/CategoryRepository.php +++ b/src/Repository/Parts/CategoryRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; use App\Entity\Parts\Category; diff --git a/src/Repository/Parts/DeviceRepository.php b/src/Repository/Parts/DeviceRepository.php index e7555f2b..442c91e5 100644 --- a/src/Repository/Parts/DeviceRepository.php +++ b/src/Repository/Parts/DeviceRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; @@ -49,4 +51,4 @@ class DeviceRepository extends StructuralDBElementRepository //Prevent user from deleting devices, to not accidentally remove filled devices from old versions return 1; } -} \ No newline at end of file +} diff --git a/src/Repository/Parts/FootprintRepository.php b/src/Repository/Parts/FootprintRepository.php index 72c25003..355cb1bb 100644 --- a/src/Repository/Parts/FootprintRepository.php +++ b/src/Repository/Parts/FootprintRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; use App\Entity\Parts\Footprint; diff --git a/src/Repository/Parts/ManufacturerRepository.php b/src/Repository/Parts/ManufacturerRepository.php index aa4d8fec..a47142d4 100644 --- a/src/Repository/Parts/ManufacturerRepository.php +++ b/src/Repository/Parts/ManufacturerRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; use App\Entity\Parts\Manufacturer; diff --git a/src/Repository/Parts/MeasurementUnitRepository.php b/src/Repository/Parts/MeasurementUnitRepository.php index 80d32743..1c9b106b 100644 --- a/src/Repository/Parts/MeasurementUnitRepository.php +++ b/src/Repository/Parts/MeasurementUnitRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; use App\Entity\Parts\MeasurementUnit; diff --git a/src/Repository/Parts/StorelocationRepository.php b/src/Repository/Parts/StorelocationRepository.php index c0c432be..e6eea9a5 100644 --- a/src/Repository/Parts/StorelocationRepository.php +++ b/src/Repository/Parts/StorelocationRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; use App\Entity\Parts\Part; diff --git a/src/Repository/Parts/SupplierRepository.php b/src/Repository/Parts/SupplierRepository.php index 0a2e2c8f..6dc995f1 100644 --- a/src/Repository/Parts/SupplierRepository.php +++ b/src/Repository/Parts/SupplierRepository.php @@ -1,4 +1,7 @@ . */ - namespace App\Repository\Parts; use App\Entity\Parts\Part; diff --git a/src/Repository/StructuralDBElementRepository.php b/src/Repository/StructuralDBElementRepository.php index 0f2dcdea..04da15ac 100644 --- a/src/Repository/StructuralDBElementRepository.php +++ b/src/Repository/StructuralDBElementRepository.php @@ -142,10 +142,7 @@ class StructuralDBElementRepository extends NamedDBElementRepository private function getNewEntityFromCache(string $name, ?AbstractStructuralDBElement $parent): ?AbstractStructuralDBElement { $key = $parent instanceof AbstractStructuralDBElement ? $parent->getFullPath('%->%').'%->%'.$name : $name; - if (isset($this->new_entity_cache[$key])) { - return $this->new_entity_cache[$key]; - } - return null; + return $this->new_entity_cache[$key] ?? null; } private function setNewEntityToCache(AbstractStructuralDBElement $entity): void diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index 62bf71f9..95426775 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -62,7 +62,7 @@ final class UserRepository extends NamedDBElementRepository implements PasswordU */ public function findByEmailOrName(string $name_or_password): ?User { - if (empty($name_or_password)) { + if ($name_or_password === '') { return null; } diff --git a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php index 674d7e26..f230cf71 100644 --- a/src/Security/EnsureSAMLUserForSAMLLoginChecker.php +++ b/src/Security/EnsureSAMLUserForSAMLLoginChecker.php @@ -1,4 +1,7 @@ . */ - namespace App\Security; use App\Entity\UserSystem\User; @@ -58,4 +60,4 @@ class EnsureSAMLUserForSAMLLoginChecker implements EventSubscriberInterface throw new CustomUserMessageAccountStatusException($this->translator->trans('saml.error.cannot_login_saml_user_locally', [], 'security')); } } -} \ No newline at end of file +} diff --git a/src/Security/SamlUserFactory.php b/src/Security/SamlUserFactory.php index 924e4e5e..d5c68146 100644 --- a/src/Security/SamlUserFactory.php +++ b/src/Security/SamlUserFactory.php @@ -1,4 +1,7 @@ . */ - namespace App\Security; use App\Entity\UserSystem\Group; @@ -148,4 +150,4 @@ class SamlUserFactory implements SamlUserFactoryInterface, EventSubscriberInterf AuthenticationSuccessEvent::class => 'onAuthenticationSuccess', ]; } -} \ No newline at end of file +} diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index 486decda..6f752518 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -1,4 +1,7 @@ . */ - namespace App\Security\Voter; use Symfony\Bundle\SecurityBundle\Security; @@ -115,4 +117,4 @@ class ParameterVoter extends ExtendedVoter //Allow class name as subject return false; } -} \ No newline at end of file +} diff --git a/src/Serializer/BigNumberNormalizer.php b/src/Serializer/BigNumberNormalizer.php index 87619849..b97b9b64 100644 --- a/src/Serializer/BigNumberNormalizer.php +++ b/src/Serializer/BigNumberNormalizer.php @@ -1,4 +1,7 @@ . */ - namespace App\Serializer; use Brick\Math\BigNumber; @@ -49,4 +51,4 @@ class BigNumberNormalizer implements NormalizerInterface BigNumber::class => true, ]; } -} \ No newline at end of file +} diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 67b4066f..28b6e252 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -1,4 +1,7 @@ . */ - namespace App\Serializer; use App\Entity\Parts\Part; @@ -180,4 +182,4 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface Part::class => false, ]; } -} \ No newline at end of file +} diff --git a/src/Serializer/StructuralElementDenormalizer.php b/src/Serializer/StructuralElementDenormalizer.php index c5130ef4..ce6f91ca 100644 --- a/src/Serializer/StructuralElementDenormalizer.php +++ b/src/Serializer/StructuralElementDenormalizer.php @@ -1,4 +1,7 @@ . */ - namespace App\Serializer; use App\Entity\Base\AbstractStructuralDBElement; @@ -94,4 +96,4 @@ class StructuralElementDenormalizer implements DenormalizerInterface AbstractStructuralDBElement::class => false, ]; } -} \ No newline at end of file +} diff --git a/src/Serializer/StructuralElementFromNameDenormalizer.php b/src/Serializer/StructuralElementFromNameDenormalizer.php index 670bcdc1..e0d29606 100644 --- a/src/Serializer/StructuralElementFromNameDenormalizer.php +++ b/src/Serializer/StructuralElementFromNameDenormalizer.php @@ -1,4 +1,7 @@ . */ - namespace App\Serializer; use App\Entity\Base\AbstractStructuralDBElement; @@ -74,4 +76,4 @@ class StructuralElementFromNameDenormalizer implements DenormalizerInterface AbstractStructuralDBElement::class => false ]; } -} \ No newline at end of file +} diff --git a/src/Serializer/StructuralElementNormalizer.php b/src/Serializer/StructuralElementNormalizer.php index c1931ffe..0c7f2ca5 100644 --- a/src/Serializer/StructuralElementNormalizer.php +++ b/src/Serializer/StructuralElementNormalizer.php @@ -1,4 +1,7 @@ . */ - namespace App\Serializer; use App\Entity\Base\AbstractStructuralDBElement; @@ -34,8 +36,7 @@ use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; class StructuralElementNormalizer implements NormalizerInterface { public function __construct( - #[Autowire(service: ObjectNormalizer::class)] - private NormalizerInterface $normalizer + #[Autowire(service: ObjectNormalizer::class)]private readonly NormalizerInterface $normalizer ) { } @@ -69,4 +70,4 @@ class StructuralElementNormalizer implements NormalizerInterface AbstractStructuralDBElement::class => true, ]; } -} \ No newline at end of file +} diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php index 3057b5b1..4429179e 100644 --- a/src/Services/Attachments/AttachmentManager.php +++ b/src/Services/Attachments/AttachmentManager.php @@ -64,7 +64,7 @@ class AttachmentManager */ public function toAbsoluteFilePath(Attachment $attachment): ?string { - if (empty($attachment->getPath())) { + if ($attachment->getPath() === '') { return null; } @@ -98,7 +98,7 @@ class AttachmentManager */ public function isFileExisting(Attachment $attachment): bool { - if (empty($attachment->getPath())) { + if ($attachment->getPath() === '') { return false; } diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index 1266ae27..d422649e 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -95,7 +95,7 @@ class AttachmentSubmitHandler public function isValidFileExtension(AttachmentType $attachment_type, UploadedFile $uploadedFile): bool { //Only validate if the attachment type has specified a filetype filter: - if (empty($attachment_type->getFiletypeFilter())) { + if ($attachment_type->getFiletypeFilter() === '') { return true; } @@ -212,7 +212,7 @@ class AttachmentSubmitHandler //Determine the old filepath $old_path = $this->pathResolver->placeholderToRealPath($attachment->getPath()); - if (empty($old_path) || !file_exists($old_path)) { + if ($old_path === null || $old_path === '' || !file_exists($old_path)) { return $attachment; } $filename = basename($old_path); @@ -357,7 +357,7 @@ class AttachmentSubmitHandler //Check if we have an extension given $pathinfo = pathinfo($filename); - if (!empty($pathinfo['extension'])) { + if ($pathinfo['extension'] !== '') { $new_ext = $pathinfo['extension']; } else { //Otherwise we have to guess the extension for the new file, based on its content $new_ext = $this->mimeTypes->getExtensions($this->mimeTypes->guessMimeType($tmp_path))[0] ?? 'tmp'; diff --git a/src/Services/Attachments/AttachmentURLGenerator.php b/src/Services/Attachments/AttachmentURLGenerator.php index 0efbf1e6..afbfade3 100644 --- a/src/Services/Attachments/AttachmentURLGenerator.php +++ b/src/Services/Attachments/AttachmentURLGenerator.php @@ -119,7 +119,7 @@ class AttachmentURLGenerator throw new InvalidArgumentException('Thumbnail creation only works for picture attachments!'); } - if ($attachment->isExternal() && !empty($attachment->getURL())) { + if ($attachment->isExternal() && ($attachment->getURL() !== null && $attachment->getURL() !== '')) { return $attachment->getURL(); } diff --git a/src/Services/Attachments/BuiltinAttachmentsFinder.php b/src/Services/Attachments/BuiltinAttachmentsFinder.php index 21be0730..b009cf60 100644 --- a/src/Services/Attachments/BuiltinAttachmentsFinder.php +++ b/src/Services/Attachments/BuiltinAttachmentsFinder.php @@ -120,7 +120,7 @@ class BuiltinAttachmentsFinder */ public function find(string $keyword, array $options = [], ?array $base_list = []): array { - if (empty($base_list)) { + if ($base_list === null || $base_list === []) { $base_list = $this->getListOfRessources(); } diff --git a/src/Services/Attachments/FileTypeFilterTools.php b/src/Services/Attachments/FileTypeFilterTools.php index c7ef3ab1..cb815797 100644 --- a/src/Services/Attachments/FileTypeFilterTools.php +++ b/src/Services/Attachments/FileTypeFilterTools.php @@ -173,6 +173,6 @@ class FileTypeFilterTools { $extension = strtolower($extension); - return empty($filter) || in_array($extension, $this->resolveFileExtensions($filter), false); + return $filter === '' || in_array($extension, $this->resolveFileExtensions($filter), false); } } diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index 2fb81c1b..e9b24d23 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -146,7 +146,7 @@ class ElementTypeNameGenerator public function formatLabelHTMLForEntity(AbstractDBElement $entity, bool $include_associated = false): string { //The element is existing - if ($entity instanceof NamedElementInterface && !empty($entity->getName())) { + if ($entity instanceof NamedElementInterface && $entity->getName() !== '') { try { $tmp = sprintf( '%s', diff --git a/src/Services/Formatters/MoneyFormatter.php b/src/Services/Formatters/MoneyFormatter.php index fbe4fc39..d49b77cf 100644 --- a/src/Services/Formatters/MoneyFormatter.php +++ b/src/Services/Formatters/MoneyFormatter.php @@ -46,7 +46,7 @@ class MoneyFormatter public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string { $iso_code = $this->base_currency; - if ($currency instanceof Currency && !empty($currency->getIsoCode())) { + if ($currency instanceof Currency && ($currency->getIsoCode() !== null && $currency->getIsoCode() !== '')) { $iso_code = $currency->getIsoCode(); } diff --git a/src/Services/ImportExportSystem/BOMImporter.php b/src/Services/ImportExportSystem/BOMImporter.php index 7227c419..89b62660 100644 --- a/src/Services/ImportExportSystem/BOMImporter.php +++ b/src/Services/ImportExportSystem/BOMImporter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem; use App\Entity\ProjectSystem\Project; @@ -135,4 +137,4 @@ class BOMImporter return $bom_entries; } -} \ No newline at end of file +} diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/MySQLDumpXMLConverter.php b/src/Services/ImportExportSystem/PartKeeprImporter/MySQLDumpXMLConverter.php index 4ff9c189..f221ee89 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/MySQLDumpXMLConverter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/MySQLDumpXMLConverter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem\PartKeeprImporter; class MySQLDumpXMLConverter @@ -107,4 +109,4 @@ class MySQLDumpXMLConverter return $row_data; } -} \ No newline at end of file +} diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php index 31939d31..d53566c0 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem\PartKeeprImporter; use App\Doctrine\Purger\ResetAutoIncrementORMPurger; @@ -268,4 +270,4 @@ class PKDatastructureImporter return $count; } -} \ No newline at end of file +} diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php index d51bc225..f36e48ce 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem\PartKeeprImporter; use App\Doctrine\Purger\ResetAutoIncrementORMPurger; @@ -64,4 +66,4 @@ class PKImportHelper { return $this->getDatabaseSchemaVersion($data) === '20170601175559'; } -} \ No newline at end of file +} diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php index 54ecae63..70237114 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKImportHelperTrait.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem\PartKeeprImporter; use Doctrine\ORM\Id\AssignedGenerator; @@ -233,4 +235,4 @@ trait PKImportHelperTrait $property->setAccessible(true); $property->setValue($entity, $date); } -} \ No newline at end of file +} diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php index e192eefa..b8e8272e 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKOptionalImporter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem\PartKeeprImporter; use App\Entity\Attachments\ProjectAttachment; @@ -144,4 +146,4 @@ class PKOptionalImporter return is_countable($users_data) ? count($users_data) : 0; } -} \ No newline at end of file +} diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php index c3d1f31e..a1b9aeed 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ImportExportSystem\PartKeeprImporter; use App\Entity\Attachments\PartAttachment; @@ -311,4 +313,4 @@ class PKPartImporter throw new \RuntimeException(sprintf('Could not find unit with ID %s', $id)); } -} \ No newline at end of file +} diff --git a/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php b/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php index 868f8038..eb413518 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/BarcodeProvider.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LabelSystem\PlaceholderProviders; use App\Entity\LabelSystem\LabelOptions; @@ -68,4 +70,4 @@ final class BarcodeProvider implements PlaceholderProviderInterface return null; } -} \ No newline at end of file +} diff --git a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php index 18a4c7d2..95654eca 100644 --- a/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php +++ b/src/Services/LabelSystem/PlaceholderProviders/StorelocationProvider.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LabelSystem\PlaceholderProviders; use App\Entity\UserSystem\User; @@ -39,4 +41,4 @@ class StorelocationProvider implements PlaceholderProviderInterface return null; } -} \ No newline at end of file +} diff --git a/src/Services/LogSystem/EventCommentNeededHelper.php b/src/Services/LogSystem/EventCommentNeededHelper.php index 3738b330..8440f199 100644 --- a/src/Services/LogSystem/EventCommentNeededHelper.php +++ b/src/Services/LogSystem/EventCommentNeededHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LogSystem; /** @@ -53,4 +55,4 @@ class EventCommentNeededHelper return in_array($comment_type, $this->enforce_change_comments_for, true); } -} \ No newline at end of file +} diff --git a/src/Services/LogSystem/LogDataFormatter.php b/src/Services/LogSystem/LogDataFormatter.php index 46dae945..f15fcdc6 100644 --- a/src/Services/LogSystem/LogDataFormatter.php +++ b/src/Services/LogSystem/LogDataFormatter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LogSystem; use App\Entity\LogSystem\AbstractLogEntry; @@ -148,4 +150,4 @@ class LogDataFormatter { return $data ? $this->translator->trans('true') : $this->translator->trans('false'); } -} \ No newline at end of file +} diff --git a/src/Services/LogSystem/LogDiffFormatter.php b/src/Services/LogSystem/LogDiffFormatter.php index 500e1a72..5828185c 100644 --- a/src/Services/LogSystem/LogDiffFormatter.php +++ b/src/Services/LogSystem/LogDiffFormatter.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LogSystem; use Jfcherng\Diff\DiffHelper; @@ -72,4 +74,4 @@ class LogDiffFormatter return sprintf('%s', $difference); } } -} \ No newline at end of file +} diff --git a/src/Services/LogSystem/LogEntryExtraFormatter.php b/src/Services/LogSystem/LogEntryExtraFormatter.php index 017de1e0..6ace35e8 100644 --- a/src/Services/LogSystem/LogEntryExtraFormatter.php +++ b/src/Services/LogSystem/LogEntryExtraFormatter.php @@ -68,7 +68,7 @@ class LogEntryExtraFormatter $str .= ''.$this->translator->trans($key).': '; } $str .= $value; - if (!empty($str)) { + if ($str !== '') { $tmp[] = $str; } } @@ -91,7 +91,7 @@ class LogEntryExtraFormatter $str .= ''.$this->translator->trans($key).': '; } $str .= $value; - if (!empty($str)) { + if ($str !== '') { $tmp[] = $str; } } @@ -184,7 +184,7 @@ class LogEntryExtraFormatter $context->getNewStock(), ($context->getNewStock() > $context->getOldStock() ? '+' : '-'). $context->getChangeAmount(), ); - if (!empty($context->getComment())) { + if ($context->getComment() !== '') { $array['log.part_stock_changed.comment'] = htmlspecialchars($context->getComment()); } if ($context->getInstockChangeType() === PartStockChangedLogEntry::TYPE_MOVE) { diff --git a/src/Services/LogSystem/LogLevelHelper.php b/src/Services/LogSystem/LogLevelHelper.php index efc8dd93..5cc13db8 100644 --- a/src/Services/LogSystem/LogLevelHelper.php +++ b/src/Services/LogSystem/LogLevelHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LogSystem; use App\Entity\LogSystem\AbstractLogEntry; @@ -60,4 +62,4 @@ class LogLevelHelper default => '', }; } -} \ No newline at end of file +} diff --git a/src/Services/LogSystem/LogTargetHelper.php b/src/Services/LogSystem/LogTargetHelper.php index abd57674..540f2b45 100644 --- a/src/Services/LogSystem/LogTargetHelper.php +++ b/src/Services/LogSystem/LogTargetHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\LogSystem; use App\Entity\Attachments\Attachment; @@ -82,4 +84,4 @@ class LogTargetHelper //Otherwise we can return a label for the target return $this->elementTypeNameGenerator->formatLabelHTMLForEntity($target, $options['show_associated']); } -} \ No newline at end of file +} diff --git a/src/Services/Misc/ConsoleInfoHelper.php b/src/Services/Misc/ConsoleInfoHelper.php index 8aea004e..f529f74a 100644 --- a/src/Services/Misc/ConsoleInfoHelper.php +++ b/src/Services/Misc/ConsoleInfoHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\Misc; class ConsoleInfoHelper @@ -47,17 +49,7 @@ class ConsoleInfoHelper return $user['name']; } - //Try to retrieve the name via the environment variable Username (Windows) - if (isset($_SERVER['USERNAME'])) { - return $_SERVER['USERNAME']; - } - - //Try to retrieve the name via the environment variable USER (Linux) - if (isset($_SERVER['USER'])) { - return $_SERVER['USER']; - } - //Otherwise we can't determine the username - return null; + return $_SERVER['USERNAME'] ?? $_SERVER['USER'] ?? null; } -} \ No newline at end of file +} diff --git a/src/Services/Misc/DBInfoHelper.php b/src/Services/Misc/DBInfoHelper.php index f2c638ff..eb75a254 100644 --- a/src/Services/Misc/DBInfoHelper.php +++ b/src/Services/Misc/DBInfoHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\Misc; use Doctrine\DBAL\Exception; diff --git a/src/Services/Misc/RangeParser.php b/src/Services/Misc/RangeParser.php index 2ff98477..f1a5db5b 100644 --- a/src/Services/Misc/RangeParser.php +++ b/src/Services/Misc/RangeParser.php @@ -71,7 +71,7 @@ class RangeParser $ranges[] = $this->generateMinMaxRange($matches[1], $matches[2]); } elseif (is_numeric($number)) { $ranges[] = [(int) $number]; - } elseif (empty($number)) { //Allow empty tokens + } elseif ($number === '') { //Allow empty tokens continue; } else { throw new InvalidArgumentException('Invalid range encoutered: '.$number); diff --git a/src/Services/Parameters/ParameterExtractor.php b/src/Services/Parameters/ParameterExtractor.php index 077101c8..9eaf946a 100644 --- a/src/Services/Parameters/ParameterExtractor.php +++ b/src/Services/Parameters/ParameterExtractor.php @@ -97,7 +97,7 @@ class ParameterExtractor $value = trim($value); //Don't allow empty names or values (these are a sign of an invalid extracted string) - if (empty($name) || empty($value)) { + if ($name === '' || $value === '') { return null; } diff --git a/src/Services/Parts/PartLotWithdrawAddHelper.php b/src/Services/Parts/PartLotWithdrawAddHelper.php index 07f4bc04..8e2d2d28 100644 --- a/src/Services/Parts/PartLotWithdrawAddHelper.php +++ b/src/Services/Parts/PartLotWithdrawAddHelper.php @@ -1,5 +1,7 @@ eventLogger->log($event); //Apply the comment also to global events, so it gets associated with the elementChanged log entry - if (!$this->eventCommentHelper->isMessageSet() && !empty($comment)) { + if (!$this->eventCommentHelper->isMessageSet() && ($comment !== null && $comment !== '')) { $this->eventCommentHelper->setMessage($comment); } @@ -125,7 +127,7 @@ final class PartLotWithdrawAddHelper $this->eventLogger->log($event); //Apply the comment also to global events, so it gets associated with the elementChanged log entry - if (!$this->eventCommentHelper->isMessageSet() && !empty($comment)) { + if (!$this->eventCommentHelper->isMessageSet() && ($comment !== null && $comment !== '')) { $this->eventCommentHelper->setMessage($comment); } @@ -179,8 +181,8 @@ final class PartLotWithdrawAddHelper $this->eventLogger->log($event); //Apply the comment also to global events, so it gets associated with the elementChanged log entry - if (!$this->eventCommentHelper->isMessageSet() && !empty($comment)) { + if (!$this->eventCommentHelper->isMessageSet() && ($comment !== null && $comment !== '')) { $this->eventCommentHelper->setMessage($comment); } } -} \ No newline at end of file +} diff --git a/src/Services/Parts/PartsTableActionHandler.php b/src/Services/Parts/PartsTableActionHandler.php index d4af56ae..c97357e0 100644 --- a/src/Services/Parts/PartsTableActionHandler.php +++ b/src/Services/Parts/PartsTableActionHandler.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\Parts; use Symfony\Bundle\SecurityBundle\Security; diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php index b9ffc374..256958f2 100644 --- a/src/Services/ProjectSystem/ProjectBuildHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\ProjectSystem; use App\Entity\Parts\Part; @@ -149,4 +151,4 @@ class ProjectBuildHelper $this->withdraw_add_helper->add($buildRequest->getBuildsPartLot(), $buildRequest->getNumberOfBuilds(), $message); } } -} \ No newline at end of file +} diff --git a/src/Services/ProjectSystem/ProjectBuildPartHelper.php b/src/Services/ProjectSystem/ProjectBuildPartHelper.php index 446f5f55..218f456e 100644 --- a/src/Services/ProjectSystem/ProjectBuildPartHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildPartHelper.php @@ -1,5 +1,7 @@ . */ - namespace App\Services\Tools; use App\Entity\PriceInformations\Currency; diff --git a/src/Services/Trees/SidebarTreeUpdater.php b/src/Services/Trees/SidebarTreeUpdater.php index 16853d7e..0d7ccee9 100644 --- a/src/Services/Trees/SidebarTreeUpdater.php +++ b/src/Services/Trees/SidebarTreeUpdater.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\Trees; use Symfony\Contracts\Cache\CacheInterface; @@ -51,4 +53,4 @@ final class SidebarTreeUpdater return new \DateTime(); }); } -} \ No newline at end of file +} diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index 201c5fd3..d1c01063 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -68,20 +68,20 @@ class ToolsTreeBuilder $item->tag(['tree_tools', 'groups', $this->keyGenerator->generateKey()]); $tree = []; - if (!empty($this->getToolsNode())) { + if ($this->getToolsNode() !== []) { $tree[] = (new TreeViewNode($this->translator->trans('tree.tools.tools'), null, $this->getToolsNode())) ->setIcon('fa-fw fa-treeview fa-solid fa-toolbox'); } - if (!empty($this->getEditNodes())) { + if ($this->getEditNodes() !== []) { $tree[] = (new TreeViewNode($this->translator->trans('tree.tools.edit'), null, $this->getEditNodes())) ->setIcon('fa-fw fa-treeview fa-solid fa-pen-to-square'); } - if (!empty($this->getShowNodes())) { + if ($this->getShowNodes() !== []) { $tree[] = (new TreeViewNode($this->translator->trans('tree.tools.show'), null, $this->getShowNodes())) ->setIcon('fa-fw fa-treeview fa-solid fa-eye'); } - if (!empty($this->getSystemNodes())) { + if ($this->getSystemNodes() !== []) { $tree[] = (new TreeViewNode($this->translator->trans('tree.tools.system'), null, $this->getSystemNodes())) ->setIcon('fa-fw fa-treeview fa-solid fa-server'); } diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index dd2db178..ca93873c 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -105,11 +105,11 @@ class TreeViewGenerator $item->setSelected(true); } - if (!empty($item->getNodes())) { + if ($item->getNodes() !== null && $item->getNodes() !== []) { $item->addTag((string) count($item->getNodes())); } - if (!empty($href_type) && null !== $item->getId()) { + if ($href_type !== '' && null !== $item->getId()) { $entity = $this->em->getPartialReference($class, $item->getId()); $item->setHref($this->urlGenerator->getURL($entity, $href_type)); } diff --git a/src/Services/UserSystem/PasswordResetManager.php b/src/Services/UserSystem/PasswordResetManager.php index d479fb51..2349297b 100644 --- a/src/Services/UserSystem/PasswordResetManager.php +++ b/src/Services/UserSystem/PasswordResetManager.php @@ -63,7 +63,7 @@ class PasswordResetManager $expiration_date->add(date_interval_create_from_date_string('1 day')); $user->setPwResetExpires($expiration_date); - if (!empty($user->getEmail())) { + if ($user->getEmail() !== null && $user->getEmail() !== '') { $address = new Address($user->getEmail(), $user->getFullName()); $mail = new TemplatedEmail(); $mail->to($address); diff --git a/src/Services/UserSystem/PermissionPresetsHelper.php b/src/Services/UserSystem/PermissionPresetsHelper.php index bf9aad8a..d12eb1ef 100644 --- a/src/Services/UserSystem/PermissionPresetsHelper.php +++ b/src/Services/UserSystem/PermissionPresetsHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\UserSystem; use App\Entity\UserSystem\PermissionData; @@ -181,4 +183,4 @@ class PermissionPresetsHelper $this->permissionResolver->setAllPermissions($perm_holder, PermissionData::ALLOW); return $perm_holder; } -} \ No newline at end of file +} diff --git a/src/Services/UserSystem/PermissionSchemaUpdater.php b/src/Services/UserSystem/PermissionSchemaUpdater.php index b939fa86..29ce332d 100644 --- a/src/Services/UserSystem/PermissionSchemaUpdater.php +++ b/src/Services/UserSystem/PermissionSchemaUpdater.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\UserSystem; use App\Entity\UserSystem\Group; @@ -138,4 +140,4 @@ class PermissionSchemaUpdater $holder->getPermissions()->removePermission('devices'); } } -} \ No newline at end of file +} diff --git a/src/Services/UserSystem/TFA/BackupCodeManager.php b/src/Services/UserSystem/TFA/BackupCodeManager.php index 70226946..07484618 100644 --- a/src/Services/UserSystem/TFA/BackupCodeManager.php +++ b/src/Services/UserSystem/TFA/BackupCodeManager.php @@ -40,7 +40,7 @@ class BackupCodeManager */ public function enableBackupCodes(User $user): void { - if (empty($user->getBackupCodes())) { + if ($user->getBackupCodes() === []) { $this->regenerateBackupCodes($user); } } diff --git a/src/Services/UserSystem/UserAvatarHelper.php b/src/Services/UserSystem/UserAvatarHelper.php index 73de40f7..5e14b34b 100644 --- a/src/Services/UserSystem/UserAvatarHelper.php +++ b/src/Services/UserSystem/UserAvatarHelper.php @@ -1,4 +1,7 @@ . */ - namespace App\Services\UserSystem; use Imagine\Exception\RuntimeException; @@ -115,7 +117,7 @@ class UserAvatarHelper private function getGravatar(User $user, int $s = 80, string $d = 'identicon', string $r = 'g'): string { $email = $user->getEmail(); - if (empty($email)) { + if ($email === null || $email === '') { $email = 'Part-DB'; } @@ -161,4 +163,4 @@ class UserAvatarHelper return $attachment; } -} \ No newline at end of file +} diff --git a/src/Twig/AttachmentExtension.php b/src/Twig/AttachmentExtension.php index beb1295c..fd93de9a 100644 --- a/src/Twig/AttachmentExtension.php +++ b/src/Twig/AttachmentExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Twig; use App\Entity\Attachments\Attachment; @@ -41,4 +43,4 @@ final class AttachmentExtension extends AbstractExtension new TwigFunction('ext_to_fa_icon', fn(string $extension): string => $this->FAIconGenerator->fileExtensionToFAType($extension)), ]; } -} \ No newline at end of file +} diff --git a/src/Twig/BarcodeExtension.php b/src/Twig/BarcodeExtension.php index 5e8984d2..ae1973e3 100644 --- a/src/Twig/BarcodeExtension.php +++ b/src/Twig/BarcodeExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Twig; use Com\Tecnick\Barcode\Barcode; diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php index 92d69631..a3737c08 100644 --- a/src/Twig/EntityExtension.php +++ b/src/Twig/EntityExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Twig; use App\Entity\Attachments\Attachment; @@ -123,4 +125,4 @@ final class EntityExtension extends AbstractExtension return false; } -} \ No newline at end of file +} diff --git a/src/Twig/LogExtension.php b/src/Twig/LogExtension.php index dde70e18..34dad988 100644 --- a/src/Twig/LogExtension.php +++ b/src/Twig/LogExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Twig; use App\Entity\LogSystem\AbstractLogEntry; @@ -40,4 +42,4 @@ final class LogExtension extends AbstractExtension new TwigFunction('format_log_diff', fn($old_data, $new_data): string => $this->logDiffFormatter->formatDiff($old_data, $new_data), ['is_safe' => ['html']]), ]; } -} \ No newline at end of file +} diff --git a/src/Twig/MiscExtension.php b/src/Twig/MiscExtension.php index 32080df2..1edef7a3 100644 --- a/src/Twig/MiscExtension.php +++ b/src/Twig/MiscExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Twig; use Twig\TwigFunction; @@ -38,4 +40,4 @@ final class MiscExtension extends AbstractExtension ), ]; } -} \ No newline at end of file +} diff --git a/src/Twig/TwigCoreExtension.php b/src/Twig/TwigCoreExtension.php index d4b14c83..0443b847 100644 --- a/src/Twig/TwigCoreExtension.php +++ b/src/Twig/TwigCoreExtension.php @@ -1,4 +1,7 @@ . */ - namespace App\Twig; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; @@ -68,4 +70,4 @@ final class TwigCoreExtension extends AbstractExtension return $this->objectNormalizer->normalize($object, null); } -} \ No newline at end of file +} diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php index 62231ea8..76acb25a 100644 --- a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php +++ b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThanValidator.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\BigDecimal; use Brick\Math\BigDecimal; diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php index 3e4c8444..b6df06d0 100644 --- a/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php +++ b/src/Validator/Constraints/BigDecimal/BigDecimalGreaterThenOrEqualValidator.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\BigDecimal; use Brick\Math\BigDecimal; diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php b/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php index bb4e61eb..de66eea3 100644 --- a/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php +++ b/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\BigDecimal; use Symfony\Component\Validator\Constraints\GreaterThan; diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php b/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php index 1e6558a2..30042fe2 100644 --- a/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php +++ b/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\BigDecimal; use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; diff --git a/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php b/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php index a9858730..ba89900f 100644 --- a/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php +++ b/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\BigDecimal; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; @@ -46,4 +48,4 @@ trait BigNumberConstraintTrait return $options; } -} \ No newline at end of file +} diff --git a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php index b0c99947..05ed48e9 100644 --- a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php +++ b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\ProjectSystem; use Symfony\Component\Validator\Constraint; @@ -33,4 +35,4 @@ class ValidProjectBuildRequest extends Constraint { return self::CLASS_CONSTRAINT; } -} \ No newline at end of file +} diff --git a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php index 08350f55..e5de07d2 100644 --- a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php +++ b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints\ProjectSystem; use App\Entity\Parts\PartLot; @@ -79,4 +81,4 @@ class ValidProjectBuildRequestValidator extends ConstraintValidator } } } -} \ No newline at end of file +} diff --git a/src/Validator/Constraints/ValidTheme.php b/src/Validator/Constraints/ValidTheme.php index 70a32a20..03e0d35b 100644 --- a/src/Validator/Constraints/ValidTheme.php +++ b/src/Validator/Constraints/ValidTheme.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints; use Symfony\Component\Validator\Constraint; @@ -29,4 +31,4 @@ use Symfony\Component\Validator\Constraint; class ValidTheme extends Constraint { public string $message = 'validator.selected_theme_is_invalid'; -} \ No newline at end of file +} diff --git a/src/Validator/Constraints/ValidThemeValidator.php b/src/Validator/Constraints/ValidThemeValidator.php index 03e6212f..5d222934 100644 --- a/src/Validator/Constraints/ValidThemeValidator.php +++ b/src/Validator/Constraints/ValidThemeValidator.php @@ -1,4 +1,7 @@ . */ - namespace App\Validator\Constraints; use Symfony\Component\Validator\Constraint; @@ -48,4 +50,4 @@ class ValidThemeValidator extends ConstraintValidator ->addViolation(); } } -} \ No newline at end of file +} diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index e73e639a..93f3c1e1 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\DataTables\Filters; use App\DataTables\Filters\CompoundFilterTrait; diff --git a/tests/DataTables/Filters/Constraints/FilterTraitTest.php b/tests/DataTables/Filters/Constraints/FilterTraitTest.php index baec64ed..1e32fdd8 100644 --- a/tests/DataTables/Filters/Constraints/FilterTraitTest.php +++ b/tests/DataTables/Filters/Constraints/FilterTraitTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\DataTables\Filters\Constraints; use App\DataTables\Filters\Constraints\FilterTrait; diff --git a/tests/Entity/UserSystem/PermissionDataTest.php b/tests/Entity/UserSystem/PermissionDataTest.php index d1f0ed59..4fd8c5ce 100644 --- a/tests/Entity/UserSystem/PermissionDataTest.php +++ b/tests/Entity/UserSystem/PermissionDataTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Entity\UserSystem; use App\Entity\UserSystem\PermissionData; diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index 801efd4b..c561613d 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Helpers\Projects; use App\Entity\Parts\MeasurementUnit; diff --git a/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php b/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php index 434527d8..c9a14426 100644 --- a/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php +++ b/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Security; use App\Entity\UserSystem\User; diff --git a/tests/Security/SamlUserFactoryTest.php b/tests/Security/SamlUserFactoryTest.php index 663b8627..7780b4be 100644 --- a/tests/Security/SamlUserFactoryTest.php +++ b/tests/Security/SamlUserFactoryTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Security; use App\Entity\UserSystem\User; diff --git a/tests/Serializer/BigNumberNormalizerTest.php b/tests/Serializer/BigNumberNormalizerTest.php index c0cb6070..6e3ed79b 100644 --- a/tests/Serializer/BigNumberNormalizerTest.php +++ b/tests/Serializer/BigNumberNormalizerTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Serializer; use App\Serializer\BigNumberNormalizer; diff --git a/tests/Serializer/PartNormalizerTest.php b/tests/Serializer/PartNormalizerTest.php index f19d4c6b..979254d8 100644 --- a/tests/Serializer/PartNormalizerTest.php +++ b/tests/Serializer/PartNormalizerTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Serializer; use App\Entity\Parts\Part; diff --git a/tests/Serializer/StructuralElementDenormalizerTest.php b/tests/Serializer/StructuralElementDenormalizerTest.php index be0a9e61..19cf4ea8 100644 --- a/tests/Serializer/StructuralElementDenormalizerTest.php +++ b/tests/Serializer/StructuralElementDenormalizerTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Serializer; use App\Entity\Parts\Category; diff --git a/tests/Serializer/StructuralElementFromNameDenormalizerTest.php b/tests/Serializer/StructuralElementFromNameDenormalizerTest.php index 4349c2a7..918c0339 100644 --- a/tests/Serializer/StructuralElementFromNameDenormalizerTest.php +++ b/tests/Serializer/StructuralElementFromNameDenormalizerTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Serializer; use App\Entity\Parts\Category; diff --git a/tests/Serializer/StructuralElementNormalizerTest.php b/tests/Serializer/StructuralElementNormalizerTest.php index 0974e670..8d4df05a 100644 --- a/tests/Serializer/StructuralElementNormalizerTest.php +++ b/tests/Serializer/StructuralElementNormalizerTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Serializer; use App\Entity\Parts\Category; diff --git a/tests/Services/ImportExportSystem/BOMImporterTest.php b/tests/Services/ImportExportSystem/BOMImporterTest.php index 1ccb8275..b7379537 100644 --- a/tests/Services/ImportExportSystem/BOMImporterTest.php +++ b/tests/Services/ImportExportSystem/BOMImporterTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\ImportExportSystem; use App\Entity\ProjectSystem\Project; diff --git a/tests/Services/ImportExportSystem/EntityExporterTest.php b/tests/Services/ImportExportSystem/EntityExporterTest.php index b57b22a3..004971ab 100644 --- a/tests/Services/ImportExportSystem/EntityExporterTest.php +++ b/tests/Services/ImportExportSystem/EntityExporterTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\ImportExportSystem; use App\Entity\Parts\Category; diff --git a/tests/Services/LogSystem/EventCommentNeededHelperTest.php b/tests/Services/LogSystem/EventCommentNeededHelperTest.php index 9cfabd6a..2fb3e123 100644 --- a/tests/Services/LogSystem/EventCommentNeededHelperTest.php +++ b/tests/Services/LogSystem/EventCommentNeededHelperTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\LogSystem; use App\Services\LogSystem\EventCommentNeededHelper; diff --git a/tests/Services/Misc/MySQLDumpXMLConverterTest.php b/tests/Services/Misc/MySQLDumpXMLConverterTest.php index b666597a..98614b4b 100644 --- a/tests/Services/Misc/MySQLDumpXMLConverterTest.php +++ b/tests/Services/Misc/MySQLDumpXMLConverterTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\Misc; use App\Services\ImportExportSystem\PartKeeprImporter\MySQLDumpXMLConverter; diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index bbc9eb41..b88e86e8 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -1,5 +1,7 @@ . */ - namespace App\Tests\Services\ProjectSystem; use App\Entity\Parts\Part; diff --git a/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php index 92c22b44..4baa7cf3 100644 --- a/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php +++ b/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\ProjectSystem; use App\Entity\ProjectSystem\Project; diff --git a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php index 82376298..1acadd14 100644 --- a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php +++ b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\UserSystem; use App\Entity\UserSystem\PermissionData; diff --git a/tests/Twig/EntityExtensionTest.php b/tests/Twig/EntityExtensionTest.php index 530047ef..86e42542 100644 --- a/tests/Twig/EntityExtensionTest.php +++ b/tests/Twig/EntityExtensionTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Twig; use App\Entity\Attachments\PartAttachment; diff --git a/tests/Twig/TwigCoreExtensionTest.php b/tests/Twig/TwigCoreExtensionTest.php index 67961fe1..47283520 100644 --- a/tests/Twig/TwigCoreExtensionTest.php +++ b/tests/Twig/TwigCoreExtensionTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Twig; use App\Twig\TwigCoreExtension; diff --git a/tests/Twig/UserExtensionTest.php b/tests/Twig/UserExtensionTest.php index e818f447..1344bbc5 100644 --- a/tests/Twig/UserExtensionTest.php +++ b/tests/Twig/UserExtensionTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Twig; use App\Twig\UserExtension; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3181151d..ecec14bf 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,15 +1,14 @@ bootEnv(dirname(__DIR__).'/.env'); } - if ($_SERVER['APP_DEBUG']) { umask(0000); } diff --git a/tests/symfony-container.php b/tests/symfony-container.php index f4b63872..be2ff108 100644 --- a/tests/symfony-container.php +++ b/tests/symfony-container.php @@ -1,10 +1,9 @@ boot(); - return $appKernel->getContainer(); From e5a14557a27440de724b46bd4c333dba7232a51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:05:27 +0200 Subject: [PATCH 47/91] Fixed strict typing errors --- .../Constraints/AbstractConstraint.php | 6 +++-- .../Filters/Constraints/BooleanConstraint.php | 8 ++++-- .../Filters/Constraints/ChoiceConstraint.php | 4 +-- .../Filters/Constraints/EntityConstraint.php | 7 ++++- .../Constraints/InstanceOfConstraint.php | 4 +-- .../Filters/Constraints/NumberConstraint.php | 26 +++++++++---------- 6 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/DataTables/Filters/Constraints/AbstractConstraint.php b/src/DataTables/Filters/Constraints/AbstractConstraint.php index 4dc79a41..cbb62352 100644 --- a/src/DataTables/Filters/Constraints/AbstractConstraint.php +++ b/src/DataTables/Filters/Constraints/AbstractConstraint.php @@ -40,10 +40,12 @@ abstract class AbstractConstraint implements FilterInterface */ abstract public function isEnabled(): bool; - public function __construct(/** + public function __construct( + /** * @var string The property where this BooleanConstraint should apply to */ - protected string $property, string $identifier = null) + protected string $property, + string $identifier = null) { $this->identifier = $identifier ?? $this->generateParameterIdentifier($property); } diff --git a/src/DataTables/Filters/Constraints/BooleanConstraint.php b/src/DataTables/Filters/Constraints/BooleanConstraint.php index 1f971b0a..b3f1dc47 100644 --- a/src/DataTables/Filters/Constraints/BooleanConstraint.php +++ b/src/DataTables/Filters/Constraints/BooleanConstraint.php @@ -26,8 +26,12 @@ use Doctrine\ORM\QueryBuilder; class BooleanConstraint extends AbstractConstraint { - public function __construct(string $property, string $identifier = null, /** @var bool|null The value of our constraint */ - protected ?bool $value = null) + public function __construct( + string $property, + string $identifier = null, + /** @var bool|null The value of our constraint */ + protected ?bool $value = null + ) { parent::__construct($property, $identifier); } diff --git a/src/DataTables/Filters/Constraints/ChoiceConstraint.php b/src/DataTables/Filters/Constraints/ChoiceConstraint.php index aea35571..621edfe9 100644 --- a/src/DataTables/Filters/Constraints/ChoiceConstraint.php +++ b/src/DataTables/Filters/Constraints/ChoiceConstraint.php @@ -31,12 +31,12 @@ class ChoiceConstraint extends AbstractConstraint /** * @var string[]|int[] The values to compare to */ - protected array $value; + protected array $value = []; /** * @var string The operator to use */ - protected string $operator; + protected string $operator = ""; /** * @return string[]|int[] diff --git a/src/DataTables/Filters/Constraints/EntityConstraint.php b/src/DataTables/Filters/Constraints/EntityConstraint.php index df8a670c..b0eed001 100644 --- a/src/DataTables/Filters/Constraints/EntityConstraint.php +++ b/src/DataTables/Filters/Constraints/EntityConstraint.php @@ -43,7 +43,12 @@ class EntityConstraint extends AbstractConstraint * @param null $value * @param string $operator */ - public function __construct(protected ?NodesListBuilder $nodesListBuilder, protected string $class, string $property, string $identifier = null, protected $value = null, protected ?string $operator = '') + public function __construct(protected ?NodesListBuilder $nodesListBuilder, + protected string $class, + string $property, + string $identifier = null, + protected $value = null, + protected ?string $operator = null) { if (!$nodesListBuilder instanceof NodesListBuilder && $this->isStructural()) { throw new \InvalidArgumentException('NodesListBuilder must be provided for structural entities'); diff --git a/src/DataTables/Filters/Constraints/InstanceOfConstraint.php b/src/DataTables/Filters/Constraints/InstanceOfConstraint.php index 582a1b90..227bdaba 100644 --- a/src/DataTables/Filters/Constraints/InstanceOfConstraint.php +++ b/src/DataTables/Filters/Constraints/InstanceOfConstraint.php @@ -34,12 +34,12 @@ class InstanceOfConstraint extends AbstractConstraint /** * @var string[] The values to compare to (fully qualified class names) */ - protected array $value; + protected array $value = []; /** * @var string The operator to use */ - protected string $operator; + protected string $operator = ""; /** * @return string[] diff --git a/src/DataTables/Filters/Constraints/NumberConstraint.php b/src/DataTables/Filters/Constraints/NumberConstraint.php index e1c741ea..cad1c6a8 100644 --- a/src/DataTables/Filters/Constraints/NumberConstraint.php +++ b/src/DataTables/Filters/Constraints/NumberConstraint.php @@ -63,20 +63,18 @@ class NumberConstraint extends AbstractConstraint } - /** - * @param float|null|int|\DateTimeInterface $value1 - * @param float|null|int|\DateTimeInterface $value2 - */ - public function __construct(string $property, string $identifier = null, /** - * The value1 used for comparison (this is the main one used for all mono-value comparisons) - */ - protected float|int|\DateTimeInterface|null $value1 = null, /** - * @var string|null The operator to use - */ - protected ?string $operator = null, /** - * The second value used when operator is RANGE; this is the upper bound of the range - */ - protected float|int|\DateTimeInterface|null $value2 = null) + public function __construct( + string $property, + string $identifier = null, + /** + * The value1 used for comparison (this is the main one used for all mono-value comparisons) + */ + protected float|int|\DateTimeInterface|null $value1 = null, + protected ?string $operator = null, + /** + * The second value used when operator is RANGE; this is the upper bound of the range + */ + protected float|int|\DateTimeInterface|null $value2 = null) { parent::__construct($property, $identifier); } From 930adaf439fe3ea99c3e02ee26e9480dd5fa1c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:32:15 +0200 Subject: [PATCH 48/91] Moved custom validators from annotations to attributes --- src/Entity/Attachments/Attachment.php | 8 +-- src/Entity/Attachments/AttachmentType.php | 6 +-- .../Base/AbstractStructuralDBElement.php | 7 +-- src/Entity/Parts/PartLot.php | 6 +-- .../Parts/PartTraits/BasicPropertyTrait.php | 4 +- .../Parts/PartTraits/ManufacturerTrait.php | 2 +- src/Entity/Parts/Supplier.php | 4 +- src/Entity/PriceInformations/Currency.php | 2 +- src/Entity/PriceInformations/Pricedetail.php | 6 +-- src/Entity/ProjectSystem/ProjectBOMEntry.php | 2 +- src/Entity/UserSystem/Group.php | 11 ++-- src/Entity/UserSystem/User.php | 15 +++--- src/Helpers/Projects/ProjectBuildRequest.php | 2 +- .../BigDecimal/BigDecimalPositive.php | 20 ++------ .../BigDecimal/BigDecimalPositiveOrZero.php | 20 ++------ .../BigDecimal/BigNumberConstraintTrait.php | 51 ------------------- src/Validator/Constraints/Misc/ValidRange.php | 4 +- src/Validator/Constraints/NoLockout.php | 3 +- .../Constraints/NoLockoutValidator.php | 5 +- .../Constraints/NoneOfItsChildren.php | 3 +- .../ValidProjectBuildRequest.php | 3 +- src/Validator/Constraints/Selectable.php | 3 +- src/Validator/Constraints/UrlOrBuiltin.php | 3 +- src/Validator/Constraints/ValidFileFilter.php | 1 + src/Validator/Constraints/ValidPartLot.php | 3 +- src/Validator/Constraints/ValidPermission.php | 2 +- src/Validator/Constraints/ValidTheme.php | 2 +- 27 files changed, 50 insertions(+), 148 deletions(-) delete mode 100644 src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index cd979d78..003b7cd9 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -104,19 +104,13 @@ abstract class Attachment extends AbstractNamedDBElement */ protected ?AttachmentContainingDBElement $element = null; - /** - * @var bool - */ #[ORM\Column(type: Types::BOOLEAN)] protected bool $show_in_table = false; - /** - * @var AttachmentType|null - * @Selectable() - */ #[Assert\NotNull(message: 'validator.attachment.must_not_be_null')] #[ORM\ManyToOne(targetEntity: 'AttachmentType', inversedBy: 'attachments_with_type')] #[ORM\JoinColumn(name: 'type_id', nullable: false)] + #[Selectable()] protected ?AttachmentType $attachment_type = null; public function __construct() diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index 9bff255a..90e6baf7 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -50,12 +50,10 @@ class AttachmentType extends AbstractStructuralDBElement #[ORM\JoinColumn(name: 'parent_id')] protected ?AbstractStructuralDBElement $parent = null; - /** - * @var string - * @ValidFileFilter - */ #[ORM\Column(type: Types::TEXT)] + #[ValidFileFilter] protected string $filetype_filter = ''; + /** * @var Collection */ diff --git a/src/Entity/Base/AbstractStructuralDBElement.php b/src/Entity/Base/AbstractStructuralDBElement.php index 6e82a47d..0a5b6765 100644 --- a/src/Entity/Base/AbstractStructuralDBElement.php +++ b/src/Entity/Base/AbstractStructuralDBElement.php @@ -87,16 +87,13 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement * We can not define the mapping here, or we will get an exception. Unfortunately we have to do the mapping in the * subclasses. * - * @var AbstractStructuralDBElement[]|Collection + * @var Collection */ #[Groups(['include_children'])] protected Collection $children; - /** - * @var AbstractStructuralDBElement - * @NoneOfItsChildren() - */ #[Groups(['include_parents', 'import'])] + #[NoneOfItsChildren] protected ?AbstractStructuralDBElement $parent = null; /** @var string[] all names of all parent elements as an array of strings, diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index f6a9d404..15cda250 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -41,7 +41,6 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; * This entity describes a lot where parts can be stored. * It is the connection between a part and its store locations. * - * @ValidPartLot() * @see \App\Tests\Entity\Parts\PartLotTest */ #[ORM\Entity] @@ -49,6 +48,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; #[ORM\Table(name: 'part_lots')] #[ORM\Index(name: 'part_lots_idx_instock_un_expiration_id_part', columns: ['instock_unknown', 'expiration_date', 'id_part'])] #[ORM\Index(name: 'part_lots_idx_needs_refill', columns: ['needs_refill'])] +#[ValidPartLot] class PartLot extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface { use TimestampTrait; @@ -77,11 +77,11 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * @var Storelocation|null The storelocation of this lot - * @Selectable() */ #[Groups(['simple', 'extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: 'Storelocation')] #[ORM\JoinColumn(name: 'id_store_location')] + #[Selectable()] protected ?Storelocation $storage_location = null; /** @@ -334,7 +334,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named //When the storage location sets the owner must match, the part lot owner must match the storage location owner if ($this->getStorageLocation() && $this->getStorageLocation()->isPartOwnerMustMatch() && $this->getStorageLocation()->getOwner() && $this->getOwner() && ($this->getOwner() !== $this->getStorageLocation()->getOwner() - && $this->owner->getID() !== $this->getStorageLocation()->getOwner()->getID())) { + && $this->owner->getID() !== $this->getStorageLocation()->getOwner()->getID())) { $context->buildViolation('validator.part_lot.owner_must_match_storage_location_owner') ->setParameter('%owner_name%', $this->getStorageLocation()->getOwner()->getFullName(true)) ->atPath('owner') diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php index aa08f514..192531e3 100644 --- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php @@ -62,9 +62,9 @@ trait BasicPropertyTrait /** * @var Category|null The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping. * Every part must have a category. - * @Selectable() */ #[Assert\NotNull(message: 'validator.select_valid_category')] + #[Selectable()] #[Groups(['simple', 'extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: 'Category')] #[ORM\JoinColumn(name: 'id_category', nullable: false)] @@ -72,11 +72,11 @@ trait BasicPropertyTrait /** * @var Footprint|null The footprint of this part (e.g. DIP8) - * @Selectable() */ #[Groups(['simple', 'extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: 'Footprint')] #[ORM\JoinColumn(name: 'id_footprint')] + #[Selectable()] protected ?Footprint $footprint = null; /** diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php index 0a66dfa0..1aa3d988 100644 --- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php +++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php @@ -37,11 +37,11 @@ trait ManufacturerTrait { /** * @var Manufacturer|null The manufacturer of this part - * @Selectable() */ #[Groups(['simple', 'extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: 'Manufacturer')] #[ORM\JoinColumn(name: 'id_manufacturer')] + #[Selectable()] protected ?Manufacturer $manufacturer = null; /** diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index 2746f131..85fe6db4 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -70,18 +70,18 @@ class Supplier extends AbstractCompany /** * @var Currency|null The currency that should be used by default for order informations with this supplier. * Set to null, to use global base currency. - * @Selectable() */ #[ORM\ManyToOne(targetEntity: Currency::class)] #[ORM\JoinColumn(name: 'default_currency_id')] + #[Selectable()] protected ?Currency $default_currency = null; /** * @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier - * @BigDecimalPositiveOrZero() */ #[Groups(['extended', 'full', 'import'])] #[ORM\Column(name: 'shipping_costs', nullable: true, type: 'big_decimal', precision: 11, scale: 5)] + #[BigDecimalPositiveOrZero()] protected ?BigDecimal $shipping_costs = null; /** diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index ea14cfcc..ac41acf2 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -51,9 +51,9 @@ class Currency extends AbstractStructuralDBElement /** * @var BigDecimal|null The exchange rate between this currency and the base currency * (how many base units the current currency is worth) - * @BigDecimalPositive() */ #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5, nullable: true)] + #[BigDecimalPositive()] protected ?BigDecimal $exchange_rate = null; /** diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index 9847b41a..34df9e57 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -53,20 +53,20 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface /** * @var BigDecimal The price related to the detail. (Given in the selected currency) - * @BigDecimalPositive() */ #[Groups(['extended', 'full'])] #[ORM\Column(type: 'big_decimal', precision: 11, scale: 5)] + #[BigDecimalPositive()] protected BigDecimal $price; /** * @var ?Currency The currency used for the current price information. - * If this is null, the global base unit is assumed. - * @Selectable() + * If this is null, the global base unit is assumed */ #[Groups(['extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: 'Currency', inversedBy: 'pricedetails')] #[ORM\JoinColumn(name: 'id_currency')] + #[Selectable()] protected ?Currency $currency = null; /** diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index 0bc0186e..4469f86f 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -96,10 +96,10 @@ class ProjectBOMEntry extends AbstractDBElement /** * @var ?Currency The currency for the price of this non-part BOM entry - * @Selectable() */ #[ORM\ManyToOne(targetEntity: Currency::class)] #[ORM\JoinColumn] + #[Selectable] protected ?Currency $price_currency = null; public function __construct() diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 6dceec58..b8647847 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Entity\UserSystem; +use App\Validator\Constraints\NoLockout; use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\GroupAttachment; use App\Entity\Base\AbstractStructuralDBElement; @@ -41,6 +42,7 @@ use Symfony\Component\Validator\Constraints as Assert; #[ORM\Table('`groups`')] #[ORM\Index(name: 'group_idx_name', columns: ['name'])] #[ORM\Index(name: 'group_idx_parent_name', columns: ['parent_id', 'name'])] +#[NoLockout()] class Group extends AbstractStructuralDBElement implements HasPermissionsInterface { /** @@ -66,6 +68,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa #[Groups(['extended', 'full', 'import'])] #[ORM\Column(type: Types::BOOLEAN, name: 'enforce_2fa')] protected bool $enforce2FA = false; + /** * @var Collection */ @@ -74,15 +77,13 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa #[ORM\OrderBy(['name' => 'ASC'])] protected Collection $attachments; - /** - * @var PermissionData|null - * @ValidPermission() - */ #[Groups(['full'])] #[ORM\Embedded(class: 'PermissionData', columnPrefix: 'permissions_')] + #[ValidPermission()] protected ?PermissionData $permissions = null; - /** @var Collection + /** + * @var Collection */ #[Assert\Valid] #[ORM\OneToMany(targetEntity: GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 8f57c370..d92b0d91 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -24,6 +24,7 @@ namespace App\Entity\UserSystem; use App\Repository\UserRepository; use App\EntityListeners\TreeCacheInvalidationListener; +use App\Validator\Constraints\NoLockout; use Doctrine\DBAL\Types\Types; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\UserAttachment; @@ -64,6 +65,7 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface #[ORM\EntityListeners([TreeCacheInvalidationListener::class])] #[ORM\Table('`users`')] #[ORM\Index(name: 'user_idx_username', columns: ['name'])] +#[NoLockout()] class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface, BackupCodeInterface, TrustedDeviceInterface, WebauthnTwoFactorInterface, PreferredProviderInterface, PasswordAuthenticatedUserInterface, SamlUserInterface { @@ -83,10 +85,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var string|null The theme - * @ValidTheme() */ #[Groups(['full', 'import'])] #[ORM\Column(type: Types::STRING, name: 'config_theme', nullable: true)] + #[ValidTheme()] protected ?string $theme = null; /** @@ -127,11 +129,11 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var Group|null the group this user belongs to * DO NOT PUT A fetch eager here! Otherwise, you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions. - * @Selectable() */ #[Groups(['extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: 'Group', inversedBy: 'users')] #[ORM\JoinColumn(name: 'group_id')] + #[Selectable] protected ?Group $group = null; /** @@ -244,19 +246,16 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * Dont use fetch=EAGER here, this will cause problems with setting the currency setting. * TODO: This is most likely a bug in doctrine/symfony related to the UniqueEntity constraint (it makes a db call). * TODO: Find a way to use fetch EAGER (this improves performance a bit) - * @Selectable() */ #[Groups(['extended', 'full', 'import'])] #[ORM\ManyToOne(targetEntity: Currency::class)] #[ORM\JoinColumn(name: 'currency_id')] + #[Selectable] protected ?Currency $currency = null; - /** - * @var PermissionData|null - * @ValidPermission() - */ #[Groups(['simple', 'extended', 'full', 'import'])] #[ORM\Embedded(class: 'PermissionData', columnPrefix: 'permissions_')] + #[ValidPermission()] protected ?PermissionData $permissions = null; /** @@ -287,7 +286,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe * * @return string */ - public function __toString() + public function __toString(): string { $tmp = $this->isDisabled() ? ' [DISABLED]' : ''; diff --git a/src/Helpers/Projects/ProjectBuildRequest.php b/src/Helpers/Projects/ProjectBuildRequest.php index 09dca3aa..c1c3c66f 100644 --- a/src/Helpers/Projects/ProjectBuildRequest.php +++ b/src/Helpers/Projects/ProjectBuildRequest.php @@ -29,9 +29,9 @@ use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Validator\Constraints\ProjectSystem\ValidProjectBuildRequest; /** - * @ValidProjectBuildRequest() * @see \App\Tests\Helpers\Projects\ProjectBuildRequestTest */ +#[ValidProjectBuildRequest] final class ProjectBuildRequest { private readonly int $number_of_builds; diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php b/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php index de66eea3..0e7e755f 100644 --- a/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php +++ b/src/Validator/Constraints/BigDecimal/BigDecimalPositive.php @@ -22,25 +22,11 @@ declare(strict_types=1); */ namespace App\Validator\Constraints\BigDecimal; -use Symfony\Component\Validator\Constraints\GreaterThan; +use Symfony\Component\Validator\Constraints\Positive; -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Jan Schädlich - */ -class BigDecimalPositive extends GreaterThan +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class BigDecimalPositive extends Positive { - use BigNumberConstraintTrait; - - public $message = 'This value should be positive.'; - - public function __construct($options = null) - { - parent::__construct($this->configureNumberConstraintOptions($options)); - } - public function validatedBy(): string { return BigDecimalGreaterThanValidator::class; diff --git a/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php b/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php index 30042fe2..408cd582 100644 --- a/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php +++ b/src/Validator/Constraints/BigDecimal/BigDecimalPositiveOrZero.php @@ -22,25 +22,11 @@ declare(strict_types=1); */ namespace App\Validator\Constraints\BigDecimal; -use Symfony\Component\Validator\Constraints\GreaterThanOrEqual; +use Symfony\Component\Validator\Constraints\PositiveOrZero; -/** - * @Annotation - * @Target({"PROPERTY", "METHOD", "ANNOTATION"}) - * - * @author Jan Schädlich - */ -class BigDecimalPositiveOrZero extends GreaterThanOrEqual +#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class BigDecimalPositiveOrZero extends PositiveOrZero { - use BigNumberConstraintTrait; - - public $message = 'This value should be either positive or zero.'; - - public function __construct($options = null) - { - parent::__construct($this->configureNumberConstraintOptions($options)); - } - public function validatedBy(): string { return BigDecimalGreaterThenOrEqualValidator::class; diff --git a/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php b/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php deleted file mode 100644 index ba89900f..00000000 --- a/src/Validator/Constraints/BigDecimal/BigNumberConstraintTrait.php +++ /dev/null @@ -1,51 +0,0 @@ -. - */ -namespace App\Validator\Constraints\BigDecimal; - -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; - -use function is_array; - -trait BigNumberConstraintTrait -{ - private function configureNumberConstraintOptions($options): array - { - if (null === $options) { - $options = []; - } elseif (!is_array($options)) { - $options = [$this->getDefaultOption() => $options]; - } - - if (isset($options['propertyPath'])) { - throw new ConstraintDefinitionException(sprintf('The "propertyPath" option of the "%s" constraint cannot be set.', static::class)); - } - - if (isset($options['value'])) { - throw new ConstraintDefinitionException(sprintf('The "value" option of the "%s" constraint cannot be set.', static::class)); - } - - $options['value'] = 0; - - return $options; - } -} diff --git a/src/Validator/Constraints/Misc/ValidRange.php b/src/Validator/Constraints/Misc/ValidRange.php index 15781498..680eb04d 100644 --- a/src/Validator/Constraints/Misc/ValidRange.php +++ b/src/Validator/Constraints/Misc/ValidRange.php @@ -43,9 +43,7 @@ namespace App\Validator\Constraints\Misc; use Symfony\Component\Validator\Constraint; -/** - * @Annotation - */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class ValidRange extends Constraint { public string $message = 'validator.invalid_range'; diff --git a/src/Validator/Constraints/NoLockout.php b/src/Validator/Constraints/NoLockout.php index 323dddb4..a33f3106 100644 --- a/src/Validator/Constraints/NoLockout.php +++ b/src/Validator/Constraints/NoLockout.php @@ -26,9 +26,8 @@ use Symfony\Component\Validator\Constraint; /** * This constraint restricts a user in that way that it can not lock itself out of the user system. - * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_CLASS)] class NoLockout extends Constraint { public string $message = 'validator.noLockout'; diff --git a/src/Validator/Constraints/NoLockoutValidator.php b/src/Validator/Constraints/NoLockoutValidator.php index 7d7a3588..9d51d81e 100644 --- a/src/Validator/Constraints/NoLockoutValidator.php +++ b/src/Validator/Constraints/NoLockoutValidator.php @@ -34,11 +34,8 @@ use Symfony\Component\Validator\ConstraintValidator; class NoLockoutValidator extends ConstraintValidator { - protected array $perm_structure; - public function __construct(protected PermissionManager $resolver, protected Security $security, protected EntityManagerInterface $entityManager) { - $this->perm_structure = $resolver->getPermissionStructure(); } /** @@ -71,6 +68,8 @@ class NoLockoutValidator extends ConstraintValidator ) ?? false)) { $this->context->addViolation($constraint->message); } + } else { + throw new \LogicException('The NoLockout constraint can only be used on User or Group objects.'); } } } diff --git a/src/Validator/Constraints/NoneOfItsChildren.php b/src/Validator/Constraints/NoneOfItsChildren.php index b8e92faa..8f1e059a 100644 --- a/src/Validator/Constraints/NoneOfItsChildren.php +++ b/src/Validator/Constraints/NoneOfItsChildren.php @@ -27,9 +27,8 @@ use Symfony\Component\Validator\Constraint; /** * Constraints the parent property on StructuralDBElement objects in the way, that neither the object self nor any * of its children can be assigned. - * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class NoneOfItsChildren extends Constraint { /** diff --git a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php index 05ed48e9..1e9ac834 100644 --- a/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php +++ b/src/Validator/Constraints/ProjectSystem/ValidProjectBuildRequest.php @@ -26,9 +26,8 @@ use Symfony\Component\Validator\Constraint; /** * This constraint checks that the given ProjectBuildRequest is valid. - * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_CLASS)] class ValidProjectBuildRequest extends Constraint { public function getTargets(): string diff --git a/src/Validator/Constraints/Selectable.php b/src/Validator/Constraints/Selectable.php index 20a51aad..f65cb685 100644 --- a/src/Validator/Constraints/Selectable.php +++ b/src/Validator/Constraints/Selectable.php @@ -27,9 +27,8 @@ use Symfony\Component\Validator\Constraint; /** * If a property is marked with this constraint, the choosen value (of type StructuralDBElement) * must NOT be marked as not selectable. - * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class Selectable extends Constraint { public $message = 'validator.isSelectable'; diff --git a/src/Validator/Constraints/UrlOrBuiltin.php b/src/Validator/Constraints/UrlOrBuiltin.php index 20b71871..ceec5d07 100644 --- a/src/Validator/Constraints/UrlOrBuiltin.php +++ b/src/Validator/Constraints/UrlOrBuiltin.php @@ -27,9 +27,8 @@ use Symfony\Component\Validator\Constraints\Url; /** * Constraints the field that way that the content is either an url or a path to a builtin ressource (like %FOOTPRINTS%). - * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class UrlOrBuiltin extends Url { /** diff --git a/src/Validator/Constraints/ValidFileFilter.php b/src/Validator/Constraints/ValidFileFilter.php index 8a7b70d0..756e6a37 100644 --- a/src/Validator/Constraints/ValidFileFilter.php +++ b/src/Validator/Constraints/ValidFileFilter.php @@ -27,6 +27,7 @@ use Symfony\Component\Validator\Constraint; /** * @Annotation */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class ValidFileFilter extends Constraint { } diff --git a/src/Validator/Constraints/ValidPartLot.php b/src/Validator/Constraints/ValidPartLot.php index 3b9658ac..a82c6a10 100644 --- a/src/Validator/Constraints/ValidPartLot.php +++ b/src/Validator/Constraints/ValidPartLot.php @@ -27,9 +27,8 @@ use Symfony\Component\Validator\Constraint; /** * A constraint "dummy" to validate the PartLot. * We need to access services in our Validator, so we can not use a simple callback on PartLot. - * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_CLASS)] class ValidPartLot extends Constraint { public function getTargets(): string diff --git a/src/Validator/Constraints/ValidPermission.php b/src/Validator/Constraints/ValidPermission.php index 58a4ad2c..4d05f6cf 100644 --- a/src/Validator/Constraints/ValidPermission.php +++ b/src/Validator/Constraints/ValidPermission.php @@ -28,8 +28,8 @@ use Symfony\Component\Validator\Constraint; * A PermissionEmbed object with this annotation will be checked with ValidPermissionValidator. * That means the alsoSet values of the permission operations are set. * - * @Annotation */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class ValidPermission extends Constraint { } diff --git a/src/Validator/Constraints/ValidTheme.php b/src/Validator/Constraints/ValidTheme.php index 03e0d35b..92a19f5a 100644 --- a/src/Validator/Constraints/ValidTheme.php +++ b/src/Validator/Constraints/ValidTheme.php @@ -26,8 +26,8 @@ use Symfony\Component\Validator\Constraint; /** * A constraint to validate the theme setting of the user. - * @Annotation */ +#[\Attribute(\Attribute::TARGET_PROPERTY)] class ValidTheme extends Constraint { public string $message = 'validator.selected_theme_is_invalid'; From 3d7cf8f7f37217c2d7e6c59b77ea8e751a4f4a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:42:02 +0200 Subject: [PATCH 49/91] Removed remaining annotations --- src/Controller/PartController.php | 8 +++----- src/Entity/Attachments/AttachmentContainingDBElement.php | 5 +---- src/Services/ProjectSystem/ProjectBuildHelper.php | 2 +- src/Validator/Constraints/ValidFileFilter.php | 3 --- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/Controller/PartController.php b/src/Controller/PartController.php index 2434415e..2083c340 100644 --- a/src/Controller/PartController.php +++ b/src/Controller/PartController.php @@ -48,6 +48,7 @@ use Doctrine\ORM\EntityManagerInterface; use Exception; use Omines\DataTablesBundle\DataTableFactory; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; +use Symfony\Bridge\Doctrine\Attribute\MapEntity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -198,16 +199,13 @@ class PartController extends AbstractController return $this->redirectToRoute('homepage'); } - /** - * @ParamConverter("part", options={"id" = "id"}) - * @ParamConverter("project", options={"id" = "project_id"}) - */ #[Route(path: '/new', name: 'part_new')] #[Route(path: '/{id}/clone', name: 'part_clone')] #[Route(path: '/new_build_part/{project_id}', name: 'part_new_build_part')] public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator, AttachmentSubmitHandler $attachmentSubmitHandler, ProjectBuildPartHelper $projectBuildPartHelper, - ?Part $part = null, ?Project $project = null): Response + #[MapEntity(mapping: ['id' => 'id'])] ?Part $part = null, + #[MapEntity(mapping: ['id' => 'project_id'])] ?Project $project = null): Response { if ($part instanceof Part) { diff --git a/src/Entity/Attachments/AttachmentContainingDBElement.php b/src/Entity/Attachments/AttachmentContainingDBElement.php index d2d772e8..340c5d77 100644 --- a/src/Entity/Attachments/AttachmentContainingDBElement.php +++ b/src/Entity/Attachments/AttachmentContainingDBElement.php @@ -38,10 +38,7 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl /** * @var Attachment[]|Collection - * //TODO - * //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element") - * - * Mapping is done in sub classes like part + * ORM Mapping is done in subclasses (e.g. Part) */ #[Groups(['full'])] protected Collection $attachments; diff --git a/src/Services/ProjectSystem/ProjectBuildHelper.php b/src/Services/ProjectSystem/ProjectBuildHelper.php index 256958f2..1d0b4549 100644 --- a/src/Services/ProjectSystem/ProjectBuildHelper.php +++ b/src/Services/ProjectSystem/ProjectBuildHelper.php @@ -80,7 +80,7 @@ class ProjectBuildHelper /** * Checks if the given project can be built with the current stock. * This means that the maximum buildable count is greater or equal than the requested $number_of_projects - * @parm int $number_of_builds + * @param int $number_of_builds */ public function isProjectBuildable(Project $project, int $number_of_builds = 1): bool { diff --git a/src/Validator/Constraints/ValidFileFilter.php b/src/Validator/Constraints/ValidFileFilter.php index 756e6a37..d962c0ea 100644 --- a/src/Validator/Constraints/ValidFileFilter.php +++ b/src/Validator/Constraints/ValidFileFilter.php @@ -24,9 +24,6 @@ namespace App\Validator\Constraints; use Symfony\Component\Validator\Constraint; -/** - * @Annotation - */ #[\Attribute(\Attribute::TARGET_PROPERTY)] class ValidFileFilter extends Constraint { From 8f424f327354fe7f82c0641374435e6017feb182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:52:43 +0200 Subject: [PATCH 50/91] Removed sensio/framework-extra-bundle as it was abandoned and is not needed anymore --- composer.json | 3 +- composer.lock | 134 +++++------------- config/bundles.php | 1 - config/packages/sensio_framework_extra.yaml | 3 - .../{annotations.yaml => attributes.yaml} | 0 symfony.lock | 12 -- 6 files changed, 38 insertions(+), 115 deletions(-) delete mode 100644 config/packages/sensio_framework_extra.yaml rename config/routes/{annotations.yaml => attributes.yaml} (100%) diff --git a/composer.json b/composer.json index be1f12d0..7dda9d6b 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "beberlei/doctrineextensions": "^1.2", "brick/math": "^0.11.0", "composer/package-versions-deprecated": "^1.11.99.5", - "doctrine/annotations": "^1.6", + "doctrine/annotations": "1.14.3", "doctrine/data-fixtures": "^1.6.6", "doctrine/dbal": "^3.4.6", "doctrine/doctrine-bundle": "^2.0", @@ -42,7 +42,6 @@ "scheb/2fa-bundle": "^6.8.0", "scheb/2fa-google-authenticator": "^6.8.0", "scheb/2fa-trusted-device": "^6.8.0", - "sensio/framework-extra-bundle": "^6.1.1", "shivas/versioning-bundle": "^4.0", "spatie/db-dumper": "^3.3.1", "symfony/apache-pack": "^1.0", diff --git a/composer.lock b/composer.lock index c094f713..52f9b13b 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": "3a1f7b07108d0b82633975721493cc8a", + "content-hash": "3fced602006b9f4356f00e003f404d84", "packages": [ { "name": "beberlei/assert", @@ -5910,84 +5910,6 @@ }, "time": "2023-04-01T11:20:00+00:00" }, - { - "name": "sensio/framework-extra-bundle", - "version": "v6.2.10", - "source": { - "type": "git", - "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "2f886f4b31f23c76496901acaedfedb6936ba61f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/2f886f4b31f23c76496901acaedfedb6936ba61f", - "reference": "2f886f4b31f23c76496901acaedfedb6936ba61f", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.0|^2.0", - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0" - }, - "conflict": { - "doctrine/doctrine-cache-bundle": "<1.3.1", - "doctrine/persistence": "<1.3" - }, - "require-dev": { - "doctrine/dbal": "^2.10|^3.0", - "doctrine/doctrine-bundle": "^1.11|^2.0", - "doctrine/orm": "^2.5", - "symfony/browser-kit": "^4.4|^5.0|^6.0", - "symfony/doctrine-bridge": "^4.4|^5.0|^6.0", - "symfony/dom-crawler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/monolog-bridge": "^4.0|^5.0|^6.0", - "symfony/monolog-bundle": "^3.2", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0", - "symfony/security-bundle": "^4.4|^5.0|^6.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0", - "twig/twig": "^1.34|^2.4|^3.0" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "6.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Sensio\\Bundle\\FrameworkExtraBundle\\": "src/" - }, - "exclude-from-classmap": [ - "/tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "This bundle provides a way to configure your controllers with annotations", - "keywords": [ - "annotations", - "controllers" - ], - "support": { - "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.10" - }, - "abandoned": "Symfony", - "time": "2023-02-24T14:57:12+00:00" - }, { "name": "shivas/versioning-bundle", "version": "4.0.2", @@ -13015,16 +12937,16 @@ }, { "name": "web-auth/metadata-service", - "version": "4.5.2", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-metadata-service.git", - "reference": "82b3a517894987db1f8959a9320b9891515af9e7" + "reference": "b58fbb0df46450acc426329bd87b60d794859da0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/82b3a517894987db1f8959a9320b9891515af9e7", - "reference": "82b3a517894987db1f8959a9320b9891515af9e7", + "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/b58fbb0df46450acc426329bd87b60d794859da0", + "reference": "b58fbb0df46450acc426329bd87b60d794859da0", "shasum": "" }, "require": { @@ -13047,6 +12969,12 @@ "web-token/jwt-signature-algorithm-ecdsa": "Mandatory for fetching Metadata Statement from distant sources" }, "type": "library", + "extra": { + "thanks": { + "name": "web-auth/webauthn-framework", + "url": "https://github.com/web-auth/webauthn-framework" + } + }, "autoload": { "psr-4": { "Webauthn\\MetadataService\\": "src/" @@ -13074,7 +13002,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-metadata-service/tree/4.5.2" + "source": "https://github.com/web-auth/webauthn-metadata-service/tree/4.6.0" }, "funding": [ { @@ -13086,20 +13014,20 @@ "type": "patreon" } ], - "time": "2023-01-22T17:02:25+00:00" + "time": "2023-06-01T19:06:30+00:00" }, { "name": "web-auth/webauthn-lib", - "version": "4.5.2", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-lib.git", - "reference": "30c5e891c6418abef6d87a4351132b01b1828a98" + "reference": "e5c39be15d9e9ee1d0ad8d88c018c85d881ccf0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/30c5e891c6418abef6d87a4351132b01b1828a98", - "reference": "30c5e891c6418abef6d87a4351132b01b1828a98", + "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/e5c39be15d9e9ee1d0ad8d88c018c85d881ccf0e", + "reference": "e5c39be15d9e9ee1d0ad8d88c018c85d881ccf0e", "shasum": "" }, "require": { @@ -13129,6 +13057,12 @@ "web-token/jwt-signature-algorithm-rsa": "Mandatory for the AndroidSafetyNet Attestation Statement support" }, "type": "library", + "extra": { + "thanks": { + "name": "web-auth/webauthn-framework", + "url": "https://github.com/web-auth/webauthn-framework" + } + }, "autoload": { "psr-4": { "Webauthn\\": "src/" @@ -13156,7 +13090,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-lib/tree/4.5.2" + "source": "https://github.com/web-auth/webauthn-lib/tree/4.6.0" }, "funding": [ { @@ -13168,20 +13102,20 @@ "type": "patreon" } ], - "time": "2023-05-12T18:26:01+00:00" + "time": "2023-06-01T19:06:30+00:00" }, { "name": "web-auth/webauthn-symfony-bundle", - "version": "4.5.2", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-symfony-bundle.git", - "reference": "753854e2b3c4b5a61febe63b802739bd9f6e7143" + "reference": "4771712b59efef2051594c3ffd547a5a1b6b52fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-symfony-bundle/zipball/753854e2b3c4b5a61febe63b802739bd9f6e7143", - "reference": "753854e2b3c4b5a61febe63b802739bd9f6e7143", + "url": "https://api.github.com/repos/web-auth/webauthn-symfony-bundle/zipball/4771712b59efef2051594c3ffd547a5a1b6b52fd", + "reference": "4771712b59efef2051594c3ffd547a5a1b6b52fd", "shasum": "" }, "require": { @@ -13203,6 +13137,12 @@ "web-token/jwt-signature": "^3.1" }, "type": "symfony-bundle", + "extra": { + "thanks": { + "name": "web-auth/webauthn-framework", + "url": "https://github.com/web-auth/webauthn-framework" + } + }, "autoload": { "psr-4": { "Webauthn\\Bundle\\": "src/" @@ -13230,7 +13170,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-symfony-bundle/tree/4.5.2" + "source": "https://github.com/web-auth/webauthn-symfony-bundle/tree/4.6.0" }, "funding": [ { @@ -13242,7 +13182,7 @@ "type": "patreon" } ], - "time": "2023-01-24T19:32:30+00:00" + "time": "2023-06-01T19:06:30+00:00" }, { "name": "web-token/jwt-core", diff --git a/config/bundles.php b/config/bundles.php index 852b74b3..91a5e88a 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,7 +2,6 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], diff --git a/config/packages/sensio_framework_extra.yaml b/config/packages/sensio_framework_extra.yaml deleted file mode 100644 index 1821ccc0..00000000 --- a/config/packages/sensio_framework_extra.yaml +++ /dev/null @@ -1,3 +0,0 @@ -sensio_framework_extra: - router: - annotations: false diff --git a/config/routes/annotations.yaml b/config/routes/attributes.yaml similarity index 100% rename from config/routes/annotations.yaml rename to config/routes/attributes.yaml diff --git a/symfony.lock b/symfony.lock index 9315c04f..7e863803 100644 --- a/symfony.lock +++ b/symfony.lock @@ -388,18 +388,6 @@ "sebastian/diff": { "version": "3.0.2" }, - "sensio/framework-extra-bundle": { - "version": "5.2", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.2", - "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" - }, - "files": [ - "./config/packages/sensio_framework_extra.yaml" - ] - }, "shivas/versioning-bundle": { "version": "3.1.3" }, From 52c8ea13afa234c0e0578f4908c1973159aee0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:54:50 +0200 Subject: [PATCH 51/91] Updated doctrine/annotations recipe --- symfony.lock | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/symfony.lock b/symfony.lock index 7e863803..b09e6ac3 100644 --- a/symfony.lock +++ b/symfony.lock @@ -45,16 +45,14 @@ "version": "v0.1.1" }, "doctrine/annotations": { - "version": "1.0", + "version": "1.14", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "1.0", - "ref": "a2759dd6123694c8d901d0ec80006e044c2e6457" + "branch": "main", + "version": "1.10", + "ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05" }, - "files": [ - "./config/routes/annotations.yaml" - ] + "files": [] }, "doctrine/cache": { "version": "v1.8.0" From 7658cfcdbd42e032f13beadffb9ae76c31a1b582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:58:31 +0200 Subject: [PATCH 52/91] Updated symfony/stimulus-bridge recipe --- assets/bootstrap.js | 3 +-- symfony.lock | 11 ++++++++--- webpack.config.js | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/assets/bootstrap.js b/assets/bootstrap.js index 58308a6b..c26293e2 100644 --- a/assets/bootstrap.js +++ b/assets/bootstrap.js @@ -4,8 +4,7 @@ import { startStimulusApp } from '@symfony/stimulus-bridge'; export const app = startStimulusApp(require.context( '@symfony/stimulus-bridge/lazy-controller-loader!./controllers', true, - /\.(j|t)sx?$/ + /\.[jt]sx?$/ )); - // register any custom, 3rd party controllers here // app.register('some_controller_name', SomeImportedController); diff --git a/symfony.lock b/symfony.lock index b09e6ac3..1404741d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -672,9 +672,14 @@ "recipe": { "repo": "github.com/symfony/recipes", "branch": "main", - "version": "2.8", - "ref": "9e33a8a3794b603fb4be6c04ee5ecab901ce549e" - } + "version": "2.9", + "ref": "05c45071c7ecacc1e48f94bc43c1f8d4405fb2b2" + }, + "files": [ + "./assets/bootstrap.js", + "./assets/controllers.json", + "./assets/controllers/hello_controller.js" + ] }, "symfony/stopwatch": { "version": "v4.2.3" diff --git a/webpack.config.js b/webpack.config.js index 19596143..d38aa3c7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -71,6 +71,9 @@ Encore // When enabled, Webpack "splits" your files into smaller pieces for greater optimization. .splitEntryChunks() + // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js) + .enableStimulusBridge('./assets/controllers.json') + // will require an extra script tag for runtime.js // but, you probably want this, unless you're building a single-page app .enableSingleRuntimeChunk() From b788c3745c5351cfa68aa435e5d19ff4ccf8d558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 19:59:44 +0200 Subject: [PATCH 53/91] Updated recipe of twig-bundle --- symfony.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/symfony.lock b/symfony.lock index 1404741d..20182530 100644 --- a/symfony.lock +++ b/symfony.lock @@ -707,12 +707,12 @@ "version": "v4.2.3" }, "symfony/twig-bundle": { - "version": "5.4", + "version": "6.3", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.4", - "ref": "bb2178c57eee79e6be0b297aa96fc0c0def81387" + "branch": "main", + "version": "6.3", + "ref": "b7772eb20e92f3fb4d4fe756e7505b4ba2ca1a2c" }, "files": [ "config/packages/twig.yaml", From 172884ace83ab6cbbb5139f10703e166f60b27c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 20:00:25 +0200 Subject: [PATCH 54/91] Updated webprofiler bundle --- config/packages/web_profiler.yaml | 4 +++- symfony.lock | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml index 17893da1..b9461110 100644 --- a/config/packages/web_profiler.yaml +++ b/config/packages/web_profiler.yaml @@ -4,7 +4,9 @@ when@dev: intercept_redirects: false framework: - profiler: { only_exceptions: false } + profiler: + only_exceptions: false + collect_serializer_data: true when@test: web_profiler: diff --git a/symfony.lock b/symfony.lock index 20182530..cdd153ae 100644 --- a/symfony.lock +++ b/symfony.lock @@ -756,12 +756,12 @@ "version": "v4.2.3" }, "symfony/web-profiler-bundle": { - "version": "5.4", + "version": "6.3", "recipe": { "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "5.3", - "ref": "24bbc3d84ef2f427f82104f766014e799eefcc3e" + "branch": "main", + "version": "6.1", + "ref": "e42b3f0177df239add25373083a564e5ead4e13a" }, "files": [ "config/packages/web_profiler.yaml", From 485b35fbd4b46fc463681008e7b8d32c82572594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 11 Jun 2023 23:16:07 +0200 Subject: [PATCH 55/91] Fixed static analysis issues --- src/Controller/LogController.php | 3 --- src/Entity/UserSystem/PermissionData.php | 20 +++++++++++--------- src/Serializer/PartNormalizer.php | 7 +++++-- src/Validator/Constraints/NoLockout.php | 5 +++++ 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index 60fac14b..d4d4272a 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -87,9 +87,6 @@ class LogController extends AbstractController ]); } - /** - * @param Request $request - */ #[Route(path: '/{id}/details', name: 'log_details')] public function logDetails(AbstractLogEntry $logEntry, LogEntryExtraFormatter $logEntryExtraFormatter, LogLevelHelper $logLevelHelper, LogTargetHelper $logTargetHelper, EntityManagerInterface $entityManager): Response diff --git a/src/Entity/UserSystem/PermissionData.php b/src/Entity/UserSystem/PermissionData.php index c8330f3b..01bb2416 100644 --- a/src/Entity/UserSystem/PermissionData.php +++ b/src/Entity/UserSystem/PermissionData.php @@ -49,15 +49,17 @@ final class PermissionData implements \JsonSerializable * Creates a new Permission Data Instance using the given data. * By default, an empty array is used, meaning */ - public function __construct(/** - * @var array|null This array contains the permission values for each permission - * This array contains the permission values for each permission, in the form of: - * permission => [ - * operation => value, - * ] - */ - #[ORM\Column(type: Types::JSON, name: 'data')] - protected array $data = []) + public function __construct( + /** + * @var array This array contains the permission values for each permission + * This array contains the permission values for each permission, in the form of: + * permission => [ + * operation => value, + * ] + */ + #[ORM\Column(type: Types::JSON, name: 'data')] + protected array $data = [] + ) { //If the passed data did not contain a schema version, we set it to the current version if (!isset($this->data['$ver'])) { diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 28b6e252..00bd2256 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -56,7 +56,10 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface public function __construct( private readonly StructuralElementFromNameDenormalizer $locationDenormalizer, #[Autowire(service: ObjectNormalizer::class)] - private readonly NormalizerInterface $normalizer) + private readonly NormalizerInterface $normalizer, + #[Autowire(service: ObjectNormalizer::class)] + private readonly DenormalizerInterface $denormalizer, + ) { } @@ -121,7 +124,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface $data['minamount'] = 0.0; } - $object = $this->normalizer->denormalize($data, $type, $format, $context); + $object = $this->denormalizer->denormalize($data, $type, $format, $context); if (!$object instanceof Part) { throw new \InvalidArgumentException('This normalizer only supports Part objects!'); diff --git a/src/Validator/Constraints/NoLockout.php b/src/Validator/Constraints/NoLockout.php index a33f3106..30eb770f 100644 --- a/src/Validator/Constraints/NoLockout.php +++ b/src/Validator/Constraints/NoLockout.php @@ -31,4 +31,9 @@ use Symfony\Component\Validator\Constraint; class NoLockout extends Constraint { public string $message = 'validator.noLockout'; + + public function getTargets(): string|array + { + return [self::CLASS_CONSTRAINT]; + } } From 71cd4057a77a5b37394be5940359694b92f19501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 12 Jun 2023 23:39:30 +0200 Subject: [PATCH 56/91] Use enums for LabelOptions --- .../AdminPages/BaseAdminController.php | 2 +- src/Controller/LabelController.php | 15 ++--- src/DataFixtures/LabelProfileFixtures.php | 2 +- src/Doctrine/Types/BigDecimalType.php | 4 +- src/Entity/LabelSystem/BarcodeType.php | 64 +++++++++++++++++++ src/Entity/LabelSystem/LabelOptions.php | 55 ++++++---------- src/Entity/LabelSystem/LabelPictureType.php | 37 +++++++++++ src/Entity/LabelSystem/LabelProcessMode.php | 29 +++++++++ .../LabelSystem/LabelSupportedElement.php | 45 +++++++++++++ src/Form/LabelOptionsType.php | 53 ++++++++------- src/Repository/LabelProfileRepository.php | 25 +++----- src/Services/LabelSystem/BarcodeGenerator.php | 48 ++++++-------- .../LabelExampleElementsGenerator.php | 9 +-- src/Services/LabelSystem/LabelGenerator.php | 15 +---- .../LabelSystem/LabelHTMLGenerator.php | 5 +- .../LabelProfileDropdownHelper.php | 15 ++++- .../LabelSystem/SandboxedTwigProvider.php | 3 +- src/Twig/TwigCoreExtension.php | 18 ++++++ templates/label_system/dialog.html.twig | 4 +- .../label_system/labels/base_label.html.twig | 6 +- .../LabelSystem/BarcodeGeneratorTest.php | 9 +-- .../LabelSystem/LabelGeneratorTest.php | 13 ++-- .../LabelSystem/SandboxedTwigProviderTest.php | 10 +-- 23 files changed, 329 insertions(+), 157 deletions(-) create mode 100644 src/Entity/LabelSystem/BarcodeType.php create mode 100644 src/Entity/LabelSystem/LabelPictureType.php create mode 100644 src/Entity/LabelSystem/LabelProcessMode.php create mode 100644 src/Entity/LabelSystem/LabelSupportedElement.php diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index 8fb35ae0..11f49c92 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -159,7 +159,7 @@ abstract class BaseAdminController extends AbstractController //Disable editing of options, if user is not allowed to use twig... if ( $entity instanceof LabelProfile - && 'twig' === $entity->getOptions()->getLinesMode() + && 'twig' === $entity->getOptions()->getProcessMode() && !$this->isGranted('@labels.use_twig') ) { $form_options['disable_options'] = true; diff --git a/src/Controller/LabelController.php b/src/Controller/LabelController.php index 8f55b37c..36f9b669 100644 --- a/src/Controller/LabelController.php +++ b/src/Controller/LabelController.php @@ -44,6 +44,7 @@ namespace App\Controller; use App\Entity\Base\AbstractDBElement; use App\Entity\LabelSystem\LabelOptions; use App\Entity\LabelSystem\LabelProfile; +use App\Entity\LabelSystem\LabelSupportedElement; use App\Exceptions\TwigModeException; use App\Form\LabelSystem\LabelDialogType; use App\Repository\DBElementRepository; @@ -80,18 +81,18 @@ class LabelController extends AbstractController $label_options = $profile instanceof LabelProfile ? $profile->getOptions() : new LabelOptions(); //We have to disable the options, if twig mode is selected and user is not allowed to use it. - $disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig'); + $disable_options = 'twig' === $label_options->getProcessMode() && !$this->isGranted('@labels.use_twig'); $form = $this->createForm(LabelDialogType::class, null, [ 'disable_options' => $disable_options, ]); //Try to parse given target_type and target_id - $target_type = $request->query->get('target_type', null); + $target_type = $request->query->getEnum('target_type', LabelSupportedElement::class, null); $target_id = $request->query->get('target_id', null); $generate = $request->query->getBoolean('generate', false); - if (!$profile instanceof LabelProfile && is_string($target_type)) { + if (!$profile instanceof LabelProfile && $target_type instanceof LabelSupportedElement) { $label_options->setSupportedElement($target_type); } if (is_string($target_id)) { @@ -142,16 +143,12 @@ class LabelController extends AbstractController return $ret.'.pdf'; } - protected function findObjects(string $type, string $ids): array + protected function findObjects(LabelSupportedElement $type, string $ids): array { - if (!isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) { - throw new InvalidArgumentException('The given type is not known and can not be mapped to a class!'); - } - $id_array = $this->rangeParser->parse($ids); /** @var DBElementRepository $repo */ - $repo = $this->em->getRepository(LabelGenerator::CLASS_SUPPORT_MAPPING[$type]); + $repo = $this->em->getRepository($type->getEntityClass()); return $repo->getElementsFromIDArray($id_array); } diff --git a/src/DataFixtures/LabelProfileFixtures.php b/src/DataFixtures/LabelProfileFixtures.php index 77ebe791..23f8e4df 100644 --- a/src/DataFixtures/LabelProfileFixtures.php +++ b/src/DataFixtures/LabelProfileFixtures.php @@ -100,7 +100,7 @@ class LabelProfileFixtures extends Fixture $option4->setLines('{{ element.name }}'); $option4->setBarcodeType('code39'); $option4->setSupportedElement('part'); - $option4->setLinesMode('twig'); + $option4->setProcessMode('twig'); $profile4->setOptions($option4); $manager->persist($profile4); diff --git a/src/Doctrine/Types/BigDecimalType.php b/src/Doctrine/Types/BigDecimalType.php index 6c7bf614..ccc1b491 100644 --- a/src/Doctrine/Types/BigDecimalType.php +++ b/src/Doctrine/Types/BigDecimalType.php @@ -38,10 +38,8 @@ class BigDecimalType extends Type /** * @param string|null $value - * - * @return BigDecimal|BigNumber|mixed */ - public function convertToPHPValue($value, AbstractPlatform $platform) + public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?BigNumber { if (null === $value) { return null; diff --git a/src/Entity/LabelSystem/BarcodeType.php b/src/Entity/LabelSystem/BarcodeType.php new file mode 100644 index 00000000..0794b606 --- /dev/null +++ b/src/Entity/LabelSystem/BarcodeType.php @@ -0,0 +1,64 @@ +. + */ + +namespace App\Entity\LabelSystem; + +enum BarcodeType: string +{ + case NONE = 'none'; + case QR = 'qr'; + case CODE39 = 'code39'; + case DATAMATRIX = 'datamatrix'; + case CODE93 = 'code93'; + case CODE128 = 'code128'; + + /** + * Returns true if the barcode is none. (Useful for twig templates) + * @return bool + */ + public function isNone(): bool + { + return $this === self::NONE; + } + + /** + * Returns true if the barcode is a 1D barcode (Code39, etc.). + * @return bool + */ + public function is1D(): bool + { + return match ($this) { + self::CODE39, self::CODE93, self::CODE128 => true, + default => false, + }; + } + + /** + * Returns true if the barcode is a 2D barcode (QR code, datamatrix). + * @return bool + */ + public function is2D(): bool + { + return match ($this) { + self::QR, self::DATAMATRIX => true, + default => false, + }; + } +} diff --git a/src/Entity/LabelSystem/LabelOptions.php b/src/Entity/LabelSystem/LabelOptions.php index 1ee86079..1d15d0f5 100644 --- a/src/Entity/LabelSystem/LabelOptions.php +++ b/src/Entity/LabelSystem/LabelOptions.php @@ -48,12 +48,6 @@ use Symfony\Component\Validator\Constraints as Assert; #[ORM\Embeddable] class LabelOptions { - final public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93', 'code128']; - final public const SUPPORTED_ELEMENTS = ['part', 'part_lot', 'storelocation']; - final public const PICTURE_TYPES = ['none', 'element_picture', 'main_attachment']; - - final public const LINES_MODES = ['html', 'twig']; - /** * @var float The page size of the label in mm */ @@ -69,25 +63,19 @@ class LabelOptions protected float $height = 30.0; /** - * @var string The type of the barcode that should be used in the label (e.g. 'qr') + * @var BarcodeType The type of the barcode that should be used in the label (e.g. 'qr') */ - #[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)] - #[ORM\Column(type: Types::STRING)] - protected string $barcode_type = 'none'; + #[ORM\Column(type: Types::STRING, enumType: BarcodeType::class)] + protected BarcodeType $barcode_type = BarcodeType::NONE; /** - * @var string What image should be shown along the + * @var LabelPictureType What image should be shown along the label */ - #[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)] - #[ORM\Column(type: Types::STRING)] - protected string $picture_type = 'none'; + #[ORM\Column(type: Types::STRING, enumType: LabelPictureType::class)] + protected LabelPictureType $picture_type = LabelPictureType::NONE; - /** - * @var string - */ - #[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)] - #[ORM\Column(type: Types::STRING)] - protected string $supported_element = 'part'; + #[ORM\Column(type: Types::STRING, enumType: LabelSupportedElement::class)] + protected LabelSupportedElement $supported_element = LabelSupportedElement::PART; /** * @var string any additional CSS for the label @@ -95,11 +83,10 @@ class LabelOptions #[ORM\Column(type: Types::TEXT)] protected string $additional_css = ''; - /** @var string The mode that will be used to interpret the lines + /** @var LabelProcessMode The mode that will be used to interpret the lines */ - #[Assert\Choice(choices: LabelOptions::LINES_MODES)] - #[ORM\Column(type: Types::STRING)] - protected string $lines_mode = 'html'; + #[ORM\Column(type: Types::STRING, enumType: LabelProcessMode::class, name: 'lines_mode')] + protected LabelProcessMode $process_mode = LabelProcessMode::PLACEHOLDER; /** * @var string @@ -131,36 +118,36 @@ class LabelOptions return $this; } - public function getBarcodeType(): string + public function getBarcodeType(): BarcodeType { return $this->barcode_type; } - public function setBarcodeType(string $barcode_type): self + public function setBarcodeType(BarcodeType $barcode_type): self { $this->barcode_type = $barcode_type; return $this; } - public function getPictureType(): string + public function getPictureType(): LabelPictureType { return $this->picture_type; } - public function setPictureType(string $picture_type): self + public function setPictureType(LabelPictureType $picture_type): self { $this->picture_type = $picture_type; return $this; } - public function getSupportedElement(): string + public function getSupportedElement(): LabelSupportedElement { return $this->supported_element; } - public function setSupportedElement(string $supported_element): self + public function setSupportedElement(LabelSupportedElement $supported_element): self { $this->supported_element = $supported_element; @@ -194,14 +181,14 @@ class LabelOptions return $this; } - public function getLinesMode(): string + public function getProcessMode(): LabelProcessMode { - return $this->lines_mode; + return $this->process_mode; } - public function setLinesMode(string $lines_mode): self + public function setProcessMode(LabelProcessMode $process_mode): self { - $this->lines_mode = $lines_mode; + $this->process_mode = $process_mode; return $this; } diff --git a/src/Entity/LabelSystem/LabelPictureType.php b/src/Entity/LabelSystem/LabelPictureType.php new file mode 100644 index 00000000..c9183ca6 --- /dev/null +++ b/src/Entity/LabelSystem/LabelPictureType.php @@ -0,0 +1,37 @@ +. + */ + +namespace App\Entity\LabelSystem; + +enum LabelPictureType: string +{ + /** + * Show no picture on the label + */ + case NONE = 'none'; + /** + * Show the preview picture of the element on the label + */ + case ELEMENT_PICTURE = 'element_picture'; + /** + * Show the main attachment of the element on the label + */ + case MAIN_ATTACHMENT = 'main_attachment'; +} \ No newline at end of file diff --git a/src/Entity/LabelSystem/LabelProcessMode.php b/src/Entity/LabelSystem/LabelProcessMode.php new file mode 100644 index 00000000..76bf175f --- /dev/null +++ b/src/Entity/LabelSystem/LabelProcessMode.php @@ -0,0 +1,29 @@ +. + */ + +namespace App\Entity\LabelSystem; + +enum LabelProcessMode: string +{ + /** Use placeholders like [[PLACEHOLDER]] which gets replaced with content */ + case PLACEHOLDER = 'html'; + /** Interpret the given lines as twig template */ + case TWIG = 'twig'; +} \ No newline at end of file diff --git a/src/Entity/LabelSystem/LabelSupportedElement.php b/src/Entity/LabelSystem/LabelSupportedElement.php new file mode 100644 index 00000000..99bac6c9 --- /dev/null +++ b/src/Entity/LabelSystem/LabelSupportedElement.php @@ -0,0 +1,45 @@ +. + */ + +namespace App\Entity\LabelSystem; + +use App\Entity\Parts\Part; +use App\Entity\Parts\PartLot; +use App\Entity\Parts\Storelocation; + +enum LabelSupportedElement: string +{ + case PART = 'part'; + case PART_LOT = 'part_lot'; + case STORELOCATION = 'storelocation'; + + /** + * Returns the entity class for the given element type + * @return string + */ + public function getEntityClass(): string + { + return match ($this) { + self::PART => Part::class, + self::PART_LOT => PartLot::class, + self::STORELOCATION => Storelocation::class, + }; + } +} \ No newline at end of file diff --git a/src/Form/LabelOptionsType.php b/src/Form/LabelOptionsType.php index 38490c2b..0b15046c 100644 --- a/src/Form/LabelOptionsType.php +++ b/src/Form/LabelOptionsType.php @@ -41,11 +41,15 @@ declare(strict_types=1); namespace App\Form; +use App\Entity\LabelSystem\BarcodeType; +use App\Entity\LabelSystem\LabelProcessMode; +use App\Entity\LabelSystem\LabelSupportedElement; use Symfony\Bundle\SecurityBundle\Security; use App\Entity\LabelSystem\LabelOptions; use App\Form\Type\RichTextEditorType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\FormBuilderInterface; @@ -78,31 +82,33 @@ class LabelOptionsType extends AbstractType ], ]); - $builder->add('supported_element', ChoiceType::class, [ + $builder->add('supported_element', EnumType::class, [ 'label' => 'label_options.supported_elements.label', - 'choices' => [ - 'part.label' => 'part', - 'part_lot.label' => 'part_lot', - 'storelocation.label' => 'storelocation', - ], + 'class' => LabelSupportedElement::class, + 'choice_label' => fn(LabelSupportedElement $choice) => match($choice) { + LabelSupportedElement::PART => 'part.label', + LabelSupportedElement::PART_LOT => 'part_lot.label', + LabelSupportedElement::STORELOCATION => 'storelocation.label', + }, ]); - $builder->add('barcode_type', ChoiceType::class, [ + $builder->add('barcode_type', EnumType::class, [ 'label' => 'label_options.barcode_type.label', 'empty_data' => 'none', - 'choices' => [ - 'label_options.barcode_type.none' => 'none', - 'label_options.barcode_type.qr' => 'qr', - 'label_options.barcode_type.code128' => 'code128', - 'label_options.barcode_type.code39' => 'code39', - 'label_options.barcode_type.code93' => 'code93', - 'label_options.barcode_type.datamatrix' => 'datamatrix', - ], - 'group_by' => static function ($choice, $key, $value): ?string { - if (in_array($choice, ['qr', 'datamatrix'], true)) { + 'class' => BarcodeType::class, + 'choice_label' => fn(BarcodeType $choice) => match($choice) { + BarcodeType::NONE => 'label_options.barcode_type.none', + BarcodeType::QR => 'label_options.barcode_type.qr', + BarcodeType::CODE128 => 'label_options.barcode_type.code128', + BarcodeType::CODE39 => 'label_options.barcode_type.code39', + BarcodeType::CODE93 => 'label_options.barcode_type.code93', + BarcodeType::DATAMATRIX => 'label_options.barcode_type.datamatrix', + }, + 'group_by' => static function (BarcodeType $choice, $key, $value): ?string { + if ($choice->is2D()) { return 'label_options.barcode_type.2D'; } - if (in_array($choice, ['code39', 'code93', 'code128'], true)) { + if ($choice->is1D()) { return 'label_options.barcode_type.1D'; } @@ -129,12 +135,13 @@ class LabelOptionsType extends AbstractType 'required' => false, ]); - $builder->add('lines_mode', ChoiceType::class, [ + $builder->add('process_mode', EnumType::class, [ 'label' => 'label_options.lines_mode.label', - 'choices' => [ - 'label_options.lines_mode.html' => 'html', - 'label.options.lines_mode.twig' => 'twig', - ], + 'class' => LabelProcessMode::class, + 'choice_label' => fn(LabelProcessMode $choice) => match($choice) { + LabelProcessMode::PLACEHOLDER => 'label_options.lines_mode.html', + LabelProcessMode::TWIG => 'label.options.lines_mode.twig', + }, 'help' => 'label_options.lines_mode.help', 'help_html' => true, 'expanded' => true, diff --git a/src/Repository/LabelProfileRepository.php b/src/Repository/LabelProfileRepository.php index f3459af9..1f8ac4fe 100644 --- a/src/Repository/LabelProfileRepository.php +++ b/src/Repository/LabelProfileRepository.php @@ -43,6 +43,7 @@ namespace App\Repository; use App\Entity\LabelSystem\LabelOptions; use App\Entity\LabelSystem\LabelProfile; +use App\Entity\LabelSystem\LabelSupportedElement; use App\Helpers\Trees\TreeViewNode; use InvalidArgumentException; @@ -52,12 +53,8 @@ class LabelProfileRepository extends NamedDBElementRepository * Find the profiles that are shown in the dropdown for the given type. * You should maybe use the cached version of this in LabelProfileDropdownHelper. */ - public function getDropdownProfiles(string $type): array + public function getDropdownProfiles(LabelSupportedElement $type): array { - if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) { - throw new InvalidArgumentException('Invalid supported_element type given.'); - } - return $this->findBy([ 'options.supported_element' => $type, 'show_in_dropdown' => true, @@ -74,7 +71,7 @@ class LabelProfileRepository extends NamedDBElementRepository { $result = []; - foreach (LabelOptions::SUPPORTED_ELEMENTS as $type) { + foreach (LabelSupportedElement::cases() as $type) { $type_children = []; $entities = $this->findForSupportedElement($type); foreach ($entities as $entity) { @@ -86,7 +83,7 @@ class LabelProfileRepository extends NamedDBElementRepository if ($type_children !== []) { //Use default label e.g. 'part_label'. $$ marks that it will be translated in TreeViewGenerator - $tmp = new TreeViewNode('$$'.$type.'.label', null, $type_children); + $tmp = new TreeViewNode('$$'.$type->value.'.label', null, $type_children); $result[] = $tmp; } @@ -98,15 +95,11 @@ class LabelProfileRepository extends NamedDBElementRepository /** * Find all LabelProfiles that can be used with the given type. * - * @param string $type see LabelOptions::SUPPORTED_ELEMENTS for valid values + * @param LabelSupportedElement $type see LabelOptions::SUPPORTED_ELEMENTS for valid values * @param array $order_by The way the results should be sorted. By default ordered by */ - public function findForSupportedElement(string $type, array $order_by = ['name' => 'ASC']): array + public function findForSupportedElement(LabelSupportedElement $type, array $order_by = ['name' => 'ASC']): array { - if (!in_array($type, LabelOptions::SUPPORTED_ELEMENTS, true)) { - throw new InvalidArgumentException('Invalid supported_element type given.'); - } - return $this->findBy(['options.supported_element' => $type], $order_by); } @@ -115,7 +108,7 @@ class LabelProfileRepository extends NamedDBElementRepository */ public function getPartLabelProfiles(): array { - return $this->getDropdownProfiles('part'); + return $this->getDropdownProfiles(LabelSupportedElement::PART); } /** @@ -123,7 +116,7 @@ class LabelProfileRepository extends NamedDBElementRepository */ public function getPartLotsLabelProfiles(): array { - return $this->getDropdownProfiles('part_lot'); + return $this->getDropdownProfiles(LabelSupportedElement::PART_LOT); } /** @@ -131,6 +124,6 @@ class LabelProfileRepository extends NamedDBElementRepository */ public function getStorelocationsLabelProfiles(): array { - return $this->getDropdownProfiles('storelocation'); + return $this->getDropdownProfiles(LabelSupportedElement::STORELOCATION); } } diff --git a/src/Services/LabelSystem/BarcodeGenerator.php b/src/Services/LabelSystem/BarcodeGenerator.php index b8ab099e..03eca1f6 100644 --- a/src/Services/LabelSystem/BarcodeGenerator.php +++ b/src/Services/LabelSystem/BarcodeGenerator.php @@ -43,6 +43,7 @@ namespace App\Services\LabelSystem; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractStructuralDBElement; +use App\Entity\LabelSystem\BarcodeType; use App\Entity\LabelSystem\LabelOptions; use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator; use Com\Tecnick\Barcode\Barcode; @@ -91,44 +92,31 @@ final class BarcodeGenerator { $barcode = new Barcode(); - switch ($options->getBarcodeType()) { - case 'qr': - $type = 'QRCODE'; + $type = match ($options->getBarcodeType()) { + BarcodeType::NONE => null, + BarcodeType::QR => 'QRCODE', + BarcodeType::DATAMATRIX => 'DATAMATRIX', + BarcodeType::CODE39 => 'C39', + BarcodeType::CODE93 => 'C93', + BarcodeType::CODE128 => 'C128A', + default => throw new InvalidArgumentException('Unknown label type!'), + }; - break; - case 'datamatrix': - $type = 'DATAMATRIX'; - - break; - case 'code39': - $type = 'C39'; - - break; - case 'code93': - $type = 'C93'; - - break; - case 'code128': - $type = 'C128A'; - - break; - case 'none': - return null; - default: - throw new InvalidArgumentException('Unknown label type!'); + if ($type === null) { + return null; } - $bobj = $barcode->getBarcodeObj($type, $this->getContent($options, $target)); - return $bobj->getSvgCode(); + return $barcode->getBarcodeObj($type, $this->getContent($options, $target))->getSvgCode(); } public function getContent(LabelOptions $options, AbstractDBElement $target): ?string { - return match ($options->getBarcodeType()) { - 'qr', 'datamatrix' => $this->barcodeContentGenerator->getURLContent($target), - 'code39', 'code93', 'code128' => $this->barcodeContentGenerator->get1DBarcodeContent($target), - 'none' => null, + $barcode = $options->getBarcodeType(); + return match (true) { + $barcode->is2D() => $this->barcodeContentGenerator->getURLContent($target), + $barcode->is1D() => $this->barcodeContentGenerator->get1DBarcodeContent($target), + $barcode === BarcodeType::NONE => null, default => throw new InvalidArgumentException('Unknown label type!'), }; } diff --git a/src/Services/LabelSystem/LabelExampleElementsGenerator.php b/src/Services/LabelSystem/LabelExampleElementsGenerator.php index d3717208..40ebafa0 100644 --- a/src/Services/LabelSystem/LabelExampleElementsGenerator.php +++ b/src/Services/LabelSystem/LabelExampleElementsGenerator.php @@ -42,6 +42,7 @@ declare(strict_types=1); namespace App\Services\LabelSystem; use App\Entity\Base\AbstractStructuralDBElement; +use App\Entity\LabelSystem\LabelSupportedElement; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -55,12 +56,12 @@ use ReflectionClass; final class LabelExampleElementsGenerator { - public function getElement(string $type): object + public function getElement(LabelSupportedElement $type): object { return match ($type) { - 'part' => $this->getExamplePart(), - 'part_lot' => $this->getExamplePartLot(), - 'storelocation' => $this->getStorelocation(), + LabelSupportedElement::PART => $this->getExamplePart(), + LabelSupportedElement::PART_LOT => $this->getExamplePartLot(), + LabelSupportedElement::STORELOCATION => $this->getStorelocation(), default => throw new InvalidArgumentException('Unknown $type.'), }; } diff --git a/src/Services/LabelSystem/LabelGenerator.php b/src/Services/LabelSystem/LabelGenerator.php index 9f5d666b..41a5235e 100644 --- a/src/Services/LabelSystem/LabelGenerator.php +++ b/src/Services/LabelSystem/LabelGenerator.php @@ -53,12 +53,6 @@ use InvalidArgumentException; */ final class LabelGenerator { - public const CLASS_SUPPORT_MAPPING = [ - 'part' => Part::class, - 'part_lot' => PartLot::class, - 'storelocation' => Storelocation::class, - ]; - public const MM_TO_POINTS_FACTOR = 2.83465; public function __construct(private readonly LabelHTMLGenerator $labelHTMLGenerator) @@ -66,9 +60,9 @@ final class LabelGenerator } /** - * @param object|object[] $elements An element or an array of elements for which labels should be generated + * @param object|object[] $elements An element or an array of elements for which labels should be generated */ - public function generateLabel(LabelOptions $options, $elements): string + public function generateLabel(LabelOptions $options, object|array $elements): string { if (!is_array($elements) && !is_object($elements)) { throw new InvalidArgumentException('$element must be an object or an array of objects!'); @@ -98,11 +92,8 @@ final class LabelGenerator public function supports(LabelOptions $options, object $element): bool { $supported_type = $options->getSupportedElement(); - if (!isset(static::CLASS_SUPPORT_MAPPING[$supported_type])) { - throw new InvalidArgumentException('Supported type name of the Label options not known!'); - } - return is_a($element, static::CLASS_SUPPORT_MAPPING[$supported_type]); + return is_a($element, $supported_type->getEntityClass()); } /** diff --git a/src/Services/LabelSystem/LabelHTMLGenerator.php b/src/Services/LabelSystem/LabelHTMLGenerator.php index 98c3423a..7b6defa6 100644 --- a/src/Services/LabelSystem/LabelHTMLGenerator.php +++ b/src/Services/LabelSystem/LabelHTMLGenerator.php @@ -41,6 +41,7 @@ declare(strict_types=1); namespace App\Services\LabelSystem; +use App\Entity\LabelSystem\LabelProcessMode; use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Contracts\NamedElementInterface; use App\Entity\LabelSystem\LabelOptions; @@ -64,14 +65,14 @@ final class LabelHTMLGenerator $twig_elements = []; - if ('twig' === $options->getLinesMode()) { + if (LabelProcessMode::TWIG === $options->getProcessMode()) { $sandboxed_twig = $this->sandboxedTwigProvider->getTwig($options); $current_user = $this->security->getUser(); } $page = 1; foreach ($elements as $element) { - if (isset($sandboxed_twig, $current_user) && 'twig' === $options->getLinesMode()) { + if (isset($sandboxed_twig, $current_user) && LabelProcessMode::TWIG === $options->getProcessMode()) { try { $lines = $sandboxed_twig->render( 'lines', diff --git a/src/Services/LabelSystem/LabelProfileDropdownHelper.php b/src/Services/LabelSystem/LabelProfileDropdownHelper.php index 4dadd36f..d7f1120d 100644 --- a/src/Services/LabelSystem/LabelProfileDropdownHelper.php +++ b/src/Services/LabelSystem/LabelProfileDropdownHelper.php @@ -42,6 +42,7 @@ declare(strict_types=1); namespace App\Services\LabelSystem; use App\Entity\LabelSystem\LabelProfile; +use App\Entity\LabelSystem\LabelSupportedElement; use App\Repository\LabelProfileRepository; use App\Services\UserSystem\UserCacheKeyGenerator; use Doctrine\ORM\EntityManagerInterface; @@ -54,10 +55,20 @@ final class LabelProfileDropdownHelper { } - public function getDropdownProfiles(string $type): array + /** + * Return all label profiles for the given supported element type + * @param LabelSupportedElement|string $type + * @return array + */ + public function getDropdownProfiles(LabelSupportedElement|string $type): array { + //Useful for the twig templates, where we use the string representation of the enum + if (is_string($type)) { + $type = LabelSupportedElement::from($type); + } + $secure_class_name = str_replace('\\', '_', LabelProfile::class); - $key = 'profile_dropdown_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.'_'.$type; + $key = 'profile_dropdown_'.$this->keyGenerator->generateKey().'_'.$secure_class_name.'_'.$type->value; /** @var LabelProfileRepository $repo */ $repo = $this->entityManager->getRepository(LabelProfile::class); diff --git a/src/Services/LabelSystem/SandboxedTwigProvider.php b/src/Services/LabelSystem/SandboxedTwigProvider.php index 6c1bbce1..a0426cd1 100644 --- a/src/Services/LabelSystem/SandboxedTwigProvider.php +++ b/src/Services/LabelSystem/SandboxedTwigProvider.php @@ -49,6 +49,7 @@ use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Contracts\NamedElementInterface; use App\Entity\Contracts\TimeStampableInterface; use App\Entity\LabelSystem\LabelOptions; +use App\Entity\LabelSystem\LabelProcessMode; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\Part; @@ -123,7 +124,7 @@ final class SandboxedTwigProvider public function getTwig(LabelOptions $options): Environment { - if ('twig' !== $options->getLinesMode()) { + if (LabelProcessMode::TWIG !== $options->getProcessMode()) { throw new InvalidArgumentException('The LabelOptions must explicitly allow twig via lines_mode = "twig"!'); } diff --git a/src/Twig/TwigCoreExtension.php b/src/Twig/TwigCoreExtension.php index 0443b847..2ff6911a 100644 --- a/src/Twig/TwigCoreExtension.php +++ b/src/Twig/TwigCoreExtension.php @@ -25,6 +25,7 @@ namespace App\Twig; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Twig\Extension\AbstractExtension; use Twig\TwigFilter; +use Twig\TwigFunction; use Twig\TwigTest; /** @@ -37,6 +38,14 @@ final class TwigCoreExtension extends AbstractExtension { } + public function getFunctions() + { + return [ + /* Returns the enum cases as values */ + new TwigFunction('enum_cases', [$this, 'getEnumCases']), + ]; + } + public function getTests(): array { return [ @@ -49,6 +58,15 @@ final class TwigCoreExtension extends AbstractExtension ]; } + public function getEnumCases(string $enum_class): array + { + if (!enum_exists($enum_class)) { + throw new \InvalidArgumentException(sprintf('The given class "%s" is not an enum!', $enum_class)); + } + + return ($enum_class)::cases(); + } + public function getFilters(): array { return [ diff --git a/templates/label_system/dialog.html.twig b/templates/label_system/dialog.html.twig index eb4b0da5..a845d12e 100644 --- a/templates/label_system/dialog.html.twig +++ b/templates/label_system/dialog.html.twig @@ -77,10 +77,10 @@ diff --git a/templates/log_system/details/log_details.html.twig b/templates/log_system/details/log_details.html.twig index 6dedd8ee..92fd65bb 100644 --- a/templates/log_system/details/log_details.html.twig +++ b/templates/log_system/details/log_details.html.twig @@ -26,11 +26,11 @@ {{ ('log.type.' ~ log_entry.type) | trans }} {% if log_entry.type == 'part_stock_changed' %} - ({{ ('log.part_stock_changed.' ~ log_entry.instockChangeType)|trans }}) + ({{ ('log.part_stock_changed.' ~ log_entry.instockChangeType.value)|trans }}) {% endif %} {% if log_entry is instanceof('App\\Entity\\Contracts\\LogWithEventUndoInterface') and log_entry.undoEvent %} - ({{ ('log.undo_mode.' ~ log_entry.undoMode)|trans }}: #{{ log_entry.UndoEventID }}) + ({{ ('log.undo_mode.' ~ log_entry.undoMode.value)|trans }}: #{{ log_entry.UndoEventID }}) {% endif %} From f4c0d8438031c8987d6958c201b82b7d09eee5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 21:33:42 +0200 Subject: [PATCH 76/91] Bumped version to 1.5.0-dev --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 9df886c4..59b9db0c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.2 +1.5.0-dev From fe1715259ad302d8a35f1b6ff7e755aa8773e5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 21:38:02 +0200 Subject: [PATCH 77/91] Updated dependencies --- composer.lock | 68 ++++++++++++++++---------------- yarn.lock | 106 +++++++++++++++++++++++++------------------------- 2 files changed, 88 insertions(+), 86 deletions(-) diff --git a/composer.lock b/composer.lock index f67c8c87..5f7d384d 100644 --- a/composer.lock +++ b/composer.lock @@ -1215,28 +1215,28 @@ }, { "name": "doctrine/inflector", - "version": "2.0.6", + "version": "2.0.8", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024" + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", - "reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/f9301a5b2fb1216b2b08f02ba04dc45423db6bff", + "reference": "f9301a5b2fb1216b2b08f02ba04dc45423db6bff", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^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" + "vimeo/psalm": "^4.25 || ^5.4" }, "type": "library", "autoload": { @@ -1286,7 +1286,7 @@ ], "support": { "issues": "https://github.com/doctrine/inflector/issues", - "source": "https://github.com/doctrine/inflector/tree/2.0.6" + "source": "https://github.com/doctrine/inflector/tree/2.0.8" }, "funding": [ { @@ -1302,7 +1302,7 @@ "type": "tidelift" } ], - "time": "2022-10-20T09:10:12+00:00" + "time": "2023-06-16T13:40:37+00:00" }, { "name": "doctrine/instantiator", @@ -2572,16 +2572,16 @@ }, { "name": "jfcherng/php-diff", - "version": "6.15.2", + "version": "6.15.3", "source": { "type": "git", "url": "https://github.com/jfcherng/php-diff.git", - "reference": "2c7c87f65b04f447b773fc297217b17cb6bb3787" + "reference": "39be09756f8eda115299add3f34dc64b4bc32b66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jfcherng/php-diff/zipball/2c7c87f65b04f447b773fc297217b17cb6bb3787", - "reference": "2c7c87f65b04f447b773fc297217b17cb6bb3787", + "url": "https://api.github.com/repos/jfcherng/php-diff/zipball/39be09756f8eda115299add3f34dc64b4bc32b66", + "reference": "39be09756f8eda115299add3f34dc64b4bc32b66", "shasum": "" }, "require": { @@ -2626,7 +2626,7 @@ ], "support": { "issues": "https://github.com/jfcherng/php-diff/issues", - "source": "https://github.com/jfcherng/php-diff/tree/6.15.2" + "source": "https://github.com/jfcherng/php-diff/tree/6.15.3" }, "funding": [ { @@ -2634,7 +2634,7 @@ "type": "custom" } ], - "time": "2023-06-05T11:42:18+00:00" + "time": "2023-06-15T12:29:57+00:00" }, { "name": "jfcherng/php-mb-string", @@ -14292,16 +14292,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.18", + "version": "1.10.19", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f" + "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52b6416c579663eebdd2f1d97df21971daf3b43f", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/af5a296ff02610c1bfb4ddfac9fd4a08657b9046", + "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046", "shasum": "" }, "require": { @@ -14350,7 +14350,7 @@ "type": "tidelift" } ], - "time": "2023-06-07T22:00:43+00:00" + "time": "2023-06-14T15:26:58+00:00" }, { "name": "phpstan/phpstan-doctrine", @@ -14609,16 +14609,16 @@ }, { "name": "rector/rector", - "version": "0.17.0", + "version": "0.17.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "d8da002b107c9b64d464bb48101290d4d078df4b" + "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/d8da002b107c9b64d464bb48101290d4d078df4b", - "reference": "d8da002b107c9b64d464bb48101290d4d078df4b", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/11401dc1abba0a359fabbf98f1057f4e65129f86", + "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86", "shasum": "" }, "require": { @@ -14658,7 +14658,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.0" + "source": "https://github.com/rectorphp/rector/tree/0.17.1" }, "funding": [ { @@ -14666,7 +14666,7 @@ "type": "github" } ], - "time": "2023-06-01T09:42:59+00:00" + "time": "2023-06-14T09:05:33+00:00" }, { "name": "roave/security-advisories", @@ -14674,17 +14674,17 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "7d728f50cf52ce838ac1c1504190823b4dc06b4d" + "reference": "e47f876d3b2df4a1354964c32820b4d7c10b8675" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/7d728f50cf52ce838ac1c1504190823b4dc06b4d", - "reference": "7d728f50cf52ce838ac1c1504190823b4dc06b4d", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/e47f876d3b2df4a1354964c32820b4d7c10b8675", + "reference": "e47f876d3b2df4a1354964c32820b4d7c10b8675", "shasum": "" }, "conflict": { "3f/pygmentize": "<1.2", - "admidio/admidio": "<4.1.9", + "admidio/admidio": "<4.2.8", "adodb/adodb-php": "<=5.20.20|>=5.21,<=5.21.3", "aheinze/cockpit": "<=2.2.1", "akaunting/akaunting": "<2.1.13", @@ -14755,7 +14755,7 @@ "contao/core-bundle": "<4.9.40|>=4.10,<4.11.7|>=4.13,<4.13.21|>=5.1,<5.1.4|= 4.10.0", "contao/listing-bundle": ">=4,<4.4.8", "contao/managed-edition": "<=1.5", - "craftcms/cms": ">= 4.0.0-RC1, < 4.4.12|>= 4.0.0-RC1, <= 4.4.5|>= 4.0.0-RC1, <= 4.4.6|<=3.8.5|>=4,<4.4.6|>= 4.0.0-RC1, < 4.4.6|>= 4.0.0-RC1, < 4.3.7|>= 4.0.0-RC1, < 4.2.1", + "craftcms/cms": "<4.4.6|>= 4.0.0-RC1, < 4.4.12|>= 4.0.0-RC1, <= 4.4.5|>= 4.0.0-RC1, <= 4.4.6|>= 4.0.0-RC1, < 4.4.6|>= 4.0.0-RC1, < 4.3.7|>= 4.0.0-RC1, < 4.2.1", "croogo/croogo": "<3.0.7", "cuyz/valinor": "<0.12", "czproject/git-php": "<4.0.3", @@ -14840,7 +14840,7 @@ "funadmin/funadmin": "<=3.2", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", - "getgrav/grav": "<1.7.34", + "getgrav/grav": "<1.7.42", "getkirby/cms": "= 3.8.0|<3.5.8.2|>=3.6,<3.6.6.2|>=3.7,<3.7.5.1", "getkirby/panel": "<2.5.14", "getkirby/starterkit": "<=3.7.0.2", @@ -14875,6 +14875,7 @@ "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", "impresscms/impresscms": "<=1.4.3", "in2code/femanager": "<5.5.3|>=6,<6.3.4|>=7,<7.1", + "in2code/ipandlanguageredirect": "<5.1.2", "in2code/lux": "<17.6.1|>=18,<24.0.2", "innologi/typo3-appointments": "<2.0.6", "intelliants/subrion": "<=4.2.1", @@ -15091,7 +15092,7 @@ "ssddanbrown/bookstack": "<22.2.3", "statamic/cms": "<3.2.39|>=3.3,<3.3.2", "stormpath/sdk": ">=0,<9.9.99", - "studio-42/elfinder": "<2.1.59", + "studio-42/elfinder": "<2.1.62", "subrion/cms": "<=4.2.1", "sukohi/surpass": "<1", "sulu/sulu": "= 2.4.0-RC1|<1.6.44|>=2,<2.2.18|>=2.3,<2.3.8", @@ -15155,6 +15156,7 @@ "topthink/framework": "<6.0.14", "topthink/think": "<=6.1.1", "topthink/thinkphp": "<=3.2.3", + "tpwd/ke_search": "<4.0.3|>=4.1,<4.6.6|>=5,<5.0.2", "tribalsystems/zenario": "<=9.3.57595", "truckersmp/phpwhois": "<=4.3.1", "ttskch/pagination-service-provider": "<1", @@ -15275,7 +15277,7 @@ "type": "tidelift" } ], - "time": "2023-06-12T19:03:43+00:00" + "time": "2023-06-16T20:04:13+00:00" }, { "name": "sebastian/diff", diff --git a/yarn.lock b/yarn.lock index ecae32e5..830a5c0d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1779,9 +1779,9 @@ "@types/estree" "*" "@types/eslint@*": - version "8.40.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.40.1.tgz#92edc592c3575b52a8e790cd5ec04efe28f3d24c" - integrity sha512-vRb792M4mF1FBT+eoLecmkpLXwxsBHvWWRGJjzbYANBM6DtiJc6yETyv4rqDA6QNjF1pkj1U7LMA6dGb3VYlHw== + version "8.40.2" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.40.2.tgz#2833bc112d809677864a4b0e7d1de4f04d7dac2d" + integrity sha512-PRVjQ4Eh9z9pmmtaq8nTjZjQwKFk7YIHIud3lRoKRBgUQjgjRmoGxxGEPXQkF+lH7QkHJRNr5F4aBgYCW0lqpQ== dependencies: "@types/estree" "*" "@types/json-schema" "*" @@ -1866,9 +1866,9 @@ integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== "@types/node@*": - version "20.3.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.0.tgz#719498898d5defab83c3560f45d8498f58d11938" - integrity sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ== + version "20.3.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.3.1.tgz#e8a83f1aa8b649377bb1fb5d7bac5cb90e784dfe" + integrity sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg== "@types/parse-json@^4.0.0": version "4.0.0" @@ -2143,9 +2143,9 @@ acorn@^7.0.0, acorn@^7.1.1: integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== acorn@^8.0.4, acorn@^8.0.5, acorn@^8.2.4, acorn@^8.7.1, acorn@^8.8.2: - version "8.8.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" - integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== + version "8.9.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59" + integrity sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ== adjust-sourcemap-loader@^4.0.0: version "4.0.0" @@ -2472,12 +2472,12 @@ browserify-optional@^1.0.1: browser-resolve "^1.8.1" browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.21.3, browserslist@^4.21.4, browserslist@^4.21.5: - version "4.21.7" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.7.tgz#e2b420947e5fb0a58e8f4668ae6e23488127e551" - integrity sha512-BauCXrQ7I2ftSqd2mvKHGo85XR0u7Ru3C/Hxsy/0TkfCtjrmAbPdzLGasmoiBxplpDXlPvdjX9u7srIMfgasNA== + version "4.21.9" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.9.tgz#e11bdd3c313d7e2a9e87e8b4b0c7872b13897635" + integrity sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg== dependencies: - caniuse-lite "^1.0.30001489" - electron-to-chromium "^1.4.411" + caniuse-lite "^1.0.30001503" + electron-to-chromium "^1.4.431" node-releases "^2.0.12" update-browserslist-db "^1.0.11" @@ -2563,10 +2563,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001489: - version "1.0.30001498" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001498.tgz#84e4ee2d03e0e4f8a04a508853b75a980c703201" - integrity sha512-LFInN2zAwx3ANrGCDZ5AKKJroHqNKyjXitdV5zRIVIaQlXKj3GmxUKagoKsjqUfckpAObPCEWnk5EeMlyMWcgw== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001503: + version "1.0.30001504" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001504.tgz#eaf77e5c852dfa5f82c4924468c30602ac53744a" + integrity sha512-5uo7eoOp2mKbWyfMXnGO9rJWOGU8duvzEiYITW+wivukL7yHH4gX9yuRaobu6El4jPxo6jKZfG+N6fB621GD/Q== chalk@^2.0.0, chalk@^2.3.2: version "2.4.2" @@ -2831,16 +2831,16 @@ cookie@0.5.0: integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== core-js-compat@^3.30.1, core-js-compat@^3.30.2: - version "3.30.2" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.30.2.tgz#83f136e375babdb8c80ad3c22d67c69098c1dd8b" - integrity sha512-nriW1nuJjUgvkEjIot1Spwakz52V9YkYHZAQG6A1eCgC8AA1p0zngrQEP9R0+V6hji5XilWKG1Bd0YRppmGimA== + version "3.31.0" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.31.0.tgz#4030847c0766cc0e803dcdfb30055d7ef2064bf1" + integrity sha512-hM7YCu1cU6Opx7MXNu0NuumM0ezNeAeRKadixyiQELWY3vT3De9S4J5ZBMraWV2vZnrE1Cirl0GtFtDtMUXzPw== dependencies: browserslist "^4.21.5" core-js@^3.23.0: - version "3.30.2" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.2.tgz#6528abfda65e5ad728143ea23f7a14f0dcf503fc" - integrity sha512-uBJiDmwqsbJCWHAwjrx3cvjbMXP7xD72Dmsn5LOJpiRmE3WbBbN5rCqQ2Qh6Ek6/eOrjlWngEynBWo4VxerQhg== + version "3.31.0" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.31.0.tgz#4471dd33e366c79d8c0977ed2d940821719db344" + integrity sha512-NIp2TQSGfR6ba5aalZD+ZQ1fSxGhDo/s1w0nx3RYzf2pnJxt7YynxFlFScP6eV7+GZsKO95NSjGxyJsU3DZgeQ== core-util-is@~1.0.0: version "1.0.3" @@ -3351,10 +3351,10 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== -electron-to-chromium@^1.4.411: - version "1.4.427" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.427.tgz#67e8069f7a864fc092fe2e09f196e68af5cb88a1" - integrity sha512-HK3r9l+Jm8dYAm1ctXEWIC+hV60zfcjS9UA5BDlYvnI5S7PU/yytjpvSrTNrSSRRkuu3tDyZhdkwIczh+0DWaw== +electron-to-chromium@^1.4.431: + version "1.4.433" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.433.tgz#305ef5f8ea5fe65d252aae4b0e1088f9e4842533" + integrity sha512-MGO1k0w1RgrfdbLVwmXcDhHHuxCn2qRgR7dYsJvWFKDttvYPx6FNzCGG0c/fBBvzK2LDh3UV7Tt9awnHnvAAUQ== emoji-regex@^8.0.0: version "8.0.0" @@ -3376,10 +3376,10 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== -enhanced-resolve@^5.0.0, enhanced-resolve@^5.14.1: - version "5.14.1" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.14.1.tgz#de684b6803724477a4af5d74ccae5de52c25f6b3" - integrity sha512-Vklwq2vDKtl0y/vtwjSesgJ5MYS7Etuk5txS8VdKL4AOS1aUlD96zqIfsOSLQsdv3xgMRbtkWM8eG9XDfKUPow== +enhanced-resolve@^5.0.0, enhanced-resolve@^5.15.0: + version "5.15.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" + integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -4040,9 +4040,9 @@ html-encoding-sniffer@^2.0.1: whatwg-encoding "^1.0.5" html-entities@^2.3.2: - version "2.3.5" - resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.5.tgz#9f117bf6a5962efc31e094f6c6dad3cf3b95e33e" - integrity sha512-72TJlcMkYsEJASa/3HnX7VT59htM7iSHbH59NSZbtc+22Ap0Txnlx91sfeB+/A7wNZg7UxtZdhAW4y+/jimrdg== + version "2.3.6" + resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.6.tgz#966391d58e5737c77bca4025e31721b496ab7454" + integrity sha512-9o0+dcpIw2/HxkNuYKxSJUF/MMRZQECK4GnF+oQOmJ83yCVHTWgCH5aOXxK5bozNRmM8wtgryjHD3uloPBDEGw== html5-qrcode@^2.2.1: version "2.3.8" @@ -5829,19 +5829,19 @@ schema-utils@^2.6.5: ajv "^6.12.4" ajv-keywords "^3.5.2" -schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.1.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.2.0.tgz#7dff4881064a4f22c09f0c6a1457feb820fd0636" - integrity sha512-0zTyLGyDJYd/MBxG1AhJkKa6fpEBds4OQO2ut0w7OYG+ZGhGea09lijvzsqegYSik88zc7cUtIlnnO+/BvD6gQ== +schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== dependencies: "@types/json-schema" "^7.0.8" ajv "^6.12.5" ajv-keywords "^3.5.2" schema-utils@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.1.0.tgz#4cff1e434c12ed39502378b9a3e24787b37df41d" - integrity sha512-Jw+GZVbP5IggB2WAn6UHI02LBwGmsIeYN/lNbSMZyDziQ7jmtAUrqKqDja+W89YHVs+KL/3IkIMltAklqB1vAw== + version "4.2.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-4.2.0.tgz#70d7c93e153a273a805801882ebd3bff20d89c8b" + integrity sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw== dependencies: "@types/json-schema" "^7.0.9" ajv "^8.9.0" @@ -5884,9 +5884,9 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.8: - version "7.5.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec" - integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw== + version "7.5.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.2.tgz#5b851e66d1be07c1cdaf37dfc856f543325a2beb" + integrity sha512-SoftuTROv/cRjCze/scjGyiDtcUyxw1rgYQSZY7XTmtR5hX+dm76iDbTH8TkLPHCQmlbQVSSbNZCPM2hb0knnQ== dependencies: lru-cache "^6.0.0" @@ -6319,9 +6319,9 @@ terser-webpack-plugin@^5.3.0, terser-webpack-plugin@^5.3.7: terser "^5.16.8" terser@^5.16.8, terser@^5.3.4: - version "5.17.7" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.17.7.tgz#2a8b134826fe179b711969fd9d9a0c2479b2a8c3" - integrity sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ== + version "5.18.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.18.0.tgz#dc811fb8e3481a875d545bda247c8730ee4dc76b" + integrity sha512-pdL757Ig5a0I+owA42l6tIuEycRuM7FPY4n62h44mRLRfnOxJkkOHd6i89dOpwZlpF6JXBwaAHF6yWzFrt+QyA== dependencies: "@jridgewell/source-map" "^0.3.3" acorn "^8.8.2" @@ -6749,9 +6749,9 @@ webpack-sources@^3.2.3: integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== webpack@^5.74.0: - version "5.86.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.86.0.tgz#b0eb81794b62aee0b7e7eb8c5073495217d9fc6d" - integrity sha512-3BOvworZ8SO/D4GVP+GoRC3fVeg5MO4vzmq8TJJEkdmopxyazGDxN8ClqN12uzrZW9Tv8EED8v5VSb6Sqyi0pg== + version "5.87.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.87.0.tgz#df8a9c094c6037f45e0d77598f9e59d33ca3a98c" + integrity sha512-GOu1tNbQ7p1bDEoFRs2YPcfyGs8xq52yyPBZ3m2VGnXGtV9MxjrkABHm4V9Ia280OefsSLzvbVoXcfLxjKY/Iw== dependencies: "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.0" @@ -6762,7 +6762,7 @@ webpack@^5.74.0: acorn-import-assertions "^1.9.0" browserslist "^4.14.5" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.14.1" + enhanced-resolve "^5.15.0" es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0" @@ -6772,7 +6772,7 @@ webpack@^5.74.0: loader-runner "^4.2.0" mime-types "^2.1.27" neo-async "^2.6.2" - schema-utils "^3.1.2" + schema-utils "^3.2.0" tapable "^2.1.1" terser-webpack-plugin "^5.3.7" watchpack "^2.4.0" From 4977f6c270f083237eff1df00113dc36779bd3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 22:06:06 +0200 Subject: [PATCH 78/91] Reset autoincrements on SQLite with our ResetAutoIncrementPurger too and make it default for fixtures load --- .github/workflows/tests.yml | 2 +- config/services.yaml | 11 ++++++++++- src/Doctrine/Purger/ResetAutoIncrementORMPurger.php | 11 +++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 76137f02..99955059 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -109,7 +109,7 @@ jobs: run: php bin/console --env test doctrine:migrations:migrate -n - name: Load fixtures - run: php bin/console --env test doctrine:fixtures:load -n --purger reset_autoincrement_purger + run: php bin/console --env test doctrine:fixtures:load -n - name: Run PHPunit and generate coverage run: ./bin/phpunit --coverage-clover=coverage.xml diff --git a/config/services.yaml b/config/services.yaml index 26c35cba..6522b99b 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -259,7 +259,16 @@ services: tags: - { name: 'doctrine.fixtures.purger_factory', alias: 'reset_autoincrement_purger' } - # We are needing this service inside of a migration, where only the container is injected. So we need to define it as public, to access it from the container. + # Decorate the doctrine fixtures load command to use our custom purger by default + doctrine.fixtures_load_command.custom: + decorates: doctrine.fixtures_load_command + class: Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand + arguments: + - '@doctrine.fixtures.loader' + - '@doctrine' + - { default: '@App\Doctrine\Purger\ResetAutoIncrementPurgerFactory' } + + # We are needing this service inside a migration, where only the container is injected. So we need to define it as public, to access it from the container. App\Services\UserSystem\PermissionPresetsHelper: public: true diff --git a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php index db717c3f..84ac806e 100644 --- a/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php +++ b/src/Doctrine/Purger/ResetAutoIncrementORMPurger.php @@ -27,6 +27,7 @@ use Doctrine\Common\DataFixtures\Purger\PurgerInterface; use Doctrine\Common\DataFixtures\Sorter\TopologicalSorter; use Doctrine\DBAL\Platforms\AbstractMySQLPlatform; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Schema\Identifier; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Mapping\ClassMetadata; @@ -188,7 +189,7 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface } //Reseting autoincrement is only supported on MySQL platforms - if ($platform instanceof AbstractMySQLPlatform) { + if ($platform instanceof AbstractMySQLPlatform || $platform instanceof SqlitePlatform) { $connection->beginTransaction(); $connection->executeQuery($this->getResetAutoIncrementSQL($tbl, $platform)); } @@ -204,7 +205,13 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface { $tableIdentifier = new Identifier($tableName); - return 'ALTER TABLE '. $tableIdentifier->getQuotedName($platform) .' AUTO_INCREMENT = 1;'; + if ($platform instanceof AbstractMySQLPlatform) { + return 'ALTER TABLE '.$tableIdentifier->getQuotedName($platform).' AUTO_INCREMENT = 1;'; + } + + if ($platform instanceof SqlitePlatform) { + return 'DELETE FROM `sqlite_sequence` WHERE name = \''.$tableIdentifier->getQuotedName($platform).'\';'; + } } /** From cce3e1cfb85b036ba8a7948c2ae30397730c3807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 22:06:42 +0200 Subject: [PATCH 79/91] Specify order in which the data fixtures should be loaded --- src/DataFixtures/AppFixtures.php | 37 ---------------------- src/DataFixtures/DataStructureFixtures.php | 13 ++++++-- src/DataFixtures/LabelProfileFixtures.php | 7 ++++ src/DataFixtures/PartFixtures.php | 10 +++++- src/DataFixtures/UserFixtures.php | 10 +++++- 5 files changed, 36 insertions(+), 41 deletions(-) delete mode 100644 src/DataFixtures/AppFixtures.php diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php deleted file mode 100644 index dff739ae..00000000 --- a/src/DataFixtures/AppFixtures.php +++ /dev/null @@ -1,37 +0,0 @@ -. - */ - -declare(strict_types=1); - -namespace App\DataFixtures; - -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; - -class AppFixtures extends Fixture -{ - public function load(ObjectManager $manager): void - { - // $product = new Product(); - // $manager->persist($product); - - $manager->flush(); - } -} diff --git a/src/DataFixtures/DataStructureFixtures.php b/src/DataFixtures/DataStructureFixtures.php index 5abf6d6f..a2043bdb 100644 --- a/src/DataFixtures/DataStructureFixtures.php +++ b/src/DataFixtures/DataStructureFixtures.php @@ -31,12 +31,14 @@ use App\Entity\Parts\Manufacturer; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\Storelocation; use App\Entity\Parts\Supplier; +use App\Entity\UserSystem\User; use Doctrine\Bundle\FixturesBundle\Fixture; +use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ObjectManager; use InvalidArgumentException; -class DataStructureFixtures extends Fixture +class DataStructureFixtures extends Fixture implements DependentFixtureInterface { public function __construct(protected EntityManagerInterface $em) { @@ -49,7 +51,7 @@ class DataStructureFixtures extends Fixture { //Reset autoincrement $types = [AttachmentType::class, Project::class, Category::class, Footprint::class, Manufacturer::class, - MeasurementUnit::class, Storelocation::class, Supplier::class, ]; + MeasurementUnit::class, Storelocation::class, Supplier::class,]; foreach ($types as $type) { $this->createNodesForClass($type, $manager); @@ -106,4 +108,11 @@ class DataStructureFixtures extends Fixture $manager->persist($node2_1); $manager->persist($node1_1_1); } + + public function getDependencies(): array + { + return [ + UserFixtures::class + ]; + } } diff --git a/src/DataFixtures/LabelProfileFixtures.php b/src/DataFixtures/LabelProfileFixtures.php index 5b41bb73..c0eb85cd 100644 --- a/src/DataFixtures/LabelProfileFixtures.php +++ b/src/DataFixtures/LabelProfileFixtures.php @@ -110,4 +110,11 @@ class LabelProfileFixtures extends Fixture $manager->flush(); } + + public function getDependencies(): array + { + return [ + PartFixtures::class, + ]; + } } diff --git a/src/DataFixtures/PartFixtures.php b/src/DataFixtures/PartFixtures.php index 6b765bc8..3efb8dc8 100644 --- a/src/DataFixtures/PartFixtures.php +++ b/src/DataFixtures/PartFixtures.php @@ -55,10 +55,11 @@ use App\Entity\PriceInformations\Pricedetail; use Brick\Math\BigDecimal; use DateTime; use Doctrine\Bundle\FixturesBundle\Fixture; +use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ObjectManager; -class PartFixtures extends Fixture +class PartFixtures extends Fixture implements DependentFixtureInterface { public function __construct(protected EntityManagerInterface $em) { @@ -132,4 +133,11 @@ class PartFixtures extends Fixture $manager->persist($part); $manager->flush(); } + + public function getDependencies(): array + { + return [ + DataStructureFixtures::class + ]; + } } diff --git a/src/DataFixtures/UserFixtures.php b/src/DataFixtures/UserFixtures.php index f329d1a2..171f671e 100644 --- a/src/DataFixtures/UserFixtures.php +++ b/src/DataFixtures/UserFixtures.php @@ -24,11 +24,12 @@ namespace App\DataFixtures; use App\Entity\UserSystem\User; use Doctrine\Bundle\FixturesBundle\Fixture; +use Doctrine\Common\DataFixtures\DependentFixtureInterface; use Doctrine\ORM\EntityManagerInterface; use Doctrine\Persistence\ObjectManager; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; -class UserFixtures extends Fixture +class UserFixtures extends Fixture implements DependentFixtureInterface { public function __construct(protected UserPasswordHasherInterface $encoder, protected EntityManagerInterface $em) { @@ -66,4 +67,11 @@ class UserFixtures extends Fixture $manager->flush(); } + + public function getDependencies(): array + { + return [ + GroupFixtures::class, + ]; + } } From bb510a92403416bfff04aadc9013ffd76b3ccf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 22:11:58 +0200 Subject: [PATCH 80/91] Fixed test failure, caused by validation on user element --- tests/Services/ImportExportSystem/EntityImporterTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Services/ImportExportSystem/EntityImporterTest.php b/tests/Services/ImportExportSystem/EntityImporterTest.php index d6eeeb09..b7dd26d0 100644 --- a/tests/Services/ImportExportSystem/EntityImporterTest.php +++ b/tests/Services/ImportExportSystem/EntityImporterTest.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Tests\Services\ImportExportSystem; +use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\AttachmentType; use App\Entity\Parts\Category; use App\Entity\Parts\Part; @@ -81,8 +82,12 @@ Test1 Test2 EOT; + //Define a new anonymous class, which is not structural. We can not use User here, because it does some validation + $anonymous_object = new class extends AttachmentContainingDBElement {}; + $anonymous_class = get_class($anonymous_object); + $errors = []; - $results = $this->service->massCreation($input, User::class, null, $errors); + $results = $this->service->massCreation($input, $anonymous_class, null, $errors); //Import must not fail, even with non-structural classes $this->assertCount(3, $results); From 0aec9419ec14ba1fb4c6107b280a6dca6ce1d555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 23:49:45 +0200 Subject: [PATCH 81/91] Configure fixtures load decorator only for test env, as the base command is not available in production environments (missing dev dependencies) --- config/services.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/config/services.yaml b/config/services.yaml index 6522b99b..9e15eca0 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -259,15 +259,6 @@ services: tags: - { name: 'doctrine.fixtures.purger_factory', alias: 'reset_autoincrement_purger' } - # Decorate the doctrine fixtures load command to use our custom purger by default - doctrine.fixtures_load_command.custom: - decorates: doctrine.fixtures_load_command - class: Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand - arguments: - - '@doctrine.fixtures.loader' - - '@doctrine' - - { default: '@App\Doctrine\Purger\ResetAutoIncrementPurgerFactory' } - # We are needing this service inside a migration, where only the container is injected. So we need to define it as public, to access it from the container. App\Services\UserSystem\PermissionPresetsHelper: public: true @@ -292,3 +283,14 @@ services: autowire: true tags: - { name: monolog.processor } + +when@test: + services: + # Decorate the doctrine fixtures load command to use our custom purger by default + doctrine.fixtures_load_command.custom: + decorates: doctrine.fixtures_load_command + class: Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand + arguments: + - '@doctrine.fixtures.loader' + - '@doctrine' + - { default: '@App\Doctrine\Purger\ResetAutoIncrementPurgerFactory' } \ No newline at end of file From 6df65a0b9de773629842ab144faf62cd69222cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 19 Jun 2023 01:08:11 +0200 Subject: [PATCH 82/91] Implemented a new darkmode selector using bootstrap 5.3 color mode --- .../controllers/common/darkmode_controller.js | 129 +- assets/css/app/darkmode.css | 37 - assets/js/app.js | 1 - assets/js/register_events.js | 2 +- package.json | 1 - templates/_navbar.html.twig | 16 +- templates/components/tree_macros.html.twig | 2 +- templates/homepage.html.twig | 2 +- templates/parts/info/_part_lots.html.twig | 2 +- templates/parts/info/_picture.html.twig | 6 +- templates/projects/info/_info.html.twig | 4 +- translations/messages.de.xlf | 2600 +++++++++-------- translations/security.de.xlf | 6 +- translations/validators.de.xlf | 64 +- yarn.lock | 5 - 15 files changed, 1465 insertions(+), 1412 deletions(-) delete mode 100644 assets/css/app/darkmode.css diff --git a/assets/controllers/common/darkmode_controller.js b/assets/controllers/common/darkmode_controller.js index e7c18e67..71111166 100644 --- a/assets/controllers/common/darkmode_controller.js +++ b/assets/controllers/common/darkmode_controller.js @@ -18,43 +18,118 @@ */ import {Controller} from "@hotwired/stimulus"; -import Darkmode from "darkmode-js/src"; -import "darkmode-js" export default class extends Controller { - _darkmode; - connect() { - if (typeof window.getComputedStyle(document.body).mixBlendMode == 'undefined') { - console.warn("The browser does not support mix blend mode. Darkmode will not work."); + this.setMode(this.getMode()); + document.querySelectorAll('input[name="darkmode"]').forEach((radio) => { + radio.addEventListener('change', this._radioChanged.bind(this)); + }); + } + + /** + * Event listener for the change of radio buttons + * @private + */ + _radioChanged(event) { + const new_mode = this.getSelectedMode(); + this.setMode(new_mode); + } + + /** + * Get the current mode from the local storage + * @return {'dark', 'light', 'auto'} + */ + getMode() { + return localStorage.getItem('darkmode') ?? 'auto'; + } + + /** + * Set the mode in the local storage and apply it and change the state of the radio buttons + * @param mode + */ + setMode(mode) { + if (mode !== 'dark' && mode !== 'light' && mode !== 'auto') { + console.warn('Invalid darkmode mode: ' + mode); + mode = 'auto'; + } + + localStorage.setItem('darkmode', mode); + + this.setButtonMode(mode); + + if (mode === 'auto') { + this._setDarkmodeAuto(); + } else if (mode === 'dark') { + this._enableDarkmode(); + } else if (mode === 'light') { + this._disableDarkmode(); + } + } + + /** + * Get the selected mode via the radio buttons + * @return {'dark', 'light', 'auto'} + */ + getSelectedMode() { + return document.querySelector('input[name="darkmode"]:checked').value; + } + + /** + * Set the state of the radio buttons + * @param mode + */ + setButtonMode(mode) { + document.querySelector('input[name="darkmode"][value="' + mode + '"]').checked = true; + } + + /** + * Enable darkmode by adding the data-bs-theme="dark" to the html tag + * @private + */ + _enableDarkmode() { + //Add data-bs-theme="dark" to the html tag + document.documentElement.setAttribute('data-bs-theme', 'dark'); + } + + /** + * Disable darkmode by adding the data-bs-theme="light" to the html tag + * @private + */ + _disableDarkmode() { + //Set data-bs-theme to light + document.documentElement.setAttribute('data-bs-theme', 'light'); + } + + + /** + * Set the darkmode to auto and enable/disable it depending on the system settings, also add + * an event listener to change the darkmode if the system settings change + * @private + */ + _setDarkmodeAuto() { + if (this.getMode() !== 'auto') { return; } - try { - const darkmode = new Darkmode(); - this._darkmode = darkmode; - - //Unhide darkmode button - this._showWidget(); - - //Set the switch according to our current darkmode state - const toggler = document.getElementById("toggleDarkmode"); - toggler.checked = darkmode.isActivated(); - } - catch (e) - { - console.error(e); + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + this._enableDarkmode(); + } else { + this._disableDarkmode(); } - + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => { + console.log('Prefered color scheme changed to ' + event.matches ? 'dark' : 'light'); + this._setDarkmodeAuto(); + }); } - _showWidget() { - this.element.classList.remove('hidden'); - } - - toggleDarkmode() { - this._darkmode.toggle(); + /** + * Check if darkmode is activated + * @return {boolean} + */ + isDarkmodeActivated() { + return document.documentElement.getAttribute('data-bs-theme') === 'dark'; } } \ No newline at end of file diff --git a/assets/css/app/darkmode.css b/assets/css/app/darkmode.css deleted file mode 100644 index 8ef745f4..00000000 --- a/assets/css/app/darkmode.css +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). - * - * Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published - * by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -.darkmode-layer { - z-index: 2020; -} - -/** If darkmode is enabled revert the blening for images and videos, as these should be shown not inverted */ -.darkmode--activated img, -.darkmode--activated video, -.darkmode--activated object { - mix-blend-mode: difference; -} - -.darkmode--activated .hoverpic:hover { - background: black; -} - -.tools-ic-logos img { - mix-blend-mode: normal; -} \ No newline at end of file diff --git a/assets/js/app.js b/assets/js/app.js index 8242331f..fd7db935 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -22,7 +22,6 @@ import '../css/app/layout.css'; import '../css/app/helpers.css'; -import '../css/app/darkmode.css'; import '../css/app/tables.css'; import '../css/app/bs-overrides.css'; import '../css/app/treeview.css'; diff --git a/assets/js/register_events.js b/assets/js/register_events.js index 06f48ec1..d9b21ee9 100644 --- a/assets/js/register_events.js +++ b/assets/js/register_events.js @@ -62,7 +62,7 @@ class RegisterEventHelper { this.registerLoadHandler(() => { $(".tooltip").remove(); //Exclude dropdown buttons from tooltips, otherwise we run into endless errors from bootstrap (bootstrap.esm.js:614 Bootstrap doesn't allow more than one instance per element. Bound instance: bs.dropdown.) - $('a[title], button[title]:not([data-bs-toggle="dropdown"]), p[title], span[title], h6[title], h3[title], i.fas[title]') + $('a[title], label[title], button[title]:not([data-bs-toggle="dropdown"]), p[title], span[title], h6[title], h3[title], i.fas[title]') //@ts-ignore .tooltip("hide").tooltip({container: "body", placement: "auto", boundary: 'window'}); }); diff --git a/package.json b/package.json index 8c5d7599..d21e8da6 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,6 @@ "bs-custom-file-input": "^1.3.4", "clipboard": "^2.0.4", "compression-webpack-plugin": "^10.0.0", - "darkmode-js": "^1.5.0", "datatables.net-bs5": "^1.10.20", "datatables.net-buttons-bs5": "^2.2.2", "datatables.net-colreorder-bs5": "^1.5.1", diff --git a/templates/_navbar.html.twig b/templates/_navbar.html.twig index 14e40151..3ca68a21 100644 --- a/templates/_navbar.html.twig +++ b/templates/_navbar.html.twig @@ -1,6 +1,6 @@ {% import "helper.twig" as helper %} -