Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #171 from webimpress/hotfix/curly-braces
Browse files Browse the repository at this point in the history
Fix: replace curly offset access brace with square brackets
  • Loading branch information
michalbundyra committed Aug 29, 2019
2 parents 4696a0a + 64c25af commit 6bccfe6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/NameInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '\\');
}

Expand Down
4 changes: 2 additions & 2 deletions src/Scanner/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/Generator/FileGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

/**
Expand Down

0 comments on commit 6bccfe6

Please sign in to comment.