wiki/content/20201116142709-define.md

20 lines
364 B
Markdown

---
date: 20201116
id: f3eefc1b-34f9-41e8-a22b-33e87f94c29a
title: define()
---
# Syntax
``` php
// Before
$resolver->setRequired('host');
$resolver->setDefaults(['host' => 'smtp.example.org']);
$resolver->setAllowedTypes('host', 'string');
// After
$resolver->define('host')
->required()
->default('smtp.example.org')
->allowedTypes('string');
```