These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Doctrine\Bundle\DoctrineBundle; |
||
4 | |||
5 | use Doctrine\DBAL\Connection; |
||
6 | use Doctrine\ORM\EntityManager; |
||
7 | use Doctrine\ORM\EntityManagerInterface; |
||
8 | use Doctrine\ORM\ORMException; |
||
9 | use Psr\Container\ContainerInterface; |
||
10 | use Symfony\Bridge\Doctrine\ManagerRegistry; |
||
11 | use Symfony\Bridge\Doctrine\RegistryInterface; |
||
12 | |||
13 | /** |
||
14 | * References all Doctrine connections and entity managers in a given Container. |
||
15 | */ |
||
16 | class Registry extends ManagerRegistry implements RegistryInterface |
||
17 | { |
||
18 | /** |
||
19 | * @param Connection[] $connections |
||
20 | * @param EntityManagerInterface[] $entityManagers |
||
21 | * @param string $defaultConnection |
||
22 | * @param string $defaultEntityManager |
||
23 | */ |
||
24 | public function __construct(ContainerInterface $container, array $connections, array $entityManagers, $defaultConnection, $defaultEntityManager) |
||
25 | { |
||
26 | $this->container = $container; |
||
27 | |||
28 | parent::__construct('ORM', $connections, $entityManagers, $defaultConnection, $defaultEntityManager, 'Doctrine\ORM\Proxy\Proxy'); |
||
0 ignored issues
–
show
$entityManagers is of type array<integer,object<Doc...ntityManagerInterface>> , but the function expects a array<integer,string> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Gets the default entity manager name. |
||
33 | * |
||
34 | * @deprecated |
||
35 | * |
||
36 | * @return string The default entity manager name |
||
37 | */ |
||
38 | public function getDefaultEntityManagerName() |
||
39 | { |
||
40 | @trigger_error('getDefaultEntityManagerName is deprecated since Symfony 2.1. Use getDefaultManagerName instead', E_USER_DEPRECATED); |
||
41 | |||
42 | return $this->getDefaultManagerName(); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Gets a named entity manager. |
||
47 | * |
||
48 | * @deprecated |
||
49 | * |
||
50 | * @param string $name The entity manager name (null for the default one) |
||
51 | * |
||
52 | * @return EntityManager |
||
53 | */ |
||
54 | public function getEntityManager($name = null) |
||
55 | { |
||
56 | @trigger_error('getEntityManager is deprecated since Symfony 2.1. Use getManager instead', E_USER_DEPRECATED); |
||
57 | |||
58 | return $this->getManager($name); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Gets an array of all registered entity managers |
||
63 | * |
||
64 | * @deprecated |
||
65 | * |
||
66 | * @return EntityManager[] an array of all EntityManager instances |
||
67 | */ |
||
68 | public function getEntityManagers() |
||
69 | { |
||
70 | @trigger_error('getEntityManagers is deprecated since Symfony 2.1. Use getManagers instead', E_USER_DEPRECATED); |
||
71 | |||
72 | return $this->getManagers(); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Resets a named entity manager. |
||
77 | * |
||
78 | * This method is useful when an entity manager has been closed |
||
79 | * because of a rollbacked transaction AND when you think that |
||
80 | * it makes sense to get a new one to replace the closed one. |
||
81 | * |
||
82 | * Be warned that you will get a brand new entity manager as |
||
83 | * the existing one is not usable anymore. This means that any |
||
84 | * other object with a dependency on this entity manager will |
||
85 | * hold an obsolete reference. You can inject the registry instead |
||
86 | * to avoid this problem. |
||
87 | * |
||
88 | * @deprecated |
||
89 | * |
||
90 | * @param string $name The entity manager name (null for the default one) |
||
91 | */ |
||
92 | public function resetEntityManager($name = null) |
||
93 | { |
||
94 | @trigger_error('resetEntityManager is deprecated since Symfony 2.1. Use resetManager instead', E_USER_DEPRECATED); |
||
95 | |||
96 | $this->resetManager($name); |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * Resolves a registered namespace alias to the full namespace. |
||
101 | * |
||
102 | * This method looks for the alias in all registered entity managers. |
||
103 | * |
||
104 | * @deprecated |
||
105 | * |
||
106 | * @param string $alias The alias |
||
107 | * |
||
108 | * @return string The full namespace |
||
109 | */ |
||
110 | public function getEntityNamespace($alias) |
||
111 | { |
||
112 | @trigger_error('getEntityNamespace is deprecated since Symfony 2.1. Use getAliasNamespace instead', E_USER_DEPRECATED); |
||
113 | |||
114 | return $this->getAliasNamespace($alias); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Resolves a registered namespace alias to the full namespace. |
||
119 | * |
||
120 | * This method looks for the alias in all registered entity managers. |
||
121 | * |
||
122 | * @see Configuration::getEntityNamespace |
||
123 | * |
||
124 | * @param string $alias The alias |
||
125 | * |
||
126 | * @return string The full namespace |
||
127 | */ |
||
128 | public function getAliasNamespace($alias) |
||
129 | { |
||
130 | foreach (array_keys($this->getManagers()) as $name) { |
||
131 | try { |
||
132 | return $this->getManager($name)->getConfiguration()->getEntityNamespace($alias); |
||
133 | } catch (ORMException $e) { |
||
134 | } |
||
135 | } |
||
136 | |||
137 | throw ORMException::unknownEntityNamespace($alias); |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * Gets all connection names. |
||
142 | * |
||
143 | * @deprecated |
||
144 | * |
||
145 | * @return string[] An array of connection names |
||
146 | */ |
||
147 | public function getEntityManagerNames() |
||
148 | { |
||
149 | @trigger_error('getEntityManagerNames is deprecated since Symfony 2.1. Use getManagerNames instead', E_USER_DEPRECATED); |
||
150 | |||
151 | return $this->getManagerNames(); |
||
152 | } |
||
153 | |||
154 | /** |
||
155 | * Gets the entity manager associated with a given class. |
||
156 | * |
||
157 | * @deprecated |
||
158 | * |
||
159 | * @param string $class A Doctrine Entity class name |
||
160 | * |
||
161 | * @return EntityManager|null |
||
162 | */ |
||
163 | public function getEntityManagerForClass($class) |
||
164 | { |
||
165 | @trigger_error('getEntityManagerForClass is deprecated since Symfony 2.1. Use getManagerForClass instead', E_USER_DEPRECATED); |
||
166 | |||
167 | return $this->getManagerForClass($class); |
||
168 | } |
||
169 | } |
||
170 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: