PHP is a weak type, which is characterized by the need not to specify a type for the variable, but also to store any type thereafter, but in PHP's new syntax, in some specific cases, for certain types, syntax constraints are also available.
Specific occasions: form parametric of functions (methods)
Specific types: Object types (class names), interface types (interface names), array types (arrays), function types (callable)
function f (class name $p) {}//requires that the argument can only use Object function f (interface name $p) of the class {}//requires that the parameter can only use the object that implements the interface function f (arrary $p) {}// This parameter is required to use only the array function f (callable $p)//requires that the parameter is only a function (method), which is called a callback function (method)
<?phpclass a{}function F (A $p) {} $obj = new A (); F ($obj);