is_scalar() does not consider resource type values to be scalar as resources are abstract datatypes which are currently based on integers. This implementation detail should not be relied upon, as it may change.
Casting to int quietens the notice, and make the assumption about the resource type explicit.
The line in question:
where:
From the PHP manual:
Casting to int quietens the notice, and make the assumption about the resource type explicit.