Req->Bug #81450 [Opn->Nab]: object type hint does not accept resource

From: Date: Thu, 16 Sep 2021 23:11:13 +0000
Subject: Req->Bug #81450 [Opn->Nab]: object type hint does not accept resource
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236656@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81450&edit=1 ID: 81450 Updated by: requinix@php.net Reported by: gib-o-master at mail dot ru Summary: object type hint does not accept resource -Status: Open +Status: Not a bug -Type: Feature/Change Request +Type: Bug Package: *General Issues PHP Version: 8.0.10 Block user comment: N Private report: N New Comment: Resources are not objects. https://www.php.net/manual/en/language.types.declarations.php Previous Comments: ------------------------------------------------------------------------ [2021-09-16 22:58:47] gib-o-master at mail dot ru Description: ------------ i do proc_open() which returns resource https://www.php.net/manual/en/function.proc-open $proc = proc_open(..); $hand = new ProcessController($proc); i pass it to the constructor function which has object type hint function __construct(public object $proc) {..} the result is "($proc) must be of type object, resource given" why object hint does not accept resource? will it be fixed in future versions of php? Expected result: ---------------- resource is accepted Actual result: -------------- TypeError exception ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81450&edit=1

« previous php.bugs (#236656) next »