Skip to content

Instantly share code, notes, and snippets.

@xvilo
Last active February 22, 2018 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xvilo/a23b1a5c55b1a032cea086f79a92adde to your computer and use it in GitHub Desktop.
Save xvilo/a23b1a5c55b1a032cea086f79a92adde to your computer and use it in GitHub Desktop.
<?php
class TypeCheckingObject {
/** @var string */
private $storage = '';
/**
* @return string
*/
public function getStorage() : string
{
return $this->storage;
}
/**
* @param string $data
*/
public function setStorage(string $data)
{
$this->storage = $data;
}
}
$obj = new TypeCheckingObject();
$obj->setStorage(intval(10));
var_dump($obj->getStorage());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment