cs: Switch to a stricter way of coding - this might break in a lot of places.

This commit is contained in:
Pol Dellaiera
2021-11-30 13:33:18 +01:00
parent 28d2c42454
commit 47c5855a21
957 changed files with 9025 additions and 568 deletions

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle;
use Chill\CustomFieldsBundle\DependencyInjection\CustomFieldCompilerPass;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Command;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -139,7 +148,7 @@ class CreateFieldsOnGroupCommand extends Command
$question->setNormalizer(
static function ($answer) use ($customFieldsGroups) {
foreach ($customFieldsGroups as $customFieldsGroup) {
if ($customFieldsGroup->getId() == $answer) {
if ($customFieldsGroup->getId() === $answer) {
return $customFieldsGroup;
}
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Controller;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Controller;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -117,7 +126,7 @@ class CustomFieldsGroupController extends AbstractController
$makeDefaultFormViews = [];
foreach ($cfGroups as $group) {
if (!in_array($group->getId(), $defaultGroups)) {
if (!in_array($group->getId(), $defaultGroups, true)) {
$makeDefaultFormViews[$group->getId()] = $this->createMakeDefaultForm($group)->createView();
}
}
@@ -419,7 +428,7 @@ class CustomFieldsGroupController extends AbstractController
. 'customizables_entities');
foreach ($options as $key => $definition) {
if ($definition['class'] == $entity) {
if ($definition['class'] === $entity) {
foreach ($definition['options'] as $key => $value) {
yield $key;
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -90,7 +99,7 @@ class CustomFieldChoice extends AbstractCustomField
];
//if allow_other = true
if (true == $customFieldOptions[self::ALLOW_OTHER]) {
if (true === $customFieldOptions[self::ALLOW_OTHER]) {
$otherValueLabel = null;
if (array_key_exists(self::OTHER_VALUE_LABEL, $customFieldOptions)) {
@@ -233,10 +242,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'], true);
}
return in_array($choiceSlug, $this->deserialize($data, $cf));
return in_array($choiceSlug, $this->deserialize($data, $cf), true);
}
if ($cf->getOptions()[self::ALLOW_OTHER]) {
@@ -295,13 +304,13 @@ class CustomFieldChoice extends AbstractCustomField
$selected = (is_array($data)) ? $data : [$data];
$choices = $customField->getOptions()[self::CHOICES];
if (in_array('_other', $selected)) {
if (in_array('_other', $selected, true)) {
$choices[] = ['name' => $value['_other'], 'slug' => '_other'];
}
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice.html.twig';
if ('csv' == $documentType) {
if ('csv' === $documentType) {
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:choice.csv.twig';
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -103,7 +112,7 @@ class CustomFieldText extends AbstractCustomField
{
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.html.twig';
if ('csv' == $documentType) {
if ('csv' === $documentType) {
$template = 'ChillCustomFieldsBundle:CustomFieldsRendering:text.csv.twig';
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\CustomFields;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\DataFixtures\ORM;
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\DependencyInjection;
use LogicException;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice;
use Doctrine\Common\Collections\Collection;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\EntityRepository\CustomFieldLongChoice;
use Chill\CustomFieldsBundle\Entity\CustomFieldLongChoice\Option;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form;
use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\DataTransformer;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\DataTransformer;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Extension;
use Symfony\Component\Form\AbstractTypeExtension;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Extension;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Extension;
use Symfony\Component\Form\Extension\Core\Type\NumberType;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Type;
use Chill\MainBundle\Form\Type\TranslatableStringFormType;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Type;
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Form\Type;
use Chill\MainBundle\Templating\TranslatableStringHelper;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
@@ -18,7 +27,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 === 'cli-server')
|| !(in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1'], true) || \PHP_SAPI === 'cli-server')
) {
header('HTTP/1.0 403 Forbidden');

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Service;
use LogicException;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Service;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Service;
use Exception;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Templating\Twig;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Templating\Twig;
use Symfony\Component\DependencyInjection\Container;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests\Config;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -17,7 +26,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
class ConfigCustomizablesEntitiesTest extends KernelTestCase
final class ConfigCustomizablesEntitiesTest extends KernelTestCase
{
/**
* Test that the 'chill_custom_fields.customizables_entities' is filled
@@ -28,7 +37,7 @@ class ConfigCustomizablesEntitiesTest extends KernelTestCase
public function testNotEmptyConfig()
{
self::bootKernel(['environment' => 'test_customizable_entities_test_not_empty_config']);
$customizableEntities = static::$kernel->getContainer()
$customizableEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities');
$this->assertInternalType('array', $customizableEntities);
@@ -51,7 +60,7 @@ class ConfigCustomizablesEntitiesTest extends KernelTestCase
public function testNotPresentInConfig()
{
self::bootKernel(['environment' => 'test']);
$customizableEntities = static::$kernel->getContainer()
$customizableEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities');
$this->assertInternalType('array', $customizableEntities);

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -15,7 +24,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
class CustomFieldControllerTest_TODO extends WebTestCase
final class CustomFieldControllerTest_TODO extends WebTestCase
{
/*
public function testCompleteScenario()

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Client;
@@ -16,13 +25,13 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
class CustomFieldsGroupControllerTest extends WebTestCase
final class CustomFieldsGroupControllerTest extends WebTestCase
{
public function testCompleteScenario()
{
self::bootKernel(['environment' => 'test_customizable_entities_test_not_empty_config']);
// Create a new client to browse the application
$client = static::createClient([], [
$client = self::createClient([], [
'PHP_AUTH_USER' => 'admin',
'PHP_AUTH_PW' => 'olala',
]);

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\Entity\CustomField;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
@@ -23,7 +32,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
class CustomFieldsChoiceTest extends KernelTestCase
final class CustomFieldsChoiceTest extends KernelTestCase
{
/**
* @var \Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice
@@ -37,9 +46,9 @@ class CustomFieldsChoiceTest extends KernelTestCase
public function setUp()
{
static::bootKernel();
self::bootKernel();
$this->cfProvider = static::$kernel->getContainer()
$this->cfProvider = self::$kernel->getContainer()
->get('chill.custom_field.provider');
$this->cfChoice = $this->cfProvider->getCustomFieldByType('choice');
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldNumber;
@@ -20,7 +29,7 @@ use function count;
* @internal
* @coversNothing
*/
class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
final class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTestCase
{
/**
* @var CustomFieldNumber
@@ -126,7 +135,7 @@ class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTes
$cfGroup = (new \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup())
->addCustomField($cf);
$form = static::$kernel->getContainer()->get('form.factory')
$form = self::$kernel->getContainer()->get('form.factory')
->createBuilder(\Chill\CustomFieldsBundle\Form\Type\CustomFieldType::class, [], [
'group' => $cfGroup,
])
@@ -151,7 +160,7 @@ class CustomFieldsNumberTest extends \Symfony\Bundle\FrameworkBundle\Test\WebTes
$cfGroup = (new \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup())
->addCustomField($cf);
$form = static::$kernel->getContainer()->get('form.factory')
$form = self::$kernel->getContainer()->get('form.factory')
->createBuilder(\Chill\CustomFieldsBundle\Form\Type\CustomFieldType::class, [], [
'group' => $cfGroup,
])

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldText;
@@ -17,7 +26,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
class CustomFieldsTextTest extends WebTestCase
final class CustomFieldsTextTest extends WebTestCase
{
use CustomFieldTestHelper;
@@ -28,8 +37,8 @@ class CustomFieldsTextTest extends WebTestCase
public function setUp()
{
static::bootKernel();
$this->customFieldProvider = static::$kernel->getContainer()
self::bootKernel();
$this->customFieldProvider = self::$kernel->getContainer()
->get('chill.custom_field.provider');
}
@@ -49,7 +58,7 @@ class CustomFieldsTextTest extends WebTestCase
public function testFormTextNew()
{
$client = static::createClient();
$client = self::createClient();
$crawler = $client->request('GET', '/fr/admin/customfield/new?type=text');

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFields\Tests\Form\Extension;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -18,7 +27,7 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
* @internal
* @coversNothing
*/
class PostTextIntegerExtensionTest extends KernelTestCase
final class PostTextIntegerExtensionTest extends KernelTestCase
{
/**
* @var \Symfony\Component\Form\FormBuilderInterface

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFields\Tests\Form\Extension;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -18,7 +27,7 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType;
* @internal
* @coversNothing
*/
class PostTextNumberExtensionTest extends KernelTestCase
final class PostTextNumberExtensionTest extends KernelTestCase
{
/**
* @var \Symfony\Component\Form\FormBuilderInterface

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFieldsBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -18,11 +27,11 @@ use Symfony\Component\HttpFoundation\Response;
* @internal
* @coversNothing
*/
class RoutingLoaderTest extends WebTestCase
final class RoutingLoaderTest extends WebTestCase
{
public function testRoutesAreLoaded()
{
$client = static::createClient();
$client = self::createClient();
$client->request('GET', '/fr/admin/customfield/');

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFields\Tests\Service;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -19,7 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
class CustomFieldsHelperTest extends KernelTestCase
final class CustomFieldsHelperTest extends KernelTestCase
{
/**
* @var CustomFieldsHelper

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFields\Tests\Templating\Twig;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -20,7 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
class CustomFieldRenderingTwigTest extends KernelTestCase
final class CustomFieldRenderingTwigTest extends KernelTestCase
{
/**
* @var CustomFieldProvider

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CustomFields\Tests\Templating\Twig;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -22,7 +31,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
{
/**
* @var CustomFieldProvider

View File

@@ -7,6 +7,14 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
if (!is_file($autoloadFile = __DIR__ . '/../vendor/autoload.php')) {
throw new \LogicException('Could not find autoload.php in vendor/. Did you run "composer install --dev"?');
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +29,7 @@ class Version20151210155904 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE CustomField DROP required');
}
@@ -28,7 +37,7 @@ class Version20151210155904 extends AbstractMigration
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE customfield ADD required BOOLEAN DEFAULT FALSE');
}

View File

@@ -7,6 +7,15 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\Migrations\CustomFields;
use Doctrine\DBAL\Schema\Schema;
@@ -20,7 +29,7 @@ class Version20151210205610 extends AbstractMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('ALTER TABLE custom_field_long_choice_options DROP CONSTRAINT cf_long_choice_self_referencing');
$this->addSql('DROP SEQUENCE custom_field_long_choice_options_id_seq CASCADE');
@@ -29,7 +38,7 @@ class Version20151210205610 extends AbstractMigration
public function up(Schema $schema): void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE SEQUENCE custom_field_long_choice_options_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE custom_field_long_choice_options (id INT NOT NULL, '