diff --git a/tests/compiler/basic/datetime_builtin_class.phpt b/tests/compiler/basic/datetime_builtin_class.phpt index 310d6d90..cf49a7a9 100644 --- a/tests/compiler/basic/datetime_builtin_class.phpt +++ b/tests/compiler/basic/datetime_builtin_class.phpt @@ -35,9 +35,9 @@ $date4 = new DateTime('2023-12-31'); $interval = $date3->diff($date4); echo $interval->days . " days\n"; -// Test static create methods -$now = DateTime::createFromFormat('U', time()); -echo $now->format('Y-m-d H:i:s') . "\n"; +// Test parsing a datetime string with an explicit format. +$parsed = DateTime::createFromFormat('Y-m-d H:i:s', '2024-02-03 04:05:06'); +echo $parsed->format('Y-m-d H:i:s') . "\n"; // Test add/subtract intervals $date->add(new DateInterval('P1D')); // Add 1 day @@ -57,8 +57,8 @@ echo $date->format('r') . "\n"; // RFC 2822 format 2024-01-01 12:00:00 2024-01-01 12:00:00 UTC 364 days -%d-%d-%d %d:%d:%d +2024-02-03 04:05:06 2024-01-02 12:00:00 2024-01-01 12:00:00 2024-01-01T12:00:00+00:00 -Mon, 01 Jan 2024 12:00:00 +0000 \ No newline at end of file +Mon, 01 Jan 2024 12:00:00 +0000 diff --git a/tests/compiler/magic_methods/invoke-and-tostring.phpt b/tests/compiler/magic_methods/invoke-and-tostring.phpt index 3e163631..4739362b 100644 --- a/tests/compiler/magic_methods/invoke-and-tostring.phpt +++ b/tests/compiler/magic_methods/invoke-and-tostring.phpt @@ -41,7 +41,9 @@ function main(): void { echo $greet("World") . "\n"; echo $greet . "\n"; - echo strlen($double) . "\n"; + // TypePHP is always strict; Stringable objects require an explicit cast + // when passed to an internal function with a string parameter. + echo strlen((string) $double) . "\n"; } ?> --EXPECT-- diff --git a/tests/compiler/static/static-call.phpt b/tests/compiler/static/static-call.phpt index 329f59ae..69027a38 100644 --- a/tests/compiler/static/static-call.phpt +++ b/tests/compiler/static/static-call.phpt @@ -4,6 +4,6 @@ static calls --EXPECTF-- diff --git a/tests/compiler/string_method/to-str.phpt b/tests/compiler/string_method/to-str.phpt index bb2d1eeb..14ffd0fd 100644 --- a/tests/compiler/string_method/to-str.phpt +++ b/tests/compiler/string_method/to-str.phpt @@ -1,12 +1,12 @@ --TEST-- -any +Explicit numeric-to-string casts work with string functions in strict mode --FILE-- --EXPECT-- int(8)