Fix code formatting

This commit is contained in:
Timothy Warren 2022-09-30 10:49:02 -04:00
parent 41d19ad84b
commit fb296c1034
24 changed files with 337 additions and 369 deletions

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
namespace App\Controller; namespace App\Controller;
@ -7,8 +7,7 @@ use App\Form\BrandType;
use App\Traits\FormControllerTrait; use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
#[Route('/brand')] #[Route('/brand')]
@ -29,7 +28,7 @@ class BrandController extends AbstractController
public function index(): Response public function index(): Response
{ {
return $this->itemListView('brands', [ return $this->itemListView('brands', [
'name' => 'asc' 'name' => 'asc',
]); ]);
} }
@ -49,20 +48,6 @@ class BrandController extends AbstractController
public function edit(Request $request, Brand $brand): Response public function edit(Request $request, Brand $brand): Response
{ {
return $this->itemUpdate($request, $brand, 'brand'); return $this->itemUpdate($request, $brand, 'brand');
//
// $form = $this->createForm(BrandType::class, $brand);
// $form->handleRequest($request);
//
// if ($form->isSubmitted() && $form->isValid()) {
// $entityManager->flush();
//
// return $this->redirectToRoute('brand_index', [], Response::HTTP_SEE_OTHER);
// }
//
// return $this->renderForm('brand/edit.html.twig', [
// 'brand' => $brand,
// 'form' => $form,
// ]);
} }
#[Route('/{id}', name: 'brand_delete', methods: ['POST'])] #[Route('/{id}', name: 'brand_delete', methods: ['POST'])]

View File

@ -4,10 +4,8 @@ namespace App\Controller;
use App\Entity\Camera; use App\Entity\Camera;
use App\Form\CameraType; use App\Form\CameraType;
use App\Traits\DeleteFormTrait; use App\Traits\{DeleteFormTrait, FormControllerTrait};
use App\Traits\FormControllerTrait; use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\ORMInvalidArgumentException;
use LogicException; use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;

View File

@ -4,8 +4,7 @@ namespace App\Controller;
use App\Entity\CameraType; use App\Entity\CameraType;
use App\Form\CameraTypeType; use App\Form\CameraTypeType;
use App\Traits\DeleteFormTrait; use App\Traits\{DeleteFormTrait, FormControllerTrait};
use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};

View File

@ -4,8 +4,7 @@ namespace App\Controller;
use App\Entity\Film; use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
use App\Traits\DeleteFormTrait; use App\Traits\{DeleteFormTrait, FormControllerTrait};
use App\Traits\FormControllerTrait;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use LogicException; use LogicException;

View File

@ -4,11 +4,9 @@ namespace App\Controller;
use App\Entity\Flash; use App\Entity\Flash;
use App\Form\FlashType; use App\Form\FlashType;
use App\Traits\DeleteFormTrait; use App\Traits\{DeleteFormTrait, FormControllerTrait};
use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
namespace App\Controller; namespace App\Controller;
@ -7,8 +7,7 @@ use App\Form\GPUCoreType;
use App\Traits\FormControllerTrait; use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
#[Route('/gpu-core')] #[Route('/gpu-core')]

View File

@ -4,8 +4,7 @@ namespace App\Controller;
use App\Entity\Lenses; use App\Entity\Lenses;
use App\Form\LensesType; use App\Form\LensesType;
use App\Traits\DeleteFormTrait; use App\Traits\{DeleteFormTrait, FormControllerTrait};
use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;

View File

@ -5,8 +5,7 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedCamera; use App\Entity\PreviouslyOwnedCamera;
use App\Form\PreviouslyOwnedCameraType; use App\Form\PreviouslyOwnedCameraType;
use App\Traits\FormControllerTrait; use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
use Doctrine\ORM\ORMInvalidArgumentException;
use LogicException; use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;

View File

@ -16,7 +16,7 @@ class Brand
#[ORM\SequenceGenerator(sequenceName: 'brand_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'brand_id_seq', allocationSize: 1, initialValue: 1)]
private int $id; private int $id;
#[ORM\Column(name: 'name', unique: true, nullable: FALSE)] #[ORM\Column(name: 'name', unique: TRUE, nullable: FALSE)]
private string $name; private string $name;
public function __toString(): string public function __toString(): string

View File

@ -2,7 +2,6 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Stringable; use Stringable;

View File

@ -2,7 +2,6 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View File

