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.

Class constants as arguments are not recognised as valid imports

See original GitHub issue

See below. Happy to expand on this if it’s not clear.

<?php

namespace Com\SomeBundle\Observer;

use Com\SomeBundle\Events\SomethingEvents; // this use statement is unrecognised, and e.g. when optimizing imports, this gets removed
use Com\SomeBundle\Event\MySomethingEvent;
use JMS\DiExtraBundle\Annotation as DI;

/**
 * @DI\Service
 */
class SomeEventObserver
{
    /**
     * @DI\Observe(SomethingEvents::PRE_UPDATE)
     */
    public function doSomething(MySomethingEvent $event)
    {
        // whatever
    }
}
<?php

namespace Com\SomeBundle\Events;

class SomethingEvents
{
    const PRE_UPDATE = 'something.pre_update';
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
hoshsadiqcommented, May 27, 2015

yeah, @Haehnchen any update on this?

0reactions
Haehnchencommented, Aug 6, 2016

done

Read more comments on GitHub >

github_iconTop Results From Across the Web

Class is not defined despite being imported - python
py file containing my class, Python is insistent that the class doesn't actually exist. I have a theory that the import is not...
Read more >
Python Constants: Improve Your Code's Maintainability
Using named constants to provide default argument values to functions, methods, and classes is another common practice in Python.
Read more >
os — Miscellaneous operating system interfaces — Python ...
In Python, file names, command line arguments, and environment variables are represented using the string type. On some systems, decoding these strings to ......
Read more >
Export and Import - The Modern JavaScript Tutorial
We can label any declaration as exported by placing export before it, be it a variable, function or a class. For instance, here...
Read more >
export - JavaScript - MDN Web Docs
The value of an imported binding is subject to change in the module that exports ... let, // const, function, class) export let...
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