���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /usr/share/php/Symfony4/Component/DependencyInjection/Compiler/ |
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Definition; /** * Looks for definitions with autowiring enabled and registers their corresponding "@required" methods as setters. * * @author Nicolas Grekas <[email protected]> */ class AutowireRequiredMethodsPass extends AbstractRecursivePass { /** * {@inheritdoc} */ protected function processValue($value, $isRoot = false) { $value = parent::processValue($value, $isRoot); if (!$value instanceof Definition || !$value->isAutowired() || $value->isAbstract() || !$value->getClass()) { return $value; } if (!$reflectionClass = $this->container->getReflectionClass($value->getClass(), false)) { return $value; } $alreadyCalledMethods = []; $withers = []; foreach ($value->getMethodCalls() as [$method]) { $alreadyCalledMethods[strtolower($method)] = true; } foreach ($reflectionClass->getMethods() as $reflectionMethod) { $r = $reflectionMethod; if ($r->isConstructor() || isset($alreadyCalledMethods[strtolower($r->name)])) { continue; } while (true) { if (false !== $doc = $r->getDocComment()) { if (false !== stripos($doc, '@required') && preg_match('#(?:^/\*\*|\n\s*+\*)\s*+@required(?:\s|\*/$)#i', $doc)) { if (preg_match('#(?:^/\*\*|\n\s*+\*)\s*+@return\s++static[\s\*]#i', $doc)) { $withers[] = [$reflectionMethod->name, [], true]; } else { $value->addMethodCall($reflectionMethod->name, []); } break; } if (false === stripos($doc, '@inheritdoc') || !preg_match('#(?:^/\*\*|\n\s*+\*)\s*+(?:\{@inheritdoc\}|@inheritdoc)(?:\s|\*/$)#i', $doc)) { break; } } try { $r = $r->getPrototype(); } catch (\ReflectionException $e) { break; // method has no prototype } } } if ($withers) { // Prepend withers to prevent creating circular loops $setters = $value->getMethodCalls(); $value->setMethodCalls($withers); foreach ($setters as $call) { $value->addMethodCall($call[0], $call[1], $call[2] ?? false); } } return $value; } }