User "Tim Starling" posted a comment on MediaWiki.r103893.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/103893#c26663
Commit summary:

Implement a number of namespace related equals functions:
* MWNamespace::equals to test equivalence of two namespaces (forward compatible 
with any changes we may make like introducing namespace keys like 'USER')
* MWNamespace::subjectEquals to test equivalence of the subject of two 
namespaces e.g.: MWNamespace::subjectEquals( NS_USER, $ns ); instead of testing 
for equivalence to both NS_USER and NS_USER_TALK
* Title::inNamespace to use instead of $title->getNamespace() == NS_???
* Title::inNamespaces for use like $title->inNamespaces( NS_USER, NS_PROJECT ) 
when you only care if it's in one of a number of namespaces (also accepts an 
array)
* Title::hasSubjectNamespace for use instead of testing for equivalence to both 
the subject and talk such as NS_USER and NS_USER_TALK.

Include phpunit tests for all this new code, and also add some tests for some 
existing code.

Comment:

In the "$f == 1" case the notice is masking what an epic failure it is. So 
maybe this is a better example:

<pre>
> class Foo { function __toString() { return '2'; } }

> $f = new Foo;

> var_dump($f == 2)
PHP Notice:  Object of class Foo could not be converted to int in ... eval()'d 
code on line 1
bool(false)

> print intval($f)
PHP Notice:  Object of class Foo could not be converted to int in ... eval()'d 
code on line 1
1


_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to