0% found this document useful (0 votes)
8 views

Basic Coding Style Guide

Uploaded by

priya h.p
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Basic Coding Style Guide

Uploaded by

priya h.p
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Basic Coding Style Guide:

1.Files:
All PHP files MUST use the Unix LF (linefeed) line ending.
All PHP files MUST end with a single blank line.

2. Lines:
Lines SHOULD NOT be longer than 80 characters; lines longer than that
SHOULD be split into multiple subsequent lines of no more than 80 characters
each.
There MUST NOT be trailing whitespace at the end of non-blank lines.

3.Indenting
Code MUST use an indent of 4 spaces and MUST NOT use tabs for indenting.

4.Keywords and True/False/Null


PHP keywords MUST be in lower case.
The PHP constants true, false, and null MUST be in lower case.

5.Namespace and Use Declarations


When present, there MUST be one blank line after the namespace declaration.
When present, all use declarations MUST go after the namespace declaration.
There MUST be one use keyword per declaration
There MUST be one blank line after the use block.

6.Control Structures
There MUST be one space after the control structure keyword
There MUST NOT be a space after the opening parenthesis
There MUST NOT be a space before the closing parenthesis
There MUST be one space between the closing parenthesis and the opening
brace
The structure body MUST be indented once
The closing brace MUST be on the next line after the body
7. Extends and Implements
The extends and implements keywords MUST be declared on the same line as
the class name.
The opening brace for the class MUST go on its own line; the closing brace for
the class MUST go on the next line after the body.
Opening braces MUST be on their own line and MUST NOT be preceded or
followed by a blank line.
Closing braces MUST be on their own line and MUST NOT be preceded by a
blank line.

8.Properties and Constants


Visibility MUST be declared on all properties and constants.
The var keyword MUST NOT be used to declare a property.
There MUST be a space between type declaration and property name.

9.Methods and Functions


Visibility MUST be declared on all methods.
The opening brace MUST go on its own line, and the closing brace MUST go on
the next line following the body.
There MUST NOT be a space after the opening parenthesis, and there MUST
NOT be a space before the closing parenthesis.

10.Method and Function Arguments


In the argument list, there MUST NOT be a space before each comma, and
there MUST be one space after each comma
New Features:
1.The nullsafe operator

2.Named arguments

3.Match expression

4. Constructor property promotion


class Money

public function __construct(

public Currency $currency,


public int $amount,

) {}

New PHP Functions

1.New str_contains() function

Some may argue it’s long overdue, but essentially we no longer have to rely on
strops() to know whether there’s another string within a string.

2.New str_starts_with() and str_ends_with() functions

These two functions are long overdue and are now part of the core.

3.New fdiv() function

The new fdiv() function has similar ability as the fmod() and intdiv() functions,
that allows for division by 0.
Instead of getting errors, you’ll get INF, -INF, or NAN, depending on the
scenario.

4.get_debug_type() function

The new get_debug_type function always returns the true native type of
variables. It returns a return native type names, e.g., int rather than integer,
double instead of float.

Git:

git init
git remote add origin https://github.com/secqureone/sq1-asm.git
git fetch && git checkout develop
git add file_name
git commit -m “SQ1ASM-1 : Commit msg”
git config --global user.name "FIRST_NAME LAST_NAME"
For code Review create PR : From develop -> master branch

You might also like