PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, August 30, 2022

[FIXED] How do I use php_beautifier with PEAR Code Standards?

 August 30, 2022     code-formatting, coding-style, pear, php, php-beautifier     No comments   

Issue

How do I use php_beautifier with PEAR Code Standards?


Solution

You have to use PHP_Beautifier_Filter_Pear instead of the default filter.

$oBeaut->addFilter('Pear',array('add_header'=>'php'));

Or from CLI

$ php_beautifier --filters "Pear(add_header=php)"

The PEAR filter will

  • Add 2 newlines after Break in switch statements. Break indent is the same of previous line
  • Brace in function definition put on a new line, same indent of 'function' construct
  • Comments started with '#' are replaced with '//'
  • Open tags are replaced with <?php
  • T_OPEN_TAG_WITH_ECHO replaced with <?php echo
  • With setting 'add_header', the filter add one of the standard PEAR comment header (php, bsd, apache, lgpl, pear) or any file as licence header.


Answered By - Gordon
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing