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

Commit

Permalink
Merge branch 'hotfix/171' into develop
Browse files Browse the repository at this point in the history
Forward port #171
  • Loading branch information
michalbundyra committed Aug 29, 2019
2 parents 8a1826a + b4e2b1b commit b2a1295
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- [#171](https://github.com/zendframework/zend-code/pull/171) changes
curly braces in array and string offset access to square brackets
in order to prevent issues under the upcoming PHP 7.4 release.

- [#164](https://github.com/zendframework/zend-code/pull/164) fixes indentation in multi-level arrays generated by `ValueGenerator`.

## 3.3.1 - 2018-08-13
Expand Down
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 b2a1295

Please sign in to comment.