Reputation: 19569
If I can explicitly declare the type of a member var (esp. other class as a member), them my IDE( such as Dreamweaver) can know the member's member.
class PHPClass(){
OtherClass $member_var;
}
Upvotes: 10
Views: 5023
Reputation: 81
In PHP 7.4, property definitions can have type declarations.
https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.typed-properties
Upvotes: 1
Reputation: 46050
The only way is to use documentation like so:
class MyClass {
/**
* @var OtherClass This is my other class
*/
private $other;
}
Upvotes: 17
Reputation: 219804
You can't do that in PHP but you can come close by using type hinting:
class PHPClass
{
protected $member_var;
public function __construct(OtherClass $member)
{
$this->member_var = $member;
}
}
I don't know if that will help you in Dreamweaver, though.
Upvotes: 6