Skip to content

Commit

Permalink
ISSUE-337: fix phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
tatevikg1 committed Dec 10, 2024
1 parent 822d258 commit 43fb174
Show file tree
Hide file tree
Showing 20 changed files with 178 additions and 127 deletions.
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@
"symfony/test-pack": "^1.1",
"symfony/process": "^6.4",
"composer/composer": "^2.7",
"symfony/symfony": "^6.4"
"symfony/framework-bundle": "^6.4",
"symfony/http-kernel": "^6.4",
"symfony/http-foundation": "^6.4",
"symfony/routing": "^6.4",
"symfony/console": "^6.4"
},
"suggest": {
"phplist/web-frontend": "5.0.x-dev",
Expand Down
20 changes: 10 additions & 10 deletions src/Domain/Model/Identity/Administrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@
*
* @author Oliver Klee <[email protected]>
*/
#[ORM\Entity(repositoryClass: "PhpList\Core\Domain\Repository\Identity\AdministratorRepository")]
#[ORM\Table(name: "phplist_admin")]
#[ORM\Entity(repositoryClass: 'PhpList\Core\Domain\Repository\Identity\AdministratorRepository')]
#[ORM\Table(name: 'phplist_admin')]
#[ORM\HasLifecycleCallbacks]
class Administrator implements DomainModel, Identity, CreationDate, ModificationDate
{
use IdentityTrait;
use CreationDateTrait;
use ModificationDateTrait;

#[ORM\Column(name: "loginname")]
#[ORM\Column(name: 'loginname')]
private string $loginName;

#[ORM\Column(name: "email")]
#[ORM\Column(name: 'email')]
private string $emailAddress;

#[ORM\Column(name: "created", type: "datetime")]
#[ORM\Column(name: 'created', type: 'datetime')]
protected ?DateTime $creationDate = null;

#[ORM\Column(name: "modified", type: "datetime")]
#[ORM\Column(name: 'modified', type: 'datetime')]
protected ?DateTime $modificationDate;

#[ORM\Column(name: "password")]
#[ORM\Column(name: 'password')]
private string $passwordHash;

#[ORM\Column(name: "passwordchanged", type: "date", nullable: true)]
#[ORM\Column(name: 'passwordchanged', type: 'date', nullable: true)]
private ?DateTime $passwordChangeDate;

#[ORM\Column(type: "boolean")]
#[ORM\Column(type: 'boolean')]
private bool $disabled;

#[ORM\Column(name: "superuser", type: "boolean")]
#[ORM\Column(name: 'superuser', type: 'boolean')]
private bool $superUser;

public function __construct()
Expand Down
18 changes: 9 additions & 9 deletions src/Domain/Model/Identity/AdministratorToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@
* This class represents an API authentication token for an administrator.
* @author Oliver Klee <[email protected]>
*/
#[ORM\Entity(repositoryClass: "PhpList\Core\Domain\Repository\Identity\AdministratorTokenRepository")]
#[ORM\Table(name: "phplist_admintoken")]
#[ORM\Entity(repositoryClass: 'PhpList\Core\Domain\Repository\Identity\AdministratorTokenRepository')]
#[ORM\Table(name: 'phplist_admintoken')]
#[ORM\HasLifecycleCallbacks]
class AdministratorToken implements DomainModel, Identity, CreationDate
{
use IdentityTrait;

public const DEFAULT_EXPIRY = '+1 hour';

#[ORM\Column(name: "entered", type: "integer")]
#[ORM\Column(name: 'entered', type: 'integer')]
#[Ignore]
protected int $creationDate = 0;

#[ORM\Column(name: "expires", type: "datetime")]
#[SerializedName("expiry_date")]
#[ORM\Column(name: 'expires', type: 'datetime')]
#[SerializedName('expiry_date')]
private ?DateTime $expiry = null;

#[ORM\Column(name: "value")]
#[SerializedName("key")]
#[ORM\Column(name: 'value')]
#[SerializedName('key')]
private string $key = '';

#[ORM\ManyToOne(targetEntity: "PhpList\Core\Domain\Model\Identity\Administrator")]
#[ORM\JoinColumn(name: "adminid")]
#[ORM\ManyToOne(targetEntity: 'PhpList\Core\Domain\Model\Identity\Administrator')]
#[ORM\JoinColumn(name: 'adminid')]
#[Ignore]
private ?Administrator $administrator = null;

Expand Down
42 changes: 21 additions & 21 deletions src/Domain/Model/Messaging/SubscriberList.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
* selected lists (as the owner), send campaigns to these lists and edit subscribers.
* @author Oliver Klee <[email protected]>
*/
#[ORM\Entity(repositoryClass: "PhpList\Core\Domain\Repository\Messaging\SubscriberListRepository")]
#[ORM\Table(name: "phplist_list")]
#[ORM\Index(name: "nameidx", columns: ["name"])]
#[ORM\Index(name: "listorderidx", columns: ["listorder"])]
#[ORM\Entity(repositoryClass: 'PhpList\Core\Domain\Repository\Messaging\SubscriberListRepository')]
#[ORM\Table(name: 'phplist_list')]
#[ORM\Index(name: 'nameidx', columns: ['name'])]
#[ORM\Index(name: 'listorderidx', columns: ['listorder'])]
#[ORM\HasLifecycleCallbacks]
class SubscriberList implements DomainModel, Identity, CreationDate, ModificationDate
{
Expand All @@ -39,53 +39,53 @@ class SubscriberList implements DomainModel, Identity, CreationDate, Modificatio
use ModificationDateTrait;

#[ORM\Column]
#[SerializedName("name")]
#[SerializedName('name')]
#[Groups(['SubscriberList'])]
private string $name = '';

#[ORM\Column]
#[SerializedName("description")]
#[SerializedName('description')]
#[Groups(['SubscriberList'])]
private string $description = '';

#[ORM\Column(name: "entered", type: "datetime", nullable: true)]
#[SerializedName("creation_date")]
#[ORM\Column(name: 'entered', type: 'datetime', nullable: true)]
#[SerializedName('creation_date')]
#[Groups(['SubscriberList'])]
protected ?DateTime $creationDate = null;

#[ORM\Column(name: "modified", type: "datetime")]
#[ORM\Column(name: 'modified', type: 'datetime')]
#[Ignore]
protected ?DateTime $modificationDate = null;

#[ORM\Column(name: "listorder", type: "integer")]
#[SerializedName("list_position")]
#[ORM\Column(name: 'listorder', type: 'integer')]
#[SerializedName('list_position')]
#[Groups(['SubscriberList'])]
private ?int $listPosition;

#[ORM\Column(name: "prefix")]
#[SerializedName("subject_prefix")]
#[ORM\Column(name: 'prefix')]
#[SerializedName('subject_prefix')]
#[Groups(['SubscriberList'])]
private ?string $subjectPrefix;

#[ORM\Column(name: "active", type: "boolean")]
#[SerializedName("public")]
#[ORM\Column(name: 'active', type: 'boolean')]
#[SerializedName('public')]
#[Groups(['SubscriberList'])]
private bool $public;

#[ORM\Column]
#[SerializedName("category")]
#[SerializedName('category')]
#[Groups(['SubscriberList'])]
private string $category;

#[ORM\ManyToOne(targetEntity: "PhpList\Core\Domain\Model\Identity\Administrator")]
#[ORM\JoinColumn(name: "owner")]
#[ORM\ManyToOne(targetEntity: 'PhpList\Core\Domain\Model\Identity\Administrator')]
#[ORM\JoinColumn(name: 'owner')]
#[Ignore]
private ?Administrator $owner = null;

#[ORM\OneToMany(
targetEntity: "PhpList\Core\Domain\Model\Subscription\Subscription",
mappedBy: "subscriberList",
cascade: ["remove"],
targetEntity: 'PhpList\Core\Domain\Model\Subscription\Subscription',
mappedBy: 'subscriberList',
cascade: ['remove'],
orphanRemoval: true,
)]
#[MaxDepth(1)]
Expand Down
54 changes: 27 additions & 27 deletions src/Domain/Model/Subscription/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,71 +24,71 @@
* campaigns for those subscriber lists.
* @author Oliver Klee <[email protected]>
*/
#[ORM\Entity(repositoryClass: "PhpList\Core\Domain\Repository\Subscription\SubscriberRepository")]
#[ORM\Table(name: "phplist_user_user")]
#[ORM\Index(name: "idxuniqid", columns: ["uniqid"])]
#[ORM\Index(name: "enteredindex", columns: ["entered"])]
#[ORM\Index(name: "confidx", columns: ["confirmed"])]
#[ORM\Index(name: "blidx", columns: ["blacklisted"])]
#[ORM\Entity(repositoryClass: 'PhpList\Core\Domain\Repository\Subscription\SubscriberRepository')]
#[ORM\Table(name: 'phplist_user_user')]
#[ORM\Index(name: 'idxuniqid', columns: ['uniqid'])]
#[ORM\Index(name: 'enteredindex', columns: ['entered'])]
#[ORM\Index(name: 'confidx', columns: ['confirmed'])]
#[ORM\Index(name: 'blidx', columns: ['blacklisted'])]
#[ORM\HasLifecycleCallbacks]
class Subscriber implements DomainModel, Identity, CreationDate, ModificationDate
{
use IdentityTrait;
use CreationDateTrait;
use ModificationDateTrait;

#[ORM\Column(name: "entered", type: "datetime", nullable: true)]
#[SerializedName("creation_date")]
#[ORM\Column(name: 'entered', type: 'datetime', nullable: true)]
#[SerializedName('creation_date')]
#[Groups(['SubscriberListMembers'])]
protected ?DateTime $creationDate = null;

#[ORM\Column(name: "modified", type: "datetime")]
#[ORM\Column(name: 'modified', type: 'datetime')]
#[Ignore]
protected ?DateTime $modificationDate = null;

#[ORM\Column(unique: true)]
#[SerializedName("email")]
#[SerializedName('email')]
#[Groups(['SubscriberListMembers'])]
private string $email = '';

#[ORM\Column(type: "boolean")]
#[SerializedName("confirmed")]
#[ORM\Column(type: 'boolean')]
#[SerializedName('confirmed')]
#[Groups(['SubscriberListMembers'])]
private bool $confirmed = false;

#[ORM\Column(type: "boolean")]
#[SerializedName("blacklisted")]
#[ORM\Column(type: 'boolean')]
#[SerializedName('blacklisted')]
#[Groups(['SubscriberListMembers'])]
private bool $blacklisted = false;

#[ORM\Column(name: "bouncecount", type: "integer")]
#[SerializedName("bounce_count")]
#[ORM\Column(name: 'bouncecount', type: 'integer')]
#[SerializedName('bounce_count')]
#[Groups(['SubscriberListMembers'])]
private int $bounceCount = 0;

#[ORM\Column(name: "uniqid", unique: true)]
#[SerializedName("unique_id")]
#[ORM\Column(name: 'uniqid', unique: true)]
#[SerializedName('unique_id')]
#[Groups(['SubscriberListMembers'])]
private string $uniqueId = '';

#[ORM\Column(name: "htmlemail", type: "boolean")]
#[SerializedName("html_email")]
#[ORM\Column(name: 'htmlemail', type: 'boolean')]
#[SerializedName('html_email')]
#[Groups(['SubscriberListMembers'])]
private bool $htmlEmail = false;

#[ORM\Column(type: "boolean")]
#[SerializedName("disabled")]
#[ORM\Column(type: 'boolean')]
#[SerializedName('disabled')]
#[Groups(['SubscriberListMembers'])]
private bool $disabled = false;

#[ORM\Column(name: "extradata", type: "text")]
#[SerializedName("extra_data")]
#[ORM\Column(name: 'extradata', type: 'text')]
#[SerializedName('extra_data')]
private ?string $extraData;

#[ORM\OneToMany(
targetEntity: "PhpList\Core\Domain\Model\Subscription\Subscription",
mappedBy: "subscriber",
cascade: ["remove"],
targetEntity: 'PhpList\Core\Domain\Model\Subscription\Subscription',
mappedBy: 'subscriber',
cascade: ['remove'],
orphanRemoval: true,
)]
private Collection $subscriptions;
Expand Down
32 changes: 16 additions & 16 deletions src/Domain/Model/Subscription/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,41 @@
* campaigns for those subscriber lists.
* @author Oliver Klee <[email protected]>
*/
#[ORM\Entity(repositoryClass: "PhpList\Core\Domain\Repository\Subscription\SubscriptionRepository")]
#[ORM\Table(name: "phplist_listuser")]
#[ORM\Index(name: "userenteredidx", columns: ["userid", "entered"])]
#[ORM\Index(name: "userlistenteredidx", columns: ["userid", "entered", "listid"])]
#[ORM\Index(name: "useridx", columns: ["userid"])]
#[ORM\Index(name: "listidx", columns: ["listid"])]
#[ORM\Entity(repositoryClass: 'PhpList\Core\Domain\Repository\Subscription\SubscriptionRepository')]
#[ORM\Table(name: 'phplist_listuser')]
#[ORM\Index(name: 'userenteredidx', columns: ['userid', 'entered'])]
#[ORM\Index(name: 'userlistenteredidx', columns: ['userid', 'entered', 'listid'])]
#[ORM\Index(name: 'useridx', columns: ['userid'])]
#[ORM\Index(name: 'listidx', columns: ['listid'])]
#[ORM\HasLifecycleCallbacks]
class Subscription implements DomainModel, CreationDate, ModificationDate
{
use CreationDateTrait;
use ModificationDateTrait;

#[ORM\Column(name: "entered", type: "datetime", nullable: true)]
#[SerializedName("creation_date")]
#[ORM\Column(name: 'entered', type: 'datetime', nullable: true)]
#[SerializedName('creation_date')]
protected ?DateTime $creationDate = null;

#[ORM\Column(name: "modified", type: "datetime")]
#[ORM\Column(name: 'modified', type: 'datetime')]
#[Ignore]
protected ?DateTime $modificationDate = null;

#[ORM\Id]
#[ORM\ManyToOne(
targetEntity: "PhpList\Core\Domain\Model\Subscription\Subscriber",
inversedBy: "subscriptions"
targetEntity: 'PhpList\Core\Domain\Model\Subscription\Subscriber',
inversedBy: 'subscriptions'
)]
#[ORM\JoinColumn(name: "userid")]
#[SerializedName("subscriber")]
#[ORM\JoinColumn(name: 'userid')]
#[SerializedName('subscriber')]
private ?Subscriber $subscriber = null;

