cs: Enable more risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-30 11:37:57 +01:00
parent c8195e6df5
commit a9188355c5
193 changed files with 306 additions and 63 deletions

View File

@@ -23,6 +23,7 @@ use Symfony\Component\Console\Question\Question;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Yaml\Exception\ParseException;
use Symfony\Component\Yaml\Parser;
use function count;
/**
* Class for the command 'chill:custom_fields:populate_group' that

View File

@@ -24,6 +24,7 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\Translation\TranslatorInterface;
use function in_array;
/**
* Class CustomFieldsGroupController.

View File

@@ -21,6 +21,10 @@ use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
use function array_key_exists;
use function count;
use function in_array;
use function is_array;
use function LogicException;
class CustomFieldChoice extends AbstractCustomField
@@ -229,10 +233,10 @@ class CustomFieldChoice extends AbstractCustomField
if ($cf->getOptions()[self::MULTIPLE]) {
if ($cf->getOptions()[self::ALLOW_OTHER]) {
return \in_array($choiceSlug, $this->deserialize($data, $cf)['_choices']);
return in_array($choiceSlug, $this->deserialize($data, $cf)['_choices']);
}
return \in_array($choiceSlug, $this->deserialize($data, $cf));
return in_array($choiceSlug, $this->deserialize($data, $cf));
}
if ($cf->getOptions()[self::ALLOW_OTHER]) {

View File

@@ -21,6 +21,9 @@ use LogicException;
use Symfony\Bridge\Twig\TwigEngine;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use function get_class;
use function gettype;
use function is_object;
class CustomFieldLongChoice extends AbstractCustomField
{

View File

@@ -18,6 +18,7 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use function array_key_exists;
class CustomFieldText extends AbstractCustomField
{

View File

@@ -18,6 +18,7 @@ use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;
use function count;
class CustomFieldsGroupType extends AbstractType
{

View File

@@ -13,6 +13,7 @@ use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
use function gettype;
class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
{

View File

@@ -14,6 +14,7 @@ namespace Chill\CustomFieldsBundle\Form\DataTransformer;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use function array_key_exists;
class JsonCustomFieldToArrayTransformer implements DataTransformerInterface
{

View File

@@ -13,6 +13,7 @@ use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
use function array_key_exists;
/**
* This extension create the possibility to add some text

View File

@@ -18,7 +18,7 @@ use Symfony\Component\HttpFoundation\Request;
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || PHP_SAPI === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');

View File

@@ -15,7 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
class CustomFieldControllerTest extends WebTestCase
class CustomFieldControllerTest_TODO extends WebTestCase
{
/*
public function testCompleteScenario()

View File

@@ -12,6 +12,7 @@ namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber;
use Chill\CustomFieldsBundle\Entity\CustomField;
use Symfony\Component\Form\FormBuilderInterface;
use function count;
/**
* Test CustomFieldsNumber.