Skip to content

Instantly share code, notes, and snippets.

@brzuchal
Last active December 10, 2016 06:48
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 brzuchal/7e1e81e53ef29e1d8700ca249e2a4776 to your computer and use it in GitHub Desktop.
Save brzuchal/7e1e81e53ef29e1d8700ca249e2a4776 to your computer and use it in GitHub Desktop.
<?php declare(strict_types=1);
namespace MyTest;
/**
* @ValueObject
*/
class MyClass {
/**
* @var int
* @Setter @Getter
*/
private $age;
/**
* @var int[]
*/
private $days = [];
}
<?php declare(strict_types=1);
namespace MyTest;
/**
* @ValueObject
* @method void setAge(int $age) Sets age
* @method int getAge() Retrieves age
* @method void addDay(int $day) Adds day
* @method void removeDay(int $day) Removes day
* @method int[] getDays() Retrieves days
*/
class MyClass {
/**
* @var int
* @Setter @Getter
*/
private $age;
/**
* @var int[]
* @Setter @Getter
*/
private $days = [];
}
<?php declare(strict_types=1);
namespace MyTest;
/**
* @ValueObject
*/
class MyClass {
/**
* @var int
* @Setter @Getter
*/
private $age;
/**
* @var int[]
*/
private $days = [];
public function setAge(int $age) : void
{
$this->age = $age;
}
public function getAge() : int
{
return $this->age;
}
public function addDay(int $day) : void
{
//...
}
public function removeDay(int $day) : void
{
// ...
}
/**
* @return int[]
*/
public function getDays() : array
{
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment