Answer the question
In order to leave comments, you need to log in
PHPStorm highlight error?
Guys, sorry for the noob question, I'm just studying php, tell me what the error is, phpStorm underlines the error
Maybe I have the wrong path
When you hover over the mouse, the editor shows that the object was not found, include the expression is not allowed
code from all
User.php files
<?php
namespace Models\Users;
class User {
private $name;
public function __construct($name)
{
$this->name = $name;
}
public function getName():string
{
return $this->name;
}
}
<?php
namespace Models\Articles;
use Models\Users\User;
class Article {
private $title;
private $text;
private $author;
public function __construct(string $text, string $title, User $author)
{
$this->title = $title;
$this->text = $text;
$this->author = $author;
}
public function getTitle(): string
{
return $this->title;
}
public function getText(): string
{
return $this->text;
}
public function getAuthor(): User
{
return $this->author;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question