Skip to content

Commit

Permalink
Typed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Sep 1, 2023
1 parent af46ea6 commit 8713fc9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 32 deletions.
24 changes: 6 additions & 18 deletions src/Bulk/BulkOperator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ abstract class BulkOperator
{
/**
* The PDO connection.
*
* @var \PDO
*/
private $pdo;
private \PDO $pdo;

/**
* The name of the target database table.
Expand All @@ -39,10 +37,8 @@ abstract class BulkOperator

/**
* The number of records to process per query.
*
* @var int
*/
private $operationsPerQuery;
private int $operationsPerQuery;

/**
* The prepared statement to process a full batch of records.
Expand All @@ -53,33 +49,25 @@ abstract class BulkOperator

/**
* A buffer containing the pending values to process in the next batch.
*
* @var array
*/
private $buffer = [];
private array $buffer = [];

/**
* The number of operations in the buffer.
*
* @var int
*/
private $bufferSize = 0;
private int $bufferSize = 0;

/**
* The total number of operations that have been queued.
*
* This includes both flushed and pending operations.
*
* @var int
*/
private $totalOperations = 0;
private int $totalOperations = 0;

/**
* The total number of rows affected by flushed operations.
*
* @var int
*/
private $affectedRows = 0;
private int $affectedRows = 0;

/**
* @param \PDO $pdo The PDO connection.
Expand Down
9 changes: 3 additions & 6 deletions tests/Bulk/PDOMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@
*/
class PDOMock extends \PDO
{
/**
* @var int
*/
private $statementNumber = 0;
private int $statementNumber = 0;

/**
* @var string[]
*/
private $log = [];
private array $log = [];

/**
* The values that will be returned by successive calls to PDOStatementMock::rowCount().
*
* @var int[]
*/
private $rowCounts;
private array $rowCounts;

/**
* @param array $rowCounts The values that will be returned by successive calls to PDOStatementMock::rowCount().
Expand Down
10 changes: 2 additions & 8 deletions tests/Bulk/PDOStatementMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@
*/
class PDOStatementMock extends \PDOStatement
{
/**
* @var PDOMock
*/
private $pdo;
private PDOMock $pdo;

/**
* @var int
*/
private $number;
private int $number;

/**
* @param PDOMock $pdo
Expand Down

0 comments on commit 8713fc9

Please sign in to comment.