Ilmari Karonen wrote:
> Tim Starling wrote:
>> Html::img( array( 'src' => $src, 'alt' => $alt ) );
> 
> ...although at that point you might almost as well just go the extra 
> step and make it:
> 
> Html::element( 'img', array( 'src' => $src, 'alt' => $alt ) );

Why not go full way:

Html::doStuff( array( 'what' => 'element', 'element' => 'img', 'src' => 
$src, 'alt' => $alt ) );

Seriously, I see a logical distinction between obligatory (every image 
must have a src) and non-obligatory parameters, so perhaps this would be 
the best:

Html::img( $src, array( 'alt' => $alt ) );

It should not be a problem to remember parameter order when there is 
only one parameter.

Yet another possibility is to patch PHP so that it allows named 
parameters :]

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to