@ -2,32 +2,31 @@
namespace App\Entity; namespace App\Entity;
trait GetSetTrait { use InvalidArgumentException;
trait GetSetTrait
{
public function __call(string $name, array $arguments): mixed public function __call(string $name, array $arguments): mixed
{ {
if (method_exists($this, $name)) if (method_exists($this, $name)) {
{ return $this->{$name}(...$arguments);
return $this->$name(...$arguments);
} }
// Apparently Doctrine first tries the method with the same // Apparently Doctrine first tries the method with the same
// name as the property, instead of with the get prefix // name as the property, instead of with the get prefix
if (property_exists($this, $name) && empty($arguments)) if (property_exists($this, $name) && empty($arguments)) {
{ return $this->{$name};
return $this->$name;
} }
if (str_starts_with('set', $name)) if (str_starts_with('set', $name)) {
{
$var = lcfirst(str_replace('set', '', $name)); $var = lcfirst(str_replace('set', '', $name));
if (property_exists($this, $var)) if (property_exists($this, $var)) {
{ $this->{$name} = $arguments[0];
$this->$name = $arguments[0];
} }
return $this; return $this;
} }
throw new \InvalidArgumentException("Undefined method: {$name}"); throw new InvalidArgumentException("Undefined method: {$name}");
} }
} }

View File

@ -2,7 +2,6 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'gpu', schema: 'collection')] #[ORM\Table(name: 'gpu', schema: 'collection')]

View File

@ -2,8 +2,6 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\GPURepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'gpu_core', schema: 'collection')] #[ORM\Table(name: 'gpu_core', schema: 'collection')]
@ -41,7 +39,7 @@ class GpuCore
public function __toString(): string public function __toString(): string
{ {
return "$this->brand $this->name ($this->variant/$this->generationName)"; return "{$this->brand} {$this->name} ({$this->variant}/{$this->generationName})";
} }
public function getId(): ?int public function getId(): ?int

View File

@ -65,11 +65,10 @@ trait LensTrait
public function __get(string $name): mixed public function __get(string $name): mixed
{ {
if (property_exists($this, $name)) if (property_exists($this, $name)) {
{ return $this->{$name};
return $this->$name;
} }
return null; return NULL;
} }
} }

View File

@ -1,10 +1,9 @@
<?php <?php declare(strict_types=1);
namespace App\Form; namespace App\Form;
use App\Entity\Brand; use App\Entity\Brand;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class BrandType extends AbstractType class BrandType extends AbstractType
@ -12,8 +11,7 @@ class BrandType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void public function buildForm(FormBuilderInterface $builder, array $options): void
{ {
$builder $builder
->add('name') ->add('name');
;
} }
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void

View File

@ -1,10 +1,9 @@
<?php <?php declare(strict_types=1);
namespace App\Form; namespace App\Form;
use App\Entity\GpuCore; use App\Entity\GpuCore;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class GPUCoreType extends AbstractType class GPUCoreType extends AbstractType
@ -18,8 +17,7 @@ class GPUCoreType extends AbstractType
->add('architecture') ->add('architecture')
->add('architectureLink') ->add('architectureLink')
->add('generationName') ->add('generationName')
->add('processNode') ->add('processNode');
;
} }
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void

View File

@ -7,18 +7,15 @@ use Doctrine\ORM\{EntityRepository};
use ReflectionObject; use ReflectionObject;
use Throwable; use Throwable;
abstract class AcquireRepository extends EntityRepository abstract class AcquireRepository extends EntityRepository
{ {
abstract public function reacquire(mixed $currentRecord): void; abstract public function reacquire(mixed $currentRecord): void;
abstract public function deacquire(mixed $currentRecord): void; abstract public function deacquire(mixed $currentRecord): void;
/** /**
* Move a record from the table represented by $currentRecord * Move a record from the table represented by $currentRecord
* into the table represented by $newRecord * into the table represented by $newRecord
*
* @param mixed $currentRecord
* @param mixed $newRecord
*/ */
protected function moveRecord(mixed $currentRecord, mixed $newRecord): void protected function moveRecord(mixed $currentRecord, mixed $newRecord): void
{ {

View File

@ -4,10 +4,16 @@ namespace App\Types;
enum BusInterface: string { enum BusInterface: string {
case PCI = 'PCI'; case PCI = 'PCI';
case ISA = 'ISA'; case ISA = 'ISA';
case VLB = 'VLB (Vesa Local Bus)'; case VLB = 'VLB (Vesa Local Bus)';
case AGP = 'AGP'; case AGP = 'AGP';
case AGPX2 = 'AGP 2x'; case AGPX2 = 'AGP 2x';
case AGPX4 = 'AGP 4x'; case AGPX4 = 'AGP 4x';
case AGPX8 = 'AGP 8x'; case AGPX8 = 'AGP 8x';
} }