Datatype in function parameters?
Posted: Mon Apr 30, 2007 7:52 am
PHP is a typeless language. However, in Zend Studio, if you write a function, for example...
...and then try and add a PHPDoc block to it, it comes up with...
It is the 'unknown_type' which I am wondering about. Give the function parameters a type and you will get this:
Which has got me wondering. Is Zend trying to slowly convince us to define the datatype we are passing around? We add the datatype if it is a Class object, so why not a "normal" variable?
I don't think I have ever seen a piece of PHP code that defines the data types; why is this?
Code: Select all
public function setRequired($field)
{
$this -> _required[] = $field;
}Code: Select all
/**
* Enter description here...
*
* @param unknown_type $something
*/Code: Select all
/**
* Enter description here...
*
* @param string $something
*/
private function setSomething(string $something)
{
$this -> _something = $something;
}I don't think I have ever seen a piece of PHP code that defines the data types; why is this?