#[ORM\Id]
#[ORM\ManyToOne(
targetEntity: "PhpList\Core\Domain\Model\Messaging\SubscriberList",
inversedBy: "subscriptions"
targetEntity: 'PhpList\Core\Domain\Model\Messaging\SubscriberList',
inversedBy: 'subscriptions'
)]
#[ORM\JoinColumn(name: "listid", onDelete: "CASCADE")]
#[ORM\JoinColumn(name: 'listid', onDelete: 'CASCADE')]
#[Ignore]
private ?SubscriberList $subscriberList = null;

Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Model/Traits/IdentityTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
trait IdentityTrait
{
#[ORM\Id]
#[ORM\Column(type: "integer")]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue]
#[SerializedName("id")]
#[SerializedName('id')]
#[Groups(['SubscriberList', 'SubscriberListMembers'])]
private int $id;

Expand Down
3 changes: 1 addition & 2 deletions src/Domain/Repository/Messaging/SubscriberListRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function findWithSubscription($id)
->where('sl.id = :id')
->setParameter('id', $id)
->getQuery()
->getOneOrNullResult()
;
->getOneOrNullResult();
}
}
8 changes: 7 additions & 1 deletion src/TestingSupport/Traits/DatabaseTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ protected function tearDownDatabaseTest(): void

/**
* Initializes the Bootstrap and Doctrine EntityManager.
*
* @throws RuntimeException
*/
private function initializeBootstrap(): void
{
Expand All @@ -60,6 +62,7 @@ private function initializeBootstrap(): void
* Loads data fixtures into the database.
*
* @param array $fixtures List of fixture classes to load
* @throws InvalidArgumentException
*/
protected function loadFixtures(array $fixtures): void
{
Expand Down Expand Up @@ -89,7 +92,10 @@ protected function loadSchema(): void
if (!$schemaManager->tablesExist([$tableName])) {
try {
$schemaTool->createSchema([$classMetadata]);
} catch (ToolsException $e){}
} catch (ToolsException $e) {
// nothing to do
echo $e->getMessage();
}
}
}
}
Expand Down
Loading

0 comments on commit 43fb174

Please sign in to comment.