PHP code example of mfn / argument-validation
1. Go to this page and download the library: Download mfn/argument-validation library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mfn / argument-validation example snippets
use Mfn\ArgumentValidation\ExtractFromDocblock;
use Mfn\ArgumentValidation\ArgumentValidation;
$docblock = <<<'DOCBLOCK'
/**
* @var array $someArray
* @var bool $isCool
*/
DOCBLOCK;
$parameters = (new ExtractFromDocblock)->extract($docblock);
$arguments = [
'someArray' => [],
'isCool' => 'foobar',
];
$errors = (new ArgumentValidation)->validate($parameters, $arguments);
var_dump($errors);