clemens-tolboom / uml-generator-php

http://clemens-tolboom.github.io/uml-generator-php/
MIT License
44 stars 5 forks source link

Visibility bit not set on static functions #4

Open MartijnBraam opened 10 years ago

MartijnBraam commented 10 years ago

If the input file contains static function() phpparser doesn't assume the visibility is public, only the MODIFIER_STATIC bit is set.

Example:

static function staticFunction(){}
public static function publicStaticFunction(){}

This only happens on static functions without the explicit public modifier

if($statement->type & Stmt\Class_::MODIFIER_PUBLIC){
    $node['visibility'] = 'public';
}elseif($statement->type & Stmt\Class_::MODIFIER_PROTECTED){
    $node['visibility'] = 'protected';
}elseif($statement->type & Stmt\Class_::MODIFIER_PRIVATE){
    $node['visibility'] = 'private';
}
if($statement->type & Stmt\Class_::MODIFIER_STATIC){
    $node['scope'] = 'classifier';
}else{
    $node['scope'] = 'instance';
}