Re: Protected destructors

From: Date: Sat, 28 Sep 2024 09:54:46 +0000
Subject: Re: Protected destructors
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-125698@lists.php.net to get a copy of this message
On 27.09.2024 at 14:32, Jonathan Vollebregt wrote: > Long story short I'd like to suggest: > > 1. Allow the engine to call protected destructors (again) > 2. Warning when declaring a private destructor as with other magic methods > 3. Documentation update to confirm private destructors aren't allowed > > Does this sound good? Hmm, I wonder about the use-cases of userland destructors. It seems to me they are mostly useful for sanity checks, and maybe to close resources. Are there others? If not, I wouldn't worry much about the visibility of destructors, because resources are scheduled for replacement anyway. And since manually calling magic methods came up in the ticket: in my opinion, whenever you have ->__ in production code, you're doing something wrong. Christoph

« previous php.internals (#125698) next »