Download the PHP package mrpunyapal/rector-pest without Composer

On this page you can find all versions of the php package mrpunyapal/rector-pest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rector-pest

Check official Rector Plugin

Rector Pest

Latest Version on Packagist Total Downloads on Packagist CI

Rector rules for PestPHP to improve code quality and help with version upgrades.

Rector Pest now also exposes a semantic remediation layer for safe Pest-specific diagnostics. Canonical issue identifiers, semantic metadata, and diagnostic-to-fix mapping live inside this package so Rector rules can stay independent from any single analyzer while still remaining ready for future PestStan interoperability.

Available Rules

See all available Pest rules here. See the semantic architecture and interoperability contract here.

Installation

Available Rule Sets

Code Quality

Improve your Pest tests with better readability and expressiveness.

The code-quality set also fixes a small set of PestStan-aligned anti-patterns, including static Pest callbacks that actually require instance binding, invalid beforeAll()/afterAll() usage inside describe() blocks, invalid literal repeat() counts, and redundant literal type expectations when another matcher keeps the chain meaningful. Empty test closures and impossible literal/type combinations remain modeled in the semantic registry, but they are not auto-fixed when the runtime semantics would change or the intent would become ambiguous.

These semantic fixes do not require PestStan at runtime for package consumers. This repository still keeps PestStan as a development-only dependency for its own PHPStan configuration, while Rector Pest itself owns the canonical issue registry and consumes analyzer diagnostics through stable identifiers instead of direct analyzer coupling.

Set Description
PestSetList::PEST_CODE_QUALITY Converts expect() assertions to use Pest's built-in matchers for better readability
PestSetList::PEST_CHAIN Merges multiple expect() calls into chained expectations and optimizes their order.
PestSetList::PEST_LARAVEL Laravel-specific rules (requires illuminate/support): converts Str:: equality checks to Pest string case matchers
PestSetList::PEST_MIGRATION PHPUnit → Pest migration rules (opt-in): converts assertions, data providers, and test structure
PestSetList::PEST_BROWSER Pest Browser code-quality rules (requires pestphp/pest-plugin-browser): converts expect($page->getter()) patterns to dedicated browser assertion methods

Version Upgrade Sets

Use PestLevelSetList to automatically upgrade to a specific Pest version. Sets for higher versions include sets for lower versions.

Set Description
PestLevelSetList::UP_TO_PEST_30 Upgrade from Pest v2 to v3
PestLevelSetList::UP_TO_PEST_40 Upgrade from Pest v2/v3 to v4 (includes v3 changes)

Manual Version Configuration

Use PestSetList if you only want changes for a specific version:

Set Description
PestSetList::PEST_30 Pest v2 → v3 migration rules
PestSetList::PEST_40 Pest v3 → v4 migration rules

Chaining Expectations

The PEST_CHAIN set automatically merges multiple expect() calls into a single chained expression.

Before:

After:

Formatting rules (requires rector/rector 2.4.1+):

Note: On rector/rector versions older than 2.4.1, chaining still works but all method calls are printed inline on a single line.

PHPUnit to Pest Migration

The PEST_MIGRATION set helps convert PHPUnit test patterns to Pest equivalents. This is an opt-in set — review changes carefully after applying.

Included rules:

Rule Description
ConvertAssertToExpectRector Converts $this->assert*() calls to expect()-> chains
ConvertExpectExceptionToThrowRector Converts $this->expectException*() plus the throwing call to expect(fn() => ...)->toThrow()

Pest Browser Testing

The PEST_BROWSER set improves code quality of tests written with pestphp/pest-plugin-browser. It converts verbose expect($page->getter()) patterns into the plugin's dedicated browser assertion methods, producing clearer failure messages and more readable tests.

Requirement: The target project must have pestphp/pest-plugin-browser installed.

Included rules:

Rule Transforms
UseBrowserValueAssertionsRector expect($page->value($sel))->toBe($v) → $page->assertValue($sel, $v) and negated form → assertValueIsNot
UseBrowserAriaAndDataAttributeAssertionsRector expect($page->attribute($sel, 'aria-*'))->toBe($v) → $page->assertAriaAttribute($sel, $attr, $v) and data-* form → assertDataAttribute
UseBrowserAttributeAssertionsRector expect($page->attribute($sel, $attr))->toBe/toContain/not->toContain/toBeNull → assertAttribute, assertAttributeContains, assertAttributeDoesntContain, assertAttributeMissing
UseBrowserSourceAssertionsRector expect($page->content())->toContain($html) → assertSourceHas and negated form → assertSourceMissing
UseBrowserScriptAssertionsRector expect($page->script($expr))->toBe/toEqual($v) → $page->assertScript($expr, $v)
UseBrowserUrlAssertionsRector expect($page->url())->toBe($url) → $page->assertUrlIs($url)

URL assertions scope: only assertUrlIs is covered because it is the only URL-related assertion that has a direct expect($page->getter())->toBe() equivalent. Path, scheme, host, port, query-string, and fragment assertions (assertPathIs, assertSchemeIs, assertHostIs, etc.) have no expect() counterparts in the plugin and are out of scope.

Aria/data attribute assertions scope: assertAriaAttribute and assertDataAttribute are covered by UseBrowserAriaAndDataAttributeAssertionsRector. Note that the plugin methods accept the attribute name without the aria-/data- prefix — the rule strips the prefix automatically.

Before:

After:

Using Individual Rules

You can also use individual rules instead of sets:

Running Rector

Semantic Interoperability

Rector Pest separates three concerns:

That split keeps the transformation layer conservative. For example, redundant literal type cleanup only removes checks when the literal value is deterministic and the surrounding chain does not branch or transform the expectation subject. Static callback cleanup also distinguishes nested Pest callbacks from nested non-Pest closure trees so outer describe() callbacks are not rewritten just because an inner hook needs instance binding.

The current semantic contract is documented in docs/semantic-architecture.md.

Requirements

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

The MIT License (MIT). Please see License File for more information.


All versions of rector-pest with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
rector/rector Version ^2.0
symplify/rule-doc-generator-contracts Version ^11.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mrpunyapal/rector-pest contains the following files

Loading the files please wait ...