Repository navigation
0.17.4
Fixes
- Fixed DocBlockThrows sniff to make sure FQCN adds no extra leading backslash.
- Fixed DocBlockReturnTag sniff for more complex generics.
Improvements
Added Spryker.PHP.DisallowTrailingCommaInSingleLine to avoid side effects with other sniffs.
Added Spryker.ControlStructures.DisallowCloakingCheck to remove unnecessary anti-pattern of cloaking (silencing of non-existence), regarding variables and properties. This is also in sync with stricter 8.2+ in the future, but already now can spot a few typos and no-ops.
Make sure to always declare local variables or class properties before using. Using isset()/empty() is only useful when the key of an array is possibly undefined. This is never the case on local variables or normal class properties.
It has a strict mode (default off) which would also disallow some edge cases and silencing for dynamic property access.
We don't want to go quite as far as this article and say never, but there are some use cases where more appropriate solutions are possible:
$x = !empty($this->property) !== false;
// should be
$x = (bool)$this->property;
if (isset($this->property)) {}
// should be
if ($this->property !== null) {}
if (empty($myTransfer->getFoo()) {}
// should be
if (!$myTransfer->getFoo()) {}For further reference see guidelines.