Skip to content

Instantly share code, notes, and snippets.

Last active March 16, 2016 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/7ffe242323c75f206b3c to your computer and use it in GitHub Desktop.
Save anonymous/7ffe242323c75f206b3c 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