#104: Add isStatic() method on ASTMemberPrimaryPrefix node
Issue revisions
- new by Manuel Pichler at 2009-D-23 13:04
- assigned by Manuel Pichler at 2009-D-23 13:08
- assigned by Manuel Pichler at 2009-D-23 13:08
- closed by Manuel Pichler at 2009-D-26 9:44
| Type | |
|---|---|
| State | |
| Priority | |
| Resolution | |
| Assigned to | Manuel Pichler |
| Scheduled for | 0.9.9 |
| Affected versions | 0.9.8, 0.9.x-svn |
| Affected components | Code |
| Last change | Saturday 26 December 2009 09:44:32 UTC by Manuel Pichler |
Short description
The PHP_Depend_Code_ASTMemberPrimaryPrefix class should provide an isStatic() method to determine which invocation type is used. This feature would make post processing easier.
At the moment you must do something like:
$postfix = $node->getFirstChildOfType(PHP_Depend_Code_ASTPropertyPostfix::CLAZZ);
$prefix = $postfix->getParent();
if ($prefix->getImage() === '::') {
echo 'Static', PHP_EOL;
} else {
echo 'Object', PHP_EOL;
}
A simple method that checks this condition would make the code easier to read and failsave.
$postfix = $node->getFirstChildOfType(PHP_Depend_Code_ASTPropertyPostfix::CLAZZ);
$prefix = $postfix->getParent();
if ($prefix->isStatic()) {
echo 'Static', PHP_EOL;
} else {
echo 'Object', PHP_EOL;
}
Manuel Pichler at Wednesday 23 December 2009 13:08:50 UTC
Scheduled for PHP_Depend 0.9.9
Manuel Pichler at Saturday 26 December 2009 09:44:32 UTC
Implemented in svn revision #103.