diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1681bc765..4c4a44dc2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -31,9 +31,6 @@ updates: - dependency-name: friendsofsymfony/user-bundle versions: - "> 2.0.2" - - dependency-name: nelmio/api-doc-bundle - versions: - - "> 2.13.4" - package-ecosystem: github-actions directory: "/" schedule: diff --git a/composer.json b/composer.json index 7acbb5eff..06cf296bf 100644 --- a/composer.json +++ b/composer.json @@ -127,10 +127,10 @@ "m6web/redis-mock": "^5.0", "php-http/mock-client": "^1.0", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-doctrine": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpstan/phpstan-symfony": "^0.12", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-doctrine": "^1.3", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-symfony": "^1.2", "symfony/maker-bundle": "^1.18", "symfony/phpunit-bridge": "~6.0" }, diff --git a/composer.lock b/composer.lock index 0e57d5929..1e1f6a06e 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": "a2a09b8c7c80d9411cb07680b46952a5", + "content-hash": "7e2e98057e24124078e082fe4b4a7702", "packages": [ { "name": "babdev/pagerfanta-bundle", @@ -7601,16 +7601,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.13.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "33aefcdab42900e36366d0feab6206e2dd68f947" + "reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/33aefcdab42900e36366d0feab6206e2dd68f947", - "reference": "33aefcdab42900e36366d0feab6206e2dd68f947", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/aac44118344d197e6d5f7c6cee91885f0a89acdd", + "reference": "aac44118344d197e6d5f7c6cee91885f0a89acdd", "shasum": "" }, "require": { @@ -7640,9 +7640,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.13.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.13.1" }, - "time": "2022-10-21T09:57:39+00:00" + "time": "2022-11-20T08:52:26+00:00" }, { "name": "phpzip/phpzip", @@ -9511,16 +9511,16 @@ }, { "name": "symfony/polyfill-apcu", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "43273a33c46f9d5a08dac76859f63d6814242e81" + "reference": "6e7f6ed2168779a2b3927e606a9768860a8bdfa0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/43273a33c46f9d5a08dac76859f63d6814242e81", - "reference": "43273a33c46f9d5a08dac76859f63d6814242e81", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/6e7f6ed2168779a2b3927e606a9768860a8bdfa0", + "reference": "6e7f6ed2168779a2b3927e606a9768860a8bdfa0", "shasum": "" }, "require": { @@ -9529,7 +9529,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -9568,7 +9568,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-apcu/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-apcu/tree/v1.27.0" }, "funding": [ { @@ -9584,20 +9584,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -9612,7 +9612,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -9650,7 +9650,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -9666,20 +9666,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-iconv", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-iconv.git", - "reference": "143f1881e655bebca1312722af8068de235ae5dc" + "reference": "927013f3aac555983a5059aada98e1907d842695" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/143f1881e655bebca1312722af8068de235ae5dc", - "reference": "143f1881e655bebca1312722af8068de235ae5dc", + "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/927013f3aac555983a5059aada98e1907d842695", + "reference": "927013f3aac555983a5059aada98e1907d842695", "shasum": "" }, "require": { @@ -9694,7 +9694,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -9733,7 +9733,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-iconv/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-iconv/tree/v1.27.0" }, "funding": [ { @@ -9749,20 +9749,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-icu", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-icu.git", - "reference": "e407643d610e5f2c8a4b14189150f68934bf5e48" + "reference": "a3d9148e2c363588e05abbdd4ee4f971f0a5330c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/e407643d610e5f2c8a4b14189150f68934bf5e48", - "reference": "e407643d610e5f2c8a4b14189150f68934bf5e48", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/a3d9148e2c363588e05abbdd4ee4f971f0a5330c", + "reference": "a3d9148e2c363588e05abbdd4ee4f971f0a5330c", "shasum": "" }, "require": { @@ -9774,7 +9774,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -9820,7 +9820,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.27.0" }, "funding": [ { @@ -9836,20 +9836,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8" + "reference": "639084e360537a19f9ee352433b84ce831f3d2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8", - "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/639084e360537a19f9ee352433b84ce831f3d2da", + "reference": "639084e360537a19f9ee352433b84ce831f3d2da", "shasum": "" }, "require": { @@ -9863,7 +9863,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -9907,7 +9907,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.27.0" }, "funding": [ { @@ -9923,20 +9923,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -9948,7 +9948,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -9991,7 +9991,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -10007,20 +10007,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -10035,7 +10035,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -10074,7 +10074,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -10090,7 +10090,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php56", @@ -10230,16 +10230,16 @@ }, { "name": "symfony/polyfill-php72", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2" + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2", - "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97", + "reference": "869329b1e9894268a8a61dabb69153029b7a8c97", "shasum": "" }, "require": { @@ -10248,7 +10248,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -10286,7 +10286,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0" }, "funding": [ { @@ -10302,20 +10302,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -10324,7 +10324,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -10365,7 +10365,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -10381,20 +10381,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -10403,7 +10403,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -10448,7 +10448,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -10464,20 +10464,20 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-uuid", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "a41886c1c81dc075a09c71fe6db5b9d68c79de23" + "reference": "f3cf1a645c2734236ed1e2e671e273eeb3586166" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/a41886c1c81dc075a09c71fe6db5b9d68c79de23", - "reference": "a41886c1c81dc075a09c71fe6db5b9d68c79de23", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/f3cf1a645c2734236ed1e2e671e273eeb3586166", + "reference": "f3cf1a645c2734236ed1e2e671e273eeb3586166", "shasum": "" }, "require": { @@ -10492,7 +10492,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -10530,7 +10530,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.27.0" }, "funding": [ { @@ -10546,7 +10546,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/service-contracts", @@ -12465,16 +12465,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.1", + "version": "v4.15.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "shasum": "" }, "require": { @@ -12515,9 +12515,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" }, - "time": "2022-09-04T07:30:47+00:00" + "time": "2022-11-12T15:38:23+00:00" }, { "name": "php-cs-fixer/diff", @@ -12645,28 +12645,27 @@ }, { "name": "phpstan/extension-installer", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051" + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051", - "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1 || ^2.0", - "php": "^7.1 || ^8.0", - "phpstan/phpstan": ">=0.11.6" + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.0" }, "require-dev": { - "composer/composer": "^1.8", - "phing/phing": "^2.16.3", + "composer/composer": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpstan/phpstan-strict-rules": "^0.11 || ^0.12" + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" }, "type": "composer-plugin", "extra": { @@ -12684,26 +12683,26 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.1.0" + "source": "https://github.com/phpstan/extension-installer/tree/1.2.0" }, - "time": "2020-12-13T13:06:13+00:00" + "time": "2022-10-17T12:59:16+00:00" }, { "name": "phpstan/phpstan", - "version": "0.12.100", + "version": "1.9.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "48236ddf823547081b2b153d1cd2994b784328c3" + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/48236ddf823547081b2b153d1cd2994b784328c3", - "reference": "48236ddf823547081b2b153d1cd2994b784328c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d6fdf01c53978b6429f1393ba4afeca39cc68afa", + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.2|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -12713,11 +12712,6 @@ "phpstan.phar" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -12728,9 +12722,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.100" + "source": "https://github.com/phpstan/phpstan/tree/1.9.2" }, "funding": [ { @@ -12746,25 +12744,25 @@ "type": "tidelift" } ], - "time": "2022-11-01T09:52:08+00:00" + "time": "2022-11-10T09:56:11+00:00" }, { "name": "phpstan/phpstan-doctrine", - "version": "0.12.44", + "version": "1.3.23", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-doctrine.git", - "reference": "5fe9a9b15707d9bc5178fa7cf0899e904d112ccd" + "reference": "964caf844c89134e5c2f19e97cbf8b5d12193779" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/5fe9a9b15707d9bc5178fa7cf0899e904d112ccd", - "reference": "5fe9a9b15707d9bc5178fa7cf0899e904d112ccd", + "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/964caf844c89134e5c2f19e97cbf8b5d12193779", + "reference": "964caf844c89134e5c2f19e97cbf8b5d12193779", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.85" + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.11" }, "conflict": { "doctrine/collections": "<1.0", @@ -12777,22 +12775,23 @@ "doctrine/annotations": "^1.11.0", "doctrine/collections": "^1.6", "doctrine/common": "^2.7 || ^3.0", - "doctrine/dbal": "^2.13.1", + "doctrine/dbal": "^2.13.8 || ^3.3.3", + "doctrine/lexer": "^1.2.1", "doctrine/mongodb-odm": "^1.3 || ^2.1", - "doctrine/orm": "^2.9.1", - "doctrine/persistence": "^1.1 || ^2.0", + "doctrine/orm": "^2.11.0", + "doctrine/persistence": "^1.3.8 || ^2.2.1", + "gedmo/doctrine-extensions": "^3.8", "nesbot/carbon": "^2.49", + "nikic/php-parser": "^4.13.2", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^0.12.16", - "phpstan/phpstan-strict-rules": "^0.12.5", - "phpunit/phpunit": "^9.5", - "ramsey/uuid-doctrine": "^1.5.0" + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5.10", + "ramsey/uuid-doctrine": "^1.5.0", + "symfony/cache": "^4.4.35" }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - }, "phpstan": { "includes": [ "extension.neon", @@ -12812,41 +12811,39 @@ "description": "Doctrine extensions for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-doctrine/issues", - "source": "https://github.com/phpstan/phpstan-doctrine/tree/0.12.44" + "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.23" }, - "time": "2021-09-01T06:46:16+00:00" + "time": "2022-11-14T07:46:16+00:00" }, { "name": "phpstan/phpstan-phpunit", - "version": "0.12.22", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-phpunit.git", - "reference": "7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc" + "reference": "dea1f87344c6964c607d9076dee42d891f3923f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc", - "reference": "7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/dea1f87344c6964c607d9076dee42d891f3923f0", + "reference": "dea1f87344c6964c607d9076dee42d891f3923f0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.92" + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.11" }, "conflict": { "phpunit/phpunit": "<7.0" }, "require-dev": { + "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-strict-rules": "^0.12.6", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5" }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - }, "phpstan": { "includes": [ "extension.neon", @@ -12866,49 +12863,51 @@ "description": "PHPUnit extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-phpunit/issues", - "source": "https://github.com/phpstan/phpstan-phpunit/tree/0.12.22" + "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.2.2" }, - "time": "2021-08-12T10:53:43+00:00" + "time": "2022-10-28T10:23:07+00:00" }, { "name": "phpstan/phpstan-symfony", - "version": "0.12.44", + "version": "1.2.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "c1627fce5b505b3f53d9d4fbd4d7963603305f98" + "reference": "d6ea16206b1b645ded5b43736d8ef5ae1168eb55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/c1627fce5b505b3f53d9d4fbd4d7963603305f98", - "reference": "c1627fce5b505b3f53d9d4fbd4d7963603305f98", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/d6ea16206b1b645ded5b43736d8ef5ae1168eb55", + "reference": "d6ea16206b1b645ded5b43736d8ef5ae1168eb55", "shasum": "" }, "require": { "ext-simplexml": "*", - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^0.12.98" + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.1" }, "conflict": { "symfony/framework-bundle": "<3.0" }, "require-dev": { + "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^0.12.16", - "phpstan/phpstan-strict-rules": "^0.12.5", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", - "symfony/config": "^4.2 || ^5.0", - "symfony/console": "^4.0 || ^5.0", - "symfony/framework-bundle": "^4.4 || ^5.0", - "symfony/http-foundation": "^4.0 || ^5.0", - "symfony/messenger": "^4.2 || ^5.0", - "symfony/serializer": "^4.0 || ^5.0" + "psr/container": "1.0 || 1.1.1", + "symfony/config": "^5.4 || ^6.1", + "symfony/console": "^5.4 || ^6.1", + "symfony/dependency-injection": "^5.4 || ^6.1", + "symfony/form": "^5.4 || ^6.1", + "symfony/framework-bundle": "^5.4 || ^6.1", + "symfony/http-foundation": "^5.4 || ^6.1", + "symfony/messenger": "^5.4", + "symfony/polyfill-php80": "^1.24", + "symfony/serializer": "^5.4" }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "0.12-dev" - }, "phpstan": { "includes": [ "extension.neon", @@ -12935,9 +12934,9 @@ "description": "Symfony Framework extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/0.12.44" + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.16" }, - "time": "2021-09-02T12:14:11+00:00" + "time": "2022-11-04T13:16:15+00:00" }, { "name": "symfony/maker-bundle", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 000000000..10a4c15d4 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,96 @@ +parameters: + ignoreErrors: + - + message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" + count: 2 + path: src/Wallabag/ApiBundle/Controller/EntryRestController.php + + - + message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ApiBundle/Controller/UserRestController.php + + - + message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" + count: 3 + path: src/Wallabag/ApiBundle/Controller/WallabagRestController.php + + - + message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getConnection\\(\\)\\.$#" + count: 5 + path: src/Wallabag/CoreBundle/Command/InstallCommand.php + + - + message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#" + count: 1 + path: src/Wallabag/CoreBundle/Controller/ConfigController.php + + - + message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" + count: 1 + path: src/Wallabag/CoreBundle/Controller/StaticController.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + count: 1 + path: src/Wallabag/CoreBundle/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#" + count: 1 + path: src/Wallabag/CoreBundle/Event/Subscriber/CustomDoctrineORMSubscriber.php + + - + message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpr\\(\\)\\.$#" + count: 10 + path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php + + - + message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getConnection\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ImportBundle/Command/ImportCommand.php + + - + message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ImportBundle/Controller/BrowserController.php + + - + message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ImportBundle/Controller/BrowserController.php + + - + message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ImportBundle/Controller/WallabagController.php + + - + message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setUser\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ImportBundle/Controller/WallabagController.php + + - + message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" + count: 1 + path: src/Wallabag/ImportBundle/DependencyInjection/Configuration.php + + - + message: "#^Call to an undefined method Scheb\\\\TwoFactorBundle\\\\Model\\\\Email\\\\TwoFactorInterface\\:\\:getName\\(\\)\\.$#" + count: 2 + path: src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php + + - + message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#" + count: 1 + path: tests/Wallabag/CoreBundle/Controller/FeedControllerTest.php + + - + message: "#^Call to method generate\\(\\) on an unknown class PHPUnit_Framework_MockObject_MockObject\\.$#" + count: 2 + path: tests/Wallabag/CoreBundle/Helper/RedirectTest.php + + - + message: "#^Property Tests\\\\Wallabag\\\\CoreBundle\\\\Helper\\\\RedirectTest\\:\\:\\$routerMock has unknown class PHPUnit_Framework_MockObject_MockObject as its type\\.$#" + count: 1 + path: tests/Wallabag/CoreBundle/Helper/RedirectTest.php diff --git a/phpstan.neon b/phpstan.neon index d57bf9517..1edbd234d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,8 @@ +includes: + - phpstan-baseline.neon + parameters: - level: 1 + level: 2 paths: - src - tests @@ -11,3 +14,6 @@ parameters: - vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php inferPrivatePropertyTypeFromConstructor: true + + ignoreErrors: + - '#^Service ".+" is private\.?#' diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index 0f2cc1e09..20c34f55d 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php @@ -52,7 +52,7 @@ class WallabagAnnotationController extends AbstractFOSRestController { $data = json_decode($request->getContent(), true); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $annotation = new Annotation($this->getUser()); $annotation->setEntry($entry); @@ -95,7 +95,7 @@ class WallabagAnnotationController extends AbstractFOSRestController $form->submit($data); if ($form->isValid()) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($annotation); $em->flush(); @@ -119,7 +119,7 @@ class WallabagAnnotationController extends AbstractFOSRestController */ public function deleteAnnotationAction(Annotation $annotation) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($annotation); $em->flush(); diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index 59c17e447..8987b263a 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php @@ -9,6 +9,8 @@ use Wallabag\AnnotationBundle\Entity\Annotation; /** * AnnotationRepository. + * + * @method Annotation|null findOneById(int $id) */ class AnnotationRepository extends ServiceEntityRepository { diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index 179285d40..c15c57678 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -23,7 +23,7 @@ class DeveloperController extends Controller */ public function indexAction() { - $clients = $this->getDoctrine()->getRepository(Client::class)->findByUser($this->getUser()->getId()); + $clients = $this->get('doctrine')->getRepository(Client::class)->findByUser($this->getUser()->getId()); return $this->render('@WallabagCore/Developer/index.html.twig', [ 'clients' => $clients, @@ -39,7 +39,7 @@ class DeveloperController extends Controller */ public function createClientAction(Request $request) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $client = new Client($this->getUser()); $clientForm = $this->createForm(ClientType::class, $client); $clientForm->handleRequest($request); @@ -79,7 +79,7 @@ class DeveloperController extends Controller throw $this->createAccessDeniedException('You can not access this client.'); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($client); $em->flush(); diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 98f11b52a..3d17d0296 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -88,7 +88,7 @@ class EntryRestController extends WallabagRestController public function getEntriesExistsAction(Request $request) { $this->validateAuthentication(); - $repo = $this->getDoctrine()->getRepository(Entry::class); + $repo = $this->get('doctrine')->getRepository(Entry::class); $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); @@ -464,7 +464,7 @@ class EntryRestController extends WallabagRestController // entry deleted, dispatch event about it! $this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($entry); $em->flush(); } @@ -532,7 +532,7 @@ class EntryRestController extends WallabagRestController $this->get(ContentProxy::class)->updateEntry($entry, $url); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -755,7 +755,7 @@ class EntryRestController extends WallabagRestController $this->get(ContentProxy::class)->setDefaultEntryTitle($entry); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -971,7 +971,7 @@ class EntryRestController extends WallabagRestController $this->get(ContentProxy::class)->setDefaultEntryTitle($entry); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -1027,7 +1027,7 @@ class EntryRestController extends WallabagRestController return new JsonResponse([], 304); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -1085,7 +1085,7 @@ class EntryRestController extends WallabagRestController // entry deleted, dispatch event about it! $this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($entry); $em->flush(); @@ -1168,7 +1168,7 @@ class EntryRestController extends WallabagRestController $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -1213,7 +1213,7 @@ class EntryRestController extends WallabagRestController $this->validateUserAccess($entry->getUser()->getId()); $entry->removeTag($tag); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -1272,7 +1272,7 @@ class EntryRestController extends WallabagRestController foreach ($tags as $label) { $label = trim($label); - $tag = $this->getDoctrine() + $tag = $this->get('doctrine') ->getRepository(Tag::class) ->findOneByLabel($label); @@ -1281,7 +1281,7 @@ class EntryRestController extends WallabagRestController } } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); } @@ -1340,7 +1340,7 @@ class EntryRestController extends WallabagRestController if (false !== $entry && !(empty($tags))) { $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); } diff --git a/src/Wallabag/ApiBundle/Controller/TagRestController.php b/src/Wallabag/ApiBundle/Controller/TagRestController.php index 3cc623909..7e943be55 100644 --- a/src/Wallabag/ApiBundle/Controller/TagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/TagRestController.php @@ -33,7 +33,7 @@ class TagRestController extends WallabagRestController { $this->validateAuthentication(); - $tags = $this->getDoctrine() + $tags = $this->get('doctrine') ->getRepository(Tag::class) ->findAllFlatTagsWithNbEntries($this->getUser()->getId()); @@ -71,7 +71,7 @@ class TagRestController extends WallabagRestController $this->validateAuthentication(); $label = $request->get('tag', ''); - $tags = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser([$label], $this->getUser()->getId()); + $tags = $this->get('doctrine')->getRepository(Tag::class)->findByLabelsAndUser([$label], $this->getUser()->getId()); if (empty($tags)) { throw $this->createNotFoundException('Tag not found'); @@ -79,7 +79,7 @@ class TagRestController extends WallabagRestController $tag = $tags[0]; - $this->getDoctrine() + $this->get('doctrine') ->getRepository(Entry::class) ->removeTag($this->getUser()->getId(), $tag); @@ -122,13 +122,13 @@ class TagRestController extends WallabagRestController $tagsLabels = $request->get('tags', ''); - $tags = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser(explode(',', $tagsLabels), $this->getUser()->getId()); + $tags = $this->get('doctrine')->getRepository(Tag::class)->findByLabelsAndUser(explode(',', $tagsLabels), $this->getUser()->getId()); if (empty($tags)) { throw $this->createNotFoundException('Tags not found'); } - $this->getDoctrine() + $this->get('doctrine') ->getRepository(Entry::class) ->removeTags($this->getUser()->getId(), $tags); @@ -167,13 +167,13 @@ class TagRestController extends WallabagRestController { $this->validateAuthentication(); - $tagFromDb = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser([$tag->getLabel()], $this->getUser()->getId()); + $tagFromDb = $this->get('doctrine')->getRepository(Tag::class)->findByLabelsAndUser([$tag->getLabel()], $this->getUser()->getId()); if (empty($tagFromDb)) { throw $this->createNotFoundException('Tag not found'); } - $this->getDoctrine() + $this->get('doctrine') ->getRepository(Entry::class) ->removeTag($this->getUser()->getId(), $tag); @@ -195,7 +195,7 @@ class TagRestController extends WallabagRestController $tags = [$tags]; } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); foreach ($tags as $tag) { if (0 === \count($tag->getEntries())) { diff --git a/src/Wallabag/ApiBundle/Controller/UserRestController.php b/src/Wallabag/ApiBundle/Controller/UserRestController.php index 348536d32..182e659e6 100644 --- a/src/Wallabag/ApiBundle/Controller/UserRestController.php +++ b/src/Wallabag/ApiBundle/Controller/UserRestController.php @@ -102,6 +102,7 @@ class UserRestController extends WallabagRestController $userManager = $this->get(UserManagerInterface::class); $user = $userManager->createUser(); + \assert($user instanceof User); // user will be disabled BY DEFAULT to avoid spamming account to be enabled $user->setEnabled(false); @@ -150,7 +151,7 @@ class UserRestController extends WallabagRestController $client = new Client($user); $client->setName($request->request->get('client_name', 'Default client')); - $this->getDoctrine()->getManager()->persist($client); + $this->get('doctrine')->getManager()->persist($client); $user->addClient($client); diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index fedc3910c..4716addd6 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -12,6 +12,7 @@ use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; +use Wallabag\UserBundle\Entity\User; class WallabagRestController extends AbstractFOSRestController { @@ -84,6 +85,7 @@ class WallabagRestController extends AbstractFOSRestController protected function validateUserAccess($requestUserId) { $user = $this->get(TokenStorageInterface::class)->getToken()->getUser(); + \assert($user instanceof User); if ($requestUserId !== $user->getId()) { throw $this->createAccessDeniedException('Access forbidden. Entry user id: ' . $requestUserId . ', logged user id: ' . $user->getId()); } diff --git a/src/Wallabag/ApiBundle/Entity/AccessToken.php b/src/Wallabag/ApiBundle/Entity/AccessToken.php index 98e0af3e1..49e21bef4 100644 --- a/src/Wallabag/ApiBundle/Entity/AccessToken.php +++ b/src/Wallabag/ApiBundle/Entity/AccessToken.php @@ -4,6 +4,8 @@ namespace Wallabag\ApiBundle\Entity; use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken; +use FOS\OAuthServerBundle\Model\ClientInterface; +use FOS\UserBundle\Model\UserInterface; /** * @ORM\Table("oauth2_access_tokens") @@ -37,12 +39,16 @@ class AccessToken extends BaseAccessToken /** * @ORM\ManyToOne(targetEntity="Client", inversedBy="accessTokens") * @ORM\JoinColumn(nullable=false) + * + * @var ClientInterface */ protected $client; /** * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") + * + * @var UserInterface */ protected $user; } diff --git a/src/Wallabag/ApiBundle/Entity/AuthCode.php b/src/Wallabag/ApiBundle/Entity/AuthCode.php index 7c9c85396..33b4c94bb 100644 --- a/src/Wallabag/ApiBundle/Entity/AuthCode.php +++ b/src/Wallabag/ApiBundle/Entity/AuthCode.php @@ -4,6 +4,8 @@ namespace Wallabag\ApiBundle\Entity; use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode; +use FOS\OAuthServerBundle\Model\ClientInterface; +use FOS\UserBundle\Model\UserInterface; /** * @ORM\Table("oauth2_auth_codes") @@ -37,12 +39,16 @@ class AuthCode extends BaseAuthCode /** * @ORM\ManyToOne(targetEntity="Client") * @ORM\JoinColumn(nullable=false) + * + * @var ClientInterface */ protected $client; /** * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") + * + * @var UserInterface */ protected $user; } diff --git a/src/Wallabag/ApiBundle/Entity/RefreshToken.php b/src/Wallabag/ApiBundle/Entity/RefreshToken.php index 55a507e13..b013f0254 100644 --- a/src/Wallabag/ApiBundle/Entity/RefreshToken.php +++ b/src/Wallabag/ApiBundle/Entity/RefreshToken.php @@ -4,6 +4,8 @@ namespace Wallabag\ApiBundle\Entity; use Doctrine\ORM\Mapping as ORM; use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken; +use FOS\OAuthServerBundle\Model\ClientInterface; +use FOS\UserBundle\Model\UserInterface; /** * @ORM\Table("oauth2_refresh_tokens") @@ -37,12 +39,16 @@ class RefreshToken extends BaseRefreshToken /** * @ORM\ManyToOne(targetEntity="Client", inversedBy="refreshTokens") * @ORM\JoinColumn(nullable=false) + * + * @var ClientInterface */ protected $client; /** * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") + * + * @var UserInterface */ protected $user; } diff --git a/src/Wallabag/ApiBundle/Repository/ClientRepository.php b/src/Wallabag/ApiBundle/Repository/ClientRepository.php index 1c00e1645..0c0b79786 100644 --- a/src/Wallabag/ApiBundle/Repository/ClientRepository.php +++ b/src/Wallabag/ApiBundle/Repository/ClientRepository.php @@ -6,6 +6,9 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Wallabag\ApiBundle\Entity\Client; +/** + * @method Client[] findByUser(int $userId) + */ class ClientRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) diff --git a/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php b/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php index 1d0fa3031..4637b4126 100644 --- a/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php +++ b/src/Wallabag/CoreBundle/Command/GenerateUrlHashesCommand.php @@ -43,7 +43,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand return 1; } } else { - $users = $this->getDoctrine()->getRepository(User::class)->findAll(); + $users = $this->getContainer()->get('doctrine')->getRepository(User::class)->findAll(); $output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users))); @@ -60,7 +60,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand private function generateHashedUrls(User $user) { $em = $this->getContainer()->get(EntityManagerInterface::class); - $repo = $this->getDoctrine()->getRepository(Entry::class); + $repo = $this->getContainer()->get('doctrine')->getRepository(Entry::class); $entries = $repo->findByEmptyHashedUrlAndUserId($user->getId()); @@ -89,7 +89,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand */ private function getUser($username) { - return $this->getDoctrine()->getRepository(User::class)->findOneByUserName($username); + return $this->getContainer()->get('doctrine')->getRepository(User::class)->findOneByUserName($username); } private function getDoctrine() diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 1dafde40d..bc3e61d14 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -20,6 +20,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule; use Wallabag\CoreBundle\Entity\InternalSetting; +use Wallabag\UserBundle\Entity\User; class InstallCommand extends ContainerAwareCommand { @@ -79,6 +80,8 @@ class InstallCommand extends ContainerAwareCommand $this->io->success('wallabag has been successfully installed.'); $this->io->success('You can now configure your web server, see https://doc.wallabag.org'); + + return 0; } private function checkRequirements() @@ -261,6 +264,7 @@ class InstallCommand extends ContainerAwareCommand $userManager = $this->getContainer()->get(UserManagerInterface::class); $user = $userManager->createUser(); + \assert($user instanceof User); $user->setUsername($this->io->ask('Username', 'wallabag')); diff --git a/src/Wallabag/CoreBundle/Command/TagAllCommand.php b/src/Wallabag/CoreBundle/Command/TagAllCommand.php index 66eb2a36a..7ca7279f2 100644 --- a/src/Wallabag/CoreBundle/Command/TagAllCommand.php +++ b/src/Wallabag/CoreBundle/Command/TagAllCommand.php @@ -47,7 +47,7 @@ class TagAllCommand extends ContainerAwareCommand $io->text('Persist ' . \count($entries) . ' entries... '); - $em = $this->getDoctrine()->getManager(); + $em = $this->getContainer()->get('doctrine')->getManager(); foreach ($entries as $entry) { $em->persist($entry); } diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 18c7a2798..bc650c57b 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -44,7 +44,7 @@ class ConfigController extends Controller */ public function indexAction(Request $request) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $config = $this->getConfig(); $userManager = $this->container->get(UserManagerInterface::class); $user = $this->getUser(); @@ -125,7 +125,7 @@ class ConfigController extends Controller $action = $this->generateUrl('config') . '#set5'; if ($request->query->has('tagging-rule')) { - $taggingRule = $this->getDoctrine() + $taggingRule = $this->get('doctrine') ->getRepository(TaggingRule::class) ->find($request->query->get('tagging-rule')); @@ -188,7 +188,7 @@ class ConfigController extends Controller $action = $this->generateUrl('config') . '#set6'; if ($request->query->has('ignore-origin-user-rule')) { - $ignoreOriginUserRule = $this->getDoctrine() + $ignoreOriginUserRule = $this->get('doctrine') ->getRepository(IgnoreOriginUserRule::class) ->find($request->query->get('ignore-origin-user-rule')); @@ -414,7 +414,7 @@ class ConfigController extends Controller $config = $this->getConfig(); $config->setFeedToken(Utils::generateToken()); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($config); $em->flush(); @@ -440,7 +440,7 @@ class ConfigController extends Controller $config = $this->getConfig(); $config->setFeedToken(null); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($config); $em->flush(); @@ -467,7 +467,7 @@ class ConfigController extends Controller { $this->validateRuleAction($rule); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($rule); $em->flush(); @@ -504,7 +504,7 @@ class ConfigController extends Controller { $this->validateRuleAction($rule); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($rule); $em->flush(); @@ -541,7 +541,7 @@ class ConfigController extends Controller { switch ($type) { case 'annotations': - $this->getDoctrine() + $this->get('doctrine') ->getRepository(Annotation::class) ->removeAllByUserId($this->getUser()->getId()); break; @@ -552,7 +552,7 @@ class ConfigController extends Controller // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff // otherwise they won't be removed ... if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) { - $this->getDoctrine()->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId()); + $this->get('doctrine')->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId()); } // manually remove tags to avoid orphan tag @@ -622,7 +622,7 @@ class ConfigController extends Controller $user = $this->getUser(); $user->getConfig()->setListMode(!$user->getConfig()->getListMode()); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($user); $em->flush(); @@ -691,7 +691,7 @@ class ConfigController extends Controller ->removeTags($userId, $tags); // cleanup orphan tags - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); foreach ($tags as $tag) { if (0 === \count($tag->getEntries())) { @@ -726,9 +726,9 @@ class ConfigController extends Controller private function removeAnnotationsForArchivedByUserId($userId) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); - $archivedEntriesAnnotations = $this->getDoctrine() + $archivedEntriesAnnotations = $this->get('doctrine') ->getRepository(Annotation::class) ->findAllArchivedEntriesByUser($userId); @@ -757,7 +757,7 @@ class ConfigController extends Controller */ private function getConfig() { - $config = $this->getDoctrine() + $config = $this->get('doctrine') ->getRepository(ConfigEntity::class) ->findOneByUser($this->getUser()); diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 964e1e3e7..6f66a021c 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -40,7 +40,7 @@ class EntryController extends Controller */ public function massAction(Request $request) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $values = $request->request->all(); $tagsToAdd = []; @@ -173,7 +173,7 @@ class EntryController extends Controller $this->updateEntry($entry); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -201,7 +201,7 @@ class EntryController extends Controller if (false === $this->checkIfEntryAlreadyExists($entry)) { $this->updateEntry($entry); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -238,7 +238,7 @@ class EntryController extends Controller $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -409,7 +409,7 @@ class EntryController extends Controller return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); } - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -431,7 +431,7 @@ class EntryController extends Controller $this->checkUserAction($entry); $entry->toggleArchive(); - $this->getDoctrine()->getManager()->flush(); + $this->get('doctrine')->getManager()->flush(); $message = 'flashes.entry.notice.entry_unarchived'; if ($entry->isArchived()) { @@ -461,7 +461,7 @@ class EntryController extends Controller $entry->toggleStar(); $entry->updateStar($entry->isStarred()); - $this->getDoctrine()->getManager()->flush(); + $this->get('doctrine')->getManager()->flush(); $message = 'flashes.entry.notice.entry_unstarred'; if ($entry->isStarred()) { @@ -500,7 +500,7 @@ class EntryController extends Controller // entry deleted, dispatch event about it! $this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($entry); $em->flush(); @@ -532,7 +532,7 @@ class EntryController extends Controller if (null === $entry->getUid()) { $entry->generateUid(); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); } @@ -555,7 +555,7 @@ class EntryController extends Controller $entry->cleanUid(); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); diff --git a/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php b/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php index 22fbf5fa0..1414de8c1 100644 --- a/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php +++ b/src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php @@ -50,7 +50,7 @@ class IgnoreOriginInstanceRuleController extends Controller $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($ignoreOriginInstanceRule); $em->flush(); @@ -82,7 +82,7 @@ class IgnoreOriginInstanceRuleController extends Controller $editForm->handleRequest($request); if ($editForm->isSubmitted() && $editForm->isValid()) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($ignoreOriginInstanceRule); $em->flush(); @@ -119,7 +119,7 @@ class IgnoreOriginInstanceRuleController extends Controller $this->get(TranslatorInterface::class)->trans('flashes.ignore_origin_instance_rule.notice.deleted') ); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($ignoreOriginInstanceRule); $em->flush(); } diff --git a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php index 67b262947..e2b44e3eb 100644 --- a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php +++ b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php @@ -60,7 +60,7 @@ class SiteCredentialController extends Controller $credential->setUsername($this->get(CryptoProxy::class)->crypt($credential->getUsername())); $credential->setPassword($this->get(CryptoProxy::class)->crypt($credential->getPassword())); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($credential); $em->flush(); @@ -99,7 +99,7 @@ class SiteCredentialController extends Controller $siteCredential->setUsername($this->get(CryptoProxy::class)->crypt($siteCredential->getUsername())); $siteCredential->setPassword($this->get(CryptoProxy::class)->crypt($siteCredential->getPassword())); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($siteCredential); $em->flush(); @@ -140,7 +140,7 @@ class SiteCredentialController extends Controller $this->get(TranslatorInterface::class)->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()]) ); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($siteCredential); $em->flush(); } diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index b32f3ad31..53ce07c98 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -39,7 +39,7 @@ class TagController extends Controller $form->get('label')->getData() ); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->persist($entry); $em->flush(); @@ -67,7 +67,7 @@ class TagController extends Controller public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag) { $entry->removeTag($tag); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->flush(); // remove orphan tag in case no entries are associated to it @@ -188,7 +188,7 @@ class TagController extends Controller $entry->removeTag($tag); } - $this->getDoctrine()->getManager()->flush(); + $this->get('doctrine')->getManager()->flush(); $this->get(SessionInterface::class)->getFlashBag()->add( 'notice', @@ -212,7 +212,7 @@ class TagController extends Controller /** @var QueryBuilder $qb */ $qb = $this->get(EntryRepository::class)->getBuilderForSearchByUser($this->getUser()->getId(), $filter, $currentRoute); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $entries = $qb->getQuery()->getResult(); @@ -246,7 +246,7 @@ class TagController extends Controller // remove orphan tag in case no entries are associated to it if (0 === \count($tag->getEntries())) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($tag); $em->flush(); } diff --git a/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php b/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php index 9372a3639..dcaa32186 100644 --- a/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php +++ b/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php @@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Event\Listener; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; +use Wallabag\UserBundle\Entity\User; /** * Stores the locale of the user in the session after the login. @@ -25,6 +26,7 @@ class UserLocaleListener public function onInteractiveLogin(InteractiveLoginEvent $event) { $user = $event->getAuthenticationToken()->getUser(); + \assert($user instanceof User); if (null !== $user->getConfig()->getLanguage() && null === $this->session->get('_locale')) { $this->session->set('_locale', $user->getConfig()->getLanguage()); diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index 44448bfb7..6581a99fc 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -15,11 +15,12 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Wallabag\CoreBundle\Repository\EntryRepository; +use Wallabag\UserBundle\Entity\User; class EntryFilterType extends AbstractType { - private $user; private $repository; + private $tokenStorage; /** * Repository & user are used to get a list of language entries for this user. @@ -27,16 +28,15 @@ class EntryFilterType extends AbstractType public function __construct(EntryRepository $entryRepository, TokenStorageInterface $tokenStorage) { $this->repository = $entryRepository; - - $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; - - if (null === $this->user || !\is_object($this->user)) { - return; - } + $this->tokenStorage = $tokenStorage; } public function buildForm(FormBuilderInterface $builder, array $options) { + $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; + + \assert($user instanceof User); + $builder ->add('readingTime', NumberRangeFilterType::class, [ 'left_number_options' => [ @@ -47,17 +47,19 @@ class EntryFilterType extends AbstractType 'condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL, 'attr' => ['min' => 0], ], - 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { + 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) use ($user) { $lower = $values['value']['left_number'][0]; $upper = $values['value']['right_number'][0]; - $min = (int) ($lower * $this->user->getConfig()->getReadingSpeed() / 200); - $max = (int) ($upper * $this->user->getConfig()->getReadingSpeed() / 200); - if (null === $lower && null === $upper) { // no value? no filter return; - } elseif (null === $lower && null !== $upper) { + } + + $min = (int) ($lower * $user->getConfig()->getReadingSpeed() / 200); + $max = (int) ($upper * $user->getConfig()->getReadingSpeed() / 200); + + if (null === $lower && null !== $upper) { // only lower value is defined: query all entries with reading LOWER THAN this value $expression = $filterQuery->getExpr()->lte($field, $max); } elseif (null !== $lower && null === $upper) { @@ -176,7 +178,7 @@ class EntryFilterType extends AbstractType 'label' => 'entry.filters.is_public_label', ]) ->add('language', ChoiceFilterType::class, [ - 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), + 'choices' => array_flip($this->repository->findDistinctLanguageByUser($user->getId())), 'label' => 'entry.filters.language_label', ]) ; diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 30727ba1f..b39fcf257 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -21,11 +21,11 @@ class EntriesExport private $wallabagUrl; private $logoPath; private $translator; + private $tokenStorage; private $title = ''; private $entries = []; private $author = 'wallabag'; private $language = ''; - private $user; /** * @param TranslatorInterface $translator Translator service @@ -38,13 +38,7 @@ class EntriesExport $this->translator = $translator; $this->wallabagUrl = $wallabagUrl; $this->logoPath = $logoPath; - - /* @var User $user */ - $this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null; - - if (null === $this->user || !\is_object($this->user)) { - return; - } + $this->tokenStorage = $tokenStorage; } /** @@ -140,6 +134,9 @@ class EntriesExport */ private function produceEpub() { + $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; + \assert($user instanceof User); + /* * Start and End of the book */ @@ -213,7 +210,7 @@ class EntriesExport $publishedDate = $entry->getPublishedAt()->format('Y-m-d'); } - $readingTime = $entry->getReadingTime() / $this->user->getConfig()->getReadingSpeed() * 200; + $readingTime = $entry->getReadingTime() / $user->getConfig()->getReadingSpeed() * 200; $titlepage = $content_start . '

' . $entry->getTitle() . '

' . @@ -306,6 +303,9 @@ class EntriesExport */ private function producePdf() { + $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; + \assert($user instanceof User); + $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); /* @@ -331,7 +331,7 @@ class EntriesExport $authors = implode(',', $publishedBy); } - $readingTime = $entry->getReadingTime() / $this->user->getConfig()->getReadingSpeed() * 200; + $readingTime = $entry->getReadingTime() / $user->getConfig()->getReadingSpeed() * 200; $pdf->addPage(); $html = '

' . $entry->getTitle() . '

' . diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 48194c234..05241d67e 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php @@ -15,7 +15,7 @@ use Psr\Log\LoggerInterface; */ class HttpClientFactory implements ClientFactory { - /** @var [\GuzzleHttp\Event\SubscriberInterface] */ + /** @var SubscriberInterface[] */ private $subscribers = []; /** @var CookieJar */ diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php index fd946fd73..bb35066d3 100644 --- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php +++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php @@ -27,7 +27,7 @@ class PreparePagerForEntries $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; } - if (null === $user || !\is_object($user)) { + if (!$user instanceof User) { return; } diff --git a/src/Wallabag/CoreBundle/Helper/Redirect.php b/src/Wallabag/CoreBundle/Helper/Redirect.php index 8add7aa50..99bc192a6 100644 --- a/src/Wallabag/CoreBundle/Helper/Redirect.php +++ b/src/Wallabag/CoreBundle/Helper/Redirect.php @@ -5,6 +5,7 @@ namespace Wallabag\CoreBundle\Helper; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Wallabag\CoreBundle\Entity\Config; +use Wallabag\UserBundle\Entity\User; /** * Manage redirections to avoid redirecting to empty routes. @@ -31,7 +32,7 @@ class Redirect { $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; - if (null === $user || !\is_object($user)) { + if (!$user instanceof User) { return $url; } diff --git a/src/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverter.php b/src/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverter.php index b74881b91..28ca892ab 100644 --- a/src/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverter.php +++ b/src/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverter.php @@ -8,6 +8,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInte use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Wallabag\UserBundle\Entity\User; +use Wallabag\UserBundle\Repository\UserRepository; /** * ParamConverter used in the Feed controller to retrieve the right user according to @@ -76,6 +77,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface // Get actual entity manager for class $em = $this->registry->getManagerForClass($configuration->getClass()); + /** @var UserRepository $userRepository */ $userRepository = $em->getRepository($configuration->getClass()); // Try to find user by its username and config feed_token diff --git a/src/Wallabag/CoreBundle/Repository/ConfigRepository.php b/src/Wallabag/CoreBundle/Repository/ConfigRepository.php index c09aabd19..d438311bd 100644 --- a/src/Wallabag/CoreBundle/Repository/ConfigRepository.php +++ b/src/Wallabag/CoreBundle/Repository/ConfigRepository.php @@ -6,6 +6,9 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Wallabag\CoreBundle\Entity\Config; +/** + * @method Config|null findOneByUser(int $userId) + */ class ConfigRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 7cadb091a..a5d5fed5a 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -12,6 +12,10 @@ use Wallabag\CoreBundle\Entity\Entry; use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Helper\UrlHasher; +/** + * @method Entry[] findById(int $id) + * @method Entry|null findOneByUser(int $userId) + */ class EntryRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) diff --git a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php index 0c2ad6fb5..605e97e18 100644 --- a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php +++ b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php @@ -9,6 +9,8 @@ use Wallabag\CoreBundle\Helper\CryptoProxy; /** * SiteCredentialRepository. + * + * @method SiteCredential[] findByUser(int $userId) */ class SiteCredentialRepository extends ServiceEntityRepository { diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index ffa2c0b36..3e17e2e88 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -7,6 +7,10 @@ use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Wallabag\CoreBundle\Entity\Tag; +/** + * @method Tag|null findOneByLabel(string $label) + * @method Tag|null findOneBySlug(string $slug) + */ class TagRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php index 26635fba0..ca0cc9a55 100644 --- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php +++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php @@ -10,6 +10,7 @@ use Twig\TwigFilter; use Twig\TwigFunction; use Wallabag\CoreBundle\Repository\EntryRepository; use Wallabag\CoreBundle\Repository\TagRepository; +use Wallabag\UserBundle\Entity\User; class WallabagExtension extends AbstractExtension implements GlobalsInterface { @@ -81,7 +82,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface { $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; - if (null === $user || !\is_object($user)) { + if (!$user instanceof User) { return 0; } @@ -127,7 +128,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface { $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; - if (null === $user || !\is_object($user)) { + if (!$user instanceof User) { return 0; } @@ -143,7 +144,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface { $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; - if (null === $user || !\is_object($user)) { + if (!$user instanceof User) { return 0; } diff --git a/src/Wallabag/ImportBundle/Command/ImportCommand.php b/src/Wallabag/ImportBundle/Command/ImportCommand.php index 198ab6a72..8413a3c6c 100644 --- a/src/Wallabag/ImportBundle/Command/ImportCommand.php +++ b/src/Wallabag/ImportBundle/Command/ImportCommand.php @@ -112,5 +112,7 @@ class ImportCommand extends ContainerAwareCommand $em->clear(); $output->writeln('End : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---'); + + return 0; } } diff --git a/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php b/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php index 015824f99..d5f9d3338 100644 --- a/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php +++ b/src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php @@ -40,5 +40,7 @@ class RedisWorkerCommand extends ContainerAwareCommand ); $worker->start(); + + return 0; } } diff --git a/src/Wallabag/UserBundle/Controller/ManageController.php b/src/Wallabag/UserBundle/Controller/ManageController.php index 1d2bcbb40..72922b4eb 100644 --- a/src/Wallabag/UserBundle/Controller/ManageController.php +++ b/src/Wallabag/UserBundle/Controller/ManageController.php @@ -37,6 +37,7 @@ class ManageController extends Controller $userManager = $this->container->get(UserManagerInterface::class); $user = $userManager->createUser(); + \assert($user instanceof User); // enable created user by default $user->setEnabled(true); @@ -127,7 +128,7 @@ class ManageController extends Controller $this->get(TranslatorInterface::class)->trans('flashes.user.notice.deleted', ['%username%' => $user->getUsername()]) ); - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $em->remove($user); $em->flush(); } @@ -147,7 +148,7 @@ class ManageController extends Controller */ public function searchFormAction(Request $request, $page = 1) { - $em = $this->getDoctrine()->getManager(); + $em = $this->get('doctrine')->getManager(); $qb = $em->getRepository(User::class)->createQueryBuilder('u'); $form = $this->createForm(SearchUserType::class); diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php index b4333b993..9cafe5c55 100644 --- a/src/Wallabag/UserBundle/Repository/UserRepository.php +++ b/src/Wallabag/UserBundle/Repository/UserRepository.php @@ -7,6 +7,9 @@ use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ManagerRegistry; use Wallabag\UserBundle\Entity\User; +/** + * @method User|null findOneById(int $id) + */ class UserRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) diff --git a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php index d76475acc..dd6b768a1 100644 --- a/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php +++ b/tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php @@ -3,6 +3,8 @@ namespace Tests\Wallabag\AnnotationBundle; use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManager; +use FOS\UserBundle\Security\LoginManager; use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\Cookie; @@ -23,6 +25,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase protected function setUp(): void { + parent::setUp(); $this->client = $this->createAuthorizedClient(); } @@ -46,9 +49,9 @@ abstract class WallabagAnnotationTestCase extends WebTestCase $client = static::createClient(); $container = $client->getContainer(); - /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ + /** @var UserManager $userManager */ $userManager = $container->get('fos_user.user_manager.test'); - /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ + /** @var LoginManager $loginManager */ $loginManager = $container->get('fos_user.security.login_manager.test'); $firewallName = $container->getParameter('fos_user.firewall_name'); diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php index 20c6bcc2d..92594e41f 100644 --- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php +++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php @@ -4,6 +4,8 @@ namespace Tests\Wallabag\ApiBundle; use Doctrine\ORM\EntityManagerInterface; use FOS\UserBundle\Model\UserInterface; +use FOS\UserBundle\Model\UserManager; +use FOS\UserBundle\Security\LoginManager; use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\Cookie; @@ -25,6 +27,7 @@ abstract class WallabagApiTestCase extends WebTestCase protected function setUp(): void { + parent::setUp(); $this->client = $this->createAuthorizedClient(); } @@ -36,9 +39,9 @@ abstract class WallabagApiTestCase extends WebTestCase $client = static::createClient(); $container = $client->getContainer(); - /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ + /** @var UserManager $userManager */ $userManager = $container->get('fos_user.user_manager.test'); - /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ + /** @var LoginManager $loginManager */ $loginManager = $container->get('fos_user.security.login_manager.test'); $firewallName = $container->getParameter('fos_user.firewall_name'); diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 3a5450148..f56f6916d 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -895,6 +895,8 @@ class ConfigControllerTest extends WallabagCoreTestCase $user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser(); + \assert($user instanceof User); + $tag = new Tag(); $tag->setLabel('super'); $em->persist($tag); @@ -980,6 +982,8 @@ class ConfigControllerTest extends WallabagCoreTestCase $user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser(); + \assert($user instanceof User); + $tag = new Tag(); $tag->setLabel('super'); $em->persist($tag); @@ -1056,6 +1060,8 @@ class ConfigControllerTest extends WallabagCoreTestCase $user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser(); + \assert($user instanceof User); + $tag = new Tag(); $tag->setLabel('super'); $em->persist($tag); diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php index 22b9480d0..780eeddac 100644 --- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php +++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php @@ -18,6 +18,9 @@ class RedirectTest extends TestCase /** @var Redirect */ private $redirect; + /** @var User */ + private $user; + /** @var UsernamePasswordToken */ private $token; @@ -32,24 +35,24 @@ class RedirectTest extends TestCase ->with('homepage') ->willReturn('homepage'); - $user = new User(); - $user->setName('youpi'); - $user->setEmail('youpi@youpi.org'); - $user->setUsername('youpi'); - $user->setPlainPassword('youpi'); - $user->setEnabled(true); - $user->addRole('ROLE_SUPER_ADMIN'); + $this->user = new User(); + $this->user->setName('youpi'); + $this->user->setEmail('youpi@youpi.org'); + $this->user->setUsername('youpi'); + $this->user->setPlainPassword('youpi'); + $this->user->setEnabled(true); + $this->user->addRole('ROLE_SUPER_ADMIN'); - $config = new Config($user); + $config = new Config($this->user); $config->setItemsPerPage(30); $config->setReadingSpeed(200); $config->setLanguage('en'); $config->setPocketConsumerKey('xxxxx'); $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE); - $user->setConfig($config); + $this->user->setConfig($config); - $this->token = new UsernamePasswordToken($user, 'password', 'key'); + $this->token = new UsernamePasswordToken($this->user, 'password', 'key'); $tokenStorage = new TokenStorage(); $tokenStorage->setToken($this->token); @@ -87,7 +90,7 @@ class RedirectTest extends TestCase public function testUserForRedirectToHomepage() { - $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); + $this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); $redirectUrl = $this->redirect->to('/unread/list'); @@ -96,7 +99,7 @@ class RedirectTest extends TestCase public function testUserForRedirectWithIgnoreActionMarkAsRead() { - $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); + $this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); $redirectUrl = $this->redirect->to('/unread/list', '', true); @@ -105,7 +108,7 @@ class RedirectTest extends TestCase public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead() { - $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); + $this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); $redirectUrl = $this->redirect->to(null, 'fallback', true);