Skip to content

Commit 6dbf448

Browse files
committed
Use nameof() instead of the deprecated getClassName()
See xp-framework/core#120
1 parent 8f0f71d commit 6dbf448

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

ChangeLog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Data sequences change log
33

44
## ?.?.? / ????-??-??
55

6+
## 4.1.2 / 2016-01-23
7+
8+
* Fix code to use `nameof()` instead of the deprecated `getClassName()`
9+
method from lang.Generic. See xp-framework/core#120
10+
(@thekid)
11+
612
## 4.1.1 / 2015-12-20
713

814
* Added dependencies on collections and unittest libraries which have

src/main/php/util/data/Optional.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ public function equals($cmp) {
158158
*/
159159
public function toString() {
160160
if ($this->present) {
161-
return $this->getClassName().'@'.Objects::stringOf($this->value);
161+
return nameof($this).'@'.Objects::stringOf($this->value);
162162
} else {
163-
return $this->getClassName().'<EMPTY>';
163+
return nameof($this).'<EMPTY>';
164164
}
165165
}
166166
}

src/main/php/util/data/Sequence.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,9 +552,9 @@ public function equals($cmp) {
552552
*/
553553
public function toString() {
554554
if ([] === $this->elements) {
555-
return $this->getClassName().'<EMPTY>';
555+
return nameof($this).'<EMPTY>';
556556
} else {
557-
return $this->getClassName().'@'.Objects::stringOf($this->elements);
557+
return nameof($this).'@'.Objects::stringOf($this->elements);
558558
}
559559
}
560560
}

src/test/php/util/data/unittest/EachTest.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function writing_to_console_out() {
5555
$out= new MemoryOutputStream();
5656
Console::$out->setStream($out);
5757

58-
Sequence::of([1, 2, 3, 4])->each('util.cmd.Console::write');
58+
Sequence::of([1, 2, 3, 4])->each('util.cmd.Console::write', []);
5959

6060
Console::$out->setStream($orig);
6161
$this->assertEquals('1234', $out->getBytes());

src/test/php/util/data/unittest/Employee.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function isDinosaur() { return $this->years > 10; }
4242
* @return string
4343
*/
4444
public function toString() {
45-
return $this->getClassName().'('.
45+
return nameof($this).'('.
4646
'id= '.$this->id.', name= '.$this->name.', department= '.$this->department.', years= '.$this->years.
4747
')';
4848
}

src/test/php/util/data/unittest/Name.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public function equals($cmp) {
3434
* @return string
3535
*/
3636
public function toString() {
37-
return $this->getClassName().'('.$this->value.')';
37+
return nameof($this).'('.$this->value.')';
3838
}
3939
}

src/test/php/util/data/unittest/PeekTest.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function writing_to_console_out() {
4040
$out= new MemoryOutputStream();
4141
Console::$out->setStream($out);
4242

43-
Sequence::of([1, 2, 3, 4])->peek('util.cmd.Console::write')->each();
43+
Sequence::of([1, 2, 3, 4])->peek('util.cmd.Console::write', [])->each();
4444

4545
Console::$out->setStream($orig);
4646
$this->assertEquals('1234', $out->getBytes());

0 commit comments

Comments
 (0)