timber / starter-theme

The "_s" for Timber: a dead-simple theme that you can build anything from
MIT License
812 stars 274 forks source link

Complying with WordPress Coding Standards #67

Closed alexwoollam closed 5 years ago

alexwoollam commented 5 years ago

Just a few simple php alteration for complying wpcs. helpful if your running your sites through phpcs.

jarednova commented 5 years ago

Excellent, thank you @alexwoollam! We're working on formal Timber Coding Standards (which are 99% the same as WP, but a few considerations for the unique parts of Twig and Timber) — this should get us most of the way there

alexwoollam commented 5 years ago

Great idea, are you looking at doing CodeSniffer rules for this also? and coding standards for the twig stuff? I generally use symfony's for this (but somewhat loosely).

Its probably worth noting I did leave out two issues in this pull request:

one issues is wpcs doesn't like the snakecase on in footer.php. (I just ignore this one, could probably be fixed with the "tcs").

second is functions.php - wpcs calls for the file name to be renamed to reflect "class StarterSite", when i've been using this on my sites, i generally rip this section out and put it in an /include/class-startersite.php file and require it to keep wpcs happy, I also prefer it this way. But this feels moderately preferential to me, but possibly quite confusing to others; so left as is.