Type Declarations in OOP
Type declarations ensure variables match expected types.
Example
Section titled “Example”class Calculator {
public function add(int $a, int $b): int { return $a + $b; }
}
$calc = new Calculator();echo $calc->add(2,3);