From 85fd2737de0af3f99c3433d350baf6a84b92eea7 Mon Sep 17 00:00:00 2001 From: akDeveloper Date: Sun, 2 Apr 2023 00:57:26 +0300 Subject: [PATCH] Upgrade to php 8.1 --- .travis.yml | 2 ++ composer.json | 8 ++++---- src/Doctrine/Dbal/DoctrineDbalResult.php | 8 ++++---- src/Pagerfanta/SearchAdapter.php | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0eb559c..90cbafe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ php: - 7.2 - 7.3 - 7.4 + - 8.0 + - 8.1 before_script: composer install script: - ./vendor/bin/phpunit tests/ diff --git a/composer.json b/composer.json index aa44571..c7727fe 100644 --- a/composer.json +++ b/composer.json @@ -11,12 +11,12 @@ } ], "require": { - "php": ">=7.2" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "~8.3.5", - "doctrine/dbal": "^2.9", - "pagerfanta/pagerfanta": "~2.1.3" + "phpunit/phpunit": "^9.5", + "doctrine/dbal": "^3.6", + "pagerfanta/pagerfanta": "^4.0" }, "autoload": { "psr-4": { diff --git a/src/Doctrine/Dbal/DoctrineDbalResult.php b/src/Doctrine/Dbal/DoctrineDbalResult.php index 4cd8703..549a03e 100644 --- a/src/Doctrine/Dbal/DoctrineDbalResult.php +++ b/src/Doctrine/Dbal/DoctrineDbalResult.php @@ -30,12 +30,12 @@ public function fetch(int $offset, int $limit): array { $this->queryBuilder->setFirstResult($offset); $this->queryBuilder->setMaxResults($limit); - $stmt = $this->queryBuilder->execute(); + $stmt = $this->queryBuilder->executeQuery(); - return $stmt->fetchAll(PDO::FETCH_ASSOC); + return $stmt->fetchAllAssociative(); } - public function count() + public function count(): int { if (null === $this->count) { $qb = clone $this->queryBuilder; @@ -48,7 +48,7 @@ public function count() ->setMaxResults(1); } - $this->count = intval($qb->execute()->fetchColumn()); + $this->count = intval($qb->executeQuery()->fetchOne()); } return $this->count; diff --git a/src/Pagerfanta/SearchAdapter.php b/src/Pagerfanta/SearchAdapter.php index 096eaf8..e9d3ff9 100644 --- a/src/Pagerfanta/SearchAdapter.php +++ b/src/Pagerfanta/SearchAdapter.php @@ -19,7 +19,7 @@ public function __construct(Result $result) /** * {@inheritDoc} */ - public function getNbResults() + public function getNbResults(): int { return $this->result->count(); } @@ -27,7 +27,7 @@ public function getNbResults() /** * {@inheritDoc} */ - public function getSlice($offset, $length) + public function getSlice($offset, $length): iterable { return $this->result->fetch($offset, $length); }