| 1 | <?php |
||
| 8 | final class TwigFormatter extends HtmlFormatter |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var Twig_Environment |
||
| 12 | */ |
||
| 13 | private $environment; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param Twig_Environment $environment |
||
| 17 | */ |
||
| 18 | public function __construct(Twig_Environment $environment) |
||
| 22 | 3 | ||
| 23 | /** |
||
| 24 | * Get a copy that uses a different template. |
||
| 25 | * |
||
| 26 | * @param string $template |
||
| 27 | * |
||
| 28 | * @return static |
||
| 29 | 1 | */ |
|
| 30 | public function withTemplate($template) |
||
| 37 | |||
| 38 | /** |
||
| 39 | 1 | * @inheritDoc |
|
| 40 | */ |
||
| 41 | 1 | public function format($content) |
|
| 45 | } |
||
| 46 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: