Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
CheckArgumentsValidityPass.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\DependencyInjection\Compiler;
13
14 use Symfony\Component\DependencyInjection\Definition;
15 use Symfony\Component\DependencyInjection\Exception\RuntimeException;
16
17 /**
18 * Checks if arguments of methods are properly configured.
19 *
20 * @author Kévin Dunglas <dunglas@gmail.com>
21 * @author Nicolas Grekas <p@tchwork.com>
22 */
23 class CheckArgumentsValidityPass extends AbstractRecursivePass
24 {
25 private $throwExceptions;
26
27 public function __construct($throwExceptions = true)
28 {
29 $this->throwExceptions = $throwExceptions;
30 }
31
32 /**
33 * {@inheritdoc}
34 */
35 protected function processValue($value, $isRoot = false)
36 {
37 if (!$value instanceof Definition) {
38 return parent::processValue($value, $isRoot);
39 }
40
41 $i = 0;
42 foreach ($value->getArguments() as $k => $v) {
43 if ($k !== $i++) {
44 if (!\is_int($k)) {
45 $msg = sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k);
46 $value->addError($msg);
47 if ($this->throwExceptions) {
48 throw new RuntimeException($msg);
49 }
50
51 break;
52 }
53
54 $msg = sprintf('Invalid constructor argument %d for service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $this->currentId, $i);
55 $value->addError($msg);
56 if ($this->throwExceptions) {
57 throw new RuntimeException($msg);
58 }
59 }
60 }
61
62 foreach ($value->getMethodCalls() as $methodCall) {
63 $i = 0;
64 foreach ($methodCall[1] as $k => $v) {
65 if ($k !== $i++) {
66 if (!\is_int($k)) {
67 $msg = sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k);
68 $value->addError($msg);
69 if ($this->throwExceptions) {
70 throw new RuntimeException($msg);
71 }
72
73 break;
74 }
75
76 $msg = sprintf('Invalid argument %d for method call "%s" of service "%s": argument %d must be defined before. Check your service definition.', 1 + $k, $methodCall[0], $this->currentId, $i);
77 $value->addError($msg);
78 if ($this->throwExceptions) {
79 throw new RuntimeException($msg);
80 }
81 }
82 }
83 }
84
85 return null;
86 }
87 }
88