mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-22 07:36:33 +00:00
Add ObjectManagedLoader for PHPStan
This commit is contained in:
parent
f272481ec4
commit
2149ef4510
10 changed files with 56 additions and 52 deletions
6
.github/workflows/coding-standards.yml
vendored
6
.github/workflows/coding-standards.yml
vendored
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
*/
|
||||
|
|
|
@ -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)
|
||||
*
|
||||
|
|
|
@ -44,7 +44,7 @@ class TaggingRule implements RuleInterface
|
|||
private $rule;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array<string>
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
* @ORM\Column(name="tags", type="simple_array", nullable=false)
|
||||
|
|
|
@ -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<Entry>
|
||||
* @return ArrayCollection<Client>
|
||||
*/
|
||||
public function getClients()
|
||||
{
|
||||
|
|
13
tests/object-manager.php
Normal file
13
tests/object-manager.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Required for PHPStan.
|
||||
*
|
||||
* @see https://github.com/phpstan/phpstan-doctrine#configuration
|
||||
*/
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$kernel = new AppKernel('test', true);
|
||||
$kernel->boot();
|
||||
|
||||
return $kernel->getContainer()->get('doctrine')->getManager();
|
Loading…
Reference in a new issue