fix: SA: Fix "might not be defined" rule.

SA stands for Static Analysis.
This commit is contained in:
Pol Dellaiera
2021-11-16 11:41:12 +01:00
parent a7b96f1756
commit f8aeb08594
14 changed files with 365 additions and 620 deletions

View File

@@ -1,20 +1,7 @@
<?php
/*
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace Chill\TaskBundle\Form;
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
@@ -48,6 +35,9 @@ class SingleTaskType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$center = null;
$isScopeConcerned = false;
if (NULL !== $task = $options['data']) {
$center = $this->centerResolverDispatcher->resolveCenter($task);
$isScopeConcerned = $this->scopeResolverDispatcher->isConcerned($task);
@@ -74,8 +64,7 @@ class SingleTaskType extends AbstractType
'required' => false
]);
if ($this->parameterBag->get('chill_main')['acl']['form_show_scopes']
&& $isScopeConcerned) {
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
$builder
->add('circle', ScopePickerType::class, [
'center' => $center,