apply rector rules

This commit is contained in:
2023-07-28 02:40:02 +02:00
parent 157cdf6dfc
commit f570fe92a5
112 changed files with 252 additions and 562 deletions

View File

@@ -37,7 +37,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
*/
public $fakerNl;
private $counter = 0;
private int $counter = 0;
public function __construct()
{

View File

@@ -27,20 +27,16 @@ class CustomField
final public const ONE_TO_ONE = 1;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private $active = true;
private bool $active = true;
/**
* @var CustomFieldsGroup
*
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldsGroup",
* inversedBy="customFields")
*/
private $customFieldGroup;
private ?\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null;
/**
* @var int
@@ -59,11 +55,9 @@ class CustomField
private $name;
/**
* @var array
*
* @ORM\Column(type="json")
*/
private $options = [];
private array $options = [];
/**
* @var float
@@ -73,11 +67,9 @@ class CustomField
private $ordering;
/**
* @var bool
*
* @ORM\Column(type="boolean")
*/
private $required = false;
private false $required = false;
/**
* @var string

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -22,10 +23,9 @@ use Doctrine\ORM\Mapping as ORM;
class Option
{
/**
* @var bool
* @ORM\Column(type="boolean")
*/
private $active = true;
private bool $active = true;
/**
* @var Collection<Option>
@@ -45,33 +45,34 @@ class Option
private $id;
/**
* @var string
* @ORM\Column(type="string", length=50, name="internal_key")
*/
private $internalKey = '';
private string $internalKey = '';
/**
* @var string
* @ORM\Column(type="string", length=15)
*/
private $key;
private ?string $key = null;
/**
* @var Option
* @ORM\ManyToOne(
* targetEntity="Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option",
* inversedBy="children")
* @ORM\JoinColumn(nullable=true)
*/
private $parent;
private ?\Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option $parent = null;
/**
* A json representation of text (multilingual).
*
* @var array
* @ORM\Column(type="json")
*/
private $text;
private ?array $text = null;
public function __construct()
{
$this->children = new ArrayCollection();
}
/**
* @return bool

View File

@@ -26,10 +26,8 @@ class CustomFieldsGroup
/**
* The custom fields of the group that are active.
* This variable if null, if this informations has not been computed.
*
* @var array|null
*/
private $activeCustomFields;
private ?array $activeCustomFields = null;
/**
* The custom fields of the group.
@@ -67,11 +65,9 @@ class CustomFieldsGroup
private $name;
/**
* @var array
*
* @ORM\Column(type="json")
*/
private $options = [];
private array $options = [];
/**
* CustomFieldsGroup constructor.

View File

@@ -22,7 +22,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
*/
class ChoiceWithOtherType extends AbstractType
{
private $otherValueLabel = 'Other value';
private string $otherValueLabel = 'Other value';
/** (non-PHPdoc).
* @see \Symfony\Component\Form\AbstractType::buildForm()

View File

@@ -32,19 +32,15 @@ class LinkedCustomFieldsType extends AbstractType
* The name for the choice field.
*
* Extracted from builder::getName
*
* @var string
*/
private $choiceName = 'choice';
private string $choiceName = 'choice';
/**
* the option of the form.
*
* @internal options are stored at the class level to be reused by appendChoice, after data are setted
*
* @var array
*/
private $options = [];
private array $options = [];
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper)
{

View File

@@ -39,7 +39,7 @@ class CustomFieldProvider implements ContainerAwareInterface
/**
* @var array The services indexes by the type
*/
private $servicesByType = [];
private array $servicesByType = [];
/**
* Add a new custom field to the provider.

View File

@@ -26,15 +26,12 @@ use Twig\TwigFunction;
*/
class CustomFieldRenderingTwig extends AbstractExtension implements ContainerAwareInterface
{
/**
* @var Container The container
*/
private $container;
private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null;
/**
* @var array The default parameters
*/
private $defaultParams = [
private array $defaultParams = [
'label_layout' => 'ChillCustomFieldsBundle:CustomField:render_label.html.twig',
];

View File

@@ -24,15 +24,12 @@ use Twig\TwigFunction;
*/
class CustomFieldsGroupRenderingTwig extends AbstractExtension implements ContainerAwareInterface
{
/**
* @var Container The container
*/
private $container;
private ?\Symfony\Component\DependencyInjection\ContainerInterface $container = null;
/**
* @var array The default parameters
*/
private $defaultParams = [
private array $defaultParams = [
'layout' => 'ChillCustomFieldsBundle:CustomFieldsGroup:render.html.twig',
'show_empty' => true,
];

View File

@@ -32,10 +32,7 @@ final class CustomFieldsChoiceTest extends KernelTestCase
*/
private $cfChoice;
/**
* @var \Chill\CustomFieldsBundle\Service\CustomFieldProvider
*/
private $cfProvider;
private ?object $cfProvider = null;
protected function setUp(): void
{

View File

@@ -24,10 +24,7 @@ use function count;
*/
final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
{
/**
* @var CustomFieldNumber
*/
private $customFieldNumber;
private ?object $customFieldNumber = null;
/**
* @var FormBuilderInterface

View File

@@ -24,10 +24,7 @@ final class CustomFieldsTextTest extends WebTestCase
{
use CustomFieldTestHelper;
/**
* @var \Chill\CustomFieldsBundle\Service\CustomFieldProvider
*/
private $customFieldProvider;
private ?object $customFieldProvider = null;
protected function setUp(): void
{

View File

@@ -23,15 +23,9 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
*/
final class CustomFieldsHelperTest extends KernelTestCase
{
/**
* @var CustomFieldsHelper
*/
private $cfHelper;
private ?object $cfHelper = null;
/**
* @var CustomField
*/
private $randomCFText;
private \Chill\CustomFieldsBundle\Entity\CustomField $randomCFText;
protected function setUp(): void
{

View File

@@ -24,15 +24,9 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
*/
final class CustomFieldRenderingTwigTest extends KernelTestCase
{
/**
* @var CustomFieldProvider
*/
private $cfProvider;
private ?object $cfProvider = null;
/**
* @var CustomFieldRenderingTwig
*/
private $cfRendering;
private ?object $cfRendering = null;
protected function setUp(): void
{

View File

@@ -26,15 +26,9 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
*/
final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
{
/**
* @var CustomFieldProvider
*/
private $cfProvider;
private ?object $cfProvider = null;
/**
* @var CustomFieldsGroupRenderingTwig
*/
private $cfRendering;
private ?object $cfRendering = null;
protected function setUp(): void
{