Skip to content

Commit bdc31f5

Browse files
xaloppmmoll
authored andcommitted
update documentation
1 parent c53298b commit bdc31f5

File tree

2 files changed

+68
-27
lines changed

2 files changed

+68
-27
lines changed

CONTRIBUTING.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,24 @@
55
We do recommend the following setup:
66

77
* make sure that [Composer](https://getcomposer.org) is installed
8-
* clone the [PHP_CodeSniffer repository](https://github.com/squizlabs/PHP_CodeSniffer)
9-
* run `composer install` inside the `PHP_CodeSniffer` directory to install required dependencies
10-
* get the [Symfony Coding Standard](https://github.com/djoos/Symfony-coding-standard) and symlink, copy or move its `Symfony` subdirectory to `PHP_CodeSniffer/src/Standards/Symfony`
11-
* symlink, copy or clone this repository to `PHP_CodeSniffer/src/Standards/MO4`
8+
* clone this repository
9+
10+
git clone https://github.com/mayflower/mo4-coding-standard.git
11+
12+
* install all required dependencies
1213

13-
git clone https://github.com/squizlabs/PHP_CodeSniffer.git
14-
cd PHP_CodeSniffer
1514
composer install
16-
cd src/Standards
17-
git clone https://github.com/djoos/Symfony-coding-standard.git Symfony
18-
mv Symfony/Symfony/* Symfony/
19-
git clone https://github.com/mayflower/mo4-coding-standard.git MO4
2015

2116

2217
## Coding Standard and Tests
2318

2419
If you contribute code, please make sure it conforms to the PHPCS coding standard and that the unit tests still pass.
2520

26-
1. To check the coding standard, run in the repository root of `PHP_CodeSniffer`:
21+
1. To check the coding standard, execute in the repository root:
2722

28-
./bin/phpcs --ignore='*/vendor/*' src/Standards/MO4
23+
./vendor/bin/phpcs MO4
2924

30-
2. The unit-tests are run from within the `PHP_CodeSniffer` directory
25+
2. To run the unit tests, execute in the repository root:
3126

3227
./vendor/bin/phpunit --filter MO4
3328

README.md

+60-14
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,83 @@ The MO4 Coding Standard is an extension of the [Symfony Coding Standard](http://
2626

2727
## Installation
2828

29-
1. Install phpcs:
29+
### Composer
3030

31-
pear install PHP_CodeSniffer
31+
Using [Composer](https://getcomposer.org/) is the preferred way.
32+
33+
1. Add the MO4 repository
34+
35+
composer config repositories.mo4 vcs https://github.com/mayflower/mo4-coding-standard.git
36+
37+
If composer complains about a missing composer.json, just create an empty one
38+
39+
echo '{}' > composer.json
40+
41+
2. Add the MO4 coding standard to `composer.json`
42+
43+
composer require --dev mayflower/mo4-coding-standard:dev-master
44+
45+
3. Profit
46+
47+
./vendor/bin/phpcs --standard=MO4 path/to/my/file.php
48+
49+
4. Optionally, you might set MO4 as default coding standard
50+
51+
./vendor/bin/phpcs --config-set default_standard MO4
52+
53+
### Source
54+
55+
1. Checkout this repository
56+
57+
git clone https://github.com/mayflower/mo4-coding-standard.git
58+
59+
2. Install dependencies
3260

33-
2. Find your PEAR directory:
61+
composer install
3462

35-
pear config-show | grep php_dir
63+
3. Check, that Symfony and MO4 are listed as coding standards
3664

37-
3. Copy, symlink or check out the Symfony coding standard and this repository to their respecting folders inside the
38-
phpcs `Standards` directory:
65+
./vendor/bin/phpcs -i
3966

40-
cd /path/to/pear/PHP/CodeSniffer/src/Standards
41-
git clone https://github.com/djoos/Symfony-coding-standard.git Symfony
42-
mv Symfony/Symfony/* Symfony/
43-
git clone https://github.com/mayflower/mo4-coding-standard.git MO4
67+
4. Profit
4468

45-
4. Select the MO4 ruleset as your default coding standard:
69+
./vendor/bin/phpcs --standard=MO4 path/to/my/file.php
4670

71+
5. Optionally, you might set MO4 as default coding standard
72+
73+
./vendor/bin/phpcs --config-set default_standard MO4
74+
75+
76+
### Pear
77+
78+
1. Install phpcs
79+
80+
pear install PHP_CodeSniffer
81+
82+
2. Check out the Symfony coding standard and this repository
83+
84+
git clone https://github.com/djoos/symfony-coding-standard.git
85+
git clone https://github.com/mayflower/mo4-coding-standard.git
86+
87+
3. Select the MO4 ruleset as your default coding standard
88+
89+
phpcs --config-set installed_paths PATH/TO/symfony2-coding-standard,PATH/TO/mo4-coding-standard
4790
phpcs --config-set default_standard MO4
4891

49-
5. Profit
92+
4. Profit
93+
94+
phpcs --standard=MO4 path/to/my/file.php
5095

51-
phpcs path/to/my/file.php
96+
5. Optionally, you might set MO4 as default coding standard
97+
98+
phpcs --config-set default_standard MO4
5299

53100
## Contributing
54101

55102
See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
56103

57104
## Credit
58105

59-
60106
## License
61107

62108
This project is licensed under the MIT license.

0 commit comments

Comments
 (0)