Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7795979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:13:46+00:00 2026-06-01T23:13:46+00:00

I’ve asked a question here because all my Php code is indented by 2,

  • 0

I’ve asked a question here because all my Php code is indented by 2, not 4.

Php CodeSniffer, which is a really great tool, has an indentation of “4” and it seems you can’t change that value.

Php CodeSniffer has a lot of options. So this it should be easy to add “indentation width”. But it seems the creators have voluntary avoided the possibility, because it’s not possible (which is weird IMHO).

So if you can’t change this, I was wondering: is “indentation width = 4” a de-facto standard?

Is this the same for Java / JavaDoc generation ?

Do I have to change all my 10.000+ lines of code to a 4 – indendation width?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:13:48+00:00Added an answer on June 1, 2026 at 11:13 pm

    Any public member var in sniffs can be overwritten by using a ruleset.xml file. A ruleset.xml file is an XML representation of your own custom coding standard. It can import sniffs from any of the included standards and can also include your own custom sniffs if you choose to write them.

    In your case, you want the exact PEAR standard, but with the indent value changed. So create a file mystandard.xml and make this the contents:

    <?xml version="1.0"?>
    <ruleset name="MyStandard">
     <description>My custom PEAR coding standard.</description>
     <rule ref="PEAR"/>
     <rule ref="PEAR.WhiteSpace.ScopeIndent">
      <properties>
       <property name="indent" value="2"/>
      </properties>
     </rule>
    </ruleset>
    

    Now, instead of running PHP_CodeSniffer using the command phpcs --standard=PEAR ... you use phpcs --standard=/path/to/mystandard.xml ...

    Note that you can call the standard anything you want and change the XML metadata (name and description) to something more appropriate.

    There is a lot more you can do with a custom ruleset.xml file. You can find more information about custom rulesets here: http://pear.php.net/manual/en/package.php.php-codesniffer.annotated-ruleset.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.