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\ReportBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;

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\ReportBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;

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\ReportBundle\DataFixtures\ORM;
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\ReportBundle\DataFixtures\ORM;
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\ReportBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;
@@ -50,7 +59,7 @@ class LoadReportACL extends AbstractFixture implements OrderedFixtureInterface
case 'administrative':
case 'direction':
if (in_array($scope->getName()['en'], ['administrative', 'social'])) {
if (in_array($scope->getName()['en'], ['administrative', 'social'], true)) {
printf("denying power on %s\n", $scope->getName()['en']);
break 2; // we do not want any power on social or administrative

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\ReportBundle\DataFixtures\ORM;
use Chill\CustomFieldsBundle\Entity\CustomField;
@@ -188,7 +197,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
if ($other) {
$result = ['_other' => null, '_choices' => $picked];
if (in_array('_other', $picked)) {
if (in_array('_other', $picked, true)) {
$result['_other'] = $this->faker->realText(70);
}

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\ReportBundle\DependencyInjection;
use Chill\CustomFieldsBundle\Form\Type\LinkedCustomFieldsType;

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\ReportBundle\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\ReportBundle\Entity;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;

View File

@@ -281,7 +281,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
default:
// for fields which are associated with person
if (in_array($key, $this->fields)) {
if (in_array($key, $this->fields, true)) {
return static function ($value) use ($key) {
if ('_header' === $value) {
return strtolower($key);
@@ -300,7 +300,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
$fields = [];
foreach ($data['fields'] as $key) {
if (in_array($key, $this->fields)) {
if (in_array($key, $this->fields, true)) {
$fields[] = $key;
}
}
@@ -344,7 +344,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
// process fields which are not custom fields
foreach ($this->fields as $f) {
// do not add fields which are not selected
if (!in_array($f, $data['fields'])) {
if (!in_array($f, $data['fields'], true)) {
continue;
}
@@ -412,7 +412,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
// process fields which are custom fields
foreach ($this->getCustomFields() as $cf) {
// do not add custom fields which are not selected
if (!in_array($cf->getSlug(), $data['fields'])) {
if (!in_array($cf->getSlug(), $data['fields'], true)) {
continue;
}

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\ReportBundle\Export\Export;
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\ReportBundle\Export\Filter;
use Chill\MainBundle\Export\FilterInterface;

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\ReportBundle\Form;
use Chill\CustomFieldsBundle\Form\Type\CustomFieldType;

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.
*/
namespace Chill\ReportBundle\Search;
use Chill\MainBundle\Entity\Scope;

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\ReportBundle\Security\Authorization;
use Chill\MainBundle\Entity\Center;
@@ -59,7 +68,7 @@ class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
if ($subject instanceof Report) {
return in_array($attribute, [
self::CREATE, self::UPDATE, self::SEE,
]);
], true);
}
if ($subject instanceof Center) {

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\ReportBundle\Tests\Controller;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
@@ -24,7 +33,7 @@ use function in_array;
* @internal
* @coversNothing
*/
class ReportControllerNextTest extends WebTestCase
final class ReportControllerNextTest extends WebTestCase
{
/**
* @var CustomFieldsGroup
@@ -38,9 +47,9 @@ class ReportControllerNextTest extends WebTestCase
public function setUp()
{
static::bootKernel();
self::bootKernel();
// get person from fixture
$em = static::$kernel->getContainer()
$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$this->person = $em
@@ -59,7 +68,7 @@ class ReportControllerNextTest extends WebTestCase
}
// get custom fields group from fixture
$customFieldsGroups = static::$kernel->getContainer()
$customFieldsGroups = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->findBy(['entity' => 'Chill\ReportBundle\Entity\Report']);
@@ -67,7 +76,7 @@ class ReportControllerNextTest extends WebTestCase
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
static function (CustomFieldsGroup $group) {
return in_array('Situation de logement', $group->getName());
return in_array('Situation de logement', $group->getName(), true);
}
);
$this->group = $filteredCustomFieldsGroupHouse[0];
@@ -92,7 +101,7 @@ class ReportControllerNextTest extends WebTestCase
public function testUngrantedUserIsDeniedAccessOnReport()
{
$client = $this->getAuthenticatedClient('center b_social');
$reports = static::$kernel->getContainer()->get('doctrine.orm.entity_manager')
$reports = self::$kernel->getContainer()->get('doctrine.orm.entity_manager')
->getRepository('ChillReportBundle:Report')
->findBy(['person' => $this->person]);
$report = $reports[0];
@@ -165,7 +174,7 @@ class ReportControllerNextTest extends WebTestCase
protected function getAuthenticatedClient($username = 'center a_social')
{
return static::createClient([], [
return self::createClient([], [
'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => 'password',
]);

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\ReportBundle\Tests\Controller;
use Chill\CustomFieldsBundle\Entity\CustomFieldsGroup;
@@ -27,7 +36,7 @@ use function in_array;
* @internal
* @coversNothing
*/
class ReportControllerTest extends WebTestCase
final class ReportControllerTest extends WebTestCase
{
public const REPORT_NAME_FIELD = 'cFGroup';
@@ -55,13 +64,13 @@ class ReportControllerTest extends WebTestCase
public static function setUpBeforeClass()
{
static::bootKernel();
self::bootKernel();
static::$em = static::$kernel->getContainer()
self::$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
//get a random person
static::$person = static::$kernel->getContainer()
self::$person = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillPersonBundle:Person')
->findOneBy(
@@ -71,13 +80,13 @@ class ReportControllerTest extends WebTestCase
]
);
if (null === static::$person) {
if (null === self::$person) {
throw new RuntimeException('The expected person is not present in the database. '
. 'Did you run `php app/console doctrine:fixture:load` before launching tests ? '
. "(expecting person is 'Charline Depardieu'");
}
$customFieldsGroups = static::$kernel->getContainer()
$customFieldsGroups = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->findBy(['entity' => 'Chill\ReportBundle\Entity\Report']);
@@ -85,12 +94,12 @@ class ReportControllerTest extends WebTestCase
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
static function (CustomFieldsGroup $group) {
return in_array('Situation de logement', $group->getName());
return in_array('Situation de logement', $group->getName(), true);
}
);
static::$group = $filteredCustomFieldsGroupHouse[0];
self::$group = $filteredCustomFieldsGroupHouse[0];
static::$user = static::$kernel->getContainer()
self::$user = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillMainBundle:User')
->findOneBy(['username' => 'center a_social']);
@@ -98,7 +107,7 @@ class ReportControllerTest extends WebTestCase
public function setUp()
{
static::$client = static::createClient([], [
self::$client = self::createClient([], [
'PHP_AUTH_USER' => 'center a_social',
'PHP_AUTH_PW' => 'password',
]);
@@ -111,7 +120,7 @@ class ReportControllerTest extends WebTestCase
*/
public function getAuthenticatedClient($username = 'center a_social')
{
return static::createClient([], [
return self::createClient([], [
'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => 'password',
]);
@@ -203,7 +212,7 @@ class ReportControllerTest extends WebTestCase
$client = $this->getAuthenticatedClient();
$crawler = $client->request('GET', sprintf(
'/fr/person/%s/report/list',
static::$person->getId()
self::$person->getId()
));
$this->assertTrue($client->getResponse()->isSuccessful());
@@ -212,7 +221,7 @@ class ReportControllerTest extends WebTestCase
$this->assertGreaterThan(0, count($linkSee));
$this->assertRegExp(sprintf(
'|/fr/person/%s/report/[0-9]*/view$|',
static::$person->getId(),
self::$person->getId(),
$reportId
), $linkSee[0]->getUri());
@@ -220,7 +229,7 @@ class ReportControllerTest extends WebTestCase
$this->assertGreaterThan(0, count($linkUpdate));
$this->assertRegExp(sprintf(
'|/fr/person/%s/report/[0-9]*/edit$|',
static::$person->getId(),
self::$person->getId(),
$reportId
), $linkUpdate[0]->getUri());
}
@@ -238,7 +247,7 @@ class ReportControllerTest extends WebTestCase
$client = $this->getAuthenticatedClient();
$crawlerPersonPage = $client->request('GET', sprintf(
'/fr/person/%d/general',
static::$person->getId()
self::$person->getId()
));
if (!$client->getResponse()->isSuccessful()) {
@@ -256,7 +265,7 @@ class ReportControllerTest extends WebTestCase
$this->assertContains(
sprintf(
'/fr/person/%d/report/select/type/for/creation',
static::$person->getId()
self::$person->getId()
),
$link->getUri(),
'There is a "add a report" link in menu'
@@ -293,8 +302,8 @@ class ReportControllerTest extends WebTestCase
{
$client = $this->getAuthenticatedClient();
$form = $this->getReportForm(
static::$person,
static::$group,
self::$person,
self::$group,
$client
);
//var_dump($form);
@@ -319,7 +328,7 @@ class ReportControllerTest extends WebTestCase
$client = $this->getAuthenticatedClient();
$crawler = $client->request(
'GET',
sprintf('/fr/person/%s/report/%s/edit', static::$person->getId(), $reportId)
sprintf('/fr/person/%s/report/%s/edit', self::$person->getId(), $reportId)
);
$this->assertTrue($client->getResponse()->isSuccessful());
@@ -337,12 +346,12 @@ class ReportControllerTest extends WebTestCase
$this->assertTrue($client->getResponse()->isRedirect(
sprintf(
'/fr/person/%s/report/%s/view',
static::$person->getId(),
self::$person->getId(),
$reportId
)
));
$this->assertEquals(new DateTime('yesterday'), static::$kernel->getContainer()
$this->assertEquals(new DateTime('yesterday'), self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('ChillReportBundle:Report')
->find($reportId)
@@ -371,7 +380,7 @@ class ReportControllerTest extends WebTestCase
$client->followRedirect();
$this->assertRegExp(
'|/fr/person/' . static::$person->getId() . '/report/[0-9]*/view$|',
'|/fr/person/' . self::$person->getId() . '/report/[0-9]*/view$|',
$client->getHistory()->current()->getUri(),
"The next page is a redirection to the new report's view page"
);
@@ -398,7 +407,7 @@ class ReportControllerTest extends WebTestCase
$client = $this->getAuthenticatedClient();
$client->request(
'GET',
sprintf('/fr/person/%s/report/%s/view', static::$person->getId(), $reportId)
sprintf('/fr/person/%s/report/%s/view', self::$person->getId(), $reportId)
);
$this->assertTrue(
@@ -474,7 +483,7 @@ class ReportControllerTest extends WebTestCase
$this->assertEquals(
'center a_social',
static::$user->getUsername(),
self::$user->getUsername(),
'the user field is the current user by default'
);
}

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\ReportBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
@@ -15,7 +24,7 @@ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
* @internal
* @coversNothing
*/
class ChillReportExtensionTest extends KernelTestCase
final class ChillReportExtensionTest extends KernelTestCase
{
/*
* Check if class Chill\ReportBundle\Entity\Report is in chill_custom_fields.customizables_entities
@@ -23,7 +32,7 @@ class ChillReportExtensionTest extends KernelTestCase
public function testDeclareReportAsCustomizable()
{
self::bootKernel(['environment' => 'test']);
$customizablesEntities = static::$kernel->getContainer()
$customizablesEntities = self::$kernel->getContainer()
->getParameter('chill_custom_fields.customizables_entities');
$reportFounded = 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\ReportBundle\Tests\Search;
use DateTime;
@@ -18,7 +27,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @internal
* @coversNothing
*/
class ReportSearchTest extends WebTestCase
final class ReportSearchTest extends WebTestCase
{
public function testNamedSearch()
{
@@ -107,7 +116,7 @@ class ReportSearchTest extends WebTestCase
*/
private function getAuthenticatedClient($username = 'center a_social')
{
return static::createClient([], [
return self::createClient([], [
'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => 'password',
]);

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\ReportBundle\Tests\Security\Authorization;
use Chill\MainBundle\Entity\Center;
@@ -23,7 +32,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
* @internal
* @coversNothing
*/
class ReportVoterTest extends KernelTestCase
final class ReportVoterTest extends KernelTestCase
{
use PrepareCenterTrait;
use PrepareScopeTrait;
@@ -45,8 +54,8 @@ class ReportVoterTest extends KernelTestCase
public function setUp()
{
static::bootKernel();
$this->voter = static::$kernel->getContainer()
self::bootKernel();
$this->voter = self::$kernel->getContainer()
->get('chill.report.security.authorization.report_voter');
$this->prophet = new \Prophecy\Prophet();
}

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\ReportBundle\Tests\Timeline;
use Chill\MainBundle\Entity\Scope;
@@ -23,7 +32,7 @@ use function count;
* @internal
* @coversNothing
*/
class TimelineProviderTest extends WebTestCase
final class TimelineProviderTest extends WebTestCase
{
/**
* @var \Doctrine\ORM\EntityManager
@@ -45,12 +54,12 @@ class TimelineProviderTest extends WebTestCase
*/
public function setUp()
{
static::bootKernel();
self::bootKernel();
static::$em = static::$kernel->getContainer()
self::$em = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager');
$center = static::$em->getRepository('ChillMainBundle:Center')
$center = self::$em->getRepository('ChillMainBundle:Center')
->findOneBy(['name' => 'Center A']);
$person = (new Person(new DateTime('2015-05-01')))
@@ -58,18 +67,18 @@ class TimelineProviderTest extends WebTestCase
->setFirstName('Nelson')
->setLastName('Mandela')
->setCenter($center);
static::$em->persist($person);
self::$em->persist($person);
$this->person = $person;
$scopesSocial = array_filter(
static::$em
self::$em
->getRepository('ChillMainBundle:Scope')
->findAll(),
static function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
);
$report = (new Report())
->setUser(static::$em->getRepository('ChillMainBundle:User')
->setUser(self::$em->getRepository('ChillMainBundle:User')
->findOneByUsername('center a_social'))
->setDate(new DateTime('2015-05-02'))
->setPerson($this->person)
@@ -78,10 +87,10 @@ class TimelineProviderTest extends WebTestCase
'house-desc' => 'blah blah', ])
->setScope(end($scopesSocial));
static::$em->persist($report);
self::$em->persist($report);
$this->report = $report;
static::$em->flush();
self::$em->flush();
}
public function tearDown()
@@ -94,7 +103,7 @@ class TimelineProviderTest extends WebTestCase
public function testReportIsNotVisibleToUngrantedUsers()
{
$client = static::createClient(
$client = self::createClient(
[],
MainTestHelper::getAuthenticatedClientOptions('center a_administrative')
);
@@ -115,7 +124,7 @@ class TimelineProviderTest extends WebTestCase
*/
public function testTimelineReport()
{
$client = static::createClient(
$client = self::createClient(
[],
MainTestHelper::getAuthenticatedClientOptions()
);
@@ -137,7 +146,7 @@ class TimelineProviderTest extends WebTestCase
public function testTimelineReportWithSummaryField()
{
//load the page
$client = static::createClient(
$client = self::createClient(
[],
MainTestHelper::getAuthenticatedClientOptions()
);
@@ -177,7 +186,7 @@ class TimelineProviderTest extends WebTestCase
*/
private function getHousingCustomFieldsGroup()
{
$groups = static::$em
$groups = self::$em
->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')
->findAll();

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

@@ -123,7 +123,8 @@ class TimelineReportProvider implements TimelineProviderInterface
foreach ($entity->getCFGroup()->getCustomFields() as $customField) {
if (in_array(
$customField->getSlug(),
$entity->getCFGroup()->getOptions()['summary_fields']
$entity->getCFGroup()->getOptions()['summary_fields'],
true
)) {
// if we do not want to show empty values
if (false === $this->showEmptyValues) {
@@ -239,7 +240,7 @@ break;
$askedCenters = $args['centers'];
foreach ($reachableCenters as $center) {
if (false === in_array($center, $askedCenters)) {
if (false === in_array($center, $askedCenters, true)) {
continue;
}
@@ -249,7 +250,7 @@ break;
$scopeIds = [];
foreach ($this->helper->getReachableScopes($this->security->getUser(), $role, $center) as $scope) {
if (in_array($scope->getId(), $scopeIds)) {
if (in_array($scope->getId(), $scopeIds, true)) {
continue;
}
$scopeIds[] = $scope->getId();
@@ -297,7 +298,7 @@ break;
$scopes = $this->helper->getReachableScopes($this->security->getUser(), $role, $args['person']->getCenter());
foreach ($scopes as $scope) {
if (in_array($scope->getId(), $parameters)) {
if (in_array($scope->getId(), $parameters, true)) {
continue;
}

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\Report;
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\Report;
use Chill\MainBundle\Entity\Scope;
@@ -29,7 +38,7 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI
public function down(Schema $schema): void
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
$this->connection->getDatabasePlatform()->getName() !== 'postgresql',
'Migration can only be executed safely on \'postgresql\'.'
);
@@ -52,7 +61,7 @@ class Version20150622233319 extends AbstractMigration implements ContainerAwareI
public function up(Schema $schema): void
{
$this->abortIf(
$this->connection->getDatabasePlatform()->getName() != 'postgresql',
$this->connection->getDatabasePlatform()->getName() !== 'postgresql',
'Migration can only be executed safely on \'postgresql\'.'
);