namespace capitalisation
Hi, I've just moved to codeigniter 4 which uses namespaces and am trying to set it up correctly in phpstorm.
The project structure is shown below. In the Messages.php file, first line is "namespace App\Controllers\Options;". The site works fine but phpstorm flags the namespace line as an error and says "namespace doesnt match the psr0/psr4 structure". If i rename the "app" folder to "App" phpstorm is happy but the site doesn't work. I have project/settings/sources as /home/develop/cig4/mysite. What is the correct way set up the project? Many thanks, Bill
/home/develop/cig4/mysite
app
Controllers (folder)
Messages.php (this is a controller)
other folders eg Config, Database etc
public
请先登录再写评论。
Hi there,
I see some contradictions here.
On one hand you have
but the folder structure tells that the file path is
I do not see "Options" bit there at all...
1) The correct spelling is PhpStorm.
2) Go to "Settings/Preferences | Directories" and mark your "app" folder as Source Root -- use "App\" as a package prefix there, so at the end it will look like this:
This will tell to the IDE that your app folder is mapped to App\ namespace bit.
thanks a million, that solved it, now i can work in peace
Bill