diff --git a/src/NameInformation.php b/src/NameInformation.php index 8c096642..bea84ac6 100644 --- a/src/NameInformation.php +++ b/src/NameInformation.php @@ -141,11 +141,11 @@ public function getUses() */ public function resolveName($name) { - if ($this->namespace && ! $this->uses && strlen($name) > 0 && $name{0} != '\\') { + if ($this->namespace && ! $this->uses && strlen($name) > 0 && $name[0] != '\\') { return $this->namespace . '\\' . $name; } - if (! $this->uses || strlen($name) <= 0 || $name{0} == '\\') { + if (! $this->uses || strlen($name) <= 0 || $name[0] == '\\') { return ltrim($name, '\\'); } diff --git a/src/Scanner/Util.php b/src/Scanner/Util.php index 764060c2..b1d4ad39 100644 --- a/src/Scanner/Util.php +++ b/src/Scanner/Util.php @@ -48,13 +48,13 @@ public static function resolveImports(&$value, $key = null, stdClass $data = nul )); } - if ($data->namespace && ! $data->uses && strlen($value) > 0 && $value{0} != '\\') { + if ($data->namespace && ! $data->uses && strlen($value) > 0 && $value[0] != '\\') { $value = $data->namespace . '\\' . $value; return; } - if (! $data->uses || strlen($value) <= 0 || $value{0} == '\\') { + if (! $data->uses || strlen($value) <= 0 || $value[0] == '\\') { $value = ltrim($value, '\\'); return; diff --git a/test/Generator/FileGeneratorTest.php b/test/Generator/FileGeneratorTest.php index f2ec0bc9..cce6530b 100644 --- a/test/Generator/FileGeneratorTest.php +++ b/test/Generator/FileGeneratorTest.php @@ -184,7 +184,7 @@ public function testFileLineEndingsAreAlwaysLineFeed() $targetLength = strlen('require_once \'SampleClass.php\';'); self::assertEquals($targetLength, strlen($lines[2])); - self::assertEquals(';', $lines[2]{$targetLength - 1}); + self::assertEquals(';', $lines[2][$targetLength - 1]); } /**