From 98a2d1ab4a1332b51d48472f824ec3b1cd365754 Mon Sep 17 00:00:00 2001 From: Mathias Gelhausen Date: Mon, 8 Jun 2020 20:25:30 +0200 Subject: [PATCH] fix: remove usage of deprecated string offset access syntax In three files, the string offset access syntax with curly braces was used, which causes errors when executed under PHP 7.4. [ fixes #8 ] --- src/TestCase/SetupTargetTrait.php | 2 +- src/Utils/Instance.php | 4 ++-- src/Utils/Target.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TestCase/SetupTargetTrait.php b/src/TestCase/SetupTargetTrait.php index 32cbdfb..7958c3a 100644 --- a/src/TestCase/SetupTargetTrait.php +++ b/src/TestCase/SetupTargetTrait.php @@ -127,7 +127,7 @@ private function setupTarget(): void $nameParts = explode(' ', $this->getName()); $name = reset($nameParts); $set = end($nameParts); - $set = '#' == $set{0} || '"' == $set{0} ? trim($set, '"') : ''; + $set = '#' == $set[0] || '"' == $set[0] ? trim($set, '"') : ''; foreach ($specs as $spec) { $for = isset($spec['for']) ? (array) $spec['for'] : ['*']; diff --git a/src/Utils/Instance.php b/src/Utils/Instance.php index d90f850..fc56dca 100644 --- a/src/Utils/Instance.php +++ b/src/Utils/Instance.php @@ -74,7 +74,7 @@ public static function create($fqcn, ...$arguments): object ); } - if ('!' == $fqcn{0}) { + if ('!' == $fqcn[0]) { return self::reflection(substr($fqcn, 1)); } @@ -142,7 +142,7 @@ public static function withMappedArguments($fqcn, $arguments, ?object $context = break; // '@function' - case is_string($value) && '@' == $value{0}: + case is_string($value) && '@' == $value[0]: $callback = ltrim($value, '@'); break; diff --git a/src/Utils/Target.php b/src/Utils/Target.php index 3d79a2c..a265070 100644 --- a/src/Utils/Target.php +++ b/src/Utils/Target.php @@ -68,7 +68,7 @@ public static function get( return $target; } - if (!$forceObject && is_string($target) && '!' != $target{0}) { + if (!$forceObject && is_string($target) && '!' != $target[0]) { return $target; }