Skip to content

Commit 8adb880

Browse files
authored
Update codebase to PHP 7.4 (#12)
* Add typed properties * PHP 7.4 arrow function & static closures
1 parent 9176ee2 commit 8adb880

File tree

54 files changed

+162
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+162
-177
lines changed

src/batch-box-spout/src/FlatFileReader.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ final class FlatFileReader implements
3535
/**
3636
* @var string
3737
*/
38-
private $type;
38+
private string $type;
3939

4040
/**
4141
* @var array
4242
*/
43-
private $options;
43+
private array $options;
4444

4545
/**
4646
* @var string
4747
*/
48-
private $headersMode;
48+
private string $headersMode;
4949

5050
/**
5151
* @var array|null
5252
*/
53-
private $headers;
53+
private ?array $headers;
5454

5555
/**
5656
* @var string|null
5757
*/
58-
private $filePath;
58+
private ?string $filePath;
5959

6060
public function __construct(
6161
string $type,

src/batch-box-spout/src/FlatFileWriter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,32 @@ final class FlatFileWriter implements
3030
/**
3131
* @var string
3232
*/
33-
private $type;
33+
private string $type;
3434

3535
/**
3636
* @var array|null
3737
*/
38-
private $headers;
38+
private ?array $headers;
3939

4040
/**
4141
* @var WriterInterface|null
4242
*/
43-
private $writer;
43+
private ?WriterInterface $writer = null;
4444

4545
/**
4646
* @var bool
4747
*/
48-
private $headersAdded = false;
48+
private bool $headersAdded = false;
4949

5050
/**
5151
* @var string|null
5252
*/
53-
private $filePath;
53+
private ?string $filePath;
5454

5555
/**
5656
* @var array
5757
*/
58-
private $options;
58+
private array $options;
5959

6060
public function __construct(string $type, array $headers = null, string $filePath = null, array $options = [])
6161
{

src/batch-doctrine-dbal/src/DoctrineDBALJobExecutionStorage.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,82 +23,82 @@ final class DoctrineDBALJobExecutionStorage implements QueryableJobExecutionStor
2323
/**
2424
* @var Connection
2525
*/
26-
private $connection;
26+
private Connection $connection;
2727

2828
/**
2929
* @var string
3030
*/
31-
private $table = 'yokai_batch_job_execution';
31+
private string $table = 'yokai_batch_job_execution';
3232

3333
/**
3434
* @var string
3535
*/
36-
private $idCol = 'id';
36+
private string $idCol = 'id';
3737

3838
/**
3939
* @var string
4040
*/
41-
private $jobNameCol = 'job_name';
41+
private string $jobNameCol = 'job_name';
4242

4343
/**
4444
* @var string
4545
*/
46-
private $statusCol = 'status';
46+
private string $statusCol = 'status';
4747

4848
/**
4949
* @var string
5050
*/
51-
private $parametersCol = 'parameters';
51+
private string $parametersCol = 'parameters';
5252

5353
/**
5454
* @var string
5555
*/
56-
private $startTimeCol = 'start_time';
56+
private string $startTimeCol = 'start_time';
5757

5858
/**
5959
* @var string
6060
*/
61-
private $endTimeCol = 'end_time';
61+
private string $endTimeCol = 'end_time';
6262

6363
/**
6464
* @var string
6565
*/
66-
private $summaryCol = 'summary';
66+
private string $summaryCol = 'summary';
6767

6868
/**
6969
* @var string
7070
*/
71-
private $failuresCol = 'failures';
71+
private string $failuresCol = 'failures';
7272

7373
/**
7474
* @var string
7575
*/
76-
private $warningsCol = 'warnings';
76+
private string $warningsCol = 'warnings';
7777

7878
/**
7979
* @var string
8080
*/
81-
private $childExecutionsCol = 'child_executions';
81+
private string $childExecutionsCol = 'child_executions';
8282

8383
/**
8484
* @var string
8585
*/
86-
private $logsCol = 'logs';
86+
private string $logsCol = 'logs';
8787

8888
/**
8989
* @var array
9090
*/
91-
private $types;
91+
private array $types;
9292

9393
/**
9494
* @var Schema
9595
*/
96-
private $schema;
96+
private Schema $schema;
9797

9898
/**
9999
* @var JobExecutionRowNormalizer|null
100100
*/
101-
private $normalizer;
101+
private ?JobExecutionRowNormalizer $normalizer = null;
102102

103103
public function __construct(Connection $connection, array $options)
104104
{
@@ -165,7 +165,7 @@ public function createSchemaSql(): array
165165
$config = $this->connection->getConfiguration();
166166
$previousFilter = $config->getSchemaAssetsFilter();
167167

168-
$config->setSchemaAssetsFilter(function ($asset) use ($previousFilter, $toSchema): bool {
168+
$config->setSchemaAssetsFilter(static function ($asset) use ($previousFilter, $toSchema): bool {
169169
$assetName = $asset instanceof AbstractAsset ? $asset->getName() : $asset;
170170

171171
return $toSchema->hasTable($assetName)

src/batch-doctrine-dbal/src/JobExecutionRowNormalizer.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,62 +23,62 @@ final class JobExecutionRowNormalizer
2323
/**
2424
* @var string
2525
*/
26-
private $idCol = 'id';
26+
private string $idCol;
2727

2828
/**
2929
* @var string
3030
*/
31-
private $jobNameCol = 'job_name';
31+
private string $jobNameCol;
3232

3333
/**
3434
* @var string
3535
*/
36-
private $statusCol = 'status';
36+
private string $statusCol;
3737

3838
/**
3939
* @var string
4040
*/
41-
private $parametersCol = 'parameters';
41+
private string $parametersCol;
4242

4343
/**
4444
* @var string
4545
*/
46-
private $startTimeCol = 'start_time';
46+
private string $startTimeCol;
4747

4848
/**
4949
* @var string
5050
*/
51-
private $endTimeCol = 'end_time';
51+
private string $endTimeCol;
5252

5353
/**
5454
* @var string
5555
*/
56-
private $summaryCol = 'summary';
56+
private string $summaryCol;
5757

5858
/**
5959
* @var string
6060
*/
61-
private $failuresCol = 'failures';
61+
private string $failuresCol;
6262

6363
/**
6464
* @var string
6565
*/
66-
private $warningsCol = 'warnings';
66+
private string $warningsCol;
6767

6868
/**
6969
* @var string
7070
*/
71-
private $childExecutionsCol = 'child_executions';
71+
private string $childExecutionsCol;
7272

7373
/**
7474
* @var string
7575
*/
76-
private $logsCol;
76+
private string $logsCol;
7777

7878
/**
7979
* @var string
8080
*/
81-
private $dateFormat;
81+
private string $dateFormat;
8282

8383
public function __construct(
8484
string $idCol,

src/batch-doctrine-dbal/tests/DoctrineDBALJobExecutionStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DoctrineDBALJobExecutionStorageTest extends TestCase
3535
/**
3636
* @var Connection
3737
*/
38-
private $connection;
38+
private Connection $connection;
3939

4040
protected function setUp(): void
4141
{

src/batch-doctrine-orm/src/EntityReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ final class EntityReader implements ItemReaderInterface
1414
/**
1515
* @var ManagerRegistry
1616
*/
17-
private $doctrine;
17+
private ManagerRegistry $doctrine;
1818

1919
/**
2020
* @var string
2121
*/
22-
private $class;
22+
private string $class;
2323

2424
public function __construct(ManagerRegistry $doctrine, string $class)
2525
{

src/batch-doctrine-orm/tests/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class User
88
{
9-
public $id;
9+
public string $id;
1010

1111
public function __construct(string $id)
1212
{

src/batch-doctrine-persistence/src/ObjectWriter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ final class ObjectWriter implements ItemWriterInterface
1414
/**
1515
* @var ManagerRegistry
1616
*/
17-
private $doctrine;
17+
private ManagerRegistry $doctrine;
1818

1919
/**
2020
* @var ObjectManager[]
2121
*/
22-
private $encounteredManagers = [];
22+
private array $encounteredManagers = [];
2323

2424
/**
2525
* @var ObjectManager[]
2626
*/
27-
private $encounteredClasses = [];
27+
private array $encounteredClasses = [];
2828

2929
/**
3030
* @var ObjectManager[]
3131
*/
32-
private $managerForClass = [];
32+
private array $managerForClass = [];
3333

3434
public function __construct(ManagerRegistry $doctrine)
3535
{

src/batch-doctrine-persistence/tests/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Group
88
{
9-
public $id;
9+
public string $id;
1010

1111
public function __construct(string $id)
1212
{

src/batch-doctrine-persistence/tests/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Product
88
{
9-
public $id;
9+
public string $id;
1010

1111
public function __construct(string $id)
1212
{

0 commit comments

Comments
 (0)