lint
All checks were successful
/ ls (pull_request) Successful in 29s
/ ls (push) Successful in 29s

This commit is contained in:
Jonas 2024-06-10 20:23:36 +02:00
parent a541338909
commit 7663f684a4
Signed by: lubiana
SSH key fingerprint: SHA256:gkqM8DUX4Blf6P52fycW8ISTd+4eAHH+Uzu9iyc8hAM
9 changed files with 50 additions and 32 deletions

View file

@ -1,9 +1,25 @@
<?php
<?php declare(strict_types=1);
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\MakerBundle\MakerBundle;
use Symfony\Bundle\TwigBundle\TwigBundle;
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
FrameworkBundle::class => [
'all' => true,
],
MakerBundle::class => [
'dev' => true,
],
DoctrineBundle::class => [
'all' => true,
],
DoctrineMigrationsBundle::class => [
'all' => true,
],
TwigBundle::class => [
'all' => true,
],
];

View file

@ -1,6 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

View file

@ -1,6 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

View file

@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace App\Controller;
@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
#[Route('/food/vendor')]
class FoodVendorController extends AbstractController
final class FoodVendorController extends AbstractController
{
#[Route('/', name: 'app_food_vendor_index', methods: ['GET'])]
public function index(FoodVendorRepository $foodVendorRepository): Response
@ -25,7 +25,7 @@ class FoodVendorController extends AbstractController
#[Route('/new', name: 'app_food_vendor_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
$foodVendor = new FoodVendor();
$foodVendor = new FoodVendor;
$form = $this->createForm(FoodVendorType::class, $foodVendor);
$form->handleRequest($request);
@ -71,7 +71,7 @@ class FoodVendorController extends AbstractController
#[Route('/{id}', name: 'app_food_vendor_delete', methods: ['POST'])]
public function delete(Request $request, FoodVendor $foodVendor, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete'.$foodVendor->getId(), $request->getPayload()->getString('_token'))) {
if ($this->isCsrfTokenValid('delete' . $foodVendor->getId(), $request->getPayload()->getString('_token'))) {
$entityManager->remove($foodVendor);
$entityManager->flush();
}

View file

@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace App\Entity;
@ -18,14 +18,14 @@ class FoodVendor
private Ulid|null $id = null;
#[ORM\Column(length: 50)]
private ?string $name = null;
private string|null $name = null;
public function getId(): ?Ulid
public function getId(): Ulid|null
{
return $this->id;
}
public function getName(): ?string
public function getName(): string|null
{
return $this->name;
}

View file

@ -1,14 +1,16 @@
<?php
<?php declare(strict_types=1);
namespace App\Form;
use App\Entity\FoodVendor;
use Override;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FoodVendorType extends AbstractType
final class FoodVendorType extends AbstractType
{
#[Override]
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
@ -16,6 +18,7 @@ class FoodVendorType extends AbstractType
;
}
#[Override]
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([

View file

@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace App\Repository;
@ -9,7 +9,7 @@ use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<FoodVendor>
*/
class FoodVendorRepository extends ServiceEntityRepository
final class FoodVendorRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{

View file

@ -1,16 +1,18 @@
<?php
<?php declare(strict_types=1);
namespace App\Test\Controller;
use App\Entity\FoodVendor;
use App\Kernel;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Tools\SchemaTool;
use Override;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class FoodVendorControllerTest extends WebTestCase
use function sprintf;
final class FoodVendorControllerTest extends WebTestCase
{
private KernelBrowser $client;
private EntityManagerInterface $manager;
@ -22,6 +24,8 @@ class FoodVendorControllerTest extends WebTestCase
(new SchemaTool($this->manager))
->createSchema($this->manager->getMetadataFactory()->getAllMetadata());
}
#[Override]
protected function setUp(): void
{
$this->client = static::createClient();
@ -38,7 +42,7 @@ class FoodVendorControllerTest extends WebTestCase
public function testIndex(): void
{
$crawler = $this->client->request('GET', $this->path);
$this->client->request('GET', $this->path);
self::assertResponseStatusCodeSame(200);
self::assertPageTitleContains('FoodVendor index');
@ -66,7 +70,7 @@ class FoodVendorControllerTest extends WebTestCase
public function testShow(): void
{
$this->markTestIncomplete();
$fixture = new FoodVendor();
$fixture = new FoodVendor;
$fixture->setName('My Title');
$this->manager->persist($fixture);
@ -83,7 +87,7 @@ class FoodVendorControllerTest extends WebTestCase
public function testEdit(): void
{
$this->markTestIncomplete();
$fixture = new FoodVendor();
$fixture = new FoodVendor;
$fixture->setName('Value');
$this->manager->persist($fixture);
@ -105,7 +109,7 @@ class FoodVendorControllerTest extends WebTestCase
public function testRemove(): void
{
$this->markTestIncomplete();
$fixture = new FoodVendor();
$fixture = new FoodVendor;
$fixture->setName('Value');
$this->manager->persist($fixture);

View file

@ -1,6 +1,5 @@
<?php declare(strict_types=1);
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__) . '/vendor/autoload.php';