note 130671 added to language.types.never

From: Date: Sun, 01 Mar 2026 04:10:18 +0000
Subject: note 130671 added to language.types.never
Groups: php.notes 
Request: Send a blank email to php-notes+get-222566@lists.php.net to get a copy of this message
Never cannot be used in a union type because, being the bottom type, it is already automatically a subtype of every other type. "A|never" is equivalent to "A". When one type is "obviously" a subtype of another (i.e., it doesn't require loading the class definitions of all the types involved), the former is redundant in union types, and PHP flags the union of both as an error. Similarly for intersection types, where "A&never" means the same thing as "never". It "obviously" doesn't make sense to mention A there, so PHP won't allow doing so. ---- Server IP: 206.189.2.9 Probable Submitter: 122.57.27.239 ---- Manual Page -- https://php.net/manual/en/language.types.never.php Edit -- https://main.php.net/note/edit/130671 Del: integrated -- https://main.php.net/note/delete/130671/integrated Del: useless -- https://main.php.net/note/delete/130671/useless Del: bad code -- https://main.php.net/note/delete/130671/bad+code Del: spam -- https://main.php.net/note/delete/130671/spam Del: non-english -- https://main.php.net/note/delete/130671/non-english Del: in docs -- https://main.php.net/note/delete/130671/in+docs Del: other reasons-- https://main.php.net/note/delete/130671 Reject -- https://main.php.net/note/reject/130671 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222566) next »