Skip to content

Commit

Permalink
Merge pull request #72 from sasezaki/default-rule-enables
Browse files Browse the repository at this point in the history
Change default enable rules
  • Loading branch information
sasezaki committed Feb 10, 2024
2 parents 3f78b53 + a552379 commit 3032109
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
* [PSR-3 Meta Document](https://www.php-fig.org/psr/psr-3/meta/)

> [!IMPORTANT]
> It is planned to change default rule settings.
> Since `0.20.0`, changed default rule settings.
* MessageStaticStringRule would be enabled by default.
* ContextRequireExceptionKeyRule would be disabled by default.
* [Recommendation] write these parameters to your project's `phpstan.neon`
* MessageStaticStringRule is enabled by default.
* ContextRequireExceptionKeyRule is disabled by default.
* [Recommendation] write these parameters to your project's `phpstan.neon`.

```neon
parameters:
Expand Down Expand Up @@ -182,19 +182,16 @@ Then, `debug`| `info` | `notice` LogLevel is ignored for report.
}
```

* If you want to disable this rule, please add `enableContextRequireExceptionKeyRule` as false.
* If you want to enable this rule, please add `enableContextRequireExceptionKeyRule` as true.

```neon
parameters:
sfpPsrLog:
enableContextRequireExceptionKeyRule: false
enableContextRequireExceptionKeyRule: true
```

### MessageStaticStringRule

> [!IMPORTANT]
> This Rule is currently experimental.
| :pushpin: _error identifier_ |
| --- |
| sfp-psr-log.messageNotStaticString |
Expand All @@ -208,12 +205,12 @@ $logger->info(sprintf('Message contains %s variable', $var));

#### Configuration

* If you want to enable this rule, please add `enableMessageStaticStringRule` as true.
* If you want to disable this rule, please add `enableMessageStaticStringRule` as false.

```neon
parameters:
sfpPsrLog:
enableMessageStaticStringRule: true
enableMessageStaticStringRule: false
```

## Installation
Expand Down
2 changes: 1 addition & 1 deletion example/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ parameters:
paths:
- %currentWorkingDirectory%/example/src
sfpPsrLog:
# enableContextRequireExceptionKeyRule: true
enableContextRequireExceptionKeyRule: true
enableMessageStaticStringRule: true
reportContextExceptionLogLevel: 'notice'
contextKeyOriginalPattern: '#\A[A-Za-z0-9-]+\z#'
Expand Down
4 changes: 2 additions & 2 deletions rules.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ parametersSchema:

parameters:
sfpPsrLog:
enableContextRequireExceptionKeyRule: true
enableMessageStaticStringRule: false
enableContextRequireExceptionKeyRule: false
enableMessageStaticStringRule: true
reportContextExceptionLogLevel: 'debug'
contextKeyOriginalPattern: null

Expand Down

0 comments on commit 3032109

Please sign in to comment.