Treat global constant declared using const keyword as global and not class constant #57

Merged
merged 1 commit into from Nov 22, 2011

Projects

None yet

4 participants

Contributor

Distinguish between const keyword used inside class definition and not (#50)

PHP 5.3.0 introduced behavior of using const keyword in place of define() for global constants. token_get_all() still treats it as a class constant however.

@tetsuo13 tetsuo13 Distinguish between const keyword used inside class definition and not (
#50)

PHP 5.3.0 introduced behavior of using const keyword in place of define() for
global constants. token_get_all() still treats it as a class constant however.
331e331
@peej peej merged commit 0e2a51e into peej:master Nov 22, 2011
avit commented Dec 16, 2011

I think this introduced a regression: const defined in a class now shows up as a global.

Contributor

I've duplicated this behavior. Trouble lies with the inherit limitations in using token_get_all(): it correctly identifies tokens but doesn't understand their parent/child relationships with other objects. For example, a class constant is identical to a global constant.

I'll try to either amend my previous commit or attempt at modifying PHPDoctor's parsing engine to add relationships -- the latter of which is probably needed in order to implement some of the other features requested in tickets.

This commit breaks parsing for class constants and does not properly parse the value for global constants declared using CONST. For a fix view pgraham/phpdoctor@1e22bb9

I would submit a pull request but this fix is on a branch that requires php5.3 and has diverged considerably from master.

Contributor

Absolutely this commit should be fixed, either by merging the previous revision or continuing on with 1e22bb9 as you suggest. It seems that this project is suffering from a bit of neglect as of recently; there are a few forks that are way ahead.

Owner
peej replied Jul 18, 2012

Sorry for the lack of progress on this project, I have new dad syndrome and my coding has taken a backseat. It may be better for @pgraham's branch to be used for now, it's probably worth migrating to 5.3 anyway.

Hey Congrats, I will likely be in the same boat in about a month or so :)

It shouldn't be too hard to move my fix to the master branch in order to open a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment