Skip to content

Releases: Moxio/php-codesniffer-sniffs

2.5.0

15 Dec 18:39
a4dbcf9

Choose a tag to compare

Added compatibility with PHP 8.

Bumped requirement for slevomat/coding-standard to at least version 6.3.11.

2.4.0

15 Jan 06:49
9bf5e22

Choose a tag to compare

This package is now compatible with slevomat/coding-standard 6.x. Thanks to @Jeroeny for the patch.

2.3.0

31 Jul 09:23

Choose a tag to compare

New sniff added: MoxioSniffs.PHP.DisallowUtf8EncodeDecode. This sniff disallows calls to utf8_encode() and utf8_decode(). These functions can be considered misleading because they only convert to/from ISO-8859-1, and do not 'magically' detect the source/target encoding. Using iconv() or mb_convert_encoding() instead makes both character encodings that play a role in the conversion explicit.

2.2.0

19 Jul 14:20

Choose a tag to compare

This project now requires PHP 7.1 or newer.

New sniff added: MoxioSniffs.PHP.DisallowMbDetectEncoding, which disallows usage of mb_detect_encoding. This function has a misleading name that implies it can actually detect the encoding of a string, a problem which is generally impossible. Rather it checks a list of encodings until it finds one that could be the right one (i.e. the string is a valid byte sequence according to that encoding). Using mb_check_encoding (possibly in a loop) instead makes this much more explicit. See this talk for more background information on this topic.

2.1.0

04 Jul 17:50

Choose a tag to compare

New sniff added: MoxioSniffs.PHP.DisallowDateTime: This sniff disallows usage of \DateTime and promotes the use of \DateTimeImmutable instead. The former being mutable can lead to some subtle but nasty bugs. Thanks to @nikolaposa for the blogpost that inspired this sniff, and to the folks at @slevomat for their great collection of helpers for PHP_CodeSniffer.

2.0.0

08 Nov 10:28

Choose a tag to compare

This major release contains a backward incompatible change to the 'standard' name (Moxio to MoxioSniffs) and associated namespace (Moxio\Sniffs to Moxio\CodeSniffer\MoxioSniffs\Sniffs). This change is meant to emphasize the character of this 'standard' as a set of pick-and-match sniffs rather than a complete coding standard, and to prevent naming conflicts with our internal company coding standard. Please consult the upgrading instructions.

1.6.0

02 Nov 15:32

Choose a tag to compare

New sniff added: Moxio.PHP.DisallowImplicitIteratorToArrayWithUseKeys. This sniff disallows calls to iterator_to_array() without the $use_keys argument being explicitly set. By default, iterator_to_array uses the keys provided by the iterator. This behavior is often desired for associative arrays, but can cause unexpected results for 'list-like' arrays. Explicitly requiring the parameter to be set ensures that the developer has to think about which behavior is desired for the situation at hand. Thanks to @hollodotme for drawing our attention to this 'risky' default behavior.

1.5.0

01 Nov 07:13
461799b

Choose a tag to compare

New sniff added: Moxio.PHP.DisallowImplicitLooseBase64Decode. This sniff disallows implicit non-strict usage of the base64_decode function. By default, this function silently discards invalid characters, which may be unexpected and undesirable. Using this sniff, one needs to explicitly opt-in to this behavior, making it a deliberate choice. Thank you @dheineman for this contribution (#5).

1.4.1

31 Oct 07:46

Choose a tag to compare

This project is now automatically detected by DealerDirect/phpcodesniffer-composer-installer, so that (if that plugin is used) PHP_CodeSniffer can reference the standard by name. Thank you @dheineman for the PR (#4)!

1.4.0

15 Mar 15:20

Choose a tag to compare

Changed Moxio.PHP.ImplicitLooseComparisonSniff to also apply to array_keys. When called with two or more parameters, array_keys essentially behaves like a multi-valued array_search. For that variant, we now also disallow implicit loose comparisons, like we also already do for array_search. Calls to array_keys with just a single parameter (i.e. without $search_value) are unaffected.