lint/pest
Pest (ecosystem: on when composer.lock has pestphp/pest).
no-before-all-in-describe
Replaces invalid beforeAll() and afterAll() hooks inside describe() with beforeEach() and afterEach()
In the coding-style set. Safe fix. Runs when pest is installed.
no-invalid-repeat
Normalizes invalid literal repeat() counts to 1
In the coding-style set. Safe fix. Runs when pest is installed.
no-negated-boolean-matcher
Simplifies double-negative expectations like ->not->toBeFalse() to ->toBeTrue()
In the coding-style set. Safe fix. Runs when pest is installed.
no-only
Remove ->only() from Pest tests.
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
no-redundant-type-expectation
Removes redundant literal type expectations when a later matcher keeps the chain meaningful
In the coding-style set. Safe fix. Runs when pest is installed.
no-redundant-uses
Removes redundant local Pest uses already configured globally in tests/Pest.php
In the coding-style set. Safe fix. Runs when pest is installed.
no-static-test-closure
Removes static from Pest test and hook callbacks that use the test case instance
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-chained-expect
Chains consecutive expect() calls into a single chained expectation, combining calls on the same value and joining different values with ->and() (configurable)
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-dedicated-expectation
Use dedicated Pest matchers (toBeArray(), toStartWith(), toHaveCount(), …) instead of expect(fn(…))->toBeTrue().
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-defer
Replaces deprecated ->tap() method with ->defer() for Pest v3 migration
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-each-modifier
Converts foreach loops with expect() calls to use the ->each modifier
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-expect
Converts $this->assert*() calls to Pest expect() chains
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-extend
Converts uses() and pest()->uses() to pest()->extend() for classes and pest()->use() for traits
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-filesystem-matchers
Simplifies combined filesystem checks to single Pest matchers
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-not-modifier
Simplifies negated expectations by flipping the matcher (e.g., expect(!$x)->toBeTrue() becomes expect($x)->toBeFalse())
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-sequence
Converts consecutive indexed expect() calls to sequence()
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-simpler-expectation
Simplify Pest expectations: expect($a > $b)->toBeTrue() becomes expect($a)->toBeGreaterThan($b), and similar.
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-specific-expectations
Use toBeTrue()/toBeFalse()/toBeNull() instead of toBe(true|false|null).
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-strict-equality-matchers
Converts strict equality expressions to toBe() matcher
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-be-alpha
Converts ctype_alpha() checks to toBeAlpha() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-alpha-numeric
Converts ctype_alnum() checks to toBeAlphaNumeric() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-between
Converts expect($value >= $min && $value <= $max)->toBeTrue() to expect($value)->toBeBetween($min, $max)
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-be-digits
Converts ctype_digit() checks to toBeDigits() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-directory
Converts is_dir() checks to toBeDirectory() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-empty
Converts empty checks and count-zero comparisons to toBeEmpty() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-file
Converts is_file() checks to toBeFile() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-in
Converts strict in_array() checks to the toBeIn() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-infinite
Converts is_infinite() checks to toBeInfinite() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-instance-of
Converts expect($obj instanceof User)->toBeTrue() to expect($obj)->toBeInstanceOf(User::class)
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-be-json
Converts json_decode() null checks to toBeJson() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-list
Converts array_is_list() checks to toBeList() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-lowercase
Converts strtolower() equality checks to toBeLowercase() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-nan
Converts is_nan() checks to toBeNan() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-truthy-falsy
Converts bool cast assertions to toBeTruthy()/toBeFalsy() matchers
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-be-uppercase
Converts strtoupper() equality checks to toBeUppercase() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-url
Converts filter_var($url, FILTER_VALIDATE_URL) checks to toBeUrl() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-be-uuid
Converts UUID regex validation to toBeUuid() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-contain
Converts in_array() checks to toContain() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-contain-equal
Converts in_array(…, false) checks to toContainEqual() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-contain-only-instances-of
Converts ->each->toBeInstanceOf() pattern to toContainOnlyInstancesOf() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-end-with
Converts str_ends_with() checks to toEndWith() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-equal-canonicalizing
Converts sort-then-compare to toEqualCanonicalizing() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-equal-with-delta
Converts expect(abs($a - $b) < $delta)->toBeTrue() to expect($a)->toEqualWithDelta($b, $delta)
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-have-count
Converts expect(count($arr))->toBe(5) to expect($arr)->toHaveCount(5)
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-have-key
Converts array_key_exists() checks to toHaveKey() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-have-keys
Converts chained toHaveKey() calls to toHaveKeys() with array of keys
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-have-length
Converts strlen()/mb_strlen() comparisons to toHaveLength() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-have-method-on-class
Changes expect($object)->toHaveMethod() to expect($object::class)->toHaveMethod() for Pest v3
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-have-properties
Converts chained toHaveProperty() calls to toHaveProperties() with array of properties
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-have-property
Converts property_exists() checks to toHaveProperty() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-have-same-size
Converts expect(count($a))->toBe(count($b)) to expect($a)->toHaveSameSize($b)
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-match
Converts expect(preg_match(“/pattern/”, $str))->toBe(1) to expect($str)->toMatch(“/pattern/”)
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-match-array
Converts multiple array element assertions to toMatchArray() matcher
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-match-object
Converts consecutive toHaveProperty() with values to toMatchObject() matcher
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-to-start-with
Converts str_starts_with() checks to toStartWith() matcher
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
prefer-to-throw
Use expect()->toThrow() instead of expectException() or try/catch in Pest tests.
In the coding-style set. Safe fix. Runs when pest is installed.
prefer-type-matchers
Converts expect(is_array($x))->toBeTrue() to expect($x)->toBeArray()
In the coding-style set. Unsafe fix: it can change behaviour. Runs when pest is installed.
require-type-matcher-first
Ensure type-check matchers (e.g. toBeInt, toBeInstanceOf) appear before value assertions in expect() chains and consecutive expects
In the coding-style set. Safe fix. Runs when pest is installed.