Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False alarm undefinedConstant Class constant ::XX does not exist #1171

Open
EdmondDantes opened this issue Feb 19, 2022 · 0 comments
Open

False alarm undefinedConstant Class constant ::XX does not exist #1171

EdmondDantes opened this issue Feb 19, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@EdmondDantes
Copy link

EdmondDantes commented Feb 19, 2022

PHP Version: 8.1

OS: Windows 11

Run command:

noverify.exe check --ignore-vendor --allow-disable="./*" --exclude-checks="discardExpr" --index-only-files="./tests/KC,./vendor,./api3.php" --output="reports.txt" ./KC

The minimal code in which the bug appears:

class Students                      extends LMSEntityAbstract
{
    
    const TIME_ZONE                 = 'time_zone';

    protected function _propertyTimeZone(): VirtualProperty
    {
        // @todo propertyTimeZone
        return new VirtualProperty(static::TIME_ZONE);
    }
    
    
    protected function propertyFullName(): VirtualProperty
    {
        // CONCAT_WS(' ', first_name, last_name)
        return new VirtualPropertyAsExpression(self::FULL_NAME, new ConcatenateWithSeparator(
            ' ',
            new FieldRef(self::FIRST_NAME),
            new FieldRef(self::LAST_NAME)
        ));
    }

Actual Behavior:

ERROR undefinedConstant: Class constant ::TIME_ZONE does not exist at Entities/Students.php:180
return new VirtualProperty(static::TIME_ZONE);
^^^^^^^^^
ERROR undefinedConstant: Class constant ::FULL_NAME does not exist at Entities/Students.php:187
return new VirtualPropertyAsExpression(self::FULL_NAME, new ConcatenateWithSeparator(
^^^^^^^^^
ERROR undefinedConstant: Class constant ::FIRST_NAME does not exist at Entities/Students.php:189
new FieldRef(self::FIRST_NAME),
^^^^^^^^^^
ERROR undefinedConstant: Class constant ::LAST_NAME does not exist at Entities/Students.php:190
new FieldRef(self::LAST_NAME)
^^^^^^^^^

Expected Behavior:

No alert
Students.zip
s

@EdmondDantes EdmondDantes added the bug Something isn't working label Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant