diff --git a/lib/GPH.pm b/lib/GPH.pm index d6c7f1a..593869d 100644 --- a/lib/GPH.pm +++ b/lib/GPH.pm @@ -3,7 +3,7 @@ package GPH; use strict; use warnings FATAL => 'all'; -our $VERSION = '1.2.0'; +our $VERSION = '1.2.1'; 1; diff --git a/lib/GPH/Util/Php.pm b/lib/GPH/Util/Php.pm index 9f109e9..80879c8 100644 --- a/lib/GPH/Util/Php.pm +++ b/lib/GPH/Util/Php.pm @@ -16,7 +16,7 @@ sub new { sub types { my ($self, @files) = @_; - my ($fh, $pattern); + my ($fh, $pattern, $constant); foreach my $file (@files) { chomp $file; @@ -24,9 +24,12 @@ sub types { open($fh, '<', getcwd() . '/' . $file) or die "unable to open file $file : $!"; $pattern = "[ ]{0,}([^ ]+) " . $1 . "(?:[ :]|\$){1,}"; + $constant = $1 . "::class"; while(<$fh>) { chomp $_; + next if $_ =~ /^[\* ]\*/; #ignore comments + next if $_ =~ $constant; next unless $_ =~ $pattern; my $type = ($1 ne 'enum') ? $1 : $self->resolveEnum(<$fh>); diff --git a/t/share/Php/Bar.php b/t/share/Php/Bar.php index 28c9fc7..3461c31 100644 --- a/t/share/Php/Bar.php +++ b/t/share/Php/Bar.php @@ -2,6 +2,9 @@ namespace share\Php; +/** + * this comment about Bar should be ignored + */ abstract class Bar { diff --git a/t/share/Php/Foo.php b/t/share/Php/Foo.php index 823ae16..d2bdf52 100644 --- a/t/share/Php/Foo.php +++ b/t/share/Php/Foo.php @@ -1,5 +1,7 @@