lint
This commit is contained in:
parent
a541338909
commit
7663f684a4
9 changed files with 50 additions and 32 deletions
|
@ -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 [
|
return [
|
||||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
FrameworkBundle::class => [
|
||||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
'all' => true,
|
||||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
],
|
||||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
MakerBundle::class => [
|
||||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
'dev' => true,
|
||||||
|
],
|
||||||
|
DoctrineBundle::class => [
|
||||||
|
'all' => true,
|
||||||
|
],
|
||||||
|
DoctrineMigrationsBundle::class => [
|
||||||
|
'all' => true,
|
||||||
|
],
|
||||||
|
TwigBundle::class => [
|
||||||
|
'all' => true,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
#[Route('/food/vendor')]
|
#[Route('/food/vendor')]
|
||||||
class FoodVendorController extends AbstractController
|
final class FoodVendorController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/', name: 'app_food_vendor_index', methods: ['GET'])]
|
#[Route('/', name: 'app_food_vendor_index', methods: ['GET'])]
|
||||||
public function index(FoodVendorRepository $foodVendorRepository): Response
|
public function index(FoodVendorRepository $foodVendorRepository): Response
|
||||||
|
@ -25,7 +25,7 @@ class FoodVendorController extends AbstractController
|
||||||
#[Route('/new', name: 'app_food_vendor_new', methods: ['GET', 'POST'])]
|
#[Route('/new', name: 'app_food_vendor_new', methods: ['GET', 'POST'])]
|
||||||
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
public function new(Request $request, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
$foodVendor = new FoodVendor();
|
$foodVendor = new FoodVendor;
|
||||||
$form = $this->createForm(FoodVendorType::class, $foodVendor);
|
$form = $this->createForm(FoodVendorType::class, $foodVendor);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class FoodVendorController extends AbstractController
|
||||||
#[Route('/{id}', name: 'app_food_vendor_delete', methods: ['POST'])]
|
#[Route('/{id}', name: 'app_food_vendor_delete', methods: ['POST'])]
|
||||||
public function delete(Request $request, FoodVendor $foodVendor, EntityManagerInterface $entityManager): Response
|
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->remove($foodVendor);
|
||||||
$entityManager->flush();
|
$entityManager->flush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
|
@ -18,14 +18,14 @@ class FoodVendor
|
||||||
private Ulid|null $id = null;
|
private Ulid|null $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 50)]
|
#[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;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): ?string
|
public function getName(): string|null
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Form;
|
namespace App\Form;
|
||||||
|
|
||||||
use App\Entity\FoodVendor;
|
use App\Entity\FoodVendor;
|
||||||
|
use Override;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
class FoodVendorType extends AbstractType
|
final class FoodVendorType extends AbstractType
|
||||||
{
|
{
|
||||||
|
#[Override]
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
|
@ -16,6 +18,7 @@ class FoodVendorType extends AbstractType
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Override]
|
||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ use Doctrine\Persistence\ManagerRegistry;
|
||||||
/**
|
/**
|
||||||
* @extends ServiceEntityRepository<FoodVendor>
|
* @extends ServiceEntityRepository<FoodVendor>
|
||||||
*/
|
*/
|
||||||
class FoodVendorRepository extends ServiceEntityRepository
|
final class FoodVendorRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
public function __construct(ManagerRegistry $registry)
|
public function __construct(ManagerRegistry $registry)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Test\Controller;
|
namespace App\Test\Controller;
|
||||||
|
|
||||||
use App\Entity\FoodVendor;
|
use App\Entity\FoodVendor;
|
||||||
use App\Kernel;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Doctrine\ORM\Tools\SchemaTool;
|
use Doctrine\ORM\Tools\SchemaTool;
|
||||||
|
use Override;
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class FoodVendorControllerTest extends WebTestCase
|
use function sprintf;
|
||||||
|
|
||||||
|
final class FoodVendorControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
private KernelBrowser $client;
|
private KernelBrowser $client;
|
||||||
private EntityManagerInterface $manager;
|
private EntityManagerInterface $manager;
|
||||||
|
@ -22,6 +24,8 @@ class FoodVendorControllerTest extends WebTestCase
|
||||||
(new SchemaTool($this->manager))
|
(new SchemaTool($this->manager))
|
||||||
->createSchema($this->manager->getMetadataFactory()->getAllMetadata());
|
->createSchema($this->manager->getMetadataFactory()->getAllMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Override]
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->client = static::createClient();
|
$this->client = static::createClient();
|
||||||
|
@ -38,7 +42,7 @@ class FoodVendorControllerTest extends WebTestCase
|
||||||
|
|
||||||
public function testIndex(): void
|
public function testIndex(): void
|
||||||
{
|
{
|
||||||
$crawler = $this->client->request('GET', $this->path);
|
$this->client->request('GET', $this->path);
|
||||||
|
|
||||||
self::assertResponseStatusCodeSame(200);
|
self::assertResponseStatusCodeSame(200);
|
||||||
self::assertPageTitleContains('FoodVendor index');
|
self::assertPageTitleContains('FoodVendor index');
|
||||||
|
@ -66,7 +70,7 @@ class FoodVendorControllerTest extends WebTestCase
|
||||||
public function testShow(): void
|
public function testShow(): void
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->markTestIncomplete();
|
||||||
$fixture = new FoodVendor();
|
$fixture = new FoodVendor;
|
||||||
$fixture->setName('My Title');
|
$fixture->setName('My Title');
|
||||||
|
|
||||||
$this->manager->persist($fixture);
|
$this->manager->persist($fixture);
|
||||||
|
@ -83,7 +87,7 @@ class FoodVendorControllerTest extends WebTestCase
|
||||||
public function testEdit(): void
|
public function testEdit(): void
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->markTestIncomplete();
|
||||||
$fixture = new FoodVendor();
|
$fixture = new FoodVendor;
|
||||||
$fixture->setName('Value');
|
$fixture->setName('Value');
|
||||||
|
|
||||||
$this->manager->persist($fixture);
|
$this->manager->persist($fixture);
|
||||||
|
@ -105,7 +109,7 @@ class FoodVendorControllerTest extends WebTestCase
|
||||||
public function testRemove(): void
|
public function testRemove(): void
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete();
|
$this->markTestIncomplete();
|
||||||
$fixture = new FoodVendor();
|
$fixture = new FoodVendor;
|
||||||
$fixture->setName('Value');
|
$fixture->setName('Value');
|
||||||
|
|
||||||
$this->manager->persist($fixture);
|
$this->manager->persist($fixture);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php declare(strict_types=1);
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
|
||||||
use Symfony\Component\Dotenv\Dotenv;
|
use Symfony\Component\Dotenv\Dotenv;
|
||||||
|
|
||||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
|
|
Loading…
Reference in a new issue