Skip to content

Commit 97c961a

Browse files
authored
chore: clean files for PHP 8.4 (#240)
1 parent 676df4a commit 97c961a

6 files changed

Lines changed: 15 additions & 37 deletions

File tree

src/Configurator.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
namespace Rancoud\Database;
66

7-
/**
8-
* Class Configurator.
9-
*/
107
class Configurator
118
{
129
/** @var string Driver */

src/Database.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
namespace Rancoud\Database;
88

9-
/**
10-
* Class Database.
11-
*/
129
class Database
1310
{
1411
/** @var Configurator|null Configurator */
@@ -32,7 +29,6 @@ class Database
3229
/** @var int Transaction depth */
3330
protected int $transactionDepth = 0;
3431

35-
/** Database constructor. */
3632
public function __construct(Configurator $configurator)
3733
{
3834
$this->configurator = $configurator;
@@ -116,7 +112,7 @@ protected function prepareBind(string $sql, array $parameters = []): \PDOStateme
116112
if ($statement === false) {
117113
throw new DatabaseException('Error Prepare Statement');
118114
}
119-
} catch (\Exception $e) {
115+
} catch (\Exception) {
120116
$this->addErrorPrepare($sql, $parameters);
121117

122118
throw new DatabaseException('Error Prepare Statement');
@@ -140,7 +136,7 @@ protected function prepareBind(string $sql, array $parameters = []): \PDOStateme
140136
throw new DatabaseException('Error Bind Value');
141137
}
142138
// @codeCoverageIgnoreStart
143-
} catch (\Exception $e) {
139+
} catch (\Exception) {
144140
// Could not reach this statement without mocking database
145141
$this->addErrorPrepare($sql, $parameters);
146142

@@ -268,7 +264,7 @@ protected function executeStatement(\PDOStatement $statement): void
268264
if ($success === false) {
269265
throw new DatabaseException('Error Execute');
270266
}
271-
} catch (\Exception $e) {
267+
} catch (\Exception) {
272268
$this->addErrorStatement($statement);
273269

274270
throw new DatabaseException('Error Execute');
@@ -519,7 +515,7 @@ public function startTransaction(): void
519515

520516
++$this->transactionDepth;
521517
// @codeCoverageIgnoreStart
522-
} catch (\Exception $e) {
518+
} catch (\Exception) {
523519
// Could not reach this statement without mocking database
524520
throw new DatabaseException('Error Begin Transaction');
525521
}
@@ -562,7 +558,7 @@ public function commitTransaction(): void
562558
$this->exec('RELEASE SAVEPOINT LEVEL' . $this->transactionDepth);
563559
}
564560
// @codeCoverageIgnoreStart
565-
} catch (\Exception $e) {
561+
} catch (\Exception) {
566562
// Could not reach this statement without mocking database
567563
throw new DatabaseException('Error Commit Transaction');
568564
}
@@ -591,7 +587,7 @@ public function rollbackTransaction(): void
591587
$this->exec('ROLLBACK TO SAVEPOINT LEVEL' . $this->transactionDepth);
592588
}
593589
// @codeCoverageIgnoreStart
594-
} catch (\Exception $e) {
590+
} catch (\Exception) {
595591
// Could not reach this statement without mocking database
596592
throw new DatabaseException('Error Rollback Transaction');
597593
}

src/DatabaseException.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,4 @@
44

55
namespace Rancoud\Database;
66

7-
/**
8-
* Class DatabaseException.
9-
*/
107
class DatabaseException extends \Exception {}

tests/ConfiguratorTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
use Rancoud\Database\Configurator;
99
use Rancoud\Database\DatabaseException;
1010

11-
/**
12-
* Class ConfiguratorTest.
13-
*
14-
* @internal
15-
*/
11+
/** @internal */
1612
class ConfiguratorTest extends TestCase
1713
{
1814
/** @throws DatabaseException */

tests/DatabaseNamedInstancesTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
use Rancoud\Database\Database;
1414
use Rancoud\Database\DatabaseException;
1515

16-
/**
17-
* Class DatabaseNamedInstancesTest.
18-
*
19-
* @internal
20-
*/
16+
/** @internal */
2117
class DatabaseNamedInstancesTest extends TestCase
2218
{
2319
protected ?Database $db;

tests/DatabaseTest.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
use Rancoud\Database\Database;
1616
use Rancoud\Database\DatabaseException;
1717

18-
/**
19-
* Class DatabaseTest.
20-
*
21-
* @internal
22-
*/
18+
/** @internal */
2319
class DatabaseTest extends TestCase
2420
{
2521
protected array $dbms = [
@@ -1185,15 +1181,15 @@ public function testCommitTransactionException(string $driver): void
11851181

11861182
try {
11871183
$db->commitTransaction();
1188-
} catch (DatabaseException $e) {
1184+
} catch (DatabaseException) {
11891185
--$exceptionsThrowed;
11901186
}
11911187

11921188
$db->disconnect();
11931189

11941190
try {
11951191
$db->commitTransaction();
1196-
} catch (DatabaseException $e) {
1192+
} catch (DatabaseException) {
11971193
--$exceptionsThrowed;
11981194
}
11991195

@@ -1251,15 +1247,15 @@ public function testRollbackTransactionException(string $driver): void
12511247

12521248
try {
12531249
$db->rollbackTransaction();
1254-
} catch (DatabaseException $e) {
1250+
} catch (DatabaseException) {
12551251
--$exceptionsThrowed;
12561252
}
12571253

12581254
$db->disconnect();
12591255

12601256
try {
12611257
$db->rollbackTransaction();
1262-
} catch (DatabaseException $e) {
1258+
} catch (DatabaseException) {
12631259
--$exceptionsThrowed;
12641260
}
12651261

@@ -1386,7 +1382,7 @@ public function testCompleteTransactionKO(string $driver): void
13861382
$db->update($sql, $params);
13871383

13881384
$db->select('aaa');
1389-
} catch (DatabaseException $e) {
1385+
} catch (DatabaseException) {
13901386
} finally {
13911387
$db->completeTransaction();
13921388
}
@@ -1441,7 +1437,7 @@ public function testErrorsException(string $driver): void
14411437
$db->select('aaa');
14421438
// if assert is done then it's not good
14431439
static::fail();
1444-
} catch (DatabaseException $e) {
1440+
} catch (DatabaseException) {
14451441
static::assertTrue($db->hasErrors());
14461442
static::assertCount(4, $db->getLastError());
14471443

0 commit comments

Comments
 (0)