1.2.1241. Typehints/CouldBeResource

Mark arguments, properties and return types that can be set to resource.

resource is an internal PHP type, and it should be a scalar type, yet it is not implement yet (as of PHP 8.2). It is still used as such by Exakat.

<?php

class x {
    // $p holds a resource
    private $p;

    function __construct() {
        $this->p = fopen('/tmp/file.txt', 'w+');
    }
}
?>

1.2.1241.1. Connex PHP features

1.2.1241.1.1. Specs

Short name

Typehints/CouldBeResource

Rulesets

All, Changed Behavior, Typechecks

Exakat since

2.4.5

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud