Merge branch 'master' into upgrade-sf5

This commit is contained in:
2024-02-12 21:50:34 +01:00
920 changed files with 6430 additions and 1914 deletions

View File

@@ -60,7 +60,8 @@ final class SingleTaskController extends AbstractController
private readonly SingleTaskRepository $singleTaskRepository,
private readonly Security $security,
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry,
) {}
) {
}
/**
* @Route(

View File

@@ -39,14 +39,14 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface
*
* @Serializer\Groups({"read"})
*/
private ?\Chill\MainBundle\Entity\User $assignee = null;
private ?User $assignee = null;
/**
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\Scope"
* )
*/
private ?\Chill\MainBundle\Entity\Scope $circle = null;
private ?Scope $circle = null;
/**
* @ORM\Column(name="closed", type="boolean", options={ "default": false })
@@ -60,7 +60,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface
*
* @Serializer\Groups({"read"})
*/
private ?\Chill\PersonBundle\Entity\AccompanyingPeriod $course = null;
private ?AccompanyingPeriod $course = null;
/**
* @ORM\Column(name="current_states", type="json", options={"jsonb"=true, "default"="[]"})
@@ -83,7 +83,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface
*
* @Serializer\Groups({"read"})
*/
private ?\Chill\PersonBundle\Entity\Person $person = null;
private ?Person $person = null;
/**
* @ORM\Column(name="title", type="text")
@@ -189,7 +189,7 @@ abstract class AbstractTask implements HasCenterInterface, HasScopeInterface
return $this->closed;
}
public function setAssignee(User $assignee = null)
public function setAssignee(?User $assignee = null)
{
$this->assignee = $assignee;

View File

@@ -71,7 +71,7 @@ class SingleTask extends AbstractTask
* inversedBy="singleTasks"
* )
*/
private ?\Chill\TaskBundle\Entity\RecurringTask $recurringTask = null;
private ?RecurringTask $recurringTask = null;
/**
* @ORM\Column(name="start_date", type="date", nullable=true)
@@ -112,7 +112,7 @@ class SingleTask extends AbstractTask
* message="An end date is required if a warning interval is set"
* )
*/
private null|\DateInterval $warningInterval = null;
private \DateInterval|null $warningInterval = null;
public function __construct()
{
@@ -122,7 +122,7 @@ class SingleTask extends AbstractTask
/**
* Get endDate.
*/
public function getEndDate(): null|\DateTime
public function getEndDate(): \DateTime|null
{
return $this->endDate;
}
@@ -184,7 +184,7 @@ class SingleTask extends AbstractTask
/**
* Get warningInterval.
*/
public function getWarningInterval(): null|\DateInterval
public function getWarningInterval(): \DateInterval|null
{
return $this->warningInterval;
}
@@ -234,7 +234,7 @@ class SingleTask extends AbstractTask
*
* @return SingleTask
*/
public function setWarningInterval(null|\DateInterval $warningInterval)
public function setWarningInterval(\DateInterval|null $warningInterval)
{
$this->warningInterval = $warningInterval;

View File

@@ -26,7 +26,7 @@ class AbstractTaskPlaceEvent
* targetEntity="\Chill\MainBundle\Entity\User"
* )
*/
private ?\Chill\MainBundle\Entity\User $author = null;
private ?User $author = null;
/**
* @ORM\Column(name="data", type="json")

View File

@@ -48,7 +48,7 @@ class SingleTaskPlaceEvent extends AbstractTaskPlaceEvent
* inversedBy="taskPlaceEvents"
* )
*/
protected ?\Chill\TaskBundle\Entity\SingleTask $task = null;
protected ?SingleTask $task = null;
public function getTask(): SingleTask
{

View File

@@ -27,7 +27,9 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class SingleTaskType extends AbstractType
{
public function __construct(private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher) {}
public function __construct(private readonly ParameterBagInterface $parameterBag, private readonly CenterResolverDispatcherInterface $centerResolverDispatcher, private readonly ScopeResolverDispatcher $scopeResolverDispatcher)
{
}
public function buildForm(FormBuilderInterface $builder, array $options)
{

View File

@@ -17,4 +17,6 @@ namespace Chill\TaskBundle\Repository;
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
abstract class AbstractTaskRepository extends \Doctrine\ORM\EntityRepository {}
abstract class AbstractTaskRepository extends \Doctrine\ORM\EntityRepository
{
}

View File

@@ -17,4 +17,6 @@ namespace Chill\TaskBundle\Repository;
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class RecurringTaskRepository extends \Doctrine\ORM\EntityRepository {}
class RecurringTaskRepository extends \Doctrine\ORM\EntityRepository
{
}

View File

@@ -23,10 +23,12 @@ use Symfony\Component\Security\Core\Security;
final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareRepositoryInterface
{
public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private EntityManagerInterface $em, private Security $security, private AuthorizationHelperInterface $authorizationHelper) {}
public function __construct(private CenterResolverManagerInterface $centerResolverDispatcher, private EntityManagerInterface $em, private Security $security, private AuthorizationHelperInterface $authorizationHelper)
{
}
public function buildBaseQuery(
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = []
@@ -148,7 +150,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
public function buildQueryByCourse(
AccompanyingPeriod $course,
string $pattern = null,
?string $pattern = null,
?array $flags = []
): QueryBuilder {
$qb = $this->buildBaseQuery($pattern, $flags);
@@ -160,7 +162,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
public function buildQueryByPerson(
Person $person,
string $pattern = null,
?string $pattern = null,
?array $flags = []
): QueryBuilder {
$qb = $this->buildBaseQuery($pattern, $flags);
@@ -171,7 +173,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
}
public function buildQueryMyTasks(
string $pattern = null,
?string $pattern = null,
?array $flags = []
): QueryBuilder {
$qb = $this->buildBaseQuery($pattern, $flags);
@@ -182,7 +184,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
}
public function countByAllViewable(
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = []
@@ -197,7 +199,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
public function countByCourse(
AccompanyingPeriod $course,
string $pattern = null,
?string $pattern = null,
?array $flags = []
): int {
$qb = $this->buildQueryByCourse($course, $pattern, $flags);
@@ -209,7 +211,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
}
public function countByCurrentUsersTasks(
string $pattern = null,
?string $pattern = null,
?array $flags = []
): int {
return $this->buildQueryMyTasks($pattern, $flags)
@@ -219,7 +221,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
public function countByPerson(
Person $person,
string $pattern = null,
?string $pattern = null,
?array $flags = []
): int {
$qb = $this->buildQueryByPerson($person, $pattern, $flags);
@@ -231,7 +233,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
}
public function findByAllViewable(
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = [],
@@ -247,7 +249,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
public function findByCourse(
AccompanyingPeriod $course,
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?int $start = 0,
?int $limit = 50,
@@ -260,7 +262,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
}
public function findByCurrentUsersTasks(
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?int $start = 0,
?int $limit = 50,
@@ -273,7 +275,7 @@ final readonly class SingleTaskAclAwareRepository implements SingleTaskAclAwareR
public function findByPerson(
Person $person,
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?int $start = 0,
?int $limit = 50,

View File

@@ -17,7 +17,7 @@ use Chill\PersonBundle\Entity\Person;
interface SingleTaskAclAwareRepositoryInterface
{
public function countByAllViewable(
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = []
@@ -25,20 +25,20 @@ interface SingleTaskAclAwareRepositoryInterface
public function countByCourse(
AccompanyingPeriod $course,
string $pattern = null,
?string $pattern = null,
?array $flags = []
): int;
public function countByCurrentUsersTasks(string $pattern = null, ?array $flags = []): int;
public function countByCurrentUsersTasks(?string $pattern = null, ?array $flags = []): int;
public function countByPerson(
Person $person,
string $pattern = null,
?string $pattern = null,
?array $flags = []
): int;
public function findByAllViewable(
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?array $types = [],
?array $users = [],
@@ -49,18 +49,18 @@ interface SingleTaskAclAwareRepositoryInterface
public function findByCourse(
AccompanyingPeriod $course,
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?int $start = 0,
?int $limit = 50,
?array $orderBy = []
): array;
public function findByCurrentUsersTasks(string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = []): array;
public function findByCurrentUsersTasks(?string $pattern = null, ?array $flags = [], ?int $start = 0, ?int $limit = 50, ?array $orderBy = []): array;
public function findByPerson(
Person $person,
string $pattern = null,
?string $pattern = null,
?array $flags = [],
?int $start = 0,
?int $limit = 50,

View File

@@ -56,7 +56,7 @@ class SingleTaskRepository extends EntityRepository
*
* @return int
*/
public function countByParameters($params, User $currentUser = null)
public function countByParameters($params, ?User $currentUser = null)
{
$qb = $this->createQueryBuilder('st')
->select('COUNT(st)');
@@ -175,7 +175,7 @@ class SingleTaskRepository extends EntityRepository
$qb->where($where);
}
protected function buildQuery(QueryBuilder $qb, $params, User $currentUser = null)
protected function buildQuery(QueryBuilder $qb, $params, ?User $currentUser = null)
{
if (null !== $currentUser) {
$this->buildACLQuery($qb, $currentUser);

View File

@@ -22,7 +22,8 @@ class SingleTaskStateRepository
public function __construct(
private readonly Connection $connection
) {}
) {
}
/**
* Return a list of all states associated to at least one single task in the database.

View File

@@ -26,10 +26,11 @@ class AuthorizationEvent extends \Symfony\Contracts\EventDispatcher\Event
protected $vote;
public function __construct(
private readonly null|AbstractTask|AccompanyingPeriod|Person $subject,
private readonly AbstractTask|AccompanyingPeriod|Person|null $subject,
private readonly string $attribute,
private readonly TokenInterface $token
) {}
) {
}
public function getAttribute()
{

View File

@@ -39,7 +39,7 @@ class TaskTwigExtension extends AbstractExtension
AbstractTask $task,
string $key,
$metadataSubject = null,
string $name = null
?string $name = null
) {
return $this->taskWorkflowManager->getWorkflowMetadata($task, $key, $metadataSubject, $name);
}

View File

@@ -18,4 +18,6 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*
* @coversNothing
*/
final class TaskControllerTest extends WebTestCase {}
final class TaskControllerTest extends WebTestCase
{
}

View File

@@ -30,7 +30,9 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
{
final public const TYPE = 'chill_task.transition';
public function __construct(protected EntityManagerInterface $em, protected Registry $registry, protected AuthorizationHelper $authorizationHelper, protected Security $security) {}
public function __construct(protected EntityManagerInterface $em, protected Registry $registry, protected AuthorizationHelper $authorizationHelper, protected Security $security)
{
}
public function fetchQuery($context, $args)
{

View File

@@ -11,4 +11,6 @@ declare(strict_types=1);
namespace Chill\TaskBundle\Workflow;
interface TaskWorkflowDefinition {}
interface TaskWorkflowDefinition
{
}

View File

@@ -56,7 +56,7 @@ class TaskWorkflowManager implements WorkflowSupportStrategyInterface
return $definitions[0];
}
public function getWorkflowMetadata(AbstractTask $task, string $key, $metadataSubject = null, string $name = null)
public function getWorkflowMetadata(AbstractTask $task, string $key, $metadataSubject = null, ?string $name = null)
{
return $this->getTaskWorkflowDefinition($task)
->getWorkflowMetadata($task, $key, $metadataSubject);