From 41caca272287484bc6e57f288c2698be9195450d Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Thu, 17 Feb 2022 15:48:16 -0500 Subject: [PATCH] Replace the last of the PHPDoc annotations with PHP attributes --- config/packages/doctrine.yaml | 2 +- src/Controller/CameraController.php | 11 +- src/Controller/FilmController.php | 6 +- src/Controller/LensesController.php | 9 +- .../PreviouslyOwnedCameraController.php | 3 - src/Entity/BatteryType.php | 5 +- src/Entity/Camera.php | 8 +- src/Entity/CameraTrait.php | 65 ++------ src/Entity/CameraType.php | 18 +-- src/Entity/Film.php | 63 +------- src/Entity/FilmFormat.php | 8 - src/Entity/FlashTrait.php | 22 +-- src/Entity/LensTrait.php | 142 +++++------------- src/Entity/Lenses.php | 18 +-- src/Entity/PreviouslyOwnedCamera.php | 8 +- src/Entity/PreviouslyOwnedLenses.php | 8 +- src/Entity/PurchasePriceTrait.php | 2 - src/Repository/AcquireTrait.php | 2 +- src/ValueObject/Money.php | 5 +- 19 files changed, 96 insertions(+), 309 deletions(-) diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 7c0c9e7..92127be 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -24,7 +24,7 @@ doctrine: mappings: App: is_bundle: false - type: annotation + type: attribute dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App diff --git a/src/Controller/CameraController.php b/src/Controller/CameraController.php index 14eb30f..d581888 100644 --- a/src/Controller/CameraController.php +++ b/src/Controller/CameraController.php @@ -2,6 +2,7 @@ namespace App\Controller; +use Doctrine\Persistence\ManagerRegistry; use LogicException; use App\Entity\Camera; use App\Form\CameraType; @@ -22,13 +23,16 @@ class CameraController extends AbstractController use FormControllerTrait; protected const ENTITY = Camera::class; protected const FORM = CameraType::class; + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } /** * Lists all camera entities. */ #[Route(path: '/', name: 'camera_index', methods: ['GET'])] public function indexAction() : Response { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $receivedItems = $em->getRepository(self::ENTITY)->findBy([ 'received' => true ], [ @@ -91,11 +95,8 @@ class CameraController extends AbstractController /** * Moves a camera to the previouslyOwned table * - * @param Request $request - * @param Camera $camera * @throws LogicException * @throws ORMInvalidArgumentException - * @return RedirectResponse */ #[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])] public function deacquireAction(Request $request, Camera $camera) : RedirectResponse @@ -117,8 +118,6 @@ class CameraController extends AbstractController * Creates a form to move * * @param Camera $camera The camera entity - * - * @return FormInterface */ private function createDeacquireForm(Camera $camera): FormInterface { diff --git a/src/Controller/FilmController.php b/src/Controller/FilmController.php index a8a2d42..2f84a22 100644 --- a/src/Controller/FilmController.php +++ b/src/Controller/FilmController.php @@ -2,6 +2,7 @@ namespace App\Controller; +use Doctrine\Persistence\ManagerRegistry; use LogicException; use App\Entity\Film; use App\Form\FilmType; @@ -21,13 +22,16 @@ class FilmController extends AbstractController use FormControllerTrait; protected const ENTITY = Film::class; protected const FORM = FilmType::class; + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } /** * Lists all film entities. */ #[Route(path: '/', name: 'film_index', methods: ['GET'])] public function indexAction() : Response { - $repo = $this->getDoctrine()->getManager()->getRepository(self::ENTITY); + $repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY); $criteria = Criteria::create() ->where(Criteria::expr()->gt('rollsInCamera', 0)) ->orderBy([ diff --git a/src/Controller/LensesController.php b/src/Controller/LensesController.php index 994232f..7cd95a6 100644 --- a/src/Controller/LensesController.php +++ b/src/Controller/LensesController.php @@ -2,6 +2,7 @@ namespace App\Controller; +use Doctrine\Persistence\ManagerRegistry; use App\Entity\Lenses; use App\Form\LensesType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -18,13 +19,16 @@ class LensesController extends AbstractController use FormControllerTrait; protected const ENTITY = Lenses::class; protected const FORM = LensesType::class; + public function __construct(private readonly ManagerRegistry $managerRegistry) + { + } /** * Lists all lens entities. */ #[Route(path: '/', name: 'lens_index', methods: ['GET'])] public function indexAction() { - $em = $this->getDoctrine()->getManager(); + $em = $this->managerRegistry->getManager(); $receivedItems = $em->getRepository(self::ENTITY)->findBy([ 'received' => true ], [ @@ -76,7 +80,6 @@ class LensesController extends AbstractController * Moves a camera to the previouslyOwned table * * @param Request $request - * @param Lenses $lens * @return RedirectResponse */ #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] @@ -107,8 +110,6 @@ class LensesController extends AbstractController * Creates a form to move * * @param Lenses $lens The lens entity - * - * @return FormInterface */ private function createDeacquireForm(Lenses $lens): FormInterface { diff --git a/src/Controller/PreviouslyOwnedCameraController.php b/src/Controller/PreviouslyOwnedCameraController.php index 5680629..518c8e9 100644 --- a/src/Controller/PreviouslyOwnedCameraController.php +++ b/src/Controller/PreviouslyOwnedCameraController.php @@ -57,7 +57,6 @@ class PreviouslyOwnedCameraController extends AbstractController * Moves a camera to the previouslyOwned table * * @param Request $request - * @param PreviouslyOwnedCamera $camera * @throws LogicException * @throws ORMInvalidArgumentException * @return RedirectResponse @@ -71,8 +70,6 @@ class PreviouslyOwnedCameraController extends AbstractController * Creates a form to move * * @param PreviouslyOwnedCamera $camera The camera entity - * - * @return FormInterface */ private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface { diff --git a/src/Entity/BatteryType.php b/src/Entity/BatteryType.php index d081abb..08d4aad 100644 --- a/src/Entity/BatteryType.php +++ b/src/Entity/BatteryType.php @@ -11,11 +11,8 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class BatteryType { - /** - * @var integer - */ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private $id; + private int $id; } diff --git a/src/Entity/Camera.php b/src/Entity/Camera.php index e7b714f..29ab7d9 100644 --- a/src/Entity/Camera.php +++ b/src/Entity/Camera.php @@ -2,6 +2,7 @@ namespace App\Entity; +use App\Repository\CameraRepository; use Doctrine\ORM\Mapping as ORM; /** @@ -9,16 +10,13 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'camera', schema: 'camera')] #[ORM\Index(columns: ['type_id'], name: 'IDX_747C826FC54C8C93')] -#[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')] +#[ORM\Entity(repositoryClass: CameraRepository::class)] class Camera { use CameraTrait; - /** - * @var integer - */ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] - private $id; + private int $id; } diff --git a/src/Entity/CameraTrait.php b/src/Entity/CameraTrait.php index 16ae3d0..cbd112a 100644 --- a/src/Entity/CameraTrait.php +++ b/src/Entity/CameraTrait.php @@ -19,32 +19,27 @@ trait CameraTrait * @var CameraType */ #[ORM\ManyToOne(targetEntity: 'CameraType')] - #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id')] - private ?CameraType $type; + #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id')]private readonly ?CameraType $type; /** * @var string */ - #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)] - private string $brand; + #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)]private readonly string $brand; /** * @var string */ - #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)] - private string $mount; + #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)]private readonly string $mount; /** * @var string */ - #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)] - private string $model; + #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)]private readonly string $model; /** * @var boolean */ - #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)] - private bool $isDigital; + #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)]private readonly bool $isDigital; /** * @var string @@ -55,20 +50,17 @@ trait CameraTrait /** * @var boolean */ - #[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)] - private bool $isWorking; + #[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)]private readonly bool $isWorking; /** * @var string */ - #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)]private readonly ?string $notes; /** * @var string */ - #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)] - private string $serial; + #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)]private readonly string $serial; /** * @var boolean @@ -85,8 +77,7 @@ trait CameraTrait /** * @var string */ - #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)] - private ?string $batteryType; + #[ORM\Column(name: 'battery_type', type: 'string', nullable: true)]private readonly ?string $batteryType; /** * @var string @@ -102,8 +93,6 @@ trait CameraTrait /** * Get id - * - * @return integer */ public function getId(): int { @@ -113,9 +102,7 @@ trait CameraTrait /** * Set type * - * @param CameraType $type * - * @return self */ public function setType(CameraType $type = null): self { @@ -137,9 +124,7 @@ trait CameraTrait /** * Set brand * - * @param string $brand * - * @return self */ public function setBrand(string $brand): self { @@ -161,9 +146,7 @@ trait CameraTrait /** * Set mount * - * @param string $mount * - * @return self */ public function setMount(string $mount): self { @@ -185,9 +168,7 @@ trait CameraTrait /** * Set model * - * @param string $model * - * @return self */ public function setModel(string $model): self { @@ -209,9 +190,7 @@ trait CameraTrait /** * Set isDigital * - * @param boolean $isDigital * - * @return self */ public function setIsDigital(bool $isDigital): self { @@ -233,9 +212,7 @@ trait CameraTrait /** * Set cropFactor * - * @param string $cropFactor * - * @return self */ public function setCropFactor(string $cropFactor): self { @@ -246,8 +223,6 @@ trait CameraTrait /** * Get cropFactor - * - * @return string */ public function getCropFactor(): string { @@ -257,9 +232,7 @@ trait CameraTrait /** * Set isWorking * - * @param boolean $isWorking * - * @return self */ public function setIsWorking(bool $isWorking): self { @@ -282,8 +255,6 @@ trait CameraTrait * Set notes * * @param string $notes - * - * @return self */ public function setNotes($notes): self { @@ -294,8 +265,6 @@ trait CameraTrait /** * Get notes - * - * @return string */ public function getNotes(): string { @@ -306,8 +275,6 @@ trait CameraTrait * Set serial * * @param string $serial - * - * @return self */ public function setSerial($serial): self { @@ -318,8 +285,6 @@ trait CameraTrait /** * Get serial - * - * @return string */ public function getSerial(): string { @@ -330,8 +295,6 @@ trait CameraTrait * Set formerlyOwned * * @param boolean $formerlyOwned - * - * @return self */ public function setFormerlyOwned($formerlyOwned): self { @@ -354,8 +317,6 @@ trait CameraTrait * Set batteryType * * @param string $batteryType - * - * @return self */ public function setBatteryType($batteryType): self { @@ -378,8 +339,6 @@ trait CameraTrait * Set filmFormat * * @param string $filmFormat - * - * @return self */ public function setFilmFormat($filmFormat): self { @@ -390,8 +349,6 @@ trait CameraTrait /** * Get filmFormat - * - * @return string */ public function getFilmFormat(): string { @@ -402,8 +359,6 @@ trait CameraTrait * Set received * * @param boolean $received - * - * @return self */ public function setReceived($received): self { @@ -414,8 +369,6 @@ trait CameraTrait /** * Get received - * - * @return boolean */ public function getReceived(): bool { diff --git a/src/Entity/CameraType.php b/src/Entity/CameraType.php index 1990f4e..a72fb02 100644 --- a/src/Entity/CameraType.php +++ b/src/Entity/CameraType.php @@ -2,6 +2,7 @@ namespace App\Entity; +use Stringable; use Doctrine\ORM\Mapping as ORM; /** @@ -9,16 +10,13 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'camera_type', schema: 'camera')] #[ORM\Entity] -class CameraType +class CameraType implements Stringable { - /** - * @var integer - */ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] - private $id; + private int $id; /** * @var string */ @@ -28,11 +26,9 @@ class CameraType * @var string */ #[ORM\Column(name: 'description', type: 'text', nullable: true)] - private ?string $description; + private ?string $description = null; /** * Value for serialization - * - * @return string */ public function __toString(): string { @@ -40,8 +36,6 @@ class CameraType } /** * Get id - * - * @return integer */ public function getId(): int { @@ -50,9 +44,7 @@ class CameraType /** * Set type * - * @param string $type * - * @return CameraType */ public function setType(string $type): self { @@ -63,9 +55,7 @@ class CameraType /** * Set description * - * @param string $description * - * @return CameraType */ public function setDescription(string $description): self { diff --git a/src/Entity/Film.php b/src/Entity/Film.php index e9148a3..f9e6dd9 100644 --- a/src/Entity/Film.php +++ b/src/Entity/Film.php @@ -11,13 +11,10 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] class Film { - /** - * @var integer - */ #[ORM\Id] #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private $id; + private int $id; /** * @var string */ @@ -27,7 +24,7 @@ class Film * @var string */ #[ORM\Column(name: 'product_line', type: 'string', nullable: true)] - private ?string $productLine; + private ?string $productLine = null; /** * @var string */ @@ -37,7 +34,7 @@ class Film * @var string */ #[ORM\Column(name: 'film_alias', type: 'string', nullable: true)] - private ?string $filmAlias; + private ?string $filmAlias = null; /** * @var int */ @@ -82,10 +79,7 @@ class Film * @var string */ #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private ?string $notes; - /** - * @return int - */ + private ?string $notes = null; public function getId(): int { return $this->id; @@ -97,10 +91,6 @@ class Film { return $this->brand; } - /** - * @param string $brand - * @return self - */ public function setBrand(string $brand): self { $this->brand = $brand; @@ -115,7 +105,6 @@ class Film } /** * @param string $productLine - * @return self */ public function setProductLine(?string $productLine): self { @@ -129,10 +118,6 @@ class Film { return $this->filmName; } - /** - * @param string $filmName - * @return self - */ public function setFilmName(string $filmName): self { $this->filmName = $filmName; @@ -145,10 +130,6 @@ class Film { return $this->filmAlias; } - /** - * @param string $filmAlias - * @return self - */ public function setFilmAlias(string $filmAlias): self { $this->filmAlias = $filmAlias; @@ -161,10 +142,6 @@ class Film { return $this->filmSpeedAsa; } - /** - * @param int $filmSpeedAsa - * @return self - */ public function setFilmSpeedAsa(int $filmSpeedAsa): self { $this->filmSpeedAsa = $filmSpeedAsa; @@ -177,10 +154,6 @@ class Film { return $this->filmSpeedDin; } - /** - * @param int $filmSpeedDin - * @return self - */ public function setFilmSpeedDin(int $filmSpeedDin): self { $this->filmSpeedDin = $filmSpeedDin; @@ -193,10 +166,6 @@ class Film { return $this->filmFormat; } - /** - * @param string $filmFormat - * @return self - */ public function setFilmFormat(string $filmFormat): self { $this->filmFormat = $filmFormat; @@ -209,10 +178,6 @@ class Film { return $this->filmBase; } - /** - * @param string $filmBase - * @return self - */ public function setFilmBase(string $filmBase): self { $this->filmBase = $filmBase; @@ -225,10 +190,6 @@ class Film { return $this->unusedRolls; } - /** - * @param int $unusedRolls - * @return self - */ public function setUnusedRolls(int $unusedRolls): self { $this->unusedRolls = $unusedRolls; @@ -241,10 +202,6 @@ class Film { return $this->rollsInCamera; } - /** - * @param int $rollsInCamera - * @return self - */ public function setRollsInCamera(int $rollsInCamera): self { $this->rollsInCamera = $rollsInCamera; @@ -257,10 +214,6 @@ class Film { return $this->developedRolls; } - /** - * @param int $developedRolls - * @return self - */ public function setDevelopedRolls(int $developedRolls): self { $this->developedRolls = $developedRolls; @@ -273,10 +226,6 @@ class Film { return $this->chemistry; } - /** - * @param string $chemistry - * @return self - */ public function setChemistry(string $chemistry): self { $this->chemistry = $chemistry; @@ -289,10 +238,6 @@ class Film { return $this->notes; } - /** - * @param string $notes - * @return self - */ public function setNotes(string $notes): self { $this->notes = $notes; diff --git a/src/Entity/FilmFormat.php b/src/Entity/FilmFormat.php index 06b4b7c..758b520 100644 --- a/src/Entity/FilmFormat.php +++ b/src/Entity/FilmFormat.php @@ -36,10 +36,6 @@ class FilmFormat { return $this->numberId; } - /** - * @param int $numberId - * @return self - */ public function setNumberId(int $numberId): self { $this->numberId = $numberId; @@ -52,10 +48,6 @@ class FilmFormat { return $this->name; } - /** - * @param string $name - * @return self - */ public function setName(string $name): self { $this->name = $name; diff --git a/src/Entity/FlashTrait.php b/src/Entity/FlashTrait.php index b7f1f6a..586e562 100644 --- a/src/Entity/FlashTrait.php +++ b/src/Entity/FlashTrait.php @@ -11,14 +11,12 @@ trait FlashTrait /** * @var string */ - #[ORM\Column(name: 'brand', type: 'string', nullable: false)] - private string $brand; + #[ORM\Column(name: 'brand', type: 'string', nullable: false)]private readonly string $brand; /** * @var string */ - #[ORM\Column(name: 'model', type: 'string', nullable: false)] - private string $model; + #[ORM\Column(name: 'model', type: 'string', nullable: false)]private readonly string $model; /** * @var boolean @@ -53,14 +51,12 @@ trait FlashTrait /** * @var string */ - #[ORM\Column(name: 'guide_number', type: 'string', nullable: true)] - private string $guideNumber; + #[ORM\Column(name: 'guide_number', type: 'string', nullable: true)]private readonly string $guideNumber; /** * @var string */ - #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)] - private ?string $purchasePrice; + #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)]private readonly ?string $purchasePrice; /** * @var string @@ -71,19 +67,15 @@ trait FlashTrait /** * @var string */ - #[ORM\Column(name: 'notes', type: 'text', nullable: true)] - private ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)]private readonly ?string $notes; /** * @var string */ - #[ORM\Column(name: 'serial', type: 'string', nullable: true)] - private ?string $serial; + #[ORM\Column(name: 'serial', type: 'string', nullable: true)]private readonly ?string $serial; /** * Get id - * - * @return integer */ public function getId(): int { @@ -238,8 +230,6 @@ trait FlashTrait * Set pTtlType * * @param string $pTtlType - * - * @return self */ public function setPTtlType($pTtlType): self { diff --git a/src/Entity/LensTrait.php b/src/Entity/LensTrait.php index 8a5dd1a..586d1ce 100644 --- a/src/Entity/LensTrait.php +++ b/src/Entity/LensTrait.php @@ -2,148 +2,129 @@ namespace App\Entity; +use Doctrine\ORM\Mapping as ORM; + trait LensTrait { use PurchasePriceTrait; /** * @var string - * - * @ORM\Column(name="brand", type="string", length=64, nullable=true) */ - private ?string $brand; + #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: true)] + private readonly ?string $brand; /** * @var string - * - * @ORM\Column(name="coatings", type="string", length=64, nullable=true) */ - private ?string $coatings; + #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: true)] + private readonly ?string $coatings; /** * @var string - * - * @ORM\Column(name="product_line", type="string", length=64, nullable=true) */ - private ?string $productLine; + #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: true)] + private readonly ?string $productLine; /** * @var string - * - * @ORM\Column(name="model", type="string", length=64, nullable=true) */ - private ?string $model; + #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: true)] + private readonly ?string $model; /** * @var string - * - * @ORM\Column(name="min_f_stop", type="string", length=10, nullable=true) */ - private ?string $minFStop; + #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: true)] + private readonly ?string $minFStop; /** * @var float - * - * @ORM\Column(name="max_f_stop", type="float", precision=10, scale=0, nullable=true) */ - private ?float $maxFStop; + #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: true)] + private readonly ?float $maxFStop; /** * @var integer - * - * @ORM\Column(name="min_focal_length", type="integer", nullable=true) */ - private ?int $minFocalLength; + #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: true)] + private readonly ?int $minFocalLength; /** * @var integer - * - * @ORM\Column(name="max_focal_length", type="integer", nullable=true) */ - private ?int $maxFocalLength; + #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: true)] + private readonly ?int $maxFocalLength; /** * @var string - * - * @ORM\Column(name="serial", type="string", length=10, nullable=true) */ - private ?string $serial; + #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)] + private readonly ?string $serial; /** * @var string - * - * @ORM\Column(name="purchase_price", type="money", nullable=true) */ - private ?string $purchasePrice; + #[ORM\Column(name: 'purchase_price', type: 'money', nullable: true)] + private readonly ?string $purchasePrice; /** * @var string - * - * @ORM\Column(name="notes", type="text", nullable=true) */ - private ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: true)] + private readonly ?string $notes; /** * @var string - * - * @ORM\Column(name="image_size", type="string", nullable=false, options={"default"="35mm"}) */ + #[ORM\Column(name: 'image_size', type: 'string', nullable: false, options: ['default' => '35mm'])] private string $imageSize = '35mm'; /** * @var string - * - * @ORM\Column(name="mount", type="string", length=40, nullable=true) */ - private ?string $mount; + #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: true)] + private readonly ?string $mount; /** * @var string - * - * @ORM\Column(name="front_filter_size", type="decimal", precision=10, scale=0, nullable=true) */ - private ?string $frontFilterSize; + #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] + private readonly ?string $frontFilterSize; /** * @var string - * - * @ORM\Column(name="rear_filter_size", type="decimal", precision=10, scale=0, nullable=true) */ - private? string $rearFilterSize; + #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] + private readonly ? string $rearFilterSize; /** * @var boolean - * - * @ORM\Column(name="is_teleconverter", type="boolean", nullable=false) */ + #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)] private bool $isTeleconverter = false; /** * @var integer - * - * @ORM\Column(name="design_elements", type="smallint", nullable=true) */ - private ?int $designElements; + #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: true)] + private readonly ?int $designElements; /** * @var integer - * - * @ORM\Column(name="design_groups", type="smallint", nullable=true) */ - private ?int $designGroups; + #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: true)] + private readonly ?int $designGroups; /** * @var integer - * - * @ORM\Column(name="aperture_blades", type="smallint", nullable=true) */ - private ?int $apertureBlades; + #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)] + private readonly ?int $apertureBlades; /** * Get id - * - * @return integer */ public function getId(): int { @@ -154,8 +135,6 @@ trait LensTrait * Set brand * * @param string $brand - * - * @return self */ public function setBrand($brand): self { @@ -178,8 +157,6 @@ trait LensTrait * Set coatings * * @param string $coatings - * - * @return self */ public function setCoatings($coatings): self { @@ -202,8 +179,6 @@ trait LensTrait * Set productLine * * @param string $productLine - * - * @return self */ public function setProductLine($productLine): self { @@ -226,8 +201,6 @@ trait LensTrait * Set model * * @param string $model - * - * @return self */ public function setModel($model): self { @@ -250,8 +223,6 @@ trait LensTrait * Set minFStop * * @param string $minFStop - * - * @return self */ public function setMinFStop($minFStop): self { @@ -274,8 +245,6 @@ trait LensTrait * Set maxFStop * * @param float $maxFStop - * - * @return self */ public function setMaxFStop($maxFStop): self { @@ -298,8 +267,6 @@ trait LensTrait * Set minFocalLength * * @param integer $minFocalLength - * - * @return self */ public function setMinFocalLength($minFocalLength): self { @@ -322,8 +289,6 @@ trait LensTrait * Set maxFocalLength * * @param integer $maxFocalLength - * - * @return self */ public function setMaxFocalLength($maxFocalLength): self { @@ -346,8 +311,6 @@ trait LensTrait * Set serial * * @param string $serial - * - * @return self */ public function setSerial($serial): self { @@ -358,8 +321,6 @@ trait LensTrait /** * Get serial - * - * @return string */ public function getSerial(): string { @@ -370,8 +331,6 @@ trait LensTrait * Set notes * * @param string $notes - * - * @return self */ public function setNotes(?string $notes): self { @@ -382,8 +341,6 @@ trait LensTrait /** * Get notes - * - * @return string */ public function getNotes(): string { @@ -392,8 +349,6 @@ trait LensTrait /** * Get image size - * - * @return string */ public function getImageSize(): string { @@ -402,9 +357,6 @@ trait LensTrait /** * Set image size - * - * @param string $imageSize - * @return self */ public function setImageSize(string $imageSize): self { @@ -416,8 +368,6 @@ trait LensTrait * Set mount * * @param string $mount - * - * @return self */ public function setMount($mount): self { @@ -440,8 +390,6 @@ trait LensTrait * Set received * * @param boolean $received - * - * @return self */ public function setReceived($received): self { @@ -464,8 +412,6 @@ trait LensTrait * Set formerlyOwned * * @param boolean $formerlyOwned - * - * @return self */ public function setFormerlyOwned($formerlyOwned): self { @@ -488,8 +434,6 @@ trait LensTrait * Set frontFilterSize * * @param string $frontFilterSize - * - * @return self */ public function setFrontFilterSize($frontFilterSize): self { @@ -512,8 +456,6 @@ trait LensTrait * Set rearFilterSize * * @param string $rearFilterSize - * - * @return self */ public function setRearFilterSize($rearFilterSize): self { @@ -536,8 +478,6 @@ trait LensTrait * Set isTeleconverter * * @param boolean $isTeleconverter - * - * @return self */ public function setIsTeleconverter($isTeleconverter): self { @@ -560,8 +500,6 @@ trait LensTrait * Set designElements * * @param integer $designElements - * - * @return self */ public function setDesignElements($designElements): self { @@ -584,8 +522,6 @@ trait LensTrait * Set designGroups * * @param integer $designGroups - * - * @return self */ public function setDesignGroups($designGroups): self { @@ -608,8 +544,6 @@ trait LensTrait * Set apertureBlades * * @param integer $apertureBlades - * - * @return self */ public function setApertureBlades($apertureBlades): self { diff --git a/src/Entity/Lenses.php b/src/Entity/Lenses.php index d87b9e6..18769f8 100644 --- a/src/Entity/Lenses.php +++ b/src/Entity/Lenses.php @@ -2,32 +2,24 @@ namespace App\Entity; +use App\Repository\LensesRepository; use Doctrine\ORM\Mapping as ORM; /** * Camera.lenses */ #[ORM\Table(name: 'lenses', schema: 'camera')] -#[ORM\Entity(repositoryClass: 'App\Repository\LensesRepository')] +#[ORM\Entity(repositoryClass: LensesRepository::class)] class Lenses { use LensTrait; - /** - * @var integer - */ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)] - private $id; - /** - * @var boolean - */ + private int $id; #[ORM\Column(name: 'received', type: 'boolean', nullable: false)] - private $received = false; - /** - * @var boolean - */ + private bool $received = false; #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] - private $formerlyOwned = false; + private bool $formerlyOwned = false; } diff --git a/src/Entity/PreviouslyOwnedCamera.php b/src/Entity/PreviouslyOwnedCamera.php index 9db1cec..6f54429 100644 --- a/src/Entity/PreviouslyOwnedCamera.php +++ b/src/Entity/PreviouslyOwnedCamera.php @@ -2,6 +2,7 @@ namespace App\Entity; +use App\Repository\CameraRepository; use Doctrine\ORM\Mapping as ORM; /** @@ -9,16 +10,13 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'previously_owned_camera', schema: 'camera')] #[ORM\Index(name: 'IDX_6EF94C6BC54C8C93', columns: ['type_id'])] -#[ORM\Entity(repositoryClass: 'App\Repository\CameraRepository')] +#[ORM\Entity(repositoryClass: CameraRepository::class)] class PreviouslyOwnedCamera { use CameraTrait; - /** - * @var integer - */ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] - private $id; + private int $id; } diff --git a/src/Entity/PreviouslyOwnedLenses.php b/src/Entity/PreviouslyOwnedLenses.php index 63a9be4..73cdd22 100644 --- a/src/Entity/PreviouslyOwnedLenses.php +++ b/src/Entity/PreviouslyOwnedLenses.php @@ -2,23 +2,21 @@ namespace App\Entity; +use App\Repository\LensesRepository; use Doctrine\ORM\Mapping as ORM; /** * Camera.previouslyOwnedLenses */ #[ORM\Table(name: 'previously_owned_lenses', schema: 'camera')] -#[ORM\Entity(repositoryClass: 'App\Repository\LensesRepository')] +#[ORM\Entity(repositoryClass: LensesRepository::class)] class PreviouslyOwnedLenses { use LensTrait; - /** - * @var integer - */ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private $id; + private int $id; /** * @var boolean */ diff --git a/src/Entity/PurchasePriceTrait.php b/src/Entity/PurchasePriceTrait.php index f71a91c..8d41a3a 100644 --- a/src/Entity/PurchasePriceTrait.php +++ b/src/Entity/PurchasePriceTrait.php @@ -8,8 +8,6 @@ trait PurchasePriceTrait * Set purchasePrice * * @param string $purchasePrice - * - * @return self */ public function setPurchasePrice($purchasePrice): self { diff --git a/src/Repository/AcquireTrait.php b/src/Repository/AcquireTrait.php index 8f78ebf..6766180 100644 --- a/src/Repository/AcquireTrait.php +++ b/src/Repository/AcquireTrait.php @@ -36,7 +36,7 @@ trait AcquireTrait { $em->remove($currentRecord); $em->flush(); } - catch (Throwable $e) + catch (Throwable) { dump($newRecord); } diff --git a/src/ValueObject/Money.php b/src/ValueObject/Money.php index 7c6fdff..b7e44f9 100644 --- a/src/ValueObject/Money.php +++ b/src/ValueObject/Money.php @@ -2,8 +2,9 @@ namespace App\ValueObject; -class Money { - private float $value; +use Stringable; +class Money implements Stringable { + private readonly float $value; public function __construct($value) {