Closed lexman1958 closed 1 year ago
This is an interesting issue;
We don't report it on purpose because it is not an error nor a warning in PHP. But I'm open to changing it.
@jakubmisek , the odd part is that it is no longer auto importing the class either when i enter class. Previously i thought it used to do both. Instead is autocomplete suggestion of full class name with namespace appears.
We think it should do these otherwise we will only know the error at runtime.
I get this reported if i use PHP Intelliphense extension;
Is the auto-import enabled using the setting "php.completion.autoimport"
?
Having 3 more extensions doing the same thing may slow down the VSCode, so there might be a delay when showing errors.
$this
if the base class is undefined.Thank you
@jakubmisek
(1) As you posted earlier "We don't report it on purpose because it is not an error nor a warning in PHP", i had to reinstall the PHP Intelliphense because with this error not being highlighted can cause a lot of runtime errors in my app.
(2) The "$this" is not the problem. The "request" class in "$this->request".
(3) Odd, the PHP.Completion: Autoimport setting is set to "auto-import" but the Settings.json file does not contain "php.completion.autoimport". I tried disabling and enabling and yet the setting in the json file is still missing. Screencap details below. After inserting the setting into the json file, it works fine.
Setting.json file details:
{
"editor.wordWrap": "on",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.colorDecorators": true,
"editor.colorDecoratorsActivatedOn": "hover",
"workbench.iconTheme": "vscode-great-icons",
"workbench.colorTheme": "Monokai Dark Soda",
"html-css-class-completion.CSSLanguages": [
"php",
"css",
"sass",
"scss",
"vue"
],
"html-css-class-completion.enableEmmetSupport": true,
"html-css-class-completion.HTMLLanguages": [
"php",
"html",
"vue",
"razor",
"handlebars",
"twig",
"django-html",
"php",
"markdown",
"erb",
"ejs",
"svelte"
],
"html-css-class-completion.JavaScriptLanguages": [
"php",
"javascript",
"javascriptreact",
"typescriptreact"
],
"editor.minimap.enabled": false,
"auto-close-tag.activationOnLanguage": [
"twig",
"xml",
"php",
"ejs",
"jinja",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"plaintext",
"markdown",
"vue",
"liquid",
"erb",
"lang-cfml",
"cfml",
"HTML (EEx)",
"HTML (Eex)",
"plist"
],
"auto-close-tag.insertSpaceBeforeSelfClosingTag": true,
"emmet.showSuggestionsAsSnippets": true,
"emmet.useInlineCompletions": true,
"emmet.triggerExpansionOnTab": true,
"editor.formatOnSave": true,
"auto-rename-tag.activationOnLanguage": ["*"],
"open-in-browser.default": "chrome",
"highlight-matching-tag.highlightFromContent": true,
"highlight-matching-tag.highlightSelfClosing": true,
"html.format.wrapLineLength": 120,
"prettier.bracketSameLine": true,
"prettier.printWidth": 80,
"prettier.bracketSpacing": false,
"prettier.vueIndentScriptAndStyle": true,
"css.enabledLanguages": ["php", "twig", "astro", "html"],
"liveSassCompile.settings.useNewCompiler": true,
"path-intellisense.extensionOnImport": true,
"path-intellisense.autoTriggerNextSuggestion": true,
"path-autocomplete.extensionOnImport": true,
"bookmarks.label.suggestion": "suggestWhenSelected",
"bookmarks.navigateThroughAllFiles": false,
"bookmarks.useWorkaroundForFormatters": true,
"workbench.startupEditor": "none",
"php.executables": {
"v8.1.17": "c:/xampp/php"
},
"php.completion.autoimport-docblock": "auto-import",
"php.completion.parameters": "parameters",
"php.executablePath": "c:/xampp/php",
"php.problems.scope": "all",
"php.problems.exclude": {
"/": [406, 437, 6406, 6602],
// "/": [406, 6406],
"vendor/": true
},
"php.problems.excludeGitIgnore": true,
"php.version": "8.1.22",
"php.format.rules.alignConsecutiveAssignments": true,
"php.format.rules.arrayInitializersAlignKeyValuePairs": true,
"php.format.rules.arrayInitializersNewLineAfterLastElement": true,
"php.format.rules.arrayInitializersNewLineBeforeFirstElement": true,
"php.format.rules.callParametersNewLineAfterLeftParen": true,
"php.format.rules.declParametersNewLineAfterLeftParen": true,
"php.format.rules.openBraceOnNewLineForFunctions": true,
"php.format.rules.openBraceOnNewLineForLambdas": true,
"php.format.rules.spaceAroundConcatenation": true,
"php.format.rules.spaceBeforeColonInControlStatements": true,
"php-docblocker.alignParams": true,
"php-docblocker.alignReturn": true,
"php-docblocker.useShortNames": true,
"files.associations": {
"*.embeddedhtml": "html",
".env*": "dotenv"
},
"editor.tokenColorCustomizations": {
"[*Light*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#000"
}
}
]
},
"[*Dark*]": {
"textMateRules": [
{
"scope": "ref.matchtext",
"settings": {
"foreground": "#fff"
}
}
]
},
"textMateRules": []
},
"phpserver.browser": "google-chrome",
"template-string-converter.autoRemoveTemplateString": true,
"tailwindCSS.emmetCompletions": true,
"[php]": {
"editor.defaultFormatter": "DEVSENSE.phptools-vscode"
},
"emmet.excludeLanguages": ["markdown"],
"emmet.includeLanguages": {
"php": "html",
"vue": "html",
"javascript": "javascriptreact",
"blade": "html",
"blade.php": "html"
},
"php-cs-fixer.autoFixBySemicolon": true,
"php-cs-fixer.formatHtml": true,
"php.validate.enable": true,
"php.debug.executablePath": "",
"rapidapi.terminalLink.enabled": false,
"liveServer.settings.donotShowInfoMsg": true,
"colorize.include": [
"**/*.php",
"**/*.css",
"**/*.scss",
"**/*.sass",
"**/*.less",
"**/*.styl",
"**/*.html"
],
"colorize.languages": [
"vue",
"astro",
"php",
"blade",
"css",
"sass",
"scss",
"less",
"postcss",
"sss",
"stylus",
"xml",
"svg",
"html"
],
"phpGettersSetters.generatePHPDoc": false,
"editor.inlineSuggest.enabled": true,
"[twig]": {
"editor.defaultFormatter": "junstyle.twig-language"
},
"github.copilot.enable": {
"*": true,
"plaintext": true,
"markdown": false,
"scminput": false,
"php": true
},
"terminal.integrated.sendKeybindingsToShell": true,
"dotenv.enableAutocloaking": false,
"php.format.rules.ifStatementNewLineAfterLeftParen": true,
"php.format.rules.openBraceOnNewLineForBlocks": false,
"window.commandCenter": false,
"inline-css-color.enablePhpStyle": true,
"inline-css-color.enableHtmlCommentStyle": true,
"[blade]": {
"editor.autoClosingBrackets": "always"
},
"laravel_goto_view.extensions": [".blade.php", ".vue", "blade.view"],
"bladeFormatter.format.noMultipleEmptyLines": true,
"colorize.colorized_colors": ["BROWSERS_COLORS", "HEXA", "RGB", "HSL"],
"colorize.exclude": [
"**/.git",
"**/.svn",
"**/.hg",
"**/CVS",
"**/.DS_Store",
"**/.git",
"**/node_modules",
"**/bower_components",
"**/tmp",
"**/dist",
"**/tests"
],
"colorize.colorized_variables": ["CSS"],
"blade.format.enable": true,
"css.validate": false,
"prettier.tabWidth": 4,
"html.format.indentInnerHtml": true,
"html.format.templating": true,
"sqltools.useNodeRuntime": true,
"security.workspace.trust.untrustedFiles": "open",
"php.format.rules.addCommaAfterLastArrayElement": true,
"php.format.rules.alignConstants": true,
"php.format.rules.alignEnumCases": true,
"php.format.rules.booleanConstantCasing": "lowercase",
"php.format.rules.nullConstantCasing": "uppercase",
"phpRefactor.showReadonly": true,
"intelephense.environment.phpVersion": "8.1.22",
"php.inlayHints.types.suppressVariableFromLiteral": false,
"intelephense.format.enable": false,
"php-allfactor.case.defaultClass": "camelCase",
"php-allfactor.case.defaultConstants": "camelCase",
"php-allfactor.case.defaultFunction": "camelCase",
"php-allfactor.files.exclude": [
"**/.git/**",
"**/.svn/**",
"**/CVS/**",
"**/.DS_Store/**",
"**/vendor/**"
],
"php.inlayHints.types.return": true
}
Screencap of Setting for the extension:
fixed in the pre-release v1.40.14087
thank you!
This is an interesting issue;
We don't report it on purpose because it is not an error nor a warning in PHP. But I'm open to changing it.
As the extension does highlight the errors if class is not imported, we have to use Intelliphense to compensate for the weaknesses. I hope you understand and would be good if the weakness is fixed. As solution developers this is a serious problem that we need to address at code time and not runtime.
As the extension does highlight the errors if class is not imported, ...
I agree
fixed in the pre-release v1.40.14087
@jakubmisek , the pre-release works wonderfully. I just disabled the Intelliphense extension. Let me monitor this and feed back. Thank you.
@jakubmisek , the pre-release works wonderfully. I just disabled the Intelliphense extension. Let me monitor this and feed back. Thank you.
Thank you for the update! I'm glad it works for you. Sure please let me know anything unexpected, or anything you'd like to improve.
When i define a class in the main code which has not been imported under the use close there is no error highlighted. See Screencap below. I am encountering this problem is when I was developing a CI4 app.