comparison vendor/symfony/http-kernel/Bundle/Bundle.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
52 * 52 *
53 * It is only ever called once when the cache is empty. 53 * It is only ever called once when the cache is empty.
54 * 54 *
55 * This method can be overridden to register compilation passes, 55 * This method can be overridden to register compilation passes,
56 * other extensions, ... 56 * other extensions, ...
57 *
58 * @param ContainerBuilder $container A ContainerBuilder instance
59 */ 57 */
60 public function build(ContainerBuilder $container) 58 public function build(ContainerBuilder $container)
61 { 59 {
62 } 60 }
63 61
157 * 155 *
158 * Override this method if your bundle commands do not follow the conventions: 156 * Override this method if your bundle commands do not follow the conventions:
159 * 157 *
160 * * Commands are in the 'Command' sub-directory 158 * * Commands are in the 'Command' sub-directory
161 * * Commands extend Symfony\Component\Console\Command\Command 159 * * Commands extend Symfony\Component\Console\Command\Command
162 *
163 * @param Application $application An Application instance
164 */ 160 */
165 public function registerCommands(Application $application) 161 public function registerCommands(Application $application)
166 { 162 {
167 if (!is_dir($dir = $this->getPath().'/Command')) { 163 if (!is_dir($dir = $this->getPath().'/Command')) {
168 return; 164 return;
181 if ($relativePath = $file->getRelativePath()) { 177 if ($relativePath = $file->getRelativePath()) {
182 $ns .= '\\'.str_replace('/', '\\', $relativePath); 178 $ns .= '\\'.str_replace('/', '\\', $relativePath);
183 } 179 }
184 $class = $ns.'\\'.$file->getBasename('.php'); 180 $class = $ns.'\\'.$file->getBasename('.php');
185 if ($this->container) { 181 if ($this->container) {
182 $commandIds = $this->container->hasParameter('console.command.ids') ? $this->container->getParameter('console.command.ids') : array();
186 $alias = 'console.command.'.strtolower(str_replace('\\', '_', $class)); 183 $alias = 'console.command.'.strtolower(str_replace('\\', '_', $class));
187 if ($this->container->has($alias)) { 184 if (isset($commandIds[$alias]) || $this->container->has($alias)) {
188 continue; 185 continue;
189 } 186 }
190 } 187 }
191 $r = new \ReflectionClass($class); 188 $r = new \ReflectionClass($class);
192 if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) { 189 if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
190 @trigger_error(sprintf('Auto-registration of the command "%s" is deprecated since Symfony 3.4 and won\'t be supported in 4.0. Use PSR-4 based service discovery instead.', $class), E_USER_DEPRECATED);
191
193 $application->add($r->newInstance()); 192 $application->add($r->newInstance());
194 } 193 }
195 } 194 }
196 } 195 }
197 196