wiki/content/20201116142709-define.md

21 lines
366 B
Markdown
Raw Permalink Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +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');
```