X7ROOT File Manager
Current Path:
/home/gfecatvj/sites/vendor/illuminate/support/Traits
home
/
gfecatvj
/
sites
/
vendor
/
illuminate
/
support
/
Traits
/
📁
..
📄
CapsuleManagerTrait.php
(1.4 KB)
📄
EnumeratesValues.php
(24.6 KB)
📄
ForwardsCalls.php
(1.34 KB)
📄
Localizable.php
(629 B)
📄
Macroable.php
(2.7 KB)
📄
ReflectsClosures.php
(1.43 KB)
📄
Tappable.php
(315 B)
Editing: ReflectsClosures.php
<?php namespace Illuminate\Support\Traits; use Closure; use Illuminate\Support\Reflector; use ReflectionFunction; use RuntimeException; trait ReflectsClosures { /** * Get the class names / types of the parameters of the given Closure. * * @param \Closure $closure * @return array * * @throws \ReflectionException */ protected function closureParameterTypes(Closure $closure) { $reflection = new ReflectionFunction($closure); return collect($reflection->getParameters())->mapWithKeys(function ($parameter) { if ($parameter->isVariadic()) { return [$parameter->getName() => null]; } return [$parameter->getName() => Reflector::getParameterClassName($parameter)]; })->all(); } /** * Get the class name of the first parameter of the given Closure. * * @param \Closure $closure * @return string * * @throws \ReflectionException|\RuntimeException */ protected function firstClosureParameterType(Closure $closure) { $types = array_values($this->closureParameterTypes($closure)); if (! $types) { throw new RuntimeException('The given Closure has no parameters.'); } if ($types[0] === null) { throw new RuntimeException('The first parameter of the given Closure is missing a type hint.'); } return $types[0]; } }
Upload File
Create Folder