Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Codesniffer Sniffs Laravel Package

moxio/php-codesniffer-sniffs

Custom PHP_CodeSniffer 3.x sniffs from Moxio to catch subtle PHP bugs and unexpected behavior. Provides a standalone ruleset or individual sniffs for other standards, enforcing safer comparisons, strict base64_decode, switch continue rules, and more.

View on GitHub
Deep Wiki
Context7
v2.6.5

This library can now be used with slevomat/coding-standard up to version 8.26.0.

v2.6.4

This library can now be used with slevomat/coding-standard up to version 8.20.0. Thanks to @Potherca for the patch!

v2.6.3

This library can now be used with slevomat/coding-standard up to version 8.15.0.

v2.5.7

This library can now be used with slevomat/coding-standard up to version 8.8.0. Thanks @mjrider for the patch.

v2.5.6

This library can now be used with slevomat/coding-standard up to version 8.6.2. Thanks @agriemink for the patch.

v2.5.5

This library can now be used with slevomat/coding-standard up to version 8.1.0. Thanks @rmikalkenas for the patch.

v2.5.4

This library can now be used with slevomat/coding-standard up to version 7.2.1. Thanks @rmikalkenas for the patch.

v2.5.3

This library can now be used with slevomat/coding-standard up to version 7.0.18. Thanks @rmikalkenas for the patch.

v2.5.2

This library can now be used with slevomat/coding-standard up to version 7.0.15. Thanks @Jeroeny for the patch.

v2.5.1

This release adds compatibility with a small set of slevomat/coding-standard 7.0.x releases. See #10 for details.

v2.5.0

Added compatibility with PHP 8.

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

v2.4.0

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

v2.3.0

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.

v2.2.0

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.

v2.1.0

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.

v2.0.0

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.

v1.6.0

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.

v1.5.0

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).

v1.4.1

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)!

v1.4.0

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.

v1.3.0

Added new sniff Moxio.PHP.DisallowImplicitMicrotimeAsString. This sniff disallows calls to microtime() without the $get_as_float argument being explicitly set. By default, microtime has a string as its return value ("msec sec"), which is unexpected and cannot be naively cast to float, making it error-prone. It is still possible to set this argument to false, but in that case you have probably thought about this.

v1.2.1

Fixed false positives by Moxio.PHP.DisallowArrayCombinersWithSingleArray when using argument unpacking, e.g. array_merge(...$arrays). In general, this allows sniffs extending AbstractFunctionCallSniff to be skipped when such unpacked arguments are present.

v1.2.0

Added new sniff Moxio.PHP.DisallowArrayCombinersWithSingleArray. This sniff disallows calls to functions that combine two or more with only a single array given as an argument. This applies to functions like array_merge(_recursive), array_replace(_recursive) and all variants of array_diff and array_intersect. Such a call does not make sense, and is most likely a result of a misplaced comma or parenthesis.

v1.1.1

AbstractFunctionCallSniff now correctly handles short array syntax in function call parameters. In particular this fixes #2. Thanks to Ondřej Mirtes (@ondrejmirtes) for reporting this issue.

Added PHPUnit tests.

v1.1.0

Added new sniff Moxio.PHP.DisallowUniqidWithoutMoreEntropy. This sniff disallows calls to uniqid() without the $more_entropy parameter being set to true, because such calls can harm performance.

v1.0.0

From this release, the sniffs are supported (only) with PHP_CodeSniffer version 3.x.

The sniff classes have been renamed in accordance with the namespacing requirement of PHP_CodeSniffer 3.

  • Moxio_Sniffs_PHP_DisallowBareContinueInSwitchSniff -> Moxio\Sniffs\PHP\DisallowBareContinueInSwitchSniff
  • Moxio_Sniffs_PHP_DisallowImplicitLooseComparisonSniff -> Moxio\Sniffs\PHP\DisallowImplicitLooseComparisonSniff
  • Moxio_Sniffs_Abstract_AbstractFunctionCallSniff -> Moxio\Sniffs\AbstractFunctionCallSniff

Thanks to Petr Bugyík (@o5) for testing this version with the final 3.x release of PHP_CodeSniffer.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor