Skip to content

Commit

Permalink
[Autocomplete] Apply PHP CS Fixer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz committed Feb 4, 2024
1 parent db61002 commit 0ff4d2d
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Autocompleter;
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\UX\Autocomplete\Doctrine\EntitySearchUtil;
use Symfony\UX\Autocomplete\EntityAutocompleterInterface;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Product;
namespace Symfony\UX\Autocomplete\Tests\Fixtures\Autocompleter;

class CustomGroupByProductAutocompleter extends CustomProductAutocompleter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Autocompleter;

use Doctrine\ORM\EntityRepository;
Expand All @@ -14,9 +23,8 @@ class CustomProductAutocompleter implements EntityAutocompleterInterface
{
public function __construct(
private RequestStack $requestStack,
private EntitySearchUtil $entitySearchUtil
)
{
private EntitySearchUtil $entitySearchUtil,
) {
}

public function getEntityClass(): string
Expand Down
10 changes: 9 additions & 1 deletion src/Autocomplete/tests/Fixtures/Entity/Category.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity()]
Expand Down
9 changes: 9 additions & 0 deletions src/Autocomplete/tests/Fixtures/Entity/Ingredient.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Entity;

use Doctrine\ORM\Mapping as ORM;
Expand Down
9 changes: 9 additions & 0 deletions src/Autocomplete/tests/Fixtures/Entity/Product.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Entity;

use Doctrine\Common\Collections\ArrayCollection;
Expand Down
37 changes: 23 additions & 14 deletions src/Autocomplete/tests/Fixtures/Factory/CategoryFactory.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Factory;

use Doctrine\ORM\EntityRepository;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Category;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;

/**
* @extends ModelFactory<Category>
*
* @method static Category|Proxy createOne(array $attributes = [])
* @method static Category[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Category|Proxy find(object|array|mixed $criteria)
* @method static Category|Proxy findOrCreate(array $attributes)
* @method static Category|Proxy first(string $sortedField = 'id')
* @method static Category|Proxy last(string $sortedField = 'id')
* @method static Category|Proxy random(array $attributes = [])
* @method static Category|Proxy randomOrCreate(array $attributes = []))
* @method static Category[]|Proxy[] all()
* @method static Category[]|Proxy[] findBy(array $attributes)
* @method static Category[]|Proxy[] randomSet(int $number, array $attributes = []))
* @method static Category[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
* @method static Category|Proxy createOne(array $attributes = [])
* @method static Category[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Category|Proxy find(object|array|mixed $criteria)
* @method static Category|Proxy findOrCreate(array $attributes)
* @method static Category|Proxy first(string $sortedField = 'id')
* @method static Category|Proxy last(string $sortedField = 'id')
* @method static Category|Proxy random(array $attributes = [])
* @method static Category|Proxy randomOrCreate(array $attributes = []))
* @method static Category[]|Proxy[] all()
* @method static Category[]|Proxy[] findBy(array $attributes)
* @method static Category[]|Proxy[] randomSet(int $number, array $attributes = []))
* @method static Category[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
* @method static EntityRepository|RepositoryProxy repository()
* @method Category|Proxy create(array|callable $attributes = [])
* @method Category|Proxy create(array|callable $attributes = [])
*/
final class CategoryFactory extends ModelFactory
{
Expand Down
37 changes: 23 additions & 14 deletions src/Autocomplete/tests/Fixtures/Factory/IngredientFactory.php
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Factory;

use Doctrine\ORM\EntityRepository;
use Symfony\Component\Uid\UuidV4;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Ingredient;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;

/**
* @extends ModelFactory<Ingredient>
*
* @method static Ingredient|Proxy createOne(array $attributes = [])
* @method static Ingredient[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Ingredient|Proxy find(object|array|mixed $criteria)
* @method static Ingredient|Proxy findOrCreate(array $attributes)
* @method static Ingredient|Proxy first(string $sortedField = 'id')
* @method static Ingredient|Proxy last(string $sortedField = 'id')
* @method static Ingredient|Proxy random(array $attributes = [])
* @method static Ingredient|Proxy randomOrCreate(array $attributes = []))
* @method static Ingredient[]|Proxy[] all()
* @method static Ingredient[]|Proxy[] findBy(array $attributes)
* @method static Ingredient[]|Proxy[] randomSet(int $number, array $attributes = []))
* @method static Ingredient[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
* @method static Ingredient|Proxy createOne(array $attributes = [])
* @method static Ingredient[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Ingredient|Proxy find(object|array|mixed $criteria)
* @method static Ingredient|Proxy findOrCreate(array $attributes)
* @method static Ingredient|Proxy first(string $sortedField = 'id')
* @method static Ingredient|Proxy last(string $sortedField = 'id')
* @method static Ingredient|Proxy random(array $attributes = [])
* @method static Ingredient|Proxy randomOrCreate(array $attributes = []))
* @method static Ingredient[]|Proxy[] all()
* @method static Ingredient[]|Proxy[] findBy(array $attributes)
* @method static Ingredient[]|Proxy[] randomSet(int $number, array $attributes = []))
* @method static Ingredient[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
* @method static EntityRepository|RepositoryProxy repository()
* @method Ingredient|Proxy create(array|callable $attributes = [])
* @method Ingredient|Proxy create(array|callable $attributes = [])
*/
final class IngredientFactory extends ModelFactory
{
Expand Down
37 changes: 23 additions & 14 deletions src/Autocomplete/tests/Fixtures/Factory/ProductFactory.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Factory;

use Doctrine\ORM\EntityRepository;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Product;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;

/**
* @extends ModelFactory<Product>
*
* @method static Product|Proxy createOne(array $attributes = [])
* @method static Product[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Product|Proxy find(object|array|mixed $criteria)
* @method static Product|Proxy findOrCreate(array $attributes)
* @method static Product|Proxy first(string $sortedField = 'id')
* @method static Product|Proxy last(string $sortedField = 'id')
* @method static Product|Proxy random(array $attributes = [])
* @method static Product|Proxy randomOrCreate(array $attributes = []))
* @method static Product[]|Proxy[] all()
* @method static Product[]|Proxy[] findBy(array $attributes)
* @method static Product[]|Proxy[] randomSet(int $number, array $attributes = []))
* @method static Product[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
* @method static Product|Proxy createOne(array $attributes = [])
* @method static Product[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Product|Proxy find(object|array|mixed $criteria)
* @method static Product|Proxy findOrCreate(array $attributes)
* @method static Product|Proxy first(string $sortedField = 'id')
* @method static Product|Proxy last(string $sortedField = 'id')
* @method static Product|Proxy random(array $attributes = [])
* @method static Product|Proxy randomOrCreate(array $attributes = []))
* @method static Product[]|Proxy[] all()
* @method static Product[]|Proxy[] findBy(array $attributes)
* @method static Product[]|Proxy[] randomSet(int $number, array $attributes = []))
* @method static Product[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
* @method static EntityRepository|RepositoryProxy repository()
* @method Product|Proxy create(array|callable $attributes = [])
* @method Product|Proxy create(array|callable $attributes = [])
*/
final class ProductFactory extends ModelFactory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Form;

use Symfony\Component\Form\AbstractType;
Expand All @@ -15,7 +24,7 @@ public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'class' => Ingredient::class,
'choice_label' => function(Ingredient $ingredient) {
'choice_label' => function (Ingredient $ingredient) {
return $ingredient->getName();
},
'multiple' => true,
Expand Down
21 changes: 15 additions & 6 deletions src/Autocomplete/tests/Fixtures/Form/CategoryAutocompleteType.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Form;

use Doctrine\ORM\EntityRepository;
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Category;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField;
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Category;

#[AsEntityAutocompleteField]
class CategoryAutocompleteType extends AbstractType
Expand All @@ -22,15 +31,15 @@ public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'class' => Category::class,
'choice_label' => function(Category $category) {
'choice_label' => function (Category $category) {
return '<strong>'.$category->getName().'</strong>';
},
'query_builder' => function(EntityRepository $repository) {
'query_builder' => function (EntityRepository $repository) {
return $repository->createQueryBuilder('category')
->andWhere('category.name LIKE :search')
->setParameter('search', '%foo%');
},
'security' => function(Security $security) {
'security' => function (Security $security) {
if ($this->requestStack->getCurrentRequest()?->query->get('enforce_test_security')) {
return $security->isGranted('ROLE_USER');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Form;

use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Category;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField;
use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;
use Symfony\UX\Autocomplete\Tests\Fixtures\Entity\Category;

#[AsEntityAutocompleteField]
class CategoryNoChoiceLabelAutocompleteType extends AbstractType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Form;

use Doctrine\ORM\EntityRepository;
Expand All @@ -17,7 +26,7 @@ public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'class' => Ingredient::class,
'choice_label' => function(Ingredient $ingredient) {
'choice_label' => function (Ingredient $ingredient) {
return '<strong>'.$ingredient->getName().'</strong>';
},
'multiple' => true,
Expand Down
9 changes: 9 additions & 0 deletions src/Autocomplete/tests/Fixtures/Form/ProductType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\UX\Autocomplete\Tests\Fixtures\Form;

use Symfony\Component\Form\AbstractType;
Expand Down

0 comments on commit 0ff4d2d

Please sign in to comment.