diff --git a/.phive/phars.xml b/.phive/phars.xml index 8bad0db..7a060a0 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -4,4 +4,5 @@ + diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..ce40c33 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,15 @@ +in(__DIR__ . '/src') + ->in(__DIR__ . '/test') + ->files() + ->notName('broken.users.php') + ->notName('broken.access.php'); + +return (new \PhpCsFixer\Config()) + ->setCacheFile('var/cache/php-cs-fixer') + ->setFinder($finder) + ->setRules(['@PER-CS' => true]); diff --git a/composer.json b/composer.json index 0913892..32a2e11 100644 --- a/composer.json +++ b/composer.json @@ -56,15 +56,15 @@ } }, "scripts": { - "post-install-cmd": "phive --no-progress install --force-accept-unsigned --trust-gpg-keys C00543248C87FB13,4AA394086372C20A,CF1A108D0E7AE720,51C67305FFC2E5C0", + "post-install-cmd": "phive --no-progress install --force-accept-unsigned --trust-gpg-keys C00543248C87FB13,4AA394086372C20A,CF1A108D0E7AE720,51C67305FFC2E5C0,E82B2FB314E9906E", "analyse": [ "@analyse:phplint", "@analyse:phpstan", - "@analyse:phpcs", + "@analyse:phpcsfixer", "@analyse:compatibilitycheck" ], "analyse:compatibilitycheck": "./vendor/bin/phpcs --standard=./phpcs.compatibilitycheck.xml", - "analyse:phpcs": "./vendor/bin/phpcs", + "analyse:phpcsfixer": "./tools/php-cs-fixer check --diff --show-progress=dots", "analyse:phplint": "./tools/phplint", "analyse:phpstan": "./tools/phpstan analyse", "cs-fix": [ @@ -72,10 +72,8 @@ ], "cs-fix:phpcbf": "./vendor/bin/phpcbf", "report": [ - "@report:phpcs", "@report:phpstan" ], - "report:phpcs": "./vendor/bin/phpcs || exit 0", "report:phpstan": "./tools/phpstan analyse --no-progress --no-ansi --no-interaction --error-format=checkstyle > ./var/log/phpstan-report.xml || exit 0", "test": [ "@test:phpunit" diff --git a/composer.lock b/composer.lock index f6b6282..c32ac11 100644 --- a/composer.lock +++ b/composer.lock @@ -681,16 +681,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "77c636dfd86c0b60c5d184b2fd2ddf8dd11c309c" + "reference": "6e108cded928bdafaf1da3fabe30dd5af20e36b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/77c636dfd86c0b60c5d184b2fd2ddf8dd11c309c", - "reference": "77c636dfd86c0b60c5d184b2fd2ddf8dd11c309c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6e108cded928bdafaf1da3fabe30dd5af20e36b9", + "reference": "6e108cded928bdafaf1da3fabe30dd5af20e36b9", "shasum": "" }, "require": { @@ -741,7 +741,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/v7.1.1" + "source": "https://github.com/symfony/dependency-injection/tree/v7.1.2" }, "funding": [ { @@ -757,7 +757,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/deprecation-contracts", @@ -828,16 +828,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "e9b8bbce0b4f322939332ab7b6b81d8c11da27dd" + "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/e9b8bbce0b4f322939332ab7b6b81d8c11da27dd", - "reference": "e9b8bbce0b4f322939332ab7b6b81d8c11da27dd", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/2412d3dddb5c9ea51a39cfbff1c565fc9844ca32", + "reference": "2412d3dddb5c9ea51a39cfbff1c565fc9844ca32", "shasum": "" }, "require": { @@ -883,7 +883,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/v7.1.1" + "source": "https://github.com/symfony/error-handler/tree/v7.1.2" }, "funding": [ { @@ -899,7 +899,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-25T19:55:06+00:00" }, { "name": "symfony/event-dispatcher", @@ -1059,16 +1059,16 @@ }, { "name": "symfony/filesystem", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "802e87002f919296c9f606457d9fa327a0b3d6b2" + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/802e87002f919296c9f606457d9fa327a0b3d6b2", - "reference": "802e87002f919296c9f606457d9fa327a0b3d6b2", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", "shasum": "" }, "require": { @@ -1105,7 +1105,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.1.1" + "source": "https://github.com/symfony/filesystem/tree/v7.1.2" }, "funding": [ { @@ -1121,7 +1121,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/http-foundation", @@ -1202,16 +1202,16 @@ }, { "name": "symfony/http-kernel", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "fa8d1c75b5f33b1302afccf81811f93976c6e26f" + "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/fa8d1c75b5f33b1302afccf81811f93976c6e26f", - "reference": "fa8d1c75b5f33b1302afccf81811f93976c6e26f", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6", + "reference": "ae3fa717db4d41a55d14c2bd92399e37cf5bc0f6", "shasum": "" }, "require": { @@ -1296,7 +1296,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/v7.1.1" + "source": "https://github.com/symfony/http-kernel/tree/v7.1.2" }, "funding": [ { @@ -1312,7 +1312,7 @@ "type": "tidelift" } ], - "time": "2024-06-04T06:52:15+00:00" + "time": "2024-06-28T13:13:31+00:00" }, { "name": "symfony/password-hasher", @@ -1926,16 +1926,16 @@ }, { "name": "symfony/property-info", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "0f80f818c6728f15de30a4f89866d68e4912ae84" + "reference": "d7b91e4aa07e822a9b935fc29a7254c12d502f16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/0f80f818c6728f15de30a4f89866d68e4912ae84", - "reference": "0f80f818c6728f15de30a4f89866d68e4912ae84", + "url": "https://api.github.com/repos/symfony/property-info/zipball/d7b91e4aa07e822a9b935fc29a7254c12d502f16", + "reference": "d7b91e4aa07e822a9b935fc29a7254c12d502f16", "shasum": "" }, "require": { @@ -1990,7 +1990,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v7.1.1" + "source": "https://github.com/symfony/property-info/tree/v7.1.2" }, "funding": [ { @@ -2006,20 +2006,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-26T07:21:35+00:00" }, { "name": "symfony/security-bundle", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "dc4fb2acee6d28bf490ba300a36389182de74d25" + "reference": "a6746372202512d2c75ba9bdbc36e15022a56c42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/dc4fb2acee6d28bf490ba300a36389182de74d25", - "reference": "dc4fb2acee6d28bf490ba300a36389182de74d25", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/a6746372202512d2c75ba9bdbc36e15022a56c42", + "reference": "a6746372202512d2c75ba9bdbc36e15022a56c42", "shasum": "" }, "require": { @@ -2096,7 +2096,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/v7.1.1" + "source": "https://github.com/symfony/security-bundle/tree/v7.1.2" }, "funding": [ { @@ -2112,20 +2112,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T10:35:32+00:00" }, { "name": "symfony/security-core", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "536399671a46b0e615d69583f067e30ad25ad038" + "reference": "d615960211a11913e70f8576e5c38cd05d90ec3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/536399671a46b0e615d69583f067e30ad25ad038", - "reference": "536399671a46b0e615d69583f067e30ad25ad038", + "url": "https://api.github.com/repos/symfony/security-core/zipball/d615960211a11913e70f8576e5c38cd05d90ec3f", + "reference": "d615960211a11913e70f8576e5c38cd05d90ec3f", "shasum": "" }, "require": { @@ -2182,7 +2182,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v7.1.1" + "source": "https://github.com/symfony/security-core/tree/v7.1.2" }, "funding": [ { @@ -2198,7 +2198,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/security-csrf", @@ -2270,16 +2270,16 @@ }, { "name": "symfony/security-http", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "8fa539ad9fe3c45452b8cca8381c2414cef78559" + "reference": "e9dc3ef093dac3d4982fcd96002525aa7a1d6989" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/8fa539ad9fe3c45452b8cca8381c2414cef78559", - "reference": "8fa539ad9fe3c45452b8cca8381c2414cef78559", + "url": "https://api.github.com/repos/symfony/security-http/zipball/e9dc3ef093dac3d4982fcd96002525aa7a1d6989", + "reference": "e9dc3ef093dac3d4982fcd96002525aa7a1d6989", "shasum": "" }, "require": { @@ -2338,7 +2338,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v7.1.1" + "source": "https://github.com/symfony/security-http/tree/v7.1.2" }, "funding": [ { @@ -2354,7 +2354,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-25T19:55:06+00:00" }, { "name": "symfony/service-contracts", @@ -2441,16 +2441,16 @@ }, { "name": "symfony/string", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "60bc311c74e0af215101235aa6f471bcbc032df2" + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/60bc311c74e0af215101235aa6f471bcbc032df2", - "reference": "60bc311c74e0af215101235aa6f471bcbc032df2", + "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", "shasum": "" }, "require": { @@ -2508,7 +2508,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.1" + "source": "https://github.com/symfony/string/tree/v7.1.2" }, "funding": [ { @@ -2524,7 +2524,7 @@ "type": "tidelift" } ], - "time": "2024-06-04T06:40:14+00:00" + "time": "2024-06-28T09:27:18+00:00" }, { "name": "symfony/translation-contracts", @@ -2688,16 +2688,16 @@ }, { "name": "symfony/var-dumper", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "deb2c2b506ff6fdbb340e00b34e9901e1605f293" + "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/deb2c2b506ff6fdbb340e00b34e9901e1605f293", - "reference": "deb2c2b506ff6fdbb340e00b34e9901e1605f293", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5857c57c6b4b86524c08cf4f4bc95327270a816d", + "reference": "5857c57c6b4b86524c08cf4f4bc95327270a816d", "shasum": "" }, "require": { @@ -2751,7 +2751,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.1.1" + "source": "https://github.com/symfony/var-dumper/tree/v7.1.2" }, "funding": [ { @@ -2767,20 +2767,20 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/var-exporter", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "db82c2b73b88734557cfc30e3270d83fa651b712" + "reference": "b80a669a2264609f07f1667f891dbfca25eba44c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/db82c2b73b88734557cfc30e3270d83fa651b712", - "reference": "db82c2b73b88734557cfc30e3270d83fa651b712", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/b80a669a2264609f07f1667f891dbfca25eba44c", + "reference": "b80a669a2264609f07f1667f891dbfca25eba44c", "shasum": "" }, "require": { @@ -2827,7 +2827,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.1.1" + "source": "https://github.com/symfony/var-exporter/tree/v7.1.2" }, "funding": [ { @@ -2843,7 +2843,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T08:00:31+00:00" }, { "name": "symfony/yaml", @@ -3724,16 +3724,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -3744,7 +3744,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -3776,9 +3776,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "ondram/ci-detector", @@ -4040,16 +4040,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.14", + "version": "10.1.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", "shasum": "" }, "require": { @@ -4106,7 +4106,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" }, "funding": [ { @@ -4114,7 +4114,7 @@ "type": "github" } ], - "time": "2024-03-12T15:33:41+00:00" + "time": "2024-06-29T08:25:15+00:00" }, { "name": "phpunit/php-file-iterator", @@ -6392,16 +6392,16 @@ }, { "name": "symfony/console", - "version": "v7.1.1", + "version": "v7.1.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3" + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", - "reference": "9b008f2d7b21c74ef4d0c3de6077a642bc55ece3", + "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", "shasum": "" }, "require": { @@ -6465,7 +6465,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.1" + "source": "https://github.com/symfony/console/tree/v7.1.2" }, "funding": [ { @@ -6481,7 +6481,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { "name": "symfony/finder", diff --git a/phpcs.xml.dist b/phpcs.xml.dist deleted file mode 100644 index 1ae9151..0000000 --- a/phpcs.xml.dist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - src/ - test/ - - - - - - - - - - diff --git a/src/AtooloSecurityBundle.php b/src/AtooloSecurityBundle.php index 5f9c582..99e4732 100644 --- a/src/AtooloSecurityBundle.php +++ b/src/AtooloSecurityBundle.php @@ -25,8 +25,8 @@ public function build(ContainerBuilder $container): void new LoaderResolver( [ new YamlFileLoader($container, new FileLocator($configDir)), - ] - ) + ], + ), ); $loader->load('services.yaml'); diff --git a/src/Entity/User.php b/src/Entity/User.php index 1281380..1fde9a3 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -48,7 +48,7 @@ public static function ofArray(array $data): User if (!isset($data['username'], $data['password'], $data['roles'])) { throw new SecurityException( 'Invalid User data provided. Expected array with keys ' . - 'username, password and roles' + 'username, password and roles', ); } @@ -90,9 +90,7 @@ public function getSalt(): ?string return null; } - public function eraseCredentials(): void - { - } + public function eraseCredentials(): void {} /** * The public representation of the user (e.g. a username, diff --git a/src/Exception/SecurityException.php b/src/Exception/SecurityException.php index 3cb05da..16fd177 100644 --- a/src/Exception/SecurityException.php +++ b/src/Exception/SecurityException.php @@ -7,6 +7,4 @@ /** * @codeCoverageIgnore */ -class SecurityException extends \RuntimeException -{ -} +class SecurityException extends \RuntimeException {} diff --git a/src/RealmPropertiesUserLoader.php b/src/RealmPropertiesUserLoader.php index f18ff7a..04d7a14 100644 --- a/src/RealmPropertiesUserLoader.php +++ b/src/RealmPropertiesUserLoader.php @@ -24,7 +24,7 @@ class RealmPropertiesUserLoader implements UserLoader public function __construct( string $realmPropertiesFile, - UserPasswordHasherInterface $passwordHasher + UserPasswordHasherInterface $passwordHasher, ) { $this->realmPropertiesFile = $realmPropertiesFile; $this->passwordHasher = $passwordHasher; @@ -53,13 +53,13 @@ private function loadRealm(): array $realm = []; if (!file_exists($this->realmPropertiesFile)) { throw new RuntimeException( - 'Realm properties file not found: ' . $this->realmPropertiesFile + 'Realm properties file not found: ' . $this->realmPropertiesFile, ); } $content = file_get_contents($this->realmPropertiesFile); if ($content === false) { throw new RuntimeException( - 'Unable to load ' . $this->realmPropertiesFile + 'Unable to load ' . $this->realmPropertiesFile, ); } @@ -111,7 +111,7 @@ private function createUser(string $name, array $values): User $user->setPasswordCallback(function () use ($plaintextPassword, $user) { return $this->passwordHasher->hashPassword( $user, - $plaintextPassword + $plaintextPassword, ); }); diff --git a/src/SiteKit/AccessMapFactory.php b/src/SiteKit/AccessMapFactory.php index 4d4b2d7..fe70967 100644 --- a/src/SiteKit/AccessMapFactory.php +++ b/src/SiteKit/AccessMapFactory.php @@ -63,7 +63,7 @@ private function loadByFile(string $file): void } catch (\Throwable $t) { $this->logger->error( 'unable to load access-map', - ['file' => $file, 'exception' => $t] + ['file' => $file, 'exception' => $t], ); } } @@ -73,8 +73,8 @@ private function loadByFile(string $file): void */ private function loadDataList(string $file): array { - // phpcs:ignore - return @include $file; + // phpcs:ignore + return @include $file; } /** diff --git a/src/SiteKit/RoleMapper.php b/src/SiteKit/RoleMapper.php index df084ae..64fa31b 100644 --- a/src/SiteKit/RoleMapper.php +++ b/src/SiteKit/RoleMapper.php @@ -19,7 +19,7 @@ function ($role) { $role = strtoupper($role); return "ROLE_" . $role; }, - $roles + $roles, ); } } diff --git a/src/SiteKit/UserLoader.php b/src/SiteKit/UserLoader.php index be2fd6b..da92a2a 100644 --- a/src/SiteKit/UserLoader.php +++ b/src/SiteKit/UserLoader.php @@ -61,7 +61,7 @@ private function createUserListByFile(string $file): array } catch (\Throwable $t) { $this->logger->error( 'unable to load user', - ['file' => $file, 'exception' => $t] + ['file' => $file, 'exception' => $t], ); } return $userList; @@ -76,7 +76,7 @@ private function createUserListByFile(string $file): array */ private function loadDataList(string $file): array { - // phpcs:ignore - return @include $file; + // phpcs:ignore + return @include $file; } } diff --git a/src/SiteKit/Voter.php b/src/SiteKit/Voter.php index 7aed4fb..756dccb 100644 --- a/src/SiteKit/Voter.php +++ b/src/SiteKit/Voter.php @@ -34,7 +34,7 @@ protected function supports(string $attribute, mixed $subject): bool protected function voteOnAttribute( string $attribute, mixed $subject, - TokenInterface $token + TokenInterface $token, ): bool { if (!($subject instanceof Request)) { diff --git a/src/UserProvider.php b/src/UserProvider.php index d2679c0..ea2167e 100644 --- a/src/UserProvider.php +++ b/src/UserProvider.php @@ -74,7 +74,7 @@ public function refreshUser(UserInterface $user): UserInterface { if (!$user instanceof User) { throw new UnsupportedUserException( - sprintf('Invalid user class "%s".', get_class($user)) + sprintf('Invalid user class "%s".', get_class($user)), ); } return $this->loadUserByIdentifier($user->getUserIdentifier()); diff --git a/test/Entity/UserTest.php b/test/Entity/UserTest.php index 064125a..575d1a6 100644 --- a/test/Entity/UserTest.php +++ b/test/Entity/UserTest.php @@ -18,7 +18,7 @@ public function testGetUserIdentifier(): void $this->assertEquals( 'test', $user->getUserIdentifier(), - 'User::getUserIdentifier should return the username' + 'User::getUserIdentifier should return the username', ); } @@ -28,7 +28,7 @@ public function testGetRoles(): void $this->assertEquals( ['ROLE_TEST'], $user->getRoles(), - 'User::getRoles should return the roles' + 'User::getRoles should return the roles', ); } @@ -39,7 +39,7 @@ public function testSetAndGetPassword(): void $this->assertEquals( 'develop', $user->getPassword(), - 'User::setPassword should set the password' + 'User::setPassword should set the password', ); } @@ -52,7 +52,7 @@ public function testSetPasswordCallback(): void $this->assertEquals( 'develop', $user->getPassword(), - 'getPassword should use the callback to get the password' + 'getPassword should use the callback to get the password', ); } @@ -61,7 +61,7 @@ public function testGetSalt(): void $user = new User('', []); $this->assertNull( $user->getSalt(), - 'User::getSalt should return null' + 'User::getSalt should return null', ); } @@ -73,7 +73,7 @@ public function testEraseCredentials(): void $this->assertEquals( $user->getPassword(), 'develop', - 'password should be the hashed password and must not be erased' + 'password should be the hashed password and must not be erased', ); } @@ -82,7 +82,7 @@ public function testOfArray(): void $data = [ 'username' => 'test', 'password' => 'test', - 'roles' => ['test'] + 'roles' => ['test'], ]; $user = User::ofArray($data); $expected = new User('test', ['ROLE_TEST']); @@ -91,7 +91,7 @@ public function testOfArray(): void $this->assertEquals( $expected, $user, - 'User::ofArray should return a User object with the given data' + 'User::ofArray should return a User object with the given data', ); } @@ -100,7 +100,7 @@ public function testOfArrayMissingUsername(): void $this->expectException(SecurityException::class); User::ofArray([ 'password' => 'test', - 'roles' => ['test'] + 'roles' => ['test'], ]); } @@ -109,7 +109,7 @@ public function testOfArrayMissingPassword(): void $this->expectException(SecurityException::class); User::ofArray([ 'username' => 'test', - 'roles' => ['test'] + 'roles' => ['test'], ]); } diff --git a/test/RealmPropertiesUserLoaderTest.php b/test/RealmPropertiesUserLoaderTest.php index 435c043..7f55216 100644 --- a/test/RealmPropertiesUserLoaderTest.php +++ b/test/RealmPropertiesUserLoaderTest.php @@ -26,16 +26,16 @@ class RealmPropertiesUserLoaderTest extends TestCase public function setUp(): void { $this->passwordHasher = $this->createStub( - UserPasswordHasherInterface::class + UserPasswordHasherInterface::class, ); $this->passwordHasher->method('hashPassword') ->willReturnCallback( function ( PasswordAuthenticatedUserInterface $user, - string $plainPassword + string $plainPassword, ) { return "hash:" . $plainPassword; - } + }, ); $this->passwordHasher->method('isPasswordValid') ->willReturn(true); @@ -44,7 +44,7 @@ function ( $this->loader = new RealmPropertiesUserLoader( self::$BASE_DIR . '/realm.properties', - $this->passwordHasher + $this->passwordHasher, ); } @@ -55,23 +55,23 @@ public function testLoaderUser() 'api' => $this->createUser( 'api', 'develop', - ['ROLE_API', 'ROLE_TEST'] + ['ROLE_API', 'ROLE_TEST'], ), 'no-roles' => $this->createUser( 'no-roles', 'develop', - [] + [], ), 'empty-password' => $this->createUser( 'empty-password', '', - [] - ) + [], + ), ]; $this->assertEquals( $expected, $users, - 'The loaded users do not match the expected users' + 'The loaded users do not match the expected users', ); } @@ -82,18 +82,18 @@ public function testPasswordCallback() $this->assertEquals( 'hash:develop', $user->getPassword(), - 'The password was not hashed correctly' + 'The password was not hashed correctly', ); } public function testLoadMissingFile() { $passwordHasher = $this->createStub( - UserPasswordHasherInterface::class + UserPasswordHasherInterface::class, ); $loader = new RealmPropertiesUserLoader( '/missing-file', - $passwordHasher + $passwordHasher, ); $this->expectException(RuntimeException::class); @@ -103,7 +103,7 @@ public function testLoadMissingFile() public function testLoadUnreadableFile() { $passwordHasher = $this->createStub( - UserPasswordHasherInterface::class + UserPasswordHasherInterface::class, ); mkdir('./var/test/'); $unreadable = './var/test/unreadable'; @@ -111,7 +111,7 @@ public function testLoadUnreadableFile() chmod($unreadable, 0000); $loader = new RealmPropertiesUserLoader( $unreadable, - $passwordHasher + $passwordHasher, ); $this->expectException(RuntimeException::class); @@ -127,16 +127,16 @@ public function testLoadUnreadableFile() private function createUser( string $username, string $plaintextPassword, - array $roles + array $roles, ): User { $user = new User($username, $roles); $user->setPasswordCallback( function () use ($plaintextPassword, $user) { return $this->passwordHasher->hashPassword( $user, - $plaintextPassword + $plaintextPassword, ); - } + }, ); return $user; } diff --git a/test/RoleMapperTest.php b/test/RoleMapperTest.php index cbe5311..02f1a4d 100644 --- a/test/RoleMapperTest.php +++ b/test/RoleMapperTest.php @@ -18,7 +18,7 @@ public function testMap(): void $this->assertEquals( ['ROLE_ADMIN', 'ROLE_USER'], $mappedRoles, - 'Roles should be mapped' + 'Roles should be mapped', ); } } diff --git a/test/SiteKit/ProtectedPathMatcherTest.php b/test/SiteKit/ProtectedPathMatcherTest.php index 607d2e6..e35b30a 100644 --- a/test/SiteKit/ProtectedPathMatcherTest.php +++ b/test/SiteKit/ProtectedPathMatcherTest.php @@ -20,7 +20,7 @@ public function testMatchesNoRules(): void $matcher = new ProtectedPathMatcher($accessMap); $this->assertFalse( $matcher->matches($this->createStub(Request::class)), - 'No rules should match' + 'No rules should match', ); } public function testMatchesEmptyRules(): void @@ -30,7 +30,7 @@ public function testMatchesEmptyRules(): void $matcher = new ProtectedPathMatcher($accessMap); $this->assertFalse( $matcher->matches($this->createStub(Request::class)), - 'No rules should match' + 'No rules should match', ); } @@ -41,7 +41,7 @@ public function testMatches(): void $matcher = new ProtectedPathMatcher($accessMap); $this->assertTrue( $matcher->matches($this->createStub(Request::class)), - 'Rules should match' + 'Rules should match', ); } } diff --git a/test/SiteKit/UserLoaderTest.php b/test/SiteKit/UserLoaderTest.php index a5a4c1a..e07a891 100644 --- a/test/SiteKit/UserLoaderTest.php +++ b/test/SiteKit/UserLoaderTest.php @@ -69,7 +69,7 @@ public function testLoadDir(): void $this->assertEquals("hash:b", $users['b']->getPassword()); $this->assertEquals( ['ROLE_USER', 'ROLE_ADMIN'], - $users['b']->getRoles() + $users['b']->getRoles(), ); $this->assertEquals('x', $users['x']->getUserIdentifier()); diff --git a/test/SiteKit/security/test.access.php b/test/SiteKit/security/test.access.php index c52d78f..1eb53d7 100644 --- a/test/SiteKit/security/test.access.php +++ b/test/SiteKit/security/test.access.php @@ -3,5 +3,5 @@ return [ ['path' => '^/path-a/', 'roles' => ['a']], ['path' => '^/path-b/', 'roles' => ['b']], - ['path' => '^/path-c/', 'ips' => ['192.168.0.1/24'], 'roles' => ['c']] + ['path' => '^/path-c/', 'ips' => ['192.168.0.1/24'], 'roles' => ['c']], ]; diff --git a/test/UserProviderTest.php b/test/UserProviderTest.php index df61bf3..09f5c41 100644 --- a/test/UserProviderTest.php +++ b/test/UserProviderTest.php @@ -28,7 +28,7 @@ public function testLoadUserByIdentifier(): void $this->assertEquals( $user, $userProvider->loadUserByIdentifier('test'), - 'User should be loaded' + 'User should be loaded', ); } @@ -53,7 +53,7 @@ public function testRefreshUser(): void $this->assertSame( $user, $userProvider->refreshUser($userFromSession), - 'User should be refreshed' + 'User should be refreshed', ); } @@ -72,7 +72,7 @@ public function testSupportsClass(): void $userProvider = new UserProvider($userLoader); $this->assertTrue( $userProvider->supportsClass(User::class), - 'User class should be supported' + 'User class should be supported', ); } @@ -82,7 +82,7 @@ public function testSupportsClassWithUnsupportedClass(): void $userProvider = new UserProvider($userLoader); $this->assertFalse( $userProvider->supportsClass(UserInterface::class), - 'User class should be supported' + 'User class should be supported', ); } } diff --git a/test/VoterTest.php b/test/VoterTest.php index bd0a09b..515f2ea 100644 --- a/test/VoterTest.php +++ b/test/VoterTest.php @@ -24,7 +24,7 @@ public function testWithInvalidSubjectVote(): void $this->assertEquals( -1, $voter->vote($token, 'invalid', [Voter::SITEKIT_PUBLICATION]), - 'Vote should fail' + 'Vote should fail', ); } @@ -40,7 +40,7 @@ public function testVoteWithoutPattern(): void $this->assertEquals( 1, $voter->vote($token, $subject, [Voter::SITEKIT_PUBLICATION]), - 'Vote should fail' + 'Vote should fail', ); } @@ -56,7 +56,7 @@ public function testVoteWithoutRoles(): void $this->assertEquals( 1, $voter->vote($token, $subject, [Voter::SITEKIT_PUBLICATION]), - 'Vote should fail' + 'Vote should fail', ); } @@ -72,7 +72,7 @@ public function testVoteWithUnmatchedRoles(): void $this->assertEquals( -1, $voter->vote($token, $subject, [Voter::SITEKIT_PUBLICATION]), - 'Vote should fail' + 'Vote should fail', ); } @@ -89,7 +89,7 @@ public function testVoteWithMatchedRoles(): void $this->assertEquals( 1, $voter->vote($token, $subject, [Voter::SITEKIT_PUBLICATION]), - 'Vote should fail' + 'Vote should fail', ); } }