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;
@ -7,8 +7,7 @@ use App\Form\BrandType;
use App\Traits\FormControllerTrait;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/brand')]
@ -29,7 +28,7 @@ class BrandController extends AbstractController
public function index(): Response
{
return $this->itemListView('brands', [
'name' => 'asc'
'name' => 'asc',
]);
}
@ -49,20 +48,6 @@ class BrandController extends AbstractController
public function edit(Request $request, Brand $brand): Response
{
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'])]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,6 @@
namespace App\Entity;
use App\Repository\GPURepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'gpu_core', schema: 'collection')]
@ -41,7 +39,7 @@ class GpuCore
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

View File

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

View File

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

View File

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

View File

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

View File

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