From f272481ec43f9a474c3fc19abfdfc9c3a909bd22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Nov 2023 03:49:55 +0000 Subject: [PATCH 1/2] Bump doctrine/orm from 2.16.2 to 2.17.0 Bumps [doctrine/orm](https://github.com/doctrine/orm) from 2.16.2 to 2.17.0. - [Release notes](https://github.com/doctrine/orm/releases) - [Commits](https://github.com/doctrine/orm/compare/2.16.2...2.17.0) --- updated-dependencies: - dependency-name: doctrine/orm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 89c160cce..a623d43d8 100644 --- a/composer.lock +++ b/composer.lock @@ -1709,16 +1709,16 @@ }, { "name": "doctrine/orm", - "version": "2.16.2", + "version": "2.17.0", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "17500f56eaa930f5cd14d765bc2cd851c7d37cc0" + "reference": "e8afa9f80ce66ac728f63325d102adda01cbd6ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/17500f56eaa930f5cd14d765bc2cd851c7d37cc0", - "reference": "17500f56eaa930f5cd14d765bc2cd851c7d37cc0", + "url": "https://api.github.com/repos/doctrine/orm/zipball/e8afa9f80ce66ac728f63325d102adda01cbd6ff", + "reference": "e8afa9f80ce66ac728f63325d102adda01cbd6ff", "shasum": "" }, "require": { @@ -1736,7 +1736,7 @@ "ext-ctype": "*", "php": "^7.1 || ^8.0", "psr/cache": "^1 || ^2 || ^3", - "symfony/console": "^4.2 || ^5.0 || ^6.0", + "symfony/console": "^4.2 || ^5.0 || ^6.0 || ^7.0", "symfony/polyfill-php72": "^1.23", "symfony/polyfill-php80": "^1.16" }, @@ -1747,14 +1747,14 @@ "doctrine/annotations": "^1.13 || ^2", "doctrine/coding-standard": "^9.0.2 || ^12.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.28", + "phpstan/phpstan": "~1.4.10 || 1.10.35", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.30.0 || 5.14.1" + "vimeo/psalm": "4.30.0 || 5.15.0" }, "suggest": { "ext-dom": "Provides support for XSD validation for XML mapping files", @@ -1804,9 +1804,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.16.2" + "source": "https://github.com/doctrine/orm/tree/2.17.0" }, - "time": "2023-08-27T18:21:56+00:00" + "time": "2023-11-15T23:04:41+00:00" }, { "name": "doctrine/persistence", From 2149ef45106866aac6fc6f152d511f51a63025d1 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 16 Nov 2023 09:36:47 +0100 Subject: [PATCH 2/2] Add ObjectManagedLoader for PHPStan --- .github/workflows/coding-standards.yml | 6 ++++ phpstan.neon | 3 ++ src/Wallabag/ApiBundle/Entity/AccessToken.php | 6 ---- src/Wallabag/ApiBundle/Entity/AuthCode.php | 6 ---- .../ApiBundle/Entity/RefreshToken.php | 6 ---- src/Wallabag/CoreBundle/Entity/Config.php | 24 ++++++------- src/Wallabag/CoreBundle/Entity/Entry.php | 34 +++++++++---------- .../CoreBundle/Entity/TaggingRule.php | 2 +- src/Wallabag/UserBundle/Entity/User.php | 8 ++--- tests/object-manager.php | 13 +++++++ 10 files changed, 56 insertions(+), 52 deletions(-) create mode 100644 tests/object-manager.php diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index fe7e65765..31e3bdd61 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -30,6 +30,12 @@ jobs: env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: "Setup MySQL" + run: | + sudo systemctl start mysql.service + sudo mysql -u root -proot -h 127.0.0.1 -e "CREATE DATABASE wallabag_test" + cp app/config/tests/parameters_test.mysql.yml app/config/parameters_test.yml + - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v2" with: diff --git a/phpstan.neon b/phpstan.neon index 843528b11..153f1d788 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,6 +10,9 @@ parameters: symfony: container_xml_path: %rootDir%/../../../var/cache/test/appAppKernelTestDebugContainer.xml + doctrine: + objectManagerLoader: tests/object-manager.php + bootstrapFiles: - vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php diff --git a/src/Wallabag/ApiBundle/Entity/AccessToken.php b/src/Wallabag/ApiBundle/Entity/AccessToken.php index 49e21bef4..98e0af3e1 100644 --- a/src/Wallabag/ApiBundle/Entity/AccessToken.php +++ b/src/Wallabag/ApiBundle/Entity/AccessToken.php @@ -4,8 +4,6 @@ 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") @@ -39,16 +37,12 @@ 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 33b4c94bb..7c9c85396 100644 --- a/src/Wallabag/ApiBundle/Entity/AuthCode.php +++ b/src/Wallabag/ApiBundle/Entity/AuthCode.php @@ -4,8 +4,6 @@ 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") @@ -39,16 +37,12 @@ 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 b013f0254..55a507e13 100644 --- a/src/Wallabag/ApiBundle/Entity/RefreshToken.php +++ b/src/Wallabag/ApiBundle/Entity/RefreshToken.php @@ -4,8 +4,6 @@ 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") @@ -39,16 +37,12 @@ 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/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index 9d020814b..dfbf0414e 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -61,7 +61,7 @@ class Config private $language; /** - * @var string + * @var string|null * * @ORM\Column(name="feed_token", type="string", nullable=true) * @@ -70,7 +70,7 @@ class Config private $feedToken; /** - * @var int + * @var int|null * * @ORM\Column(name="feed_limit", type="integer", nullable=true) * @Assert\Range( @@ -84,7 +84,7 @@ class Config private $feedLimit; /** - * @var float + * @var float|null * * @ORM\Column(name="reading_speed", type="float", nullable=true) * @@ -93,14 +93,14 @@ class Config private $readingSpeed; /** - * @var string + * @var string|null * * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true) */ private $pocketConsumerKey; /** - * @var int + * @var int|null * * @ORM\Column(name="action_mark_as_read", type="integer", nullable=true, options={"default" = 0}) * @@ -109,7 +109,7 @@ class Config private $actionMarkAsRead; /** - * @var int + * @var int|null * * @ORM\Column(name="list_mode", type="integer", nullable=true) * @@ -118,7 +118,7 @@ class Config private $listMode; /** - * @var int + * @var int|null * * @ORM\Column(name="display_thumbnails", type="integer", nullable=true, options={"default" = 1}) * @@ -127,7 +127,7 @@ class Config private $displayThumbnails; /** - * @var string + * @var string|null * * @ORM\Column(name="font", type="text", nullable=true) * @@ -136,7 +136,7 @@ class Config private $font; /** - * @var float + * @var float|null * * @ORM\Column(name="fontsize", type="float", nullable=true) * @@ -145,7 +145,7 @@ class Config private $fontsize; /** - * @var float + * @var float|null * * @ORM\Column(name="line_height", type="float", nullable=true) * @@ -154,7 +154,7 @@ class Config private $lineHeight; /** - * @var float + * @var float|null * * @ORM\Column(name="max_width", type="float", nullable=true) * @@ -163,7 +163,7 @@ class Config private $maxWidth; /** - * @var string + * @var string|null * * @ORM\Column(name="custom_css", type="text", nullable=true) */ diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index d17052727..35fabf6df 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -64,7 +64,7 @@ class Entry private $uid; /** - * @var string + * @var string|null * * @ORM\Column(name="title", type="text", nullable=true) * @@ -75,7 +75,7 @@ class Entry /** * Define the url fetched by wallabag (the final url after potential redirections). * - * @var string + * @var string|null * * @Assert\NotBlank() * @ORM\Column(name="url", type="text", nullable=true) @@ -85,7 +85,7 @@ class Entry private $url; /** - * @var string + * @var string|null * * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true) */ @@ -94,7 +94,7 @@ class Entry /** * From where user retrieved/found the url (an other article, a twitter, or the given_url if non are provided). * - * @var string + * @var string|null * * @ORM\Column(name="origin_url", type="text", nullable=true) * @@ -105,7 +105,7 @@ class Entry /** * Define the url entered by the user (without redirections). * - * @var string + * @var string|null * * @ORM\Column(name="given_url", type="text", nullable=true) * @@ -114,7 +114,7 @@ class Entry private $givenUrl; /** - * @var string + * @var string|null * * @ORM\Column(name="hashed_given_url", type="string", length=40, nullable=true) */ @@ -132,7 +132,7 @@ class Entry private $isArchived = false; /** - * @var \DateTimeInterface + * @var \DateTimeInterface|null * * @ORM\Column(name="archived_at", type="datetime", nullable=true) * @@ -152,7 +152,7 @@ class Entry private $isStarred = false; /** - * @var string + * @var string|null * * @ORM\Column(name="content", type="text", nullable=true) * @@ -179,7 +179,7 @@ class Entry private $updatedAt; /** - * @var \DateTimeInterface + * @var \DateTimeInterface|null * * @ORM\Column(name="published_at", type="datetime", nullable=true) * @@ -188,7 +188,7 @@ class Entry private $publishedAt; /** - * @var array + * @var array|null * * @ORM\Column(name="published_by", type="array", nullable=true) * @@ -197,7 +197,7 @@ class Entry private $publishedBy; /** - * @var \DateTimeInterface + * @var \DateTimeInterface|null * * @ORM\Column(name="starred_at", type="datetime", nullable=true) * @@ -214,7 +214,7 @@ class Entry private $annotations; /** - * @var string + * @var string|null * * @ORM\Column(name="mimetype", type="text", nullable=true) * @@ -223,7 +223,7 @@ class Entry private $mimetype; /** - * @var string + * @var string|null * * @ORM\Column(name="language", type="string", length=20, nullable=true) * @@ -241,7 +241,7 @@ class Entry private $readingTime = 0; /** - * @var string + * @var string|null * * @ORM\Column(name="domain_name", type="text", nullable=true) * @@ -250,7 +250,7 @@ class Entry private $domainName; /** - * @var string + * @var string|null * * @ORM\Column(name="preview_picture", type="text", nullable=true) * @@ -259,7 +259,7 @@ class Entry private $previewPicture; /** - * @var string + * @var string|null * * @ORM\Column(name="http_status", type="string", length=3, nullable=true) * @@ -268,7 +268,7 @@ class Entry private $httpStatus; /** - * @var array + * @var array|null * * @ORM\Column(name="headers", type="array", nullable=true) * diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php index 7bed7a691..dba6a1410 100644 --- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php +++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php @@ -44,7 +44,7 @@ class TaggingRule implements RuleInterface private $rule; /** - * @var array + * @var array * * @Assert\NotBlank() * @ORM\Column(name="tags", type="simple_array", nullable=false) diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 9d05929e8..6c27c46b6 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php @@ -53,7 +53,7 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI protected $id; /** - * @var string + * @var string|null * * @ORM\Column(name="name", type="text", nullable=true) * @@ -134,14 +134,14 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI protected $config; /** - * @var ArrayCollection + * @var ArrayCollection&iterable<\Wallabag\CoreBundle\Entity\SiteCredential> * * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\SiteCredential", mappedBy="user", cascade={"remove"}) */ protected $siteCredentials; /** - * @var ArrayCollection + * @var ArrayCollection&iterable<\Wallabag\ApiBundle\Entity\Client> * * @ORM\OneToMany(targetEntity="Wallabag\ApiBundle\Entity\Client", mappedBy="user", cascade={"remove"}) */ @@ -402,7 +402,7 @@ class User extends BaseUser implements EmailTwoFactorInterface, GoogleTwoFactorI } /** - * @return ArrayCollection + * @return ArrayCollection */ public function getClients() { diff --git a/tests/object-manager.php b/tests/object-manager.php new file mode 100644 index 000000000..8d7c9cd4f --- /dev/null +++ b/tests/object-manager.php @@ -0,0 +1,13 @@ +boot(); + +return $kernel->getContainer()->get('doctrine')->getManager();