Skip to content

Commit

Permalink
Merge pull request #37 from localheinz/feature/rules
Browse files Browse the repository at this point in the history
Enhancement: Extract rules.neon
  • Loading branch information
localheinz committed Nov 25, 2018
2 parents 9b20da1 + 677a345 commit e73d062
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

For a full diff see [`0.2.0...master`](https://github.com/localheinz/phpstan-rules/compare/0.2.0...master).

## [`0.3.0`](https://github.com/localheinz/phpstan-rules/releases/tag/0.3.0)

For a full diff see [`0.2.0...0.3.0`](https://github.com/localheinz/phpstan-rules/compare/0.2.0...0.3.0).

### Added

* added `Functions\NoNullableReturnTypeDeclarationRule`, which reports an
Expand All @@ -32,6 +36,8 @@ For a full diff see [`0.2.0...master`](https://github.com/localheinz/phpstan-rul
* added `Methods\NoParameterWithNullableTypeDeclarationRule`, which reports an
error when a method declared in an anonymous class, a class, or an interface
has a parameter with a nullable type declaration ([#35](https://github.com/localheinz/phpstan-rules/pull/35)), by [@localheinz](https://github.com/localheinz)
* extracted `rules.neon`, so you can easily enable all rules by including it
in your `phpstan.neon` ([#37](https://github.com/localheinz/phpstan-rules/pull/37)), by [@localheinz](https://github.com/localheinz)

## [`0.2.0`](https://github.com/localheinz/phpstan-rules/releases/tag/0.2.0)

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ This package provides the following rules for use with [`phpstan/phpstan`](https
* [`Localheinz\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule`](https://github.com/localheinz/phpstan-rules#methodsnoparameterwithnullabletypedeclarationrule)
* [`Localheinz\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule`](https://github.com/localheinz/phpstan-rules#methodsnoparameterwithnulldefaultvaluerule)

:bulb: If you want to use all of these rules, include [`rules.neon`](rules.neon) in your `phpstan.neon`:

```neon
includes:
- vendor/localheinz/phpstan-rules/rules.neon
```

You probably want to use these rules on top of [`phpstan/phpstan-strict-rules`](https://github.com/phpstan/phpstan-strict-rules).

### `Classes\AbstractOrFinalRule`

This rule reports an error when a non-anonymous class is neither `abstract` nor `final`.
Expand Down
12 changes: 1 addition & 11 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon

rules:
- Localheinz\PHPStan\Rules\Classes\AbstractOrFinalRule
- Localheinz\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule
- Localheinz\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule
- Localheinz\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule
- Localheinz\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule
- Localheinz\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule
- Localheinz\PHPStan\Rules\Methods\NoNullableReturnTypeDeclarationRule
- Localheinz\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule
- Localheinz\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule
- rules.neon
10 changes: 10 additions & 0 deletions rules.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
- Localheinz\PHPStan\Rules\Classes\AbstractOrFinalRule
- Localheinz\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule
- Localheinz\PHPStan\Rules\Closures\NoParameterWithNullableTypeDeclarationRule
- Localheinz\PHPStan\Rules\Functions\NoNullableReturnTypeDeclarationRule
- Localheinz\PHPStan\Rules\Functions\NoParameterWithNullDefaultValueRule
- Localheinz\PHPStan\Rules\Functions\NoParameterWithNullableTypeDeclarationRule
- Localheinz\PHPStan\Rules\Methods\NoNullableReturnTypeDeclarationRule
- Localheinz\PHPStan\Rules\Methods\NoParameterWithNullDefaultValueRule
- Localheinz\PHPStan\Rules\Methods\NoParameterWithNullableTypeDeclarationRule

0 comments on commit e73d062

Please sign in to comment.