Skip to content

Commit ee056be

Browse files
committed
Fix "Implicit conversion from non-compatible float" warnings
See #112, occurs in PHP 8.1 only
1 parent 3f592d8 commit ee056be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/test/php/lang/ast/unittest/emit/DeclareTest.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ class DeclareTest extends EmittingTest {
99
public function no_strict_types() {
1010
Assert::equals(1, $this->run('class <T> {
1111
public static function number(int $n) { return $n; }
12-
public function run() { return self::number(1.5); }
12+
public function run() { return self::number("1"); }
1313
}'));
1414
}
1515

1616
#[Test]
1717
public function strict_types_off() {
1818
Assert::equals(1, $this->run('declare(strict_types = 0); class <T> {
1919
public static function number(int $n) { return $n; }
20-
public function run() { return self::number(1.5); }
20+
public function run() { return self::number("1"); }
2121
}'));
2222
}
2323

24-
#[Test, Expect(class: Error::class, withMessage: '/must be of (the )?type int(eger)?, float given/')]
24+
#[Test, Expect(class: Error::class, withMessage: '/must be of (the )?type int(eger)?, string given/')]
2525
public function strict_types_on() {
2626
$this->run('declare(strict_types = 1); class <T> {
2727
public static function number(int $n) { return $n; }
28-
public function run() { return self::number(1.5); }
28+
public function run() { return self::number("1"); }
2929
}');
3030
}
3131
}

0 commit comments

Comments
 (0)