8000 [Console] added __get() to Command to have shorter and more readable … · CodingFabian/symfony@d229ce5 · GitHub
[go: up one dir, main page]

Skip to content

Commit d229ce5

Browse files
committed
[Console] added __get() to Command to have shorter and more readable code in commands
1 parent 7c72735 commit d229ce5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Symfony/Components/Console/Command/Command.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,20 @@ protected function getHelper($name)
423423
return $this->application->getHelperSet()->get($name);
424424
}
425425

426+
/**
427+
* Gets a helper instance by name.
428+
*
429+
* @param string $name The helper name
430+
*
431+
* @return mixed The helper value
432+
*
433+
* @throws \InvalidArgumentException if the helper is not defined
434+
*/
435+
public function __get($name)
436+
{
437+
return $this->application->getHelperSet()->get($name);
438+
}
439+
426440
/**
427441
* Returns a text representation of the command.
428442
*

0 commit comments

Comments
 (0)
0