phptools-docs
phptools-docs copied to clipboard
PHP6609 error
There is an error that occurs in the extension where it reports that the class name should be lowercase, or the filename should be the same as the class. Using PHP 8.3
However, it still throws this error in the vscode IDE.
Autoload is defined in index.php
This is the composer.json file which autoloads all classes in the Src folder
Running index.php doesn't print any errors or exception in the browser or console. This exception seems to only appear in vscode, but only if the PHP extension is enabled.
Thank you for reporting that!
It seems we got the letter casing wrong, and hence we misreport the problem.
Wll be fixed!
Are you on windows/linux or mac?
Are you on windows/linux or mac?
I am on Windows, I can list my PC Specs but I am not sure if it's relevant.
For me: there are a few related issues with VSCode and LSP implementation:
https://github.com/microsoft/language-server-protocol/issues/1263 https://github.com/microsoft/vscode/issues/137256
so far of what we've tested, the issue should be fixed in the upcoming update.
so far of what we've tested, the issue should be fixed in the upcoming update.
Great! I will let you know if the issue is resolved in the next update
From what I could see the last update was 3 days ago, but I'm still having this problem where the filename is the exact same as the class name and if I copy the file over to another folder (from /libraries to /models for example) then there are no problems, is this a caching issue where it remembers an old version or something with the lowercase filename?
P.S. personally, I am using VSCode on MacOs, and i have verified that both the terminal and the MacOs file system also see the filename with the uppercase as it should be.
these 2 files are an exact copy of one another, but only one gives me the error: Class name Optimizer does not match PSR autoload pattern. It is expected to be optimizer, or the file name should be Optimizer.php. PHP(PHP6609)
Thank you for the update; we couldn't repro the issue after the update, yet. Are there any particular steps to reproduce the issue?
What I did was, I copied the file from one project to another, after which I changed the filename to match the capitalisation but it would not stop giving me this error as if its looking at the original filename when it was copied over instead of the current renamed filename.
Even if its committed and everything it still remembers to give the error that i cannot get rid of without completely changing the filename which i don't understand, and as i pointed out earlier if I copy the file with the new filename to another folder then there are no issues.
Also if I delete the file and create it again in the same folder with the same name but with an empty class then it will also give me the error, that is why i was wondering if its a cache thing that is stored in git or something for that folder
@Jack-Mutsers have you renamed it using VSCode Explorer or using the MacOs Finder?
VS studio, but it was changed on mac os and terminal as well when i went to check
Right, it just seems that our extension does not get the event about the change. We'll try that on MacOs
After digging through the issue, we found several related problems in VSCode itself — it simply does not respect the letter casing after the rename. Therefore the extension (our extension) is not getting the correct information. It also uses incorrect letter casing right after opening the workspace.
I'm trying to work around it ... Meanwhile, I'll report the other issues to MS.
Related issue: https://github.com/microsoft/vscode-languageserver-node/issues/1186
Is there a way to reset this or some cache I can clear? I tried renaming the file in the finder on MacOS, renaming it in VSCode, quiting VSCode, disabling the extention, then reenabling it, uninstalled/reinstalled, and this syntax highlighting persists through all of this.
--edit-- NVM. I deleted the file, restarted VSCode, added the file, and we are set!!
@alex-elivate thank you for pointing this out!
I'm aware this is still an issue in some cases; VSCode does not respect the letter casing and we falsely report an error ...
We're working on a fix.
Hi, I have the same problem as well. However, mine only occurs when I start with a lowercase file name, delete the file, and then recreate it with an uppercase file name.
env: windows 10
@rolland97 I have the exact same problem right now, did you find a fix for this or a workaround?
Thank you for the steps and for reporting the issue; still working on it. I appreciate any information.
@jakubmisek I have the problem on MacOs, I created a controller in Laravel with php artisan make:controller and I accidentally gave it the name Authcontroller instead of AuthController and now I get errors even tho I adjusted it everywhere, deleted the file remade it, renamed it in finders and renamed it in vscode aswell.
It is caused by (the misbehavior) of the VSCode API
- https://github.com/microsoft/vscode/issues/121106
- https://github.com/microsoft/language-server-protocol/issues/1263
We'll need to do some additional workarounds to fix that.
We'll (temporarily) disable the case-sensitive check since there are multiple issues with letter casing in file names. Possible workaround would be noticeably inefficient.
This change will be included in the very next update.