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

  • Home
  • SEARCH
  • 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 8908851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:17:17+00:00 2026-06-15T03:17:17+00:00

Recently we migrated to git and implemented (for now post) receive hooks on our

  • 0

Recently we migrated to git and implemented (for now post) receive hooks on our central server to send reports to developers, as well as making several tools enabling us to have our codestandard checked automagically with phpcs on our development environments.

This is all nice and dandy, works well, but we want to be able to always depend on our code standard, not ignoring every file which does not conform for a logical reason. Now, we have our own ruleset which overrides some stuff in the default PEAR standard, but we want to go a little further if possible.

Our problem is that while the PEAR standard is perfect for all classes / business logic but in the view files we want to loosen the rules for say, closing brackets needing to be on their own line. The problem is that we mostly define html in these files and the only control structures we have are simple if-else or foreach statements, and opening php, then adding a newline, closing bracket, newline, and closing php is a bit silly imo.

Required syntax to be valid:

<?php
}
// end of some if statement ?>

What we’d instead like to use for views:

<?php } // end of some if statement ?>

This would make our code more readable…

We dislike the alternate syntax as wel (if(..): ... endif;), afaik mainly because there were some problems in validity here as well (it’s all about the whitespace…).

Ignoring the whole file (with // @codingStandardsIgnoreFile) is not an option for us.

tl;dr

So what we would like to do is define a seperate ruleset for our view files so we still have a standard to adhere to but with the relaxed rules on these fronts so our code can still be made readable.

I am not too knowledgable about phpcs yet, and couldn’t find any solutions myself using keywords I though were logical… Any suggestions to make tidy view files that also conform to PEAR are also welcome…

  • 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-15T03:17:18+00:00Added an answer on June 15, 2026 at 3:17 am

    If it comes down to just a few messages you want to exclude from some files, then you can put these exclusions directly into your ruleset.xml file. For example:

    <!--
      You can also be more specific and just exclude some messages.
      Please note that all message-specific ignore patterns are
      checked using absolute paths.
    
      The code here will just hide the ContainsVar error generated by the
      Squiz DoubleQuoteUsage sniff for files that match either of the two
      exclude patterns.
     -->
    <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
      <exclude-pattern>*/tests/*</exclude-pattern>
      <exclude-pattern>*/data/*</exclude-pattern>
    </rule>
    

    I’m not sure where your view files are stored, but if you can match them using an exclude-pattern (basically just a regular expression) then you’ll be able to relax some of the rules on them.

    The best way to figure out that ref=”” bit is to run phpcs on your view files and using the -s command line argument. For each message, you will get a unique code, which you can then use to add specific exclude-patterns to your ruleset.

    There are a bunch of other things you can do in the ruleset files as well. Check out the docs here.

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

Sidebar

Related Questions

Our team has recently migrated to git. We have production web application server with
Our small software shop recently migrated from Subversion to Git, as we programmers found
We've recently migrated our systems from Sun Java 5 to Java6 server VM (specifically,
We recently migrated our 32 bit web application to 2008 Server R2 64 bit
I receive this error when trying to run a node.js server. I recently migrated
Recently our client migrated to server with suhosin enabled. Till then we were using
I recently migrated from a Windows to Linux server... now I am getting a
we recently migrated to Maven Build manager & git hub repository for our Java
I recently migrated my JSF app(using primefaces) from glassfish 3.1 to tomcat7 server. Previously
Fairly exotic it seems to me. We recently upgraded/migrated from Windows Server 2003 to

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.