thephpleague / plates

Native PHP template system
https://platesphp.com
MIT License
1.47k stars 180 forks source link

4.0: Render context variable name should be explicit `$view`, rather than implicit `$v` #232

Closed lkraav closed 3 years ago

lkraav commented 5 years ago

Various reasons

  1. Better DX, via https://miguelgfierro.com/blog/2018/python-pro-tips-understanding-explicit-is-better-than-implicit/ etc

  2. Most PHPCS implementations, PHPMD, and possibly others, will highly likely flag single-letter variables (or anything less than 3 characters) as bad practice. They are probably correct.

  3. ...

ragboyjr commented 5 years ago

$v was for keeping the key strokes down, but pretty sure this is configurable already with:

$plates->addConfig(['render_context_var_name' => 'view']);
lkraav commented 5 years ago

It is configurable, and I did. But decisions (better defaults), not options, maybe? :)

ragboyjr commented 3 years ago

I think this is a moot point now that I'm scraping v4, so we'll just be using $this for the templates, and the new component system will also use this or captured variables from a closure. In both scenarios, it's going to be more explicit and type friendly which I think addresses the main concern here.