php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66855 There is no NotImplementedException
Submitted: 2014-03-08 18:00 UTC Modified: 2014-03-25 16:19 UTC
From: eldmannen+php at gmail dot com Assigned: levim (profile)
Status: Closed Package: SPL related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 + 29 = ?
Subscribe to this entry?

 
 [2014-03-08 18:00 UTC] eldmannen+php at gmail dot com
Description:
------------
There is no NotImplementedException.
Please add a NotImplementedException.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-09 16:43 UTC] phpmpan at mpan dot pl
What's the purpose of such exception? What's its advantage over pure `\RuntimeException`?
 [2014-03-09 17:09 UTC] eldmannen+php at gmail dot com
RuntimeException can be pretty much anything. It is very disambigous.

While NotImplementedException is very specific and explicitly conveys that this method is not implemented.

If you get a RuntimeException you have no idea what is going on or why you're getting it.

If you get a NotImplementedException then you know exactly why you got it.

It is also available in many other languages;
Python - http://docs.python.org/2/library/exceptions.html#exceptions.NotImplementedError
Ruby - http://www.ruby-doc.org/core-1.9.3/NotImplementedError.html
.NET Framework - http://msdn.microsoft.com/en-us/library/system.notimplementedexception%28v=vs.110%29.aspx
Java - http://docs.oracle.com/javase/7/docs/api/java/lang/UnsupportedOperationException.html
 [2014-03-25 13:47 UTC] levim@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: levim
 [2014-03-25 13:47 UTC] levim@php.net
Just make your own and throw it. I'm in favor of revamping the SPL structures and exceptions but even then I wouldn't include NotImplementedException; it's a sign that your interface or parent class isn't designed properly.
 [2014-03-25 16:13 UTC] eldmannen+php at gmail dot com
Levim, no it is not.

Maybe the person implementing the interface haven't written that method yet.
Not all methods in a interface is widely used, some is rarely used.

Maybe some implementations would be very tricky to write, so until further it throw NotImplemented.

Maybe for some reason it is not feasible to support that method given some circumstances and limitations.

NotImplemented is sane and it is supported in multiple other languages and for a good reason. Having to write your own seems silly, as its not project-specific, and hence something that would be much re-used and benefit everyone.
 [2014-03-25 16:16 UTC] levim@php.net
If you feel this strongly about it then propose an RFC; this isn't a bug in any case so I'm keeping this bug closed.
 [2014-03-25 16:19 UTC] eldmannen+php at gmail dot com
How/where do I propose an RFC?
 [2014-03-25 16:23 UTC] levim@php.net
https://wiki.php.net/rfc has all the information you should need (or links to it).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC