phpstan fixes

This commit is contained in:
Julie Lenaerts 2022-02-25 09:48:33 +01:00
parent 051ed19f97
commit 92a6fed521
5 changed files with 10 additions and 38 deletions

View File

@ -222,33 +222,6 @@ parameters:
count: 1 count: 1
path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php path: src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php
-
message:
"""
#^Class Chill\\\\AMLI\\\\BudgetBundle\\\\Controller\\\\AbstractElementController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
"""
count: 1
path: src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
-
message:
"""
#^Class Chill\\\\AMLI\\\\BudgetBundle\\\\Controller\\\\ElementController extends deprecated class Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\Controller\\:
since Symfony 4\\.2, use "Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController" instead\\.$#
"""
count: 1
path: src/Bundle/ChillBudgetBundle/Controller/ElementController.php
-
message:
"""
#^Instantiation of deprecated class Symfony\\\\Component\\\\Security\\\\Core\\\\Role\\\\Role\\:
since Symfony 4\\.3, to be removed in 5\\.0\\. Use strings as roles instead\\.$#
"""
count: 1
path: src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php
- -
message: message:
""" """

View File

@ -16,8 +16,7 @@ use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Form; use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -26,7 +25,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
use function get_class; use function get_class;
abstract class AbstractElementController extends Controller abstract class AbstractElementController extends AbstractController
{ {
protected LoggerInterface $chillMainLogger; protected LoggerInterface $chillMainLogger;
@ -117,7 +116,7 @@ abstract class AbstractElementController extends Controller
$indexPage = 'chill_budget_elements_household_index'; $indexPage = 'chill_budget_elements_household_index';
} }
$entity = null !== $element->getPerson() ?: $element->getHousehold(); $entity = null !== $element->getPerson() ? $element->getPerson() : $element->getHousehold();
$form = $this->createForm($this->getType(), $element); $form = $this->createForm($this->getType(), $element);
$form->add('submit', SubmitType::class); $form->add('submit', SubmitType::class);
@ -150,7 +149,7 @@ abstract class AbstractElementController extends Controller
protected function _new($entity, Request $request, $template, $flashMessageOnSuccess) protected function _new($entity, Request $request, $template, $flashMessageOnSuccess)
{ {
/** @var AbstractElement $element */ /** @var AbstractElement $element */
$element = new AbstractElement(); $element = $this->createNewElement();
if ($entity instanceof Person) { if ($entity instanceof Person) {
$element->setPerson($entity); $element->setPerson($entity);

View File

@ -21,13 +21,13 @@ use DateTime;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use function array_merge; use function array_merge;
use function count; use function count;
class ElementController extends Controller class ElementController extends AbstractController
{ {
protected CalculatorManager $calculator; protected CalculatorManager $calculator;

View File

@ -21,7 +21,7 @@ final class Version20180522080432 extends AbstractMigration
{ {
public function down(Schema $schema): void public function down(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 SCHEMA chill_budget CASCADE'); $this->addSql('CREATE SCHEMA chill_budget CASCADE');
} }
@ -33,7 +33,7 @@ final class Version20180522080432 extends AbstractMigration
public function up(Schema $schema): void 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 SCHEMA chill_budget'); $this->addSql('CREATE SCHEMA chill_budget');
$this->addSql('DROP SEQUENCE report_id_seq CASCADE'); $this->addSql('DROP SEQUENCE report_id_seq CASCADE');

View File

@ -21,14 +21,14 @@ final class Version20181219145631 extends AbstractMigration
{ {
public function down(Schema $schema): void public function down(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('ALTER TABLE chill_budget.charge ALTER help SET NOT NULL'); $this->addSql('ALTER TABLE chill_budget.charge ALTER help SET NOT NULL');
} }
public function up(Schema $schema): void 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('ALTER TABLE chill_budget.charge ALTER help DROP NOT NULL'); $this->addSql('ALTER TABLE chill_budget.charge ALTER help DROP NOT NULL');
} }