Download the PHP package zicht/standards-php without Composer

On this page you can find all versions of the php package zicht/standards-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package standards-php

Zicht PHP standards

Roughly based on the PEAR and Zend coding standards, with inclusion of the PSR-1 and PSR-2 standards, the Zicht coding standard applies some custom rules and modifications to these standards:

Usage

Basic usage vendor/bin/phpcs --standard=vendor/zicht/standards-php/phpcs.xml <directories-and-files>

Projects should incorporate following commands in the scripts section of their composer.json. You should be using the composer lint command in your daily work to inspect code changes you made before submitting a pull request (you can also incorporate these checks into PhpStorm). You can use the composer lint-fix command to auto-fix errors that can be fixed automatically. Projects should implement the composer lint-no-warn command into their Q&A jobs that should be ran on newly submitted pull requests (this ignores warnings to prevent loads of warning messages in the logs while the test will still pass).

Current ruleset

Generic

Generic.Files.LineLength

This rule is configured to give warnings on lines longer than 256 characters and give errors on lines longer than 512 characters (deliberately not following PSR-2). You should fix these warnings and stick to a maximum line length of 256 characters, but the Q&A tests should not fail on code having lines longer than 256 characters and less than 512 characters.

Zicht Sniffs

In this section each of the rules from the Zicht set are explained.

Commenting in general

All doc block comment sniffs (ClassComment, FileComment, FunctionComment and PropertyComment) will scan for empty doc blocks and doc blocks containing superfluous descriptions. Empty doc blocks and doc block containing only a superfluous comment (no tags) must be improved or removed. The description of doc blocks having a superfluous description and having tags must be improved or removed.

Superfluous descriptions are detected by looking at the declaration the doc block belongs to and see if it is a repetition of its name, which obviously is not adding anything of value. Superfluous doc blocks/descriptions are auto-fixable.

Example, all three doc block comments produce an error by the related sniff because the descriptions are superfluous:

Zicht.Commenting.ClassComment

Extends PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\ClassCommentSniff. Additionally detects empty or superfluous comments (see Commenting in general) and adds rules about what the doc block is allowed to contain in a class doc comment.

Zicht.Commenting.DefineComment

Looks for comments before the define function of PHP.

Zicht.Commenting.FileComment

Extends PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FileCommentSniff. Additionally detects empty or superfluous comments (see Commenting in general) and adds rules about what the doc block is allowed to contain in a file doc comment.

Zicht.Commenting.FunctionComment

Extends \PHP_CodeSniffer\Standards\PEAR\Sniffs\Commenting\FunctionCommentSniff. Additionally detects empty or superfluous comments (see Commenting in general) and detects {@inheritdoc} in the function comment which makes it skip params and return tags validation (if no @param or @return is added additionally). Also this sniff allows skipping a function comment when there are no parameters and returned values or when all parameters and the returned value have their type declared (type hinted):

No function doc comment is needed in above example.

Zicht.Commenting.PropertyComment

This sniffs checks for required property comment tags (@var), their (required) content and the order of tags (@var tag must always come first and official PHPDoc tags must be placed above other custom tags. Empty lines are not allowed within the property comment and a separate description is not allowed and must be placed with the @var tag. The sniff also detects for superfluous descriptions (see Commenting in general). Single line property comments (/** @var <type> */) are allowed.

Zicht.ControlStructures.ControlSignature

Checks if certain structures are formed according to the definition of the signature.

do {EOL...} while (...);EOL, while (...) {EOL, for (...) {EOL, if (...) {EOL, foreach (...) {EOL, } else if (...) {EOL, } elseif (...) {EOL, } else {EOL, do {EOL,

for example do {EOL...} while (...);EOL means: do {// (EOL) End of line from here } while ();// (EOL) End of line from here.

Zicht.ControlStructures.DisallowAssignments

Detects if there are any assignments happening in if, elseif, while, foreach and switch control structures. By default configuration a maximum of 1 assignment is allowed and it must come first before any other logic in the statement:

Zicht.Functions.FunctionCallSignature

This sniff overrides the PEAR Sniff to allow function call opening parenthesis and array square brackets on the same line. It is only allowing this if there's only one argument, which should be an array or could be a closure.

Zicht.Methods.FunctionOpeningBrace

Detects if there are no empty lines between a function's opening brace and the first line of code.

Zicht.NamingConventions.Classname

This sniff requires class names to be CamelCased.

Zicht.NamingConventions.Constants

This sniff requires a constant name to be UPPERCASE (no lower case characters allowed) and no characters other than A-Z, 0-9 and underscore.

Zicht.NamingConventions.Functions

This sniff defines the naming conventions.

Class methods are required to be studlyCased or alternatively named lowerCamelCased. The following methods are allowed: construct, get, set, call, callStatic, invoke, destruct, toString, clone, invoke, invokeStatic. Underscore and numbers are discouraged to be used in method names in classes. A number creates a warning whereas an underscore creates an error.

Global functions are required to be snake_cased so all lower an divided by a underscore.

Zicht.PHP.Namespace

Except for global classes all other classes in namespaces are not allowed to be used in code referring to the fully qualified class name. Like $sniff = new \Zicht\Sniffs\PHP\NamespaceSniff()) use an use statement and format your code like $sniff = new NamespaceSniff();

Zicht.PHP.UseStatement

This sniff defines that the use statements should be at the top of in a PHP file and can only be preceded by a declare statement, doc blocks or the namespace declaration (and surely whitespaces etc).

Zicht.Whitespace.ExcessiveWhitespace

This sniff looks for more then one whitespace after the last } in a file.

Other rules

To view the rules in this ruleset you can use the following command from the package root:

That will produce the following set:

These namespaces of rules are applied as you could see above. Check the documentation of these namespaces for explanation.

Maintainers


All versions of standards-php with dependencies

PHP Build Version
Package Version
Requires squizlabs/php_codesniffer Version ^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zicht/standards-php contains the following files

Loading the files please wait ....