diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e09ea84bb..d2b73f299 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -45,11 +45,6 @@ parameters: count: 3 path: src/Bundle/ChillActivityBundle/Entity/ActivityType.php - - - message: "#^Anonymous function has an unused use \\$data\\.$#" - count: 1 - path: src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php - - message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" count: 1 diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 3dec544ba..a0e6d3966 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -29,27 +29,27 @@ use Chill\MainBundle\Templating\TranslatableStringHelper; use Doctrine\ORM\Query\Expr\Join; /** - * + * * * @author Julien Fastré */ class ActivityTypeAggregator implements AggregatorInterface { - + /** * * @var EntityRepository */ protected $typeRepository; - + /** * * @var TranslatableStringHelper */ protected $stringHelper; - + const KEY = 'activity_type_aggregator'; - + public function __construct( EntityRepository $typeRepository, TranslatableStringHelper $stringHelper @@ -57,19 +57,19 @@ class ActivityTypeAggregator implements AggregatorInterface $this->typeRepository = $typeRepository; $this->stringHelper = $stringHelper; } - + public function alterQuery(QueryBuilder $qb, $data) { - // add select element + // add select element $qb->addSelect(sprintf('IDENTITY(activity.type) AS %s', self::KEY)); - + // add the "group by" part $groupBy = $qb->addGroupBy(self::KEY); } - + /** * Check if a join between Activity and another alias - * + * * @param Join[] $joins * @param string $alias the alias to search for * @return boolean @@ -81,7 +81,7 @@ class ActivityTypeAggregator implements AggregatorInterface return true; } } - + return false; } @@ -99,18 +99,18 @@ class ActivityTypeAggregator implements AggregatorInterface { return "Aggregate by activity type"; } - + public function addRole() { return new Role(ActivityStatsVoter::STATS); } - public function getLabels($key, array $values, $data) + public function getLabels($key, array $values, $data): \Closure { // for performance reason, we load data from db only once $this->typeRepository->findBy(array('id' => $values)); - - return function($value) use ($data) { + + return function($value): string { if ($value === '_header') { return 'Activity type'; } @@ -120,12 +120,11 @@ class ActivityTypeAggregator implements AggregatorInterface return $this->stringHelper->localize($t->getName()); }; - } - public function getQueryKeys($data) + public function getQueryKeys($data): array { - return array(self::KEY); + return [self::KEY]; } }