PHP 8.2: fix "Using ${var} in strings is deprecated, use {$var} instead" (https://github.com/woocommerce/woocommerce-blocks/pull/7782)
PHP 8.2 deprecated using ${var} in strings (https://kinsta.com/blog/php-8-2/#deprecate--string-interpolation). {$var} should be used instead. This commit fixes the occurrences of ${var} in woocommerce-blocks to prepare for the next version of PHP which is scheduled to be released early in December. I found this in the context of testing MailPoet with PHP 8.2. I'm not familiar with the woocommerce-blocks so I might be missing something. I did not test the changes in this commit.
This commit is contained in:
parent
78d8f1a626
commit
077c8fa3ff
|
@ -83,7 +83,7 @@ class RoutesController {
|
||||||
$route = $this->routes[ $version ][ $name ] ?? false;
|
$route = $this->routes[ $version ][ $name ] ?? false;
|
||||||
|
|
||||||
if ( ! $route ) {
|
if ( ! $route ) {
|
||||||
throw new \Exception( "${name} {$version} route does not exist" );
|
throw new \Exception( "{$name} {$version} route does not exist" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new $route(
|
return new $route(
|
||||||
|
|
|
@ -63,10 +63,10 @@ class SchemaController {
|
||||||
* @return Schemas\V1\AbstractSchema A new instance of the requested schema.
|
* @return Schemas\V1\AbstractSchema A new instance of the requested schema.
|
||||||
*/
|
*/
|
||||||
public function get( $name, $version = 1 ) {
|
public function get( $name, $version = 1 ) {
|
||||||
$schema = $this->schemas[ "v${version}" ][ $name ] ?? false;
|
$schema = $this->schemas[ "v{$version}" ][ $name ] ?? false;
|
||||||
|
|
||||||
if ( ! $schema ) {
|
if ( ! $schema ) {
|
||||||
throw new \Exception( "${name} v{$version} schema does not exist" );
|
throw new \Exception( "{$name} v{$version} schema does not exist" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return new $schema( $this->extend, $this );
|
return new $schema( $this->extend, $this );
|
||||||
|
|
Loading…
Reference in New Issue