Browse Source

Fix use of deprecated string interpolation

Corey Taylor 3 years ago
parent
commit
dd1e721607

+ 32 - 32
src/Routing/RouteCollection.php

@@ -218,9 +218,9 @@ class RouteCollection
         $action = strtolower($url['action']);
 
         $names = [
-            "${controller}:${action}",
-            "${controller}:_action",
-            "_controller:${action}",
+            "{$controller}:{$action}",
+            "{$controller}:_action",
+            "_controller:{$action}",
             '_controller:_action',
         ];
 
@@ -232,13 +232,13 @@ class RouteCollection
         // Only a plugin
         if ($prefix === false) {
             return [
-                "${plugin}.${controller}:${action}",
-                "${plugin}.${controller}:_action",
-                "${plugin}._controller:${action}",
-                "${plugin}._controller:_action",
-                "_plugin.${controller}:${action}",
-                "_plugin.${controller}:_action",
-                "_plugin._controller:${action}",
+                "{$plugin}.{$controller}:{$action}",
+                "{$plugin}.{$controller}:_action",
+                "{$plugin}._controller:{$action}",
+                "{$plugin}._controller:_action",
+                "_plugin.{$controller}:{$action}",
+                "_plugin.{$controller}:_action",
+                "_plugin._controller:{$action}",
                 '_plugin._controller:_action',
             ];
         }
@@ -246,13 +246,13 @@ class RouteCollection
         // Only a prefix
         if ($plugin === false) {
             return [
-                "${prefix}:${controller}:${action}",
-                "${prefix}:${controller}:_action",
-                "${prefix}:_controller:${action}",
-                "${prefix}:_controller:_action",
-                "_prefix:${controller}:${action}",
-                "_prefix:${controller}:_action",
-                "_prefix:_controller:${action}",
+                "{$prefix}:{$controller}:{$action}",
+                "{$prefix}:{$controller}:_action",
+                "{$prefix}:_controller:{$action}",
+                "{$prefix}:_controller:_action",
+                "_prefix:{$controller}:{$action}",
+                "_prefix:{$controller}:_action",
+                "_prefix:_controller:{$action}",
                 '_prefix:_controller:_action',
             ];
         }
@@ -260,21 +260,21 @@ class RouteCollection
         // Prefix and plugin has the most options
         // as there are 4 factors.
         return [
-            "${prefix}:${plugin}.${controller}:${action}",
-            "${prefix}:${plugin}.${controller}:_action",
-            "${prefix}:${plugin}._controller:${action}",
-            "${prefix}:${plugin}._controller:_action",
-            "${prefix}:_plugin.${controller}:${action}",
-            "${prefix}:_plugin.${controller}:_action",
-            "${prefix}:_plugin._controller:${action}",
-            "${prefix}:_plugin._controller:_action",
-            "_prefix:${plugin}.${controller}:${action}",
-            "_prefix:${plugin}.${controller}:_action",
-            "_prefix:${plugin}._controller:${action}",
-            "_prefix:${plugin}._controller:_action",
-            "_prefix:_plugin.${controller}:${action}",
-            "_prefix:_plugin.${controller}:_action",
-            "_prefix:_plugin._controller:${action}",
+            "{$prefix}:{$plugin}.{$controller}:{$action}",
+            "{$prefix}:{$plugin}.{$controller}:_action",
+            "{$prefix}:{$plugin}._controller:{$action}",
+            "{$prefix}:{$plugin}._controller:_action",
+            "{$prefix}:_plugin.{$controller}:{$action}",
+            "{$prefix}:_plugin.{$controller}:_action",
+            "{$prefix}:_plugin._controller:{$action}",
+            "{$prefix}:_plugin._controller:_action",
+            "_prefix:{$plugin}.{$controller}:{$action}",
+            "_prefix:{$plugin}.{$controller}:_action",
+            "_prefix:{$plugin}._controller:{$action}",
+            "_prefix:{$plugin}._controller:_action",
+            "_prefix:_plugin.{$controller}:{$action}",
+            "_prefix:_plugin.{$controller}:_action",
+            "_prefix:_plugin._controller:{$action}",
             '_prefix:_plugin._controller:_action',
         ];
     }

+ 2 - 2
tests/TestCase/Console/ShellTest.php

@@ -450,7 +450,7 @@ class ShellTest extends TestCase
 
         $this->fs->mkdir($path);
 
-        $contents = "<?php{$eol}echo 'test';${eol}\$te = 'st';{$eol}";
+        $contents = "<?php{$eol}echo 'test';{$eol}\$te = 'st';{$eol}";
 
         $this->Shell->interactive = false;
         $result = $this->Shell->createFile($file, $contents);
@@ -475,7 +475,7 @@ class ShellTest extends TestCase
 
         $this->fs->mkdir($path);
 
-        $contents = "<?php{$eol}echo 'test';${eol}\$te = 'st';{$eol}";
+        $contents = "<?php{$eol}echo 'test';{$eol}\$te = 'st';{$eol}";
         $this->Shell->interactive = false;
         $result = $this->Shell->createFile($file, $contents);
         $this->assertFalse($result);

+ 4 - 4
tests/TestCase/Database/QueryTest.php

@@ -5313,10 +5313,10 @@ class QueryTest extends TestCase
         if ($driver instanceof Postgres) {
             // Older postgres versions throw an error on the parameter type without a cast
             $query->select(['test_string' => $query->func()->cast(new StringExpression('testString', $collation), 'text')]);
-            $expected = "SELECT \(CAST\(:c0 COLLATE \"${collation}\" AS text\)\) AS <test_string>";
+            $expected = "SELECT \(CAST\(:c0 COLLATE \"{$collation}\" AS text\)\) AS <test_string>";
         } else {
             $query->select(['test_string' => new StringExpression('testString', $collation)]);
-            $expected = "SELECT \(:c0 COLLATE ${collation}\) AS <test_string>";
+            $expected = "SELECT \(:c0 COLLATE {$collation}\) AS <test_string>";
         }
         $this->assertRegExpSql($expected, $query->sql(new ValueBinder()), !$this->autoQuote);
 
@@ -5353,9 +5353,9 @@ class QueryTest extends TestCase
 
         if ($driver instanceof Postgres) {
             // Older postgres versions throw an error on the parameter type without a cast
-            $expected = "SELECT \(<title> COLLATE \"${collation}\"\) AS <test_string>";
+            $expected = "SELECT \(<title> COLLATE \"{$collation}\"\) AS <test_string>";
         } else {
-            $expected = "SELECT \(<title> COLLATE ${collation}\) AS <test_string>";
+            $expected = "SELECT \(<title> COLLATE {$collation}\) AS <test_string>";
         }
         $this->assertRegExpSql($expected, $query->sql(new ValueBinder()), !$this->autoQuote);
 

+ 1 - 1
tests/TestCase/Error/DebuggerTest.php

@@ -1073,7 +1073,7 @@ EXPECTED;
     public function testEditorUrlClosure(): void
     {
         Debugger::addEditor('open', function (string $file, int $line) {
-            return "${file}/${line}";
+            return "{$file}/{$line}";
         });
         Debugger::setEditor('open');
         $this->assertSame('test.php/123', Debugger::editorUrl('test.php', 123));