Fix issues reported by PHPStan.

This commit is contained in:
Pol Dellaiera
2021-11-09 15:17:24 +01:00
parent 48ea67968e
commit 2eb30d2ae8
7 changed files with 124 additions and 137 deletions

View File

@@ -5,15 +5,15 @@ namespace Chill\MainBundle\Util;
/**
* Utilities to compare date periods
*
* This class allow to compare periods when there are period covering. The
* This class allow to compare periods when there are period covering. The
* argument `minCovers` allow to find also when there are more than 2 period
* which intersects.
* which intersects.
*
* Example: a team may have maximum 2 leaders on a same period: you will
* Example: a team may have maximum 2 leaders on a same period: you will
* find here all periods where there are more than 2 leaders.
*
* Usage:
*
*
* ```php
* $cover = new DateRangeCovering(2); // 2 means we will have periods
* // when there are 2+ periods intersecting
@@ -73,7 +73,7 @@ class DateRangeCovering
$this->addToSequence($start->getTimestamp(), $k, null);
$this->addToSequence(
NULL === $end ? PHP_INT_MAX : $end->getTimestamp(), null, $k
);
);
return $this;
}
@@ -182,7 +182,7 @@ class DateRangeCovering
$foundExisting = false;
list($nStart, $nEnd, $nMetadata) = $intersection;
\array_walk($intersections,
\array_walk($intersections,
function(&$i, $key) use ($nStart, $nEnd, $nMetadata, $foundExisting) {
if ($foundExisting) {
return;
@@ -205,7 +205,7 @@ class DateRangeCovering
{
if (!$this->computed) {
throw new \LogicException(sprintf("You cannot call the method %s before ".
"'process'", __METHOD));
"'process'", __METHOD__));
}
return count($this->intersections) > 0;
@@ -215,7 +215,7 @@ class DateRangeCovering
{
if (!$this->computed) {
throw new \LogicException(sprintf("You cannot call the method %s before ".
"'process'", __METHOD));
"'process'", __METHOD__));
}
return $this->intersections;