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

Commit c653bc3

Browse files
committed
Merge branch 'hotfix/171'
Close #171
2 parents 4696a0a + b4e2b1b commit c653bc3

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ All notable changes to this project will be documented in this file, in reverse
2222

2323
### Fixed
2424

25+
- [#171](https://github.com/zendframework/zend-code/pull/171) changes
26+
curly braces in array and string offset access to square brackets
27+
in order to prevent issues under the upcoming PHP 7.4 release.
28+
2529
- [#164](https://github.com/zendframework/zend-code/pull/164) fixes indentation in multi-level arrays generated by `ValueGenerator`.
2630

2731
## 3.3.1 - 2018-08-13

src/NameInformation.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ public function getUses()
141141
*/
142142
public function resolveName($name)
143143
{
144-
if ($this->namespace && ! $this->uses && strlen($name) > 0 && $name{0} != '\\') {
144+
if ($this->namespace && ! $this->uses && strlen($name) > 0 && $name[0] != '\\') {
145145
return $this->namespace . '\\' . $name;
146146
}
147147

148-
if (! $this->uses || strlen($name) <= 0 || $name{0} == '\\') {
148+
if (! $this->uses || strlen($name) <= 0 || $name[0] == '\\') {
149149
return ltrim($name, '\\');
150150
}
151151

src/Scanner/Util.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ public static function resolveImports(&$value, $key = null, stdClass $data = nul
4848
));
4949
}
5050

51-
if ($data->namespace && ! $data->uses && strlen($value) > 0 && $value{0} != '\\') {
51+
if ($data->namespace && ! $data->uses && strlen($value) > 0 && $value[0] != '\\') {
5252
$value = $data->namespace . '\\' . $value;
5353

5454
return;
5555
}
5656

57-
if (! $data->uses || strlen($value) <= 0 || $value{0} == '\\') {
57+
if (! $data->uses || strlen($value) <= 0 || $value[0] == '\\') {
5858
$value = ltrim($value, '\\');
5959

6060
return;

test/Generator/FileGeneratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function testFileLineEndingsAreAlwaysLineFeed()
184184

185185
$targetLength = strlen('require_once \'SampleClass.php\';');
186186
self::assertEquals($targetLength, strlen($lines[2]));
187-
self::assertEquals(';', $lines[2]{$targetLength - 1});
187+
self::assertEquals(';', $lines[2][$targetLength - 1]);
188188
}
189189

190190
/**

0 commit comments

Comments
 (0)