<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/7lsp2gww1" -->

---
title: The “never” Type in PHP | daily.dev
description: PHP 8.1 introduced the 'never' return type to indicate functions that will never return normally, typically because they throw exceptions or call exit/die. The...
canonical: https://daily.dev/posts/7lsp2gww1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The “never” Type in PHP | daily.dev
og:description: PHP 8.1 introduced the 'never' return type to indicate functions that will never return normally, typically because they throw exceptions or call exit/die. The...
og:url: https://daily.dev/posts/7lsp2gww1
og:image: https://api.daily.dev/og/posts/7LSP2gww1.png
og:image:alt: Post cover image
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The “never” Type in PHP

**[YoanDev](https://daily.dev/sources/yoandev)** · [@thomas_l](https://daily.dev/thomas_l) · 25 upvotes · 2 comments

## Summary

PHP 8.1 introduced the 'never' return type to indicate functions that will never return normally, typically because they throw exceptions or call exit/die. The type can only be used as a return type, not for parameters, and cannot be combined with union or intersection types. Functions with 'never' type must not return values explicitly or implicitly, otherwise PHP throws fatal errors. A practical example is the dd() function from Symfony's var-dumper package, which always terminates script execution.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://ashallendesign-uk.medium.com/the-never-type-in-php-1c2c97ff47e8>

## Community discussion

Top comments from developers on daily.dev.

**@tristian\_potgieter** · 0 upvotes

> Would this only be useful when throwing exceptions ? Why would you not want PHP to return something ?

---

Tags: [#php](https://daily.dev/tags/php), [#symfony](https://daily.dev/tags/symfony)

[View this post on daily.dev](https://daily.dev/posts/7lsp2gww1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/7lsp2gww1","headline":"The “never” Type in PHP","text":"Shared: The “never” Type in PHP","url":"https://daily.dev/posts/7lsp2gww1","datePublished":"2025-08-18T07:46:08.876Z","dateModified":"2025-08-18T07:46:08.880Z","author":{"@type":"Person","name":"Thomas Laure","url":"https://daily.dev/thomas_l","image":"https://avatars.githubusercontent.com/u/25416156?v=4","description":"Software Engineer | PHP/Symfony","worksFor":{"@type":"Organization","name":"Enovacom","logo":"https://media.daily.dev/image/upload/s--37NuWhQX--/f_auto/v1745576150/companies/enovacom"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":2080}},"image":"https://media.daily.dev/image/upload/s--qPvKM23u--/f_auto/v1722860399/public/Placeholder%2009","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":25},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"sharedContent":{"@type":"WebPage","url":"https://api.daily.dev/r/9g48N7dFr"},"comment":[{"@type":"Comment","text":"Would this only be useful when throwing exceptions ? Why would you not want PHP to return something ?","datePublished":"2025-08-21T12:00:11.668Z","url":"https://daily.dev/posts/7LSP2gww1#c-n7GKipRJr","author":{"@type":"Person","name":"Tristian","url":"https://daily.dev/tristian_potgieter","image":"https://avatars.githubusercontent.com/u/102797825?v=4"}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/yoandev","name":"YoanDev"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"YoanDev","item":"https://daily.dev/squads/yoandev"},{"@type":"ListItem","position":3,"name":"The “never” Type in PHP"}]}
```

