activate bleeding edge phpstan rules (#2898)

This commit is contained in:
Kevin Papst
2021-11-02 13:33:21 +01:00
committed by GitHub
parent 36c08b0dea
commit 1b35356f81
32 changed files with 73 additions and 142 deletions

12
composer.lock generated
View File

@@ -6149,16 +6149,16 @@
}, },
{ {
"name": "symfony/flex", "name": "symfony/flex",
"version": "v1.17.1", "version": "v1.17.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/flex.git", "url": "https://github.com/symfony/flex.git",
"reference": "782ef2269622b8349c4bc3dc795fc79d39e8a5b2" "reference": "0170279814f86648c62aede39b100a343ea29962"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/flex/zipball/782ef2269622b8349c4bc3dc795fc79d39e8a5b2", "url": "https://api.github.com/repos/symfony/flex/zipball/0170279814f86648c62aede39b100a343ea29962",
"reference": "782ef2269622b8349c4bc3dc795fc79d39e8a5b2", "reference": "0170279814f86648c62aede39b100a343ea29962",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -6197,7 +6197,7 @@
"description": "Composer plugin for Symfony", "description": "Composer plugin for Symfony",
"support": { "support": {
"issues": "https://github.com/symfony/flex/issues", "issues": "https://github.com/symfony/flex/issues",
"source": "https://github.com/symfony/flex/tree/v1.17.1" "source": "https://github.com/symfony/flex/tree/v1.17.2"
}, },
"funding": [ "funding": [
{ {
@@ -6213,7 +6213,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-10-14T06:14:48+00:00" "time": "2021-10-21T08:39:19+00:00"
}, },
{ {
"name": "symfony/form", "name": "symfony/form",

View File

@@ -2,6 +2,7 @@ includes:
- vendor/phpstan/phpstan-symfony/extension.neon - vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon - vendor/phpstan/phpstan-doctrine/extension.neon
- vendor/phpstan/phpstan-symfony/rules.neon - vendor/phpstan/phpstan-symfony/rules.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters: parameters:
tmpDir: %rootDir%/../../../var/cache/phpstan tmpDir: %rootDir%/../../../var/cache/phpstan

View File

@@ -123,10 +123,8 @@ class ActivityController extends BaseApiController
if (!\is_array($projects)) { if (!\is_array($projects)) {
$projects = explode(',', $projects); $projects = explode(',', $projects);
} }
if (!empty($projects)) {
$query->setProjects($projects); $query->setProjects($projects);
} }
}
if (!empty($project = $paramFetcher->get('project'))) { if (!empty($project = $paramFetcher->get('project'))) {
$query->addProject($project); $query->addProject($project);

View File

@@ -26,6 +26,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $formDateTime = ''; private $formDateTime = '';
/** /**
@@ -36,6 +37,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $formDate = ''; private $formDate = '';
/** /**
@@ -46,6 +48,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $dateTime = ''; private $dateTime = '';
/** /**
@@ -56,6 +59,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $date = ''; private $date = '';
/** /**
@@ -66,6 +70,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $time = ''; private $time = '';
/** /**
@@ -76,6 +81,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $duration = ''; private $duration = '';
/** /**
@@ -86,6 +92,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="boolean") * @Serializer\Type(name="boolean")
* @phpstan-ignore-next-line
*/ */
private $is24hours = true; private $is24hours = true;
/** /**
@@ -96,6 +103,7 @@ final class I18nConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="DateTime") * @Serializer\Type(name="DateTime")
* @phpstan-ignore-next-line
*/ */
private $now; private $now;

View File

@@ -26,6 +26,7 @@ final class TimesheetConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $trackingMode = 'default'; private $trackingMode = 'default';
/** /**
@@ -36,6 +37,7 @@ final class TimesheetConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="string") * @Serializer\Type(name="string")
* @phpstan-ignore-next-line
*/ */
private $defaultBeginTime = 'now'; private $defaultBeginTime = 'now';
/** /**
@@ -46,6 +48,7 @@ final class TimesheetConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="integer") * @Serializer\Type(name="integer")
* @phpstan-ignore-next-line
*/ */
private $activeEntriesHardLimit = 1; private $activeEntriesHardLimit = 1;
/** /**
@@ -56,6 +59,7 @@ final class TimesheetConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="integer") * @Serializer\Type(name="integer")
* @phpstan-ignore-next-line
*/ */
private $activeEntriesSoftLimit = 1; private $activeEntriesSoftLimit = 1;
/** /**
@@ -66,6 +70,7 @@ final class TimesheetConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="boolean") * @Serializer\Type(name="boolean")
* @phpstan-ignore-next-line
*/ */
private $isAllowFutureTimes = true; private $isAllowFutureTimes = true;
/** /**
@@ -76,6 +81,7 @@ final class TimesheetConfig
* @Serializer\Expose() * @Serializer\Expose()
* @Serializer\Groups({"Default"}) * @Serializer\Groups({"Default"})
* @Serializer\Type(name="boolean") * @Serializer\Type(name="boolean")
* @phpstan-ignore-next-line
*/ */
private $isAllowOverlapping = true; private $isAllowOverlapping = true;

View File

@@ -123,10 +123,8 @@ class ProjectController extends BaseApiController
if (!\is_array($customers)) { if (!\is_array($customers)) {
$customers = explode(',', $customers); $customers = explode(',', $customers);
} }
if (!empty($customers)) {
$query->setCustomers($customers); $query->setCustomers($customers);
} }
}
if (!empty($customer = $paramFetcher->get('customer'))) { if (!empty($customer = $paramFetcher->get('customer'))) {
$query->addCustomer($customer); $query->addCustomer($customer);

View File

@@ -23,7 +23,6 @@ use App\Repository\TagRepository;
use App\Repository\TimesheetRepository; use App\Repository\TimesheetRepository;
use App\Timesheet\TimesheetService; use App\Timesheet\TimesheetService;
use App\Timesheet\TrackingMode\TrackingModeInterface; use App\Timesheet\TrackingMode\TrackingModeInterface;
use App\Timesheet\TrackingModeService;
use App\Utils\SearchTerm; use App\Utils\SearchTerm;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\Annotations as Rest;
@@ -67,10 +66,6 @@ class TimesheetController extends BaseApiController
* @var TagRepository * @var TagRepository
*/ */
private $tagRepository; private $tagRepository;
/**
* @var TrackingModeService
*/
private $trackingModeService;
/** /**
* @var EventDispatcherInterface * @var EventDispatcherInterface
*/ */
@@ -152,10 +147,8 @@ class TimesheetController extends BaseApiController
if (!\is_array($customers)) { if (!\is_array($customers)) {
$customers = explode(',', $customers); $customers = explode(',', $customers);
} }
if (!empty($customers)) {
$query->setCustomers($customers); $query->setCustomers($customers);
} }
}
if (!empty($customer = $paramFetcher->get('customer'))) { if (!empty($customer = $paramFetcher->get('customer'))) {
$query->addCustomer($customer); $query->addCustomer($customer);
@@ -165,10 +158,8 @@ class TimesheetController extends BaseApiController
if (!\is_array($projects)) { if (!\is_array($projects)) {
$projects = explode(',', $projects); $projects = explode(',', $projects);
} }
if (!empty($projects)) {
$query->setProjects($projects); $query->setProjects($projects);
} }
}
if (!empty($project = $paramFetcher->get('project'))) { if (!empty($project = $paramFetcher->get('project'))) {
$query->addProject($project); $query->addProject($project);
@@ -178,10 +169,8 @@ class TimesheetController extends BaseApiController
if (!\is_array($activities)) { if (!\is_array($activities)) {
$activities = explode(',', $activities); $activities = explode(',', $activities);
} }
if (!empty($activities)) {
$query->setActivities($activities); $query->setActivities($activities);
} }
}
if (!empty($activity = $paramFetcher->get('activity'))) { if (!empty($activity = $paramFetcher->get('activity'))) {
$query->addActivity($activity); $query->addActivity($activity);

View File

@@ -14,7 +14,6 @@ use App\Event\ActivityBudgetStatisticEvent;
use App\Event\ActivityStatisticEvent; use App\Event\ActivityStatisticEvent;
use App\Model\ActivityBudgetStatisticModel; use App\Model\ActivityBudgetStatisticModel;
use App\Model\ActivityStatistic; use App\Model\ActivityStatistic;
use App\Repository\ActivityRepository;
use App\Repository\TimesheetRepository; use App\Repository\TimesheetRepository;
use App\Timesheet\DateTimeFactory; use App\Timesheet\DateTimeFactory;
use DateTime; use DateTime;
@@ -27,13 +26,11 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*/ */
class ActivityStatisticService class ActivityStatisticService
{ {
private $activityRepository;
private $timesheetRepository; private $timesheetRepository;
private $dispatcher; private $dispatcher;
public function __construct(ActivityRepository $activityRepository, TimesheetRepository $timesheetRepository, EventDispatcherInterface $dispatcher) public function __construct(TimesheetRepository $timesheetRepository, EventDispatcherInterface $dispatcher)
{ {
$this->activityRepository = $activityRepository;
$this->timesheetRepository = $timesheetRepository; $this->timesheetRepository = $timesheetRepository;
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
} }

View File

@@ -35,19 +35,14 @@ final class InstallCommand extends Command
public const ERROR_DATABASE = 8; public const ERROR_DATABASE = 8;
public const ERROR_MIGRATIONS = 32; public const ERROR_MIGRATIONS = 32;
/**
* @var string
*/
private $rootDir;
/** /**
* @var Connection * @var Connection
*/ */
private $connection; private $connection;
public function __construct(string $projectDirectory, Connection $connection) public function __construct(Connection $connection)
{ {
parent::__construct(); parent::__construct();
$this->rootDir = $projectDirectory;
$this->connection = $connection; $this->connection = $connection;
} }

View File

@@ -117,12 +117,6 @@ final class KimaiImporterCommand extends Command
* @var Customer[] * @var Customer[]
*/ */
private $customers = []; private $customers = [];
/**
* Instance specific mappings of customer IDs to cache IDs
*
* @var string[]
*/
private $customerIds = [];
/** /**
* Old Project ID => new Project() * Old Project ID => new Project()
* Global across all instances. * Global across all instances.
@@ -130,12 +124,6 @@ final class KimaiImporterCommand extends Command
* @var Project[] * @var Project[]
*/ */
private $projects = []; private $projects = [];
/**
* Instance specific mappings of project IDs to cache IDs
*
* @var string[]
*/
private $projectIds = [];
/** /**
* id => [projectId => Activity] * id => [projectId => Activity]
* @var array<Activity[]> * @var array<Activity[]>
@@ -151,13 +139,6 @@ final class KimaiImporterCommand extends Command
* @var array * @var array
*/ */
private $oldActivities = []; private $oldActivities = [];
/**
* If true, unknown Activities will be created globally.
* Default behavior: create project specific activities
*
* @var bool
*/
private $unknownAsGlobal = false;
private $options = []; private $options = [];
@@ -316,8 +297,6 @@ final class KimaiImporterCommand extends Command
$this->teamIds = []; $this->teamIds = [];
$this->userIds = []; $this->userIds = [];
$this->customerIds = [];
$this->projectIds = [];
$this->oldActivities = []; $this->oldActivities = [];
if (!$options['merge-customer']) { if (!$options['merge-customer']) {
@@ -986,7 +965,6 @@ final class KimaiImporterCommand extends Command
private function setCustomerCache(array $oldCustomer, Customer $customer): void private function setCustomerCache(array $oldCustomer, Customer $customer): void
{ {
//$this->customerIds[$this->dbPrefix . $oldCustomer['customerID']] = $oldCustomer['customerID'];
$this->customers[$oldCustomer['customerID']] = $customer; $this->customers[$oldCustomer['customerID']] = $customer;
} }

View File

@@ -29,19 +29,14 @@ final class UpdateCommand extends Command
public const ERROR_DATABASE = 8; public const ERROR_DATABASE = 8;
public const ERROR_MIGRATIONS = 32; public const ERROR_MIGRATIONS = 32;
/**
* @var string
*/
private $rootDir;
/** /**
* @var Connection * @var Connection
*/ */
private $connection; private $connection;
public function __construct(string $projectDirectory, Connection $connection) public function __construct(Connection $connection)
{ {
parent::__construct(); parent::__construct();
$this->rootDir = $projectDirectory;
$this->connection = $connection; $this->connection = $connection;
} }

View File

@@ -19,7 +19,6 @@ use App\Reporting\WeekByUser;
use App\Reporting\WeekByUserForm; use App\Reporting\WeekByUserForm;
use App\Repository\ActivityRepository; use App\Repository\ActivityRepository;
use App\Repository\ProjectRepository; use App\Repository\ProjectRepository;
use App\Repository\TimesheetRepository;
use App\Timesheet\TimesheetStatisticService; use App\Timesheet\TimesheetStatisticService;
use DateTime; use DateTime;
use Exception; use Exception;
@@ -35,14 +34,12 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
*/ */
final class ReportByUserController extends AbstractController final class ReportByUserController extends AbstractController
{ {
private $timesheetRepository;
private $statisticService; private $statisticService;
private $projectRepository; private $projectRepository;
private $activityRepository; private $activityRepository;
public function __construct(TimesheetRepository $timesheetRepository, TimesheetStatisticService $statisticService, ProjectRepository $projectRepository, ActivityRepository $activityRepository) public function __construct(TimesheetStatisticService $statisticService, ProjectRepository $projectRepository, ActivityRepository $activityRepository)
{ {
$this->timesheetRepository = $timesheetRepository;
$this->statisticService = $statisticService; $this->statisticService = $statisticService;
$this->projectRepository = $projectRepository; $this->projectRepository = $projectRepository;
$this->activityRepository = $activityRepository; $this->activityRepository = $activityRepository;

View File

@@ -20,7 +20,6 @@ use App\Reporting\WeeklyUserListForm;
use App\Reporting\YearlyUserList; use App\Reporting\YearlyUserList;
use App\Reporting\YearlyUserListForm; use App\Reporting\YearlyUserListForm;
use App\Repository\Query\UserQuery; use App\Repository\Query\UserQuery;
use App\Repository\TimesheetRepository;
use App\Repository\UserRepository; use App\Repository\UserRepository;
use App\Timesheet\TimesheetStatisticService; use App\Timesheet\TimesheetStatisticService;
use Exception; use Exception;
@@ -35,12 +34,10 @@ use Symfony\Component\Routing\Annotation\Route;
*/ */
final class ReportUsersListController extends AbstractController final class ReportUsersListController extends AbstractController
{ {
private $timesheetRepository;
private $userRepository; private $userRepository;
public function __construct(TimesheetRepository $timesheetRepository, UserRepository $userRepository) public function __construct(UserRepository $userRepository)
{ {
$this->timesheetRepository = $timesheetRepository;
$this->userRepository = $userRepository; $this->userRepository = $userRepository;
} }

View File

@@ -176,7 +176,6 @@ final class TeamController extends AbstractController
$customerForm->handleRequest($request); $customerForm->handleRequest($request);
if ($customerForm->isSubmitted() && $customerForm->isValid()) { if ($customerForm->isSubmitted() && $customerForm->isValid()) {
if ($customerForm->isValid()) {
try { try {
$this->repository->saveTeam($team); $this->repository->saveTeam($team);
$this->flashSuccess('action.update.success'); $this->flashSuccess('action.update.success');
@@ -186,7 +185,6 @@ final class TeamController extends AbstractController
$this->flashUpdateException($ex); $this->flashUpdateException($ex);
} }
} }
}
$projectForm = $this->createForm(TeamProjectForm::class, $team, [ $projectForm = $this->createForm(TeamProjectForm::class, $team, [
'method' => 'POST', 'method' => 'POST',
@@ -194,7 +192,6 @@ final class TeamController extends AbstractController
$projectForm->handleRequest($request); $projectForm->handleRequest($request);
if ($projectForm->isSubmitted() && $projectForm->isValid()) { if ($projectForm->isSubmitted() && $projectForm->isValid()) {
if ($projectForm->isValid()) {
try { try {
$this->repository->saveTeam($team); $this->repository->saveTeam($team);
$this->flashSuccess('action.update.success'); $this->flashSuccess('action.update.success');
@@ -205,7 +202,6 @@ final class TeamController extends AbstractController
} }
} }
} }
}
return $this->render('team/edit.html.twig', [ return $this->render('team/edit.html.twig', [
'team' => $team, 'team' => $team,

View File

@@ -14,7 +14,6 @@ use App\Entity\Project;
use App\Event\CustomerStatisticEvent; use App\Event\CustomerStatisticEvent;
use App\Model\CustomerBudgetStatisticModel; use App\Model\CustomerBudgetStatisticModel;
use App\Model\CustomerStatistic; use App\Model\CustomerStatistic;
use App\Repository\CustomerRepository;
use App\Repository\TimesheetRepository; use App\Repository\TimesheetRepository;
use App\Timesheet\DateTimeFactory; use App\Timesheet\DateTimeFactory;
use DateTime; use DateTime;
@@ -28,13 +27,11 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*/ */
class CustomerStatisticService class CustomerStatisticService
{ {
private $repository;
private $timesheetRepository; private $timesheetRepository;
private $dispatcher; private $dispatcher;
public function __construct(CustomerRepository $customerRepository, TimesheetRepository $timesheetRepository, EventDispatcherInterface $dispatcher) public function __construct(TimesheetRepository $timesheetRepository, EventDispatcherInterface $dispatcher)
{ {
$this->repository = $customerRepository;
$this->timesheetRepository = $timesheetRepository; $this->timesheetRepository = $timesheetRepository;
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
} }

View File

@@ -49,22 +49,6 @@ abstract class AbstractMigration extends BaseAbstractMigration
return true; return true;
} }
/**
* @deprecated since 1.14 - will be removed with 2.0
*/
protected function deactivateForeignKeysOnSqlite()
{
@trigger_error('deactivateForeignKeysOnSqlite() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
}
/**
* @deprecated since 1.14 - will be removed with 2.0
*/
private function activateForeignKeysOnSqlite()
{
@trigger_error('activateForeignKeysOnSqlite() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
}
/** /**
* @param Schema $schema * @param Schema $schema
* @throws Exception * @throws Exception

View File

@@ -30,6 +30,7 @@ class Configuration
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @phpstan-ignore-next-line
*/ */
private $id; private $id;

View File

@@ -47,6 +47,7 @@ class Invoice
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/ */
private $id; private $id;

View File

@@ -30,6 +30,7 @@ class Role
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/ */
private $id; private $id;
/** /**

View File

@@ -30,6 +30,7 @@ class RolePermission
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/ */
private $id; private $id;
/** /**

View File

@@ -39,6 +39,7 @@ class Tag
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/ */
private $id; private $id;
/** /**

View File

@@ -32,6 +32,7 @@ class TeamMember
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue(strategy="IDENTITY")
* @phpstan-ignore-next-line
*/ */
private $id; private $id;
/** /**

View File

@@ -415,9 +415,9 @@ class User implements UserInterface, EquatableInterface, \Serializable
public function getPreference(string $name): ?UserPreference public function getPreference(string $name): ?UserPreference
{ {
// this code will be triggered, if a currently logged-in user will be deleted and the refreshed from the session // this code will be triggered, if a currently logged-in user will be deleted and then refreshed from the session
// via one of the UserProvider - e.g. see LdapUserProvider::refreshUser() which calls $user->getPreferenceValue() // via one of the UserProvider - e.g. see LdapUserProvider::refreshUser() which calls $user->getPreferenceValue()
if (empty($this->preferences)) { if ($this->preferences === null) {
return null; return null;
} }

View File

@@ -76,11 +76,7 @@ class SelectWithApiDataExtension extends AbstractTypeExtension
$formPrefix = implode('_', array_reverse($formPrefixes)); $formPrefix = implode('_', array_reverse($formPrefixes));
$formField = $formPrefix; $formField = $formPrefix . '_' . $apiData['select'];
if (!empty($formField)) {
$formField .= '_';
}
$formField .= $apiData['select'];
$view->vars['attr'] = array_merge($view->vars['attr'], [ $view->vars['attr'] = array_merge($view->vars['attr'], [
'data-form-prefix' => $formPrefix, 'data-form-prefix' => $formPrefix,

View File

@@ -50,6 +50,9 @@ class QuickEntryForm extends AbstractType
foreach ($value->getRows() as $row) { foreach ($value->getRows() as $row) {
$project = $row->getProject(); $project = $row->getProject();
$activity = $row->getActivity(); $activity = $row->getActivity();
if ($project === null || $activity === null) {
continue;
}
foreach ($row->getTimesheets() as $timesheet) { foreach ($row->getTimesheets() as $timesheet) {
$timesheet->setProject($project); $timesheet->setProject($project);
$timesheet->setActivity($activity); $timesheet->setActivity($activity);

View File

@@ -21,7 +21,6 @@ use App\Form\Type\TagsType;
use App\Form\Type\UserType; use App\Form\Type\UserType;
use App\Form\Type\YesNoType; use App\Form\Type\YesNoType;
use App\Repository\CustomerRepository; use App\Repository\CustomerRepository;
use App\Repository\ProjectRepository;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
@@ -39,15 +38,10 @@ class TimesheetEditForm extends AbstractType
* @var CustomerRepository * @var CustomerRepository
*/ */
private $customers; private $customers;
/**
* @var ProjectRepository
*/
private $projects;
public function __construct(CustomerRepository $customer, ProjectRepository $project) public function __construct(CustomerRepository $customer)
{ {
$this->customers = $customer; $this->customers = $customer;
$this->projects = $project;
} }
/** /**

View File

@@ -566,10 +566,6 @@ final class ServiceInvoice
}); });
foreach ($customerEntries as $id => $settings) { foreach ($customerEntries as $id => $settings) {
if (empty($settings['entries'])) {
continue;
}
$customerQuery = clone $query; $customerQuery = clone $query;
$customerQuery->setCustomers([$settings['customer']]); $customerQuery->setCustomers([$settings['customer']]);
$model = $this->createModelWithoutEntries($customerQuery); $model = $this->createModelWithoutEntries($customerQuery);

View File

@@ -64,6 +64,7 @@ class LdapAuthenticationProvider extends UserAuthenticationProvider
// do not update the user here from LDAP, as we don't know if the user can be authenticated // do not update the user here from LDAP, as we don't know if the user can be authenticated
} catch (UsernameNotFoundException $notFound) { } catch (UsernameNotFoundException $notFound) {
throw $notFound; throw $notFound;
/* @phpstan-ignore-next-line */
} catch (\Exception $repositoryProblem) { } catch (\Exception $repositoryProblem) {
$e = new AuthenticationServiceException($repositoryProblem->getMessage(), (int) $repositoryProblem->getCode(), $repositoryProblem); $e = new AuthenticationServiceException($repositoryProblem->getMessage(), (int) $repositoryProblem->getCode(), $repositoryProblem);
$e->setToken($token); $e->setToken($token);

View File

@@ -13,10 +13,11 @@ use App\Configuration\ConfigLoaderInterface;
use App\Entity\Configuration; use App\Entity\Configuration;
use App\Form\Model\SystemConfiguration; use App\Form\Model\SystemConfiguration;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\ORMException; use Doctrine\ORM\Exception\ORMException;
/** /**
* @extends \Doctrine\ORM\EntityRepository<Configuration> * @extends \Doctrine\ORM\EntityRepository<Configuration>
* @final
*/ */
class ConfigurationRepository extends EntityRepository implements ConfigLoaderInterface class ConfigurationRepository extends EntityRepository implements ConfigLoaderInterface
{ {
@@ -26,14 +27,14 @@ class ConfigurationRepository extends EntityRepository implements ConfigLoaderIn
public function clearCache() public function clearCache()
{ {
static::$cacheByPrefix = []; self::$cacheByPrefix = [];
static::$cacheAll = []; self::$cacheAll = [];
static::$initialized = false; self::$initialized = false;
} }
private function prefillCache() private function prefillCache()
{ {
if (static::$initialized === true) { if (self::$initialized === true) {
return; return;
} }
@@ -41,13 +42,13 @@ class ConfigurationRepository extends EntityRepository implements ConfigLoaderIn
$configs = $this->findAll(); $configs = $this->findAll();
foreach ($configs as $config) { foreach ($configs as $config) {
$key = substr($config->getName(), 0, strpos($config->getName(), '.')); $key = substr($config->getName(), 0, strpos($config->getName(), '.'));
if (!\array_key_exists($key, static::$cacheByPrefix)) { if (!\array_key_exists($key, self::$cacheByPrefix)) {
static::$cacheByPrefix[$key] = []; self::$cacheByPrefix[$key] = [];
} }
static::$cacheByPrefix[$key][] = $config; self::$cacheByPrefix[$key][] = $config;
static::$cacheAll[] = $config; self::$cacheAll[] = $config;
} }
static::$initialized = true; self::$initialized = true;
} }
public function saveConfiguration(Configuration $configuration) public function saveConfiguration(Configuration $configuration)
@@ -67,14 +68,14 @@ class ConfigurationRepository extends EntityRepository implements ConfigLoaderIn
$this->prefillCache(); $this->prefillCache();
if (null === $prefix) { if (null === $prefix) {
return static::$cacheAll; return self::$cacheAll;
} }
if (!\array_key_exists($prefix, static::$cacheByPrefix)) { if (!\array_key_exists($prefix, self::$cacheByPrefix)) {
return []; return [];
} }
return static::$cacheByPrefix[$prefix]; return self::$cacheByPrefix[$prefix];
} }
public function saveSystemConfiguration(SystemConfiguration $model) public function saveSystemConfiguration(SystemConfiguration $model)

View File

@@ -59,7 +59,7 @@ class UserTeamProjects extends SimpleWidget implements AuthorizedWidget, UserWid
foreach ($user->getTeams() as $team) { foreach ($user->getTeams() as $team) {
/** @var Project $project */ /** @var Project $project */
foreach ($team->getProjects() as $project) { foreach ($team->getProjects() as $project) {
if (!isset($projects[$project->getId()])) { if (!isset($teamProjects[$project->getId()])) {
$teamProjects[$project->getId()] = $project; $teamProjects[$project->getId()] = $project;
} }
} }

View File

@@ -31,7 +31,6 @@ class InstallCommandTest extends KernelTestCase
$container = self::$kernel->getContainer(); $container = self::$kernel->getContainer();
$this->application->add(new InstallCommand( $this->application->add(new InstallCommand(
$container->getParameter('kernel.project_dir'),
$container->get('doctrine')->getConnection() $container->get('doctrine')->getConnection()
)); ));
} }

View File

@@ -34,7 +34,6 @@ class UpdateCommandTest extends KernelTestCase
$container = self::$kernel->getContainer(); $container = self::$kernel->getContainer();
$this->application->add(new UpdateCommand( $this->application->add(new UpdateCommand(
$container->getParameter('kernel.project_dir'),
$container->get('doctrine')->getConnection() $container->get('doctrine')->getConnection()
)); ));