Doc #76311 [Ver]: __construct/destruct do not have return types

From: Date: Tue, 08 May 2018 16:39:54 +0000
Subject: Doc #76311 [Ver]: __construct/destruct do not have return types
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15660@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76311&edit=1 ID: 76311 Updated by: cmb@php.net Reported by: Andy_Schmidt at HM-Software dot com Summary: __construct/destruct do not have return types Status: Verified Type: Documentation Problem Package: Class/Object related PHP Version: 7.2.5 Block user comment: N Private report: N New Comment: > Constructors and destructors do not have the concept of a return > type. The same is true for some of the other magic methods (e.g. __wakeup()). Previous Comments: ------------------------------------------------------------------------ [2018-05-08 15:50:26] requinix@php.net Constructors and destructors do not have the concept of a return type. The docs showing anything at all, even void, is incorrect. ------------------------------------------------------------------------ [2018-05-08 15:37:05] Andy_Schmidt at HM-Software dot com Description: ------------ According to PHP's manual: http://php.net/manual/en/language.oop5.decon.php the signature of the __destruct method is: void __destruct ( void ) Consequently, the following syntax would be correct for 7.2, now that a "void" type hint is available: function __destruct(): void {} Actual result: -------------- PHP Fatal error: Destructor __destruct() cannot declare a return type ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76311&edit=1

« previous php.doc.bugs (#15660) next »