Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Coderberg committed Aug 11, 2023
1 parent a08a8a4 commit 49d7ab6
Show file tree
Hide file tree
Showing 17 changed files with 44 additions and 49 deletions.
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$rectorConfig->sets([
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
SymfonySetList::SYMFONY_62,
SensiolabsSetList::FRAMEWORK_EXTRA_61,
LevelSetList::UP_TO_PHP_81,
SetList::CODE_QUALITY,
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/City.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class City
private $metro_stations;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $title;
private ?string $title = null;

public function __construct()
{
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ class Currency
use EntityIdTrait;

#[ORM\Column(type: Types::STRING, length: 32)]
private ?string $currency_title;
private ?string $currency_title = null;

#[ORM\Column(type: Types::STRING, length: 3)]
private ?string $code;
private ?string $code = null;

#[ORM\Column(type: Types::STRING, length: 12, nullable: true)]
private ?string $symbol_left;
private ?string $symbol_left = null;

#[ORM\Column(type: Types::STRING, length: 12, nullable: true)]
private ?string $symbol_right;
private ?string $symbol_right = null;

public function getCurrencyTitle(): ?string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class Feature
use EntityIdTrait;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $name;
private ?string $name = null;

#[ORM\ManyToMany(targetEntity: Property::class, mappedBy: 'features')]
private $properties;

#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $icon;
private ?string $icon = null;

public function __construct()
{
Expand Down
10 changes: 5 additions & 5 deletions src/Entity/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ class Menu
use EntityIdTrait;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $title;
private ?string $title = null;

#[ORM\Column(type: Types::STRING, length: 2)]
private string $locale;

#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $sort_order;
private ?int $sort_order = null;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $url;
private ?string $url = null;

#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $nofollow;
private ?bool $nofollow = null;

#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
private ?bool $new_tab;
private ?bool $new_tab = null;

public function getTitle(): ?string
{
Expand Down
14 changes: 7 additions & 7 deletions src/Entity/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ class Page
use EntityIdTrait;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $title;
private ?string $title = null;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $description;
private ?string $description = null;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $slug;
private ?string $slug = null;

#[ORM\Column(type: Types::STRING, length: 2, options: ['default' => 'en'])]
private string $locale;

#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $content;
private ?string $content = null;

#[ORM\Column(type: Types::BOOLEAN)]
private ?bool $show_in_menu;
private ?bool $show_in_menu = null;

#[ORM\Column(type: Types::BOOLEAN)]
private ?bool $add_contact_form;
private ?bool $add_contact_form = null;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
#[Assert\Email]
private ?string $contact_email_address;
private ?string $contact_email_address = null;

public function getTitle(): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Photo
private $photo;

#[ORM\Column(type: Types::INTEGER, nullable: true)]
private ?int $sort_order;
private ?int $sort_order = null;

public function getProperty(): ?Property
{
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class Profile
use EntityIdTrait;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $full_name;
private ?string $full_name = null;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $phone;
private ?string $phone = null;

#[ORM\OneToOne(inversedBy: 'profile', targetEntity: User::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/PropertyDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class PropertyDescription
use EntityMetaTrait;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $title;
private ?string $title = null;

#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $content;
private ?string $content = null;

#[ORM\OneToOne(inversedBy: 'propertyDescription', targetEntity: Property::class, cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class Settings
use EntityIdTrait;

#[ORM\Column(type: Types::STRING, length: 191, unique: true)]
private ?string $setting_name;
private ?string $setting_name = null;

#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $setting_value;
private ?string $setting_value = null;

public function getSettingName(): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Traits/EntityIdTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait EntityIdTrait
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id;
private ?int $id = null;

public function getId(): ?int
{
Expand Down
12 changes: 6 additions & 6 deletions src/Entity/Traits/EntityLocationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ trait EntityLocationTrait
{
#[ORM\ManyToOne(targetEntity: District::class, inversedBy: 'properties')]
#[ORM\JoinColumn(nullable: true)]
private ?District $district;
private ?District $district = null;

#[ORM\ManyToOne(targetEntity: Neighborhood::class, inversedBy: 'properties')]
#[ORM\JoinColumn(nullable: true)]
private ?Neighborhood $neighborhood;
private ?Neighborhood $neighborhood = null;

#[ORM\ManyToOne(targetEntity: Metro::class, inversedBy: 'properties')]
#[ORM\JoinColumn(nullable: true)]
private ?Metro $metro_station;
private ?Metro $metro_station = null;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $address;
private ?string $address = null;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $latitude;
private ?string $latitude = null;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $longitude;
private ?string $longitude = null;

public function getDistrict(): ?District
{
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Traits/EntityMetaTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
trait EntityMetaTrait
{
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $meta_title;
private ?string $meta_title = null;

#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
private ?string $meta_description;
private ?string $meta_description = null;

public function getMetaTitle(): ?string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Traits/EntityNameTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
trait EntityNameTrait
{
#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $name;
private ?string $name = null;

#[ORM\Column(type: Types::STRING, length: 255)]
private ?string $slug;
private ?string $slug = null;

public function getName(): ?string
{
Expand Down
4 changes: 2 additions & 2 deletions src/Entity/Traits/EntityTimestampableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
trait EntityTimestampableTrait
{
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
private ?\DateTimeInterface $createdAt;
private ?\DateTimeInterface $createdAt = null;

#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
private ?\DateTimeInterface $updatedAt;
private ?\DateTimeInterface $updatedAt = null;

public function getCreatedAt(): ?\DateTimeInterface
{
Expand Down
12 changes: 3 additions & 9 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,11 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, TwoFact
#[Assert\NotBlank]
#[Assert\Length(min: 2, max: 50)]
private $username;
/**
* @var string
*/
#[ORM\Column(type: Types::STRING, unique: true)]
#[Assert\Email]
private $email;
/**
* @var string
*/
private ?string $email = null;
#[ORM\Column(type: Types::STRING)]
private $password;
private ?string $password = null;

#[ORM\Column(type: Types::JSON)]
private array $roles = [];
Expand All @@ -65,7 +59,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface, TwoFact
private $password_requested_at;

#[ORM\OneToOne(mappedBy: 'user', targetEntity: Profile::class, cascade: ['persist', 'remove'])]
private ?Profile $profile;
private ?Profile $profile = null;

#[ORM\Column(type: Types::DATETIMETZ_MUTABLE, nullable: true)]
private $emailVerifiedAt;
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/Controller/DefaultControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testSecureUrls(string $url): void
*/
public function testMenuItems(string $url): void
{
$client = static::createClient();
$client = DefaultControllerTest::createClient();
$crawler = $client->request('GET', '/');
$link = $crawler->filter(sprintf('a[href="%s"]', $url))->link();
$urlFound = $link->getUri();
Expand Down

0 comments on commit 49d7ab6

Please sign in to comment.