Skip to content

Commit 84e0a1e

Browse files
committed
Refrain from using LONG_MIN / LONG_MAX
See xp-framework/rfc#288
1 parent 84feb54 commit 84e0a1e

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/main/php/lang.base.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ function __construct($str) {
629629
// {{{ main
630630
date_default_timezone_set(ini_get('date.timezone')) || xp::error('[xp::core] date.timezone not configured properly.');
631631

632-
define('LONG_MAX', PHP_INT_MAX);
633-
define('LONG_MIN', -PHP_INT_MAX - 1);
634632
define('MODIFIER_STATIC', 1);
635633
define('MODIFIER_ABSTRACT', 2);
636634
define('MODIFIER_FINAL', 4);

src/test/php/net/xp_framework/unittest/tests/AssertionsTest.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ public function equals($other) {
6969
$this->assertEquals(2, $instance->equalsInvoked);
7070
}
7171

72-
#[@test, @values([0, 1, -1, LONG_MAX, LONG_MIN])]
72+
#[@test, @values([0, 1, -1, PHP_INT_MAX])]
7373
public function integersAreEqual($int) {
7474
$this->assertEquals($int, $int);
7575
}
7676

77-
#[@test, @values(['', 'Hello', 'äöüß'])]
77+
#[@test, @values(['', 'Hello', 'äöüß'])]
7878
public function stringsAreEqual($str) {
7979
$this->assertEquals($str, $str);
8080
}
@@ -103,7 +103,7 @@ public function hashesOrderNotRelevant() {
103103
$this->assertEquals($hash, array_reverse($hash, true), \xp::stringOf($hash));
104104
}
105105

106-
#[@test, @values([new String(''), new String('Hello'), new String('äöüß', 'iso-8859-1')])]
106+
#[@test, @values([new String(''), new String('Hello'), new String('äöüß')])]
107107
public function stringObjectsAreEqual($str) {
108108
$this->assertEquals($str, $str);
109109
}

src/test/php/net/xp_framework/unittest/util/ObjectsTest.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ObjectsTest extends TestCase {
1414
public function primitives() {
1515
return [
1616
[false], [true],
17-
[1], [0], [-1], [LONG_MAX], [LONG_MIN],
17+
[1], [0], [-1], [PHP_INT_MAX], [-PHP_INT_MAX -1],
1818
[1.0], [0.5], [-6.1],
1919
[''], ['String'], ["\0"]
2020
];

0 commit comments

Comments
 (0)