/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Testing/Exceptions/InvalidArgumentException.php
36 строк
892 B
S.a Mahmoudzadeh
fix: update dock block for create method in InvalidArgumentException.php (#50762)
26 мар 2024, 12:00
Не верифицирован
26 мар 2024, 12:00
fe17608
Код
Авторство
О чём код?
<?php namespace Illuminate\Testing\Exceptions; use PHPUnit\Framework\Exception; class InvalidArgumentException extends Exception { /** * Creates a new exception for an invalid argument. * * @param int $argument * @param string $type * @return static */ public static function create(int $argument, string $type): static { $stack = debug_backtrace(); $function = $stack[1]['function']; if (isset($stack[1]['class'])) { $function = sprintf('%s::%s', $stack[1]['class'], $stack[1]['function']); } return new static( sprintf( 'Argument #%d of %s() must be %s %s', $argument, $function, in_array(lcfirst($type)[0], ['a', 'e', 'i', 'o', 'u'], true) ? 'an' : 'a', $type ) ); } }