Type Hint private variables
Using PHPStorm 9.0.1.
I'm having an issue which works but I get a warning messasge. Here is an example class that give the warning:
<?php
include_once "rw.fielddefs.class.php";
class TTest {
private $FieldDefs;
public function __construct()
{
$this->FieldDefs = new TFieldDefs();
// load some info into FieldDefs.
}
public function GetFieldValue($aColumnName)
{
return $this->FieldDefs->Value($aColumnName); // I am getting a warning: Method 'Value' not found in class, however this does work.
}
}
However, if I do the funciton this way I get not error:
public function GetFieldValuie(TFieldDefs $aFieldDefs, $aColumnName)
{
return $aFieldDefs->Value($aColumnName); // No warning message but I have to pass the class as a parameter.
}
Is there a way to Type Hint a variable, for example:
private TFieldDefs $FieldDefs;
Using this method gives me an error, but this is an example only.
Regards,
Rich
Please sign in to leave a comment.
Hi there,
Use standard PHPDoc comment:
Andriy
That works perfect, thank you .. Rich