Reputation: 65
Getting unexpected error (Expected 1 arguments. Found 0) in vscode while using intelephense extension. When I uninstall the intelephense extesion from vscode at that time this error not showing but i dont want to uninstall the extension. how can i solve this issue??
Error starts showing when i write __construct method in (2.php) file.
Error:
Upvotes: 0
Views: 950
Reputation: 724
Use namespaces as Brombeer suggests in the comment he made to your question, he deserves credit for this.
I define it based off of the class that the file contains, so I have a class named Animal, and keep the namespace within the Animal class:
<?php
namespace Animal;
class Animal ...
The error exists because the IDE thinks the class you're extending exists as it's using the global namespace
why it's in the global namespace: https://www.php.net/manual/en/language.namespaces.global.php
namespaces: https://www.php.net/manual/en/language.namespaces.definition.php
edit: forgetting to add code blocks to comment...
Upvotes: 0