Why is PHP's type hinting allowing NULL in place of an object?


0 votes
asked Mar 15, 2016 by Streiten (1,120 points)
Why is PHP's type hinting allowing object through when it is NULL.

4 Answers

+1 vote
answered Jun 2, 2016 by gb705 (850 points)
selected Jun 3, 2016 by Cyr8662
 
Best answer
This document details a solution to this problem. Have a look at it at https://www.drupal.org/node/711918
commented Jun 3, 2016 by Cyr8662 (230 points)
Copied its Issue Summary here
commented Jun 4, 2016 by snp_6732 (100 points)
This operator matches strings against regular expressions. I have no idea how it happened but I just removed the reference and voila
0 votes
answered Jun 2, 2016 by nqq_6200 (320 points)

There are several functions that return either a string, FALSE, or NULL.
Adding the type of params and returns is the main subject of this issue. We're documenting data types, not data values.
commented Jun 4, 2016 by guarante (540 points)
User interface changesNone
commented Jun 4, 2016 by olivos (230 points)
Just putting this here to give the solution I eventually came up with. This support only portrait mode
commented Jun 4, 2016 by this_Prouse (210 points) 1 flag
Here is another answer to this problem. This can be especially useful with collections
0 votes
answered Jun 2, 2016 by Greaterz (670 points)
I download example from this What is in a type hint? Issue #4 lukescott/es-type-hinting
All comments about memory leaks etc are based on very old
commented Jun 4, 2016 by Glasson (120 points)
This should make life much easier
0 votes
answered Jun 2, 2016 by Feagan (140 points)
Is this a defect in Firefox/Linux or is it a defect in the page design
commented Jun 3, 2016 by calizo (530 points)
See Grammatical tense
commented Jun 3, 2016 by Gur5133 (100 points)
The format being used is from PHPDoc
commented Jun 4, 2016 by Ba6951The (100 points)
A patch or patches should be generated to bring Drupal core into compliance

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!







...