Sublime Forum

PHP warnings when I'm good and the warning is not

#1

Capture1

No errors in that code, tbmk, and yet… I’m getting warned. Both red arrows point to the php that triggers the warning. I don’t want to turn it off… just want to be warned when there’s really a problem.

Suggestions? Feedback?

0 Likes

#2

After looking up bracket pairing rules in BracketHighlighter (BH), I believe this is a coding-style problem.

        // PHP conditional keywords
        // !!! May conflict with `ruby_embedded_html` if enabled in same file !!!
        {
            "name": "php_keywords",
            "open": "(?:(?<=^)|(?<=<\\?php)|(?<=<\\?))\\s*(if|foreach|for|while|switch)\\b(?=.*?\\)\\s*:\\s*(?://.*?|/\\*.*?\\*/\\s*?)?(?:\\?>|$))",
            "close": "(?:(?<=^)|(?<=<\\?php)|(?<=<\\?))\\s*(endif|endfor|endforeach|endwhile|endswitch)\\b(?=\\s*(?:;|;?\\?>))",
            "style": "default",
            "language_filter": "whitelist",
            "scope_exclude": ["string", "comment", "text.html"],
            "scope_exclude_exceptions": [
                "source.php -comment -string"
            ],
            "plugin_library": "bh_modules.phpkeywords",
            "language_list": [
                "HTML",
                "HTML 5",
                "PHP",
                "HTML+CFML",
                "ColdFusion",
                "ColdFusionCFC"
            ],
            "enabled": true
        },

BH doesn’t think there is a while but it sees a endwhile, hence the red rectangle. I guess this may be “fixed” by writing the while into another <?php while....

0 Likes