Skip to content

Instantly share code, notes, and snippets.

@marcosh
marcosh / Boolean.php
Created January 16, 2020 11:16
Boolean implementation in PHP
<?php
declare(strict_types=1);
namespace Marcosh\PhpValidationDSL;
final class Boolean
{
/** @var Bool */
private $isTrue;
<?php
declare(strict_types=1);
/**
* @template F
* @template A
* @extends Functor<F,A>
*/
interface Apply extends Functor
@marcosh
marcosh / Country.php
Created October 15, 2020 13:08
Value object external validation
<?php
final class Country
{
private string $countryCode;
private function __construct(string $countryCode)
{
$this->countryCode = $countryCode;
}