Skip to content

Commit c13eccc

Browse files
committed
Update README.md
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
1 parent 2a6d8be commit c13eccc

File tree

1 file changed

+5
-53
lines changed

1 file changed

+5
-53
lines changed

README.md

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,15 @@
11
# phpMyAdmin Coding Standard
22

3-
phpMyAdmin Coding Standard for PHP CodeSniffer.
3+
phpMyAdmin Coding Standard is a set of [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) rules and is based on the [Doctrine Coding Standard](https://github.com/doctrine/coding-standard).
44

5-
## Installation & Usage
5+
## Installation
66

7-
### Manual installation
8-
Before starting using our coding standard install [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer).
9-
10-
Clone or download this repo somewhere on your computer or install it with [Composer](https://getcomposer.org/).
11-
To do so, add the dependency to your `composer.json` file by running `composer require --dev phpmyadmin/coding-standard`.
12-
13-
### Automatic installation with Composer
14-
Much easier, however, is to use Composer to install the necessary files automatically.
15-
Using the development version of phpMyAdmin from git requires using Composer, so the dependencies are already set
16-
in `composer.json` using the 'require-dev' section. Depending on your system, this will either be installed
17-
automatically unless you use `--no-dev` option or composer must be run with `--dev`. Regardless of your composer
18-
version, using `--dev` will always install the 'require-dev' dependencies, so we recomment using Composer with that
19-
option.
20-
21-
### Final configuration
22-
Add the standards directory to PHP_CodeSniffer installed paths. You probably have to use the full/absolute path
23-
rather than a relative one, otherwise you will get an "Unexpected Value Exception":
24-
25-
```sh
26-
$ phpcs --config-set installed_paths /var/www/html/phpmyadmin/vendor/phpmyadmin/coding-standard
27-
```
28-
29-
You can verify whether the standard can be found:
30-
31-
```sh
32-
$ phpcs -i
33-
The installed coding standards are MySource, PSR1, PHPCS, Zend, Squiz, PEAR, PSR2 and PhpMyAdmin
347
```
35-
36-
Run CodeSniffer:
37-
38-
```sh
39-
$ phpcs --standard=PhpMyAdmin /path/to/code
8+
composer require --dev phpmyadmin/coding-standard
409
```
4110

42-
You can optionally make PhpMyAdmin the default for all invocations of phpcs, then you don't need to
43-
manually specify it each time on the command line:
11+
## Usage
4412

45-
```sh
46-
$ phpcs --config-set default_standard PhpMyAdmin
4713
```
48-
49-
## Using
50-
51-
PhpMyAdmin has its tuned coding style checks, such as missing `@author`,
52-
`@copyright`, `@link` or other tags. Let's take a look at an example, checked with PhpMyAdmin:
53-
54-
```sh
55-
$ phpcs --standard=PhpMyAdmin /path/to/code/myfile.php
56-
123 | WARNING | Line exceeds 85 characters; contains 139 characters
57-
184 | ERROR   | Line indented incorrectly; expected at least 20 spaces, found
58-
    |         | 16
59-
272 | ERROR   | Closing parenthesis of a multi-line IF statement must be on a
60-
    |         | new line
61-
272 | ERROR   | Multi-line IF statement not indented correctly; expected 12
62-
    |         | spaces but found 9
14+
vendor/bin/phpcs --standard=PhpMyAdmin /path/to/code
6315
```

0 commit comments

Comments
 (0)