cs: Fix code-style (using PHPCSFixer and PHPCS).

This commit is contained in:
Pol Dellaiera
2021-12-21 10:59:23 +01:00
parent b7360955f7
commit 8401ce2656
280 changed files with 742 additions and 319 deletions

View File

@@ -25,6 +25,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Role\Role;
use function count;
/**

View File

@@ -15,6 +15,7 @@ use Chill\CustomFieldsBundle\Entity\CustomField;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use function count;
/**

View File

@@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\RoleScope;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use function in_array;
/**

View File

@@ -21,6 +21,7 @@ use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Faker\Factory as FakerFactory;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use function count;
use function in_array;

View File

@@ -37,6 +37,7 @@ use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function array_key_exists;
use function array_keys;
use function array_merge;
@@ -331,7 +332,9 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
$centers = array_map(static function ($el) {
return $el['center'];
}, $acl);
// throw an error if any fields are present
if (!array_key_exists('fields', $data)) {

View File

@@ -21,6 +21,7 @@ use RuntimeException;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Role\Role;
use function array_key_exists;
/**
@@ -96,7 +97,9 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
foreach ($reachableCenters as $center) {
$reachableScopesId = array_map(
static function (Scope $scope) { return $scope->getId(); },
static function (Scope $scope) {
return $scope->getId();
},
$this->helper->getReachableScopes($this->user, $role, $center)
);
$whereElement->add(

View File

@@ -12,13 +12,13 @@ declare(strict_types=1);
namespace Chill\ReportBundle\Security\Authorization;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
use Chill\ReportBundle\Entity\Report;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use function in_array;
class ReportVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface

View File

@@ -21,6 +21,7 @@ use Doctrine\ORM\EntityManager;
use LogicException;
use Symfony\Component\Security\Core\Security;
use UnexpectedValueException;
use function array_fill;
use function array_key_exists;
use function array_merge;
@@ -121,28 +122,34 @@ class TimelineReportProvider implements TimelineProviderInterface
$subtitle = null;
foreach ($entity->getCFGroup()->getCustomFields() as $customField) {
if (in_array(
$customField->getSlug(),
$entity->getCFGroup()->getOptions()['summary_fields'],
true
)) {
if (
in_array(
$customField->getSlug(),
$entity->getCFGroup()->getOptions()['summary_fields'],
true
)
) {
// if we do not want to show empty values
if (false === $this->showEmptyValues) {
if ($customField->getType() === 'title') {
$options = $customField->getOptions();
switch ($options['type']) {
case 'title': $title = $customField;
case 'title':
$title = $customField;
break;
break;
case 'subtitle': $subtitle = $customField;
case 'subtitle':
$subtitle = $customField;
break;
break;
}
} else {
if ($this->customFieldsHelper->isEmptyValue($entity->getCFData(), $customField)
=== false) {
if (
$this->customFieldsHelper->isEmptyValue($entity->getCFData(), $customField)
=== false
) {
if (null !== $title) {
$gatheredFields[] = $title;
$title = null;