Skip to content

Commit

Permalink
Type get_class() arg as nonnull in typechecker
Browse files Browse the repository at this point in the history
Summary: Hopefully this will prevent some code from passing a null.

Reviewed By: mdko

Differential Revision: D53099289

fbshipit-source-id: 2fa9cdda572080d9660a32cadd1f5d97e06918f6
  • Loading branch information
jano authored and facebook-github-bot committed Jan 26, 2024
1 parent bcbf500 commit df4592e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/legacy_fixme/coercions.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ function __cast_and_compare(mixed $l, mixed $r, COMPARISON_TYPE $ctype)[]: int {
$ctype === COMPARISON_TYPE::GT &&
\is_object($ri) &&
\is_object($li) &&
(\get_class($li) !== \get_class($ri) || $li is \Closure) &&
(
\get_class($li as nonnull) !== \get_class($ri as nonnull) ||
$li is \Closure
) &&
!($li is \DateTimeInterface && $ri is \DateTimeInterface)
) {
// flip the result :p
Expand Down

0 comments on commit df4592e

Please sign in to comment.