From 5c614b1a293891882a829b87c0a7933badb0acb2 Mon Sep 17 00:00:00 2001 From: turegjorup Date: Sat, 6 Jun 2026 13:46:48 +0200 Subject: [PATCH] fix: remove dead statement referencing undefined variables in MediaRepository MediaRepository::getPaginator() computed $firstResult from the undefined variables $page and $itemsPerPage and never used the result. Remove the statement and drop the two corresponding variable.undefined entries from the PHPStan baseline. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 2 ++ phpstan-baseline.neon | 12 ------------ src/Repository/MediaRepository.php | 2 -- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 184fe1c49..1f738f431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- Removed a dead statement in `MediaRepository::getPaginator()` that referenced the undefined + variables `$page` and `$itemsPerPage`; the computed value was never used. - Enabled PHPStan's `reportIgnoresWithoutComments`: inline `@phpstan-ignore` annotations must carry a comment explaining the suppression. diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index ec306812c..478694114 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2112,18 +2112,6 @@ parameters: count: 1 path: src/Repository/MediaRepository.php - - - message: '#^Undefined variable\: \$itemsPerPage$#' - identifier: variable.undefined - count: 1 - path: src/Repository/MediaRepository.php - - - - message: '#^Undefined variable\: \$page$#' - identifier: variable.undefined - count: 1 - path: src/Repository/MediaRepository.php - - message: '#^Class App\\Repository\\PlaylistRepository has PHPDoc tag @method for method findBy\(\) parameter \#1 \$criteria with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue diff --git a/src/Repository/MediaRepository.php b/src/Repository/MediaRepository.php index 2b4daeea2..77d0ea5d0 100644 --- a/src/Repository/MediaRepository.php +++ b/src/Repository/MediaRepository.php @@ -40,8 +40,6 @@ public function getById(Ulid $mediaId): QueryBuilder public function getPaginator(Ulid $slideUlid): QueryBuilder { - $firstResult = ($page - 1) * $itemsPerPage; - $queryBuilder = $this->_em->createQueryBuilder(); $queryBuilder->select('s') ->from(Slide::class, 's')