Skip to content

Commit ab5fa07

Browse files
committed
v0.9.0
1 parent 6a24aca commit ab5fa07

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.9.0
4+
- `ReturnTypeDeclarationSniff` do no warn for missing return type when a docbloc like:
5+
`@return {aType}|null` exists for the function.
6+
37
## 0.8.0
48
- Fix bug in `NoAccessorsSniff` and allow for a few method names related to PHP core interfaces.
59
- Exclude `ArrayAccess` methods from `ReturnTypeDeclarationSniff` and `ArgumentTypeDeclarationSniff`.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,19 @@ Customs rules are:
146146

147147
The tree of used rules are listed in the `/docs/rules-list/custom.md` file in this repo.
148148

149+
### Notes
150+
151+
#### Skip `InpsydeCodingStandard.CodeQuality.ReturnTypeDeclaration.NoReturnType` via doc bloc
152+
153+
As of v0.9, when there's no return type declared for a function, but it has a docbloc like:
154+
`@return {$type}|null` and the function _actually_ contains both `null` and not-null return
155+
points **no** warning is shown.
156+
However, if min PHP version is set to 7.1 via php-compatibility `testVersion` config, the warning
157+
**is** shown, because in PHP 7.1 there's the availability for nullable return types.
158+
Also note that the warning **is** shown in case:
159+
- the `@return` docbloc declares more than one not-null types, e.g. `@return Foo|Bar|null`
160+
- the `@return` docbloc types contains "mixed", e.g. `@return mixed|null`.
161+
149162
-------------
150163

151164
# Removing or Disabling Rules

0 commit comments

Comments
 (0)