Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor/
*.phpunit.xml
composer.lock
49 changes: 35 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ You can install the Doctrine Coding Standard as a plugin into your global system

```bash
$ cd /path/to/phpcs/CodeSniffer/Standards
$ git clone https://github.com/doctrine/coding-standard.git Doctrine
$ php composer create-project doctrine/coding-standard Doctrine ~0.1@dev
```

Then you can use it like
Expand All @@ -41,32 +41,53 @@ And just sniff a particular file with
$ phpcs /path/to/some/file/to/sniff.php
```

### 2. Custom installation
### 2. Global installation

You also can install the Doctrine Coding Standard globally:

```bash
$ php composer global require doctrine/coding-standard:~0.1@dev
```

Then you can use it like:

```bash
$ phpcs --standard=~/.composer/vendor/doctrine/coding-standard/Doctrine /path/to/some/file/to/sniff.php
```

Or even set it as default standard:

```bash
$ phpcs --config-set default_standard ~/.composer/vendor/doctrine/coding-standard/Doctrine
```

And just sniff a particular file with:

```bash
$ phpcs /path/to/some/file/to/sniff.php
```

### 3. Custom installation

You can install the Doctrine Coding Standard anywhere you want:

```bash
$ cd /path/to/whatever/directory/you/want
$ git clone https://github.com/doctrine/coding-standard.git Doctrine
$ php composer create-project doctrine/coding-standard /path/to/coding-standard/Doctrine ~0.1@dev
```

Then you can use it like (assuming that you have the `phpcs` binary in your search path):
Then you can use it like:

```bash
$ phpcs --standard=/path/to/whatever/directory/you/want/Doctrine /path/to/some/file/to/sniff.php
$ ./vendor/bin/phpcs --standard=. /path/to/some/file/to/sniff.php
```

### 3. As a composer dependency of your project
### 4. As a composer dependency of your project

You can install the Doctrine Coding Standard as a composer dependency to your particular project.
Just add the following block to your project's `composer.json` file:

```js
{
"require": {
"doctrine/coding-standard": "dev-master"
}
}
```bash
$ php composer require doctrine/coding-standard:~0.1@dev
```

Then you can use it like:
Expand All @@ -82,7 +103,7 @@ If you are contributing to the Doctrine Coding Standard and want to test your co
make sure all dependencies are correctly installed:

```bash
$ php composer.phar install --prefer-source --dev
$ php composer install --prefer-source
```

The option `--prefer-source` is particularly necessary to ensure the test suite from PHP_CodeSniffer is
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
{"name": "Steve Müller", "email": "st.mueller@dzh-online.de"}
],
"require": {
"php": ">=5.3"
"php": ">=5.3",
"squizlabs/php_codesniffer": "~1.0"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Sorry but why ~1.0?! Now php_codesniffer has 2.0 release

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gianarb It was just copied from line bellow: https://github.com/doctrine/coding-standard/pull/4/files#diff-b5d0ee8c97c7abd7e3fa29b9a27d1780L16

For bumping to PHP_CodeSniffer 2.0 I'd recommend standalone PR. There are many BC breaks.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I noticed this change because in doctrine/DoctrineModule composer was broken :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gianarb You mean this PR has broken something? Could you send link?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gianarb I see, thanks.

},
"require-dev": {
"squizlabs/php_codesniffer": "1.*",
"phpunit/phpunit": "~4.7"
},
"target-dir": "Doctrine"
"target-dir": "Doctrine",
"extra": {
"branch-alias": {
"dev-master": "0.1-dev"
}
}
}
Loading