<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sun, 12 Feb 2012 20:31:34 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Slawek Lukasiewicz's Blog: Throwing Exception with Type Hinting Failed]]></title>
      <guid>http://www.phpdeveloper.org/news/16699</guid>
      <link>http://www.phpdeveloper.org/news/16699</link>
      <description><![CDATA[<p>
<i>Slawek Lukasiewicz</i> has a helpful hint posted to his blog today about handling type hinting failures in a what he sees as a "more correct" way than just throwing an error - <a href="http://www.leftjoin.net/2011/08/throwing-exception-when-type-hinting-failed">throwing an exception</a> when the hinting criteria's not met.
</p>
<blockquote>
One of the most annoying behavior of PHP type hinting feature is triggering error instead of throwing exception when instance type is invalid.
</blockquote>
<p>
By default, a failure generates a "catchable error" that, thanks to the <a href="http://www.php.net/manual/en/function.set-error-handler.php">custom error handling</a> methods PHP includes, can be correctly handled. He includes a snippet of code that defines the errorHandler method that checks the error type for E_RECOVERABLE_ERROR  and throws the exception (an ErrorException) if found.
</p>]]></description>
      <pubDate>Wed, 10 Aug 2011 09:58:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: PHP typehinting gotcha in exceptions/methods]]></title>
      <guid>http://www.phpdeveloper.org/news/16591</guid>
      <link>http://www.phpdeveloper.org/news/16591</link>
      <description><![CDATA[<p>
<i>Jani Hartikainen</i> has a new post with a gotcha he came across when <a href="http://codeutopia.net/blog/2011/07/13/php-typehinting-gotcha-in-exceptionsmethods/">using typehinting in exceptions and methods</a>.
</p>
<blockquote>
A small gotcha I recently ran into: If you use typehinting, PHP never checks that the class your typehint specifies actually exists!
</blockquote>
<p>
He includes simple examples that define the class type hint as some random string and PHP never throws an error for it. He also notes that it's even worse when dealing with namespaces - how it handles exceptions locally unless you specify otherwise. Of course, these "features" can be put to good use in the right situations, but they can be confusing for a developer without a keen eye.
</p>]]></description>
      <pubDate>Thu, 14 Jul 2011 10:41:55 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Mike Willbanks' Blog: PHP Type Hinting]]></title>
      <guid>http://www.phpdeveloper.org/news/12832</guid>
      <link>http://www.phpdeveloper.org/news/12832</link>
      <description><![CDATA[<p>
There's been lots of talk about type hinting lately (both on <a href="http://www.phpdeveloper.org/news/12819">blogs</a> and on mailing lists) so <i>Mike Willbanks</i> has decided to add <a href="http://blog.digitalstruct.com/2009/07/07/php-type-hinting/">some of his own thoughts</a> about why it should be included.
</p>
<blockquote>
You may be wondering why you would want type hinting in a dynamic language. This can come in very handy especially if you are looking to enforce a specific type or need to ensure that you are indeed working with say an integer. Since this is written in C, it will be far faster than actually type casting it yourself or enforcing it yourself. General speed improvements are always nice to have.
</blockquote>
<p>
He includes two code examples of it in use and points to the <a href="http://news.php.net/php.internals">php.internals</a> mailing list for the vote count either way. So far (as of the time of those post) the results seem mixed with some recommending it outright while others suggest waiting until the spec is completely done before integration (PHP6?).
</p>]]></description>
      <pubDate>Wed, 08 Jul 2009 12:57:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ilia Alshanetsky's Blog: Type hinting rehashed (now with type casting support)]]></title>
      <guid>http://www.phpdeveloper.org/news/12819</guid>
      <link>http://www.phpdeveloper.org/news/12819</link>
      <description><![CDATA[<p>
<i>Ilia Alshanetsky</i> <a href="http://ilia.ws/archives/206-Type-hinting-rehashed-now-with-type-casting-support.html">takes a look</a> at type hinting in PHP (he's made some <a href="http://www.phpdeveloper.org/news/12798">previous comments</a> on the matter) and some of the community's comments about its suggested inclusion in the language.
</p>
<blockquote>
There has been a lot of comments both on this blog and the internals list. There seems to be a fairly large group of core developers who like the idea as well as surpassingly large support base on the user level too (wow, didn't think that this many people want type hinting).
</blockquote>
<p>
Despite some of the nay-sayers who don't think it's a good idea, the majority seems to approve and work has already been done on a new patch you can apply to your systems. He includes the Changelog information as well as links to the patch (<a href="http://ilia.ws/patch/type_hint_53_v2.txt">txt</a>) and a test suite (<a href="http://ia.gd/patch/type_hint_tests.tar.bz2">bz2</a>). 
</p>]]></description>
      <pubDate>Tue, 07 Jul 2009 07:52:37 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ilia Alshanetsky's Blog: Type hinting for PHP 5.3]]></title>
      <guid>http://www.phpdeveloper.org/news/12798</guid>
      <link>http://www.phpdeveloper.org/news/12798</link>
      <description><![CDATA[<p>
One of the features included in the PHP 5.x releases is type hinting for validating that you have the right values for your functions and methods coming in. In <a href="http://ilia.ws/archives/205-Type-hinting-for-PHP-5.3.html">this new post</a> to his blog <i>Ilia Alshanetshy</i> takes a look at the the feature and gives a patch to add it .
</p>
<blockquote>
On a general level most people agree it would be a good idea to have, since it is an optional feature and does not introduce any regressions, heck you can even mix type hinted code with the non-type hinted one. The "PROBLEM" has always been combining of PHP's typeless nature with type hinting, which is where the consensus has been difficult (impossible) to reach.
</blockquote>
<p>
He mentions an example of why its such an issue (technically, both 1 and "1" are valid numbers) and includes <a href="http://ia.gd/patch/type_hint_53.txt">a link to a patch</a> that gives a new hint to help with the problem.
</p>]]></description>
      <pubDate>Thu, 02 Jul 2009 09:46:18 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Marco Tabini's Blog: Thoughts for a new year: PHP as the new Java]]></title>
      <guid>http://www.phpdeveloper.org/news/9279</guid>
      <link>http://www.phpdeveloper.org/news/9279</link>
      <description><![CDATA[<p>
<i>Marco Tabini</i> (of <a href="http://www.phparch.com">php|architect</a> magazine) has <a href="http://mtabini.blogspot.com/2007/12/thoughts-for-new-year-php-as-new-java.html">posted some of his thoughts</a> on why PHP just might be the "new Java" in the upcoming year.
</p>
<blockquote>
Historically, PHP has been developed following the scratch-an-itch method [...]. This development process makes for some haphazard functionality, and has, in the past, been the source of many annoyances that need to be handled with extreme care.
</blockquote>
<p>
He does mention some of the good things that have come out of this process like OOP in PHP4, SimpleXML functionality and type hinting but warns that if things swing too much the other way (planning out everything, only adding things by committee) that PHP might swerve towards a dangerous precedent - the Java community's mentality. 
</p>]]></description>
      <pubDate>Wed, 19 Dec 2007 13:47:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: Namespaces (or Yet Another Pointless Opinion Piece)]]></title>
      <guid>http://www.phpdeveloper.org/news/9247</guid>
      <link>http://www.phpdeveloper.org/news/9247</link>
      <description><![CDATA[<p>
Adding even more to the huge namespaces debates going on, <i>Padraic Brady</i> has <a href="http://blog.astrumfutura.com/archives/326-Namespaces-or-Yet-Another-Pointless-Opinion-Piece.html">some of his opinions</a> posted to his blog on the subject.
</p>
<blockquote>
The problem isn't that namespaces are bad, it's that these arcane structures seem to have so little impact on development in PHP today for many many people. Does that mean it's unimportant?
</blockquote>
<p>
He <a href="http://blog.astrumfutura.com/archives/326-Namespaces-or-Yet-Another-Pointless-Opinion-Piece.html">talks about</a> the real value of namespaces, a comparison to type hinting's inclusion, the current amount of (needless?) traffic on the php.internals list and his opinions on why namespaces are valid.
</p>]]></description>
      <pubDate>Fri, 14 Dec 2007 12:01:00 -0600</pubDate>
    </item>
  </channel>
</rss>

