PHP type hinting; namespace aliasing
Tatsh
ddrtist at gmail.com
Mon Aug 20 10:30:38 UTC 2012
Some IDEs have a notation like such for dynamic constructs such as
functions that return different types, iteration such as with foreach, etc.
It looks like a normal @var PHPdoc but can be multiple lines or 1 line.
/**
* Assume the assigned variable gets this type.
* Note an alias never works this way. Only the full class name works even
if there is a use statement (which is unlike PHPDoc 2)
* @var SomeClass
*/
$a = $this->get('something'); // Dependency injection in Symfony 2
/**
* If an argument is specified after the type, that is the variable affected
* @var TypeInTheArray $b
*/
foreach ($a as $b) {}
// @var TypeInTheArray $b
foreach ($a as $b) {}
Another big one:
<?php
// Alias
use A\B\C as SomeClass;
$a = new SomeClass();
$a-> ctrl+space here gives only Kate's autocomplete, so it seems while here
is support for writing 'new A\B\C' and getting the correct type, aliases
are totally not supported (even without the 'as' clause).
Do we have anything similar or thoughts on how to handle these situations?
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120820/29667520/attachment.html>
More information about the KDevelop-devel
mailing list