for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cekta\DI\Reflection;
use ReflectionParameter;
class ParameterService
{
/**
* @param ReflectionParameter $parameter
* @param array<string> $annotations
* @return string
*/
public function getName(ReflectionParameter $parameter, array $annotations): string
$result = $parameter->getClass() === null ? $parameter->name : $parameter->getClass()->name;
if (array_key_exists($result, $annotations)) {
$result = $annotations[$result];
}
return $result;