-
-
Save philsturgeon/de8aaaa3e65b84d63486 to your computer and use it in GitHub Desktop.
Instance variable type checking needed?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Example | |
{ | |
public $number; | |
public $text; | |
public function __construct(int $number, string $text) | |
{ | |
$this->number = $number; | |
$this->text = $text; | |
} | |
public function text(): string | |
{ | |
return $this->text; | |
} | |
public function number(): int | |
{ | |
return $this->number; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment