int
parameter.
If any other type is passed, fatal error will be generatedclass Book {
public $price;
public function price(int $price) {
$this->price = $price;
}
}
$book = new Book;
$book->price('k34');
echo $book->price;
Fatal error: Uncaught TypeError: Argument 1 passed to Book::price() must be of the type int, string given