<?php namespace Demo; class User { protected $id; public function __construct($id) { $this->id = (int) $id; } /** * @return int */ public function getId(): int { return $this->id; } }