Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Forked from anonymous/example.php
Created March 16, 2016 18:27
Show Gist options
  • Save philsturgeon/de8aaaa3e65b84d63486 to your computer and use it in GitHub Desktop.
Save philsturgeon/de8aaaa3e65b84d63486 to your computer and use it in GitHub Desktop.
Instance variable type checking needed?
<?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