Skip to content

Commit

Permalink
use TYPES in decleration
Browse files Browse the repository at this point in the history
  • Loading branch information
haivala committed Oct 28, 2024
1 parent 4d78b25 commit e0c73d7
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 71 deletions.
7 changes: 7 additions & 0 deletions symfony/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\Transform\Rector\Attribute\AttributeKeyToClassConstFetchRector;
use Rector\Transform\ValueObject\AttributeKeyToClassConstFetch;

return RectorConfig::configure()
->withPaths([
Expand All @@ -16,4 +18,9 @@
->withTypeCoverageLevel(0)
->withSets([SetList::PHP_83])
->withAttributesSets(symfony: true, doctrine: true)
->withConfiguredRule(AttributeKeyToClassConstFetchRector::class, [
new AttributeKeyToClassConstFetch('Doctrine\\ORM\\Mapping\\Column', 'type', 'Doctrine\\DBAL\\Types\\Types', [
'string' => 'STRING',
]),
])
->withPreparedSets(deadCode: true);
2 changes: 1 addition & 1 deletion symfony/src/Entity/AccessGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AccessGroups implements \Stringable
#[ORM\Column(type: 'integer')]
private ?int $id = null;

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

#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'accessGroups')]
Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/Accessory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Accessory implements \Stringable
#[ORM\ManyToOne(targetEntity: \App\Entity\AccessoryChoice::class, cascade: ['persist'])]
private ?\App\Entity\AccessoryChoice $name = null;

#[ORM\Column(name: 'count', type: 'string', length: 50)]
#[ORM\Column(name: 'count', type: \Doctrine\DBAL\Types\Types::STRING, length: 50)]
#[Assert\NotBlank]
private ?string $count = null;

Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/AccessoryChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AccessoryChoice implements \Stringable
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;

#[ORM\Column(name: 'name', type: 'string', length: 190)]
#[ORM\Column(name: 'name', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private string $name;

#[ORM\Column(name: 'compensationPrice', type: 'integer')]
Expand Down
8 changes: 4 additions & 4 deletions symfony/src/Entity/Artist.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class Artist implements \Stringable
#[ORM\Column(type: 'integer')]
private ?int $id = null;

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

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

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

#[Assert\Expression(
Expand All @@ -36,7 +36,7 @@ class Artist implements \Stringable
#[ORM\Column(type: 'text', nullable: true)]
private ?string $bio = null;

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

#[ORM\OneToMany(targetEntity: EventArtistInfo::class, mappedBy: 'Artist', cascade: ['persist', 'detach'])]
Expand Down
8 changes: 4 additions & 4 deletions symfony/src/Entity/Booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class Booking implements \Stringable
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;

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

#[ORM\Column(name: 'referenceNumber', type: 'string', length: 190)]
#[ORM\Column(name: 'referenceNumber', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private int|string $referenceNumber = 0;

#[ORM\Column(name: 'renterHash', type: 'string', length: 199)]
#[ORM\Column(name: 'renterHash', type: \Doctrine\DBAL\Types\Types::STRING, length: 199)]
private int|string $renterHash = 0;

#[ORM\Column(name: 'renterConsent', type: 'boolean')]
Expand Down Expand Up @@ -107,7 +107,7 @@ class Booking implements \Stringable
#[ORM\ManyToMany(targetEntity: Reward::class, mappedBy: 'bookings')]
private $rewards;

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

#[ORM\Column(type: 'text', nullable: true)]
Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/Contract.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Contract implements \Stringable
#[ORM\Column(type: 'datetime')]
private ?\DateTimeInterface $updatedAt = null;

#[ORM\Column(type: 'string', length: 255, unique: true)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, unique: true)]
private ?string $purpose = null;

#[ORM\Column(type: 'datetime')]
Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/DoorLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DoorLog
#[ORM\Column(type: 'datetime')]
private \DateTimeInterface|\DateTime|null $createdAt = null;

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

public function getId(): ?int
Expand Down
6 changes: 3 additions & 3 deletions symfony/src/Entity/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Email implements \Stringable
#[ORM\Column(type: 'integer')]
private ?int $id = null;

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

#[ORM\Column(type: 'text')]
private ?string $body = null;

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

#[ORM\Column(type: 'datetime')]
Expand All @@ -34,7 +34,7 @@ class Email implements \Stringable
#[ORM\ManyToOne(targetEntity: Event::class, inversedBy: 'emails')]
private ?\App\Entity\Event $event = null;

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

#[ORM\Column(nullable: true)]
Expand Down
22 changes: 11 additions & 11 deletions symfony/src/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class Event implements \Stringable
#[ORM\Column(type: 'integer')]
private ?int $id = null;

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

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

#[ORM\Column(type: 'datetime')]
Expand Down Expand Up @@ -64,16 +64,16 @@ class Event implements \Stringable
private ?string $Sisallys = "Käytä näitä, vaikka monta kertaa: <br>
{{ timetable }} <br> {{ timetable_to_page }} <br> {{ bios }} <br> {{ vj_bios }} <br> {{ rsvp }} <br> {{ links }} <br> {{ happening_list }}";

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

#[ORM\Column(type: 'boolean')]
private bool $published = false;

#[ORM\Column(type: 'string', length: 180)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180)]
private ?string $type = null;

#[ORM\Column(type: 'string', length: 180, nullable: true)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180, nullable: true)]
private ?string $epics = null;

#[ORM\Column(type: 'boolean')]
Expand All @@ -82,7 +82,7 @@ class Event implements \Stringable
#[ORM\Column(type: 'boolean')]
private bool $sticky = false;

#[ORM\Column(type: 'string', length: 255)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private string $picturePosition = 'banner';

#[ORM\Column(type: 'boolean')]
Expand Down Expand Up @@ -138,16 +138,16 @@ class Event implements \Stringable
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $includeSaferSpaceGuidelines = false;

#[ORM\Column(type: 'string', length: 255)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255)]
private ?string $headerTheme = 'light';

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

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

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

#[ORM\Column(type: 'boolean', nullable: true)]
Expand All @@ -159,7 +159,7 @@ class Event implements \Stringable
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private ?\DateTimeImmutable $artistSignUpStart = null;

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

#[ORM\Column(type: 'boolean', nullable: true)]
Expand Down
6 changes: 3 additions & 3 deletions symfony/src/Entity/EventArtistInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EventArtistInfo implements \Stringable
#[ORM\Column(type: 'integer')]
private ?int $id = null;

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

#[ORM\Column(type: 'datetime', nullable: true)]
Expand All @@ -25,7 +25,7 @@ class EventArtistInfo implements \Stringable
#[ORM\ManyToOne(targetEntity: Artist::class, inversedBy: 'eventArtistInfos', cascade: ['persist'])]
private ?\App\Entity\Artist $Artist = null;

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

#[ORM\ManyToOne(targetEntity: Artist::class, cascade: ['persist'])]
Expand All @@ -34,7 +34,7 @@ class EventArtistInfo implements \Stringable
#[ORM\Column(type: 'text', nullable: true)]
private ?string $freeWord = null;

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

public function getId(): ?int
Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class File implements \Stringable
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;

#[ORM\Column(name: 'tiedostoinfo', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'tiedostoinfo', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $fileinfo = null;

#[ORM\ManyToOne(targetEntity: \App\Entity\Item::class, inversedBy: 'files')]
Expand Down
16 changes: 8 additions & 8 deletions symfony/src/Entity/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ class Item implements \Stringable
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;

#[ORM\Column(name: 'Name', type: 'string', length: 190)]
#[ORM\Column(name: 'Name', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private string $name;

#[ORM\Column(name: 'Manufacturer', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'Manufacturer', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $manufacturer = null;

#[ORM\Column(name: 'Model', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'Model', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $model = null;

#[ORM\Column(name: 'Url', type: 'string', length: 500, nullable: true)]
#[ORM\Column(name: 'Url', type: \Doctrine\DBAL\Types\Types::STRING, length: 500, nullable: true)]
private ?string $url = null;

#[ORM\Column(name: 'SerialNumber', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'SerialNumber', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $serialnumber = null;

#[ORM\Column(name: 'PlaceInStorage', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'PlaceInStorage', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $placeinstorage = null;

#[ORM\Column(name: 'Description', type: 'string', length: 4000, nullable: true)]
#[ORM\Column(name: 'Description', type: \Doctrine\DBAL\Types\Types::STRING, length: 4000, nullable: true)]
private ?string $description = null;

#[ORM\ManyToMany(targetEntity: WhoCanRentChoice::class, cascade: ['persist'])]
Expand All @@ -65,7 +65,7 @@ class Item implements \Stringable
#[ORM\Column(name: 'compensationPrice', type: 'decimal', precision: 7, scale: 2, nullable: true)]
private $compensationPrice;

#[ORM\Column(name: 'RentNotice', type: 'string', length: 5000, nullable: true)]
#[ORM\Column(name: 'RentNotice', type: \Doctrine\DBAL\Types\Types::STRING, length: 5000, nullable: true)]
private ?string $rentNotice = null;

#[ORM\Column(name: 'NeedsFixing', type: 'boolean')]
Expand Down
16 changes: 8 additions & 8 deletions symfony/src/Entity/Member.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ class Member implements \Stringable
#[ORM\GeneratedValue(strategy: 'AUTO')]
private ?int $id = null;

#[ORM\Column(name: 'firstname', type: 'string', length: 190)]
#[ORM\Column(name: 'firstname', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private string $firstname;

#[ORM\Column(name: 'lastname', type: 'string', length: 190)]
#[ORM\Column(name: 'lastname', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private string $lastname;

#[ORM\Column(name: 'email', type: 'string', length: 190, unique: true)]
#[ORM\Column(name: 'email', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, unique: true)]
private $email;

#[ORM\Column(name: 'username', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'username', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $username = null;

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

#[ORM\Column(name: 'CityOfResidence', type: 'string', length: 190, nullable: true)]
#[ORM\Column(name: 'CityOfResidence', type: \Doctrine\DBAL\Types\Types::STRING, length: 190, nullable: true)]
private ?string $CityOfResidence = null;

#[ORM\Column(name: 'createdAt', type: 'datetime')]
Expand Down Expand Up @@ -77,7 +77,7 @@ class Member implements \Stringable
#[ORM\Cache(usage: 'NONSTRICT_READ_WRITE', region: 'member')]
private ?\App\Entity\User $user = null;

#[ORM\Column(type: 'string', length: 8)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 8)]
private ?string $locale = 'fi';

#[ORM\OneToMany(targetEntity: Artist::class, mappedBy: 'member', orphanRemoval: true)]
Expand All @@ -87,7 +87,7 @@ class Member implements \Stringable
#[ORM\OneToMany(targetEntity: DoorLog::class, mappedBy: 'member', orphanRemoval: true)]
private $doorLogs;

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

#[ORM\OneToMany(targetEntity: RSVP::class, mappedBy: 'member', orphanRemoval: true)]
Expand Down
6 changes: 3 additions & 3 deletions symfony/src/Entity/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class Menu implements \Stringable
#[ORM\Column(type: 'integer')]
private $id;

#[ORM\Column(type: 'string', length: 180)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180)]
private ?string $label = null;

#[ORM\Column(type: 'string', length: 180)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180)]
private ?string $nimi = null;

#[ORM\Column(type: 'string', length: 180, nullable: true)]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180, nullable: true)]
private ?string $url = null;

#[ORM\ManyToOne(targetEntity: Page::class)]
Expand Down
2 changes: 1 addition & 1 deletion symfony/src/Entity/Nakki.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Nakki implements \Stringable
#[ORM\JoinColumn(onDelete: "SET NULL", nullable: true)]
private ?\App\Entity\Member $responsible = null;

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

#[ORM\Column(nullable: true)]
Expand Down
4 changes: 2 additions & 2 deletions symfony/src/Entity/NakkiDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class NakkiDefinition implements \Stringable
#[ORM\Column(type: 'integer')]
private ?int $id = null;

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

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

#[ORM\Column(type: 'text')]
Expand Down
4 changes: 2 additions & 2 deletions symfony/src/Entity/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class Package implements \Stringable
#[ORM\ManyToMany(targetEntity: Item::class, mappedBy: 'packages', orphanRemoval: false, fetch: 'EAGER')]
private ?Collection $items;

#[ORM\Column(name: 'name', type: 'string', length: 190)]
#[ORM\Column(name: 'name', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private string $name;

#[ORM\Column(name: 'rent', type: 'string', length: 190)]
#[ORM\Column(name: 'rent', type: \Doctrine\DBAL\Types\Types::STRING, length: 190)]
private string $rent;

#[ORM\Column(name: 'needs_fixing', type: 'boolean')]
Expand Down
Loading

0 comments on commit e0c73d7

Please sign in to comment.