Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Merged rules

Some rules exist in several upstream tools under different names. For example, PHP-CS-Fixer’s logical_operators and Rector’s LogicalToBooleanRector both turn and into &&. Pun has one rule for each.

  • pun migrate maps every upstream name to the merged rule.
  • A pun.toml, override, or -A, -W, or -D flag that names an old ID stops with an error that names the new ID.
  • pun explain <old ID> prints the merged rule.
Old ID Now Upstream names
lint/arrays/prefer-array-append lint/style/no-array-push ChangeArrayPushToArrayAssign, array_push
lint/classes/no-null-property-init lint/classes/no-null-property-default RemoveNullPropertyInitialization, no-null-property-init, no_null_property_initialization
lint/classes/no-redundant-readonly-property lint/classes/no-redundant-readonly RemoveReadonlyPropertyVisibilityOnReadonlyClass, no-redundant-readonly, no_redundant_readonly_property
lint/classes/prefer-self-over-static lint/classes/prefer-self-in-final ConvertStaticToSelf, redundant-static, self_static_accessor
lint/classes/prefer-serialize-method lint/style/no-sleep-wakeup SleepToSerialize, WakeupToUnserialize, modern_serialization_methods
lint/classes/prefer-unserialize-method lint/style/no-sleep-wakeup SleepToSerialize, WakeupToUnserialize, modern_serialization_methods
lint/complexity/no-boolean-literal-compare lint/complexity/prefer-simple-condition BooleanNotIdenticalToNotIdentical, SimplifyBoolIdenticalTrue, SimplifyConditions
lint/complexity/no-negated-and lint/complexity/no-negated-group NegatedAndsToPositiveOrs, SimplifyDeMorganBinary
lint/complexity/no-negated-comparison lint/complexity/prefer-simple-condition BooleanNotIdenticalToNotIdentical, SimplifyBoolIdenticalTrue, SimplifyConditions
lint/complexity/no-redundant-nullable-check lint/complexity/no-redundant-null-check SimplifyIfNotNullReturn, SimplifyIfNullableReturn
lint/complexity/prefer-coalesce-chain lint/complexity/prefer-null-coalesce ArrayKeyExistsTernaryThenValueToCoalescing, ConsecutiveNullCompareReturnsToNullCoalesceQueue, SimplifyForeachToCoalescing
lint/complexity/prefer-coalesce-over-foreach lint/complexity/prefer-null-coalesce ArrayKeyExistsTernaryThenValueToCoalescing, ConsecutiveNullCompareReturnsToNullCoalesceQueue, SimplifyForeachToCoalescing
lint/complexity/prefer-empty-array-identical lint/complexity/prefer-empty-array-compare SimplifyEmptyArrayCheck, SimplifyEmptyCheckOnEmptyArray
lint/complexity/prefer-in-array-over-foreach lint/complexity/prefer-in-array ForeachToInArray, RepeatedOrEqualToInArray, SimplifyArraySearch
lint/complexity/prefer-in-array-over-search lint/complexity/prefer-in-array ForeachToInArray, RepeatedOrEqualToInArray, SimplifyArraySearch
lint/control-flow/prefer-returned-condition lint/control-flow/prefer-bool-return SimplifyIfReturnBool, simplified_if_return
lint/dead-code/no-always-true-instanceof-assert lint/dead-code/no-always-true-instanceof RemoveDeadInstanceOf, RemoveDeadInstanceOfAssert, instanceof.alwaysTrue
lint/dead-code/no-bool-ternary lint/dead-code/no-useless-ternary RemoveUselessTernary, SimplifyTautologyTernary, UnnecessaryTernaryExpression
lint/dead-code/no-empty-loop lint/dead-code/no-empty-block RemoveDeadIfForeachFor, RemoveDeadLoop, no-empty-loop
lint/dead-code/no-mirror-assignment lint/dead-code/no-self-assignment Pun/no_self_assignment, SimplifyMirrorAssign, no-self-assignment
lint/dead-code/no-null-default-argument lint/dead-code/no-redundant-default-argument RemoveArgumentFromDefaultParentCall, RemoveNullArgOnNullDefaultParam, RemoveNullNamedArgOnNullDefaultParam
lint/dead-code/no-null-default-named-argument lint/dead-code/no-redundant-default-argument RemoveArgumentFromDefaultParentCall, RemoveNullArgOnNullDefaultParam, RemoveNullNamedArgOnNullDefaultParam
lint/dead-code/no-overwritten-assignment lint/dead-code/no-unused-assignment RemoveDoubleAssign, RemoveUnusedVariableAssign, no-dead-store, no-redundant-variable
lint/dead-code/no-tautology-ternary lint/dead-code/no-useless-ternary RemoveUselessTernary, SimplifyTautologyTernary, UnnecessaryTernaryExpression
lint/dead-code/no-unused-test-method-param lint/dead-code/no-unused-private-method-param RemoveTestsOverriddenPrivateMethodParameter, RemoveUnusedPrivateMethodParameter
lint/dead-code/no-useless-variable lint/control-flow/no-return-assignment SimplifyUselessVariable, inline-variable-return, return_assignment
lint/functions/no-unused-closure-variable lint/functions/no-unused-closure-use RemoveUnusedClosureVariableUse, UnusedClosureUsesRule, closure.unusedUse, closure.unusedUseFlow, lambda_not_used_import, no-unused-closure-capture
lint/laravel/prefer-query-builder-call lint/laravel/no-implicit-model-query EloquentMagicMethodToQueryBuilder, Pun/no_implicit_model_query, no-implicit-model-query
lint/laravel/prefer-status-assertion-method lint/laravel/prefer-dedicated-status-assertion AssertStatusToAssertMethod, Pun/prefer_dedicated_status_assertion, prefer-dedicated-status-assertion
lint/laravel/prefer-validation-rule-array lint/laravel/prefer-array-validation-rules Pun/prefer_array_validation_rules, ValidationRuleArrayStringValueToArray, prefer-array-validation-rules
lint/operators/prefer-boolean-and-or lint/operators/no-and-or-keywords LogicalToBoolean, logical_operators
lint/operators/prefer-shorthand-operator lint/style/prefer-compound-assignment CombinedAssign, long_to_shorthand_operator, use-compound-assignment
lint/pest/no-expect-exception lint/pest/prefer-to-throw ConvertExpectExceptionToThrow, UseToThrow
lint/pest/no-focused-test lint/pest/no-only Pun/no_only, RemoveOnly, no-only
lint/pest/prefer-comparison-matchers lint/pest/prefer-simpler-expectation Pun/use_simpler_expectation, SimplifyComparisonExpectations, use-simpler-expectation
lint/pest/prefer-to-be-true-false lint/pest/prefer-specific-expectations Pun/use_specific_expectations, SimplifyToLiteralBoolean, use-specific-expectations
lint/php-8.4/prefer-array-all lint/php-8.4/prefer-array-find ForeachToArrayAll, ForeachToArrayAny, ForeachToArrayFind, ForeachToArrayFindKey
lint/php-8.4/prefer-array-any lint/php-8.4/prefer-array-find ForeachToArrayAll, ForeachToArrayAny, ForeachToArrayFind, ForeachToArrayFindKey
lint/php-8.4/prefer-array-find-key lint/php-8.4/prefer-array-find ForeachToArrayAll, ForeachToArrayAny, ForeachToArrayFind, ForeachToArrayFindKey
lint/phpunit/prefer-merged-will-return-callback lint/phpunit/prefer-will-return-callback MergeWithCallableAndWillReturn, VoidMethodWithCallbackToWillReturnCallback
lint/phpunit/prefer-same-for-scalars lint/phpunit/prefer-assert-same AssertEqualsToSame, php_unit_strict, strict-assertions
lint/strings/no-single-argument-sprintf lint/style/no-useless-sprintf UnwrapSprintfOneArgument, no_useless_sprintf
lint/strings/prefer-empty-string-identical lint/style/prefer-empty-string-compare StrlenZeroToIdenticalEmptyString, string_length_to_empty
lint/style/no-dynamic-name lint/style/no-variable-variable VariableVariablesRule, no-variable-variable, variable.dynamicName
lint/style/prefer-class-keyword lint/style/prefer-class-constant StringClassNameToClassConstant, UseClassKeywordForClassNameResolution, class_keyword, no-literal-namespace-string
lint/style/prefer-class-name-constant lint/style/prefer-class-constant StringClassNameToClassConstant, UseClassKeywordForClassNameResolution, class_keyword, no-literal-namespace-string

Last updated on

Was this page helpful?