From e332e7cb0f3d040809d60d885c8071bad40b6bc6 Mon Sep 17 00:00:00 2001 From: Vincent QUATREVIEUX Date: Tue, 3 Jan 2023 11:42:20 +0100 Subject: [PATCH] chore: Migrate deprecated string interpolation ${var} to {$var} (#FRAM-77) --- src/Console/HydratorGenerationCommand.php | 12 ++++++------ src/Schema/Inflector/SimpleInfector.php | 2 +- tests/Query/ExpressionTest.php | 5 +++-- tests/Query/QueryOrmTest.php | 1 + tests/Sharding/Query/ShardingInsertQueryTest.php | 8 ++++++++ tests/Sharding/Query/ShardingKeyValueQueryTest.php | 9 +++++++++ tests/Sharding/ShardingConnectionTest.php | 11 ++++++++++- 7 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/Console/HydratorGenerationCommand.php b/src/Console/HydratorGenerationCommand.php index 4244e8b..66c7cba 100644 --- a/src/Console/HydratorGenerationCommand.php +++ b/src/Console/HydratorGenerationCommand.php @@ -137,7 +137,7 @@ private function configureOutputs($io): void */ private function generateHydrator($io, $className, Mapper $mapper): void { - $io->inline("Generate hydrator for ${className} "); + $io->inline("Generate hydrator for {$className} "); try { $generator = new HydratorGenerator($this->locator, $mapper, $className); @@ -185,18 +185,18 @@ private function generateLoader($io): void $embeddeds = $className::embeddedPrimeClasses(); if (empty($embeddeds)) { - $hydrators[] = "'{$className::supportedPrimeClassName()}' => new ${className}(),"; + $hydrators[] = "'{$className::supportedPrimeClassName()}' => new {$className}(),"; } else { $arguments = []; foreach ($embeddeds as $entity) { - $arguments[] = "\$registry->get('${entity}')"; + $arguments[] = "\$registry->get('{$entity}')"; } $arguments = implode(', ', $arguments); - $closure = "function(\$registry) {return new ${className}(${arguments});}"; + $closure = "function(\$registry) {return new {$className}({$arguments});}"; - $factories[] = "'{$className::supportedPrimeClassName()}' => ${closure},"; + $factories[] = "'{$className::supportedPrimeClassName()}' => {$closure},"; } } @@ -204,7 +204,7 @@ private function generateLoader($io): void if ($io->option('include')) { foreach ($includes as $file) { - $content .= "require_once __DIR__.DIRECTORY_SEPARATOR.'${file}';\n"; + $content .= "require_once __DIR__.DIRECTORY_SEPARATOR.'{$file}';\n"; } } else { $io->block([ diff --git a/src/Schema/Inflector/SimpleInfector.php b/src/Schema/Inflector/SimpleInfector.php index 0511f32..ec6645a 100644 --- a/src/Schema/Inflector/SimpleInfector.php +++ b/src/Schema/Inflector/SimpleInfector.php @@ -43,6 +43,6 @@ public function getPropertyName(string $table, string $field): string */ public function getSequenceName(string $table): string { - return "${table}_seq"; + return "{$table}_seq"; } } diff --git a/tests/Query/ExpressionTest.php b/tests/Query/ExpressionTest.php index 367031b..99dabf6 100644 --- a/tests/Query/ExpressionTest.php +++ b/tests/Query/ExpressionTest.php @@ -15,7 +15,8 @@ class ExpressionTest extends TestCase protected $repository; protected $query; - + protected $table; + protected function setUp(): void { $this->primeStart(); @@ -143,4 +144,4 @@ public function test_match_expression_in_boolean_mode() ->toSql() ); } -} \ No newline at end of file +} diff --git a/tests/Query/QueryOrmTest.php b/tests/Query/QueryOrmTest.php index 43aaec7..2114b70 100644 --- a/tests/Query/QueryOrmTest.php +++ b/tests/Query/QueryOrmTest.php @@ -32,6 +32,7 @@ class QueryOrmTest extends TestCase protected $repository; protected $query; + protected $table; /** * diff --git a/tests/Sharding/Query/ShardingInsertQueryTest.php b/tests/Sharding/Query/ShardingInsertQueryTest.php index f24353b..5061e76 100644 --- a/tests/Sharding/Query/ShardingInsertQueryTest.php +++ b/tests/Sharding/Query/ShardingInsertQueryTest.php @@ -27,6 +27,14 @@ class ShardingInsertQueryTest extends TestCase * @var ShardingConnection */ private $connection; + /** + * @var ShardingConnectionFactory + */ + private $factory; + /** + * @var ConnectionRegistry + */ + private $registry; /** * diff --git a/tests/Sharding/Query/ShardingKeyValueQueryTest.php b/tests/Sharding/Query/ShardingKeyValueQueryTest.php index a00bde0..9cb6812 100644 --- a/tests/Sharding/Query/ShardingKeyValueQueryTest.php +++ b/tests/Sharding/Query/ShardingKeyValueQueryTest.php @@ -26,6 +26,15 @@ class ShardingKeyValueQueryTest extends TestCase */ private $connection; + /** + * @var ShardingConnectionFactory + */ + private $factory; + /** + * @var ConnectionRegistry + */ + private $registry; + /** * @var ConnectionInterface */ diff --git a/tests/Sharding/ShardingConnectionTest.php b/tests/Sharding/ShardingConnectionTest.php index ee5f352..8c76ad9 100755 --- a/tests/Sharding/ShardingConnectionTest.php +++ b/tests/Sharding/ShardingConnectionTest.php @@ -24,7 +24,16 @@ class ShardingConnectionTest extends TestCase /** @var ConnectionManager $connections */ protected $connections; - + + /** + * @var ShardingConnectionFactory + */ + private $factory; + /** + * @var ConnectionRegistry + */ + private $registry; + /** * */