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
class Color {} | |
class Address {} | |
class Cat { | |
private Int age; | |
private Double weight; | |
private String name; | |
private Address address; | |
private Color color; | |
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
/** | |
* This class is purely immutable. | |
* PHP protects the string from changing by its copy-on-change mechanics | |
* If you do `$str = $immutable->getField();` and then change `$str` | |
* PHP will copy the value and change only second one. | |
*/ | |
class Immutable | |
{ | |
/** @var string */ | |
private $field; |