wiki/content/20201116142709-define.md

21 lines
366 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-29 18:27:12 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
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');
```