question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid start location for class constants / properties

See original GitHub issue

Input:

<?php
class A
{
    const test = 1;
}

AST (excerpt):

"kind": "classconstant",
          "loc": {
            "source": "test = 1",
            "start": {
              "line": 4,
              "column": 10,
              "offset": 26
            },
            "end": {
              "line": 4,
              "column": 18,
              "offset": 34
            }
          },

I think the start column of the class constant is off, it should be around 4 instead of 10 in the example.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
czoselcommented, Mar 23, 2020

Doesn’t matter as long as we get it fixed 😉

0reactions
ichiriaccommented, Mar 26, 2020

Hi @evilebottnawi, it would be great if you have some time that you keep working on branch #fix-issue-511 as the fix is not fully implemented.

Remains to check interfaces, traits, use alias on traits, but the principle remains the same as in the last commit

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using class constants for [Range] attribute - Stack Overflow
The following example demonstrates how one can use (constant)properties from a class as values used with the Range attribute from NUnit.
Read more >
Class Constants - Manual - PHP
As of PHP 8.1.0, class constants cannot be redefined by a child class if ... Same constant name can be used as a...
Read more >
Use of Persistent Variables in Class Methods Producing ...
I am attempting to make use of a persistent variable within a class method. However, invoking the method from different instances is producing...
Read more >
Understanding Class Members (The Java™ Tutorials ...
Every instance of the class shares a class variable, which is in one fixed location in memory. Any object can change the value...
Read more >
Python Constants: Improve Your Code's Maintainability
__slots__ Attribute; The @property Decorator; The namedtuple() Factory ... You just have to change the value in a single place: the constant ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found