PHPackages                             kapersoft/awesome-rector-rules - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kapersoft/awesome-rector-rules

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kapersoft/awesome-rector-rules
==============================

A collection of some awesome Rector rules

1.0.0(11mo ago)022[4 PRs](https://github.com/kapersoft/awesome-rector-rules/pulls)MITPHPPHP ^8.2CI passing

Since Jun 3Pushed 1mo agoCompare

[ Source](https://github.com/kapersoft/awesome-rector-rules)[ Packagist](https://packagist.org/packages/kapersoft/awesome-rector-rules)[ GitHub Sponsors](https://github.com/kapersoft)[ RSS](/packages/kapersoft-awesome-rector-rules/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

kapersoft/awesome-rector-rules
==============================

[](#kapersoftawesome-rector-rules)

A set of awesome [Rector](https://github.com/rectorphp/rector) rules.

Installation
------------

[](#installation)

Install via [Composer](https://getcomposer.org/):

```
composer require kapersoft/awesome-rector-rules --dev
```

Then register the rules in your `rector.php` config:

```
use Kapersoft\AwesomeRectorRules\NullableTypeToUnionTypeRector;
use Kapersoft\AwesomeRectorRules\MoveNullToEndOfUnionTypeRector;

return static function (Rector\Config\RectorConfig $rectorConfig): void {
    $rectorConfig->rules([
        NullableTypeToUnionTypeRector::class,
        MoveNullToEndOfUnionTypeRector::class,
    ]);
};
```

Included Rector Rules
---------------------

[](#included-rector-rules)

### 1. NullableTypeToUnionTypeRector

[](#1-nullabletypetouniontyperector)

**Description:** Converts nullable types (e.g., `?int`) to explicit union types with `null` (e.g., `int|null`).

**Before:**

```
function someFunction(?int $value): ?string
{
    return null;
}
```

**After:**

```
function someFunction(int|null $value): string|null
{
    return null;
}
```

### 2. MoveNullToEndOfUnionTypeRector

[](#2-movenulltoendofuniontyperector)

**Description:** Moves `null` to the end of union types for consistency (e.g., `null|string` → `string|null`).

**Before:**

```
function someFunction(null|string $param): null|int
{
}
```

**After:**

```
function someFunction(string|null $param): int|null
{
}
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for a history of changes.

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.

Security
--------

[](#security)

See [SECURITY.md](SECURITY.md) for the security policy and reporting guidelines.

License
-------

[](#license)

This project is licensed under the [MIT License](LICENSE).

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance73

Regular maintenance activity

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

341d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b282b144777d8ee6a9f1d468dd4fd44e549e337fee20857af65252fa505aeca?d=identicon)[kapersoft](/maintainers/kapersoft)

---

Top Contributors

[![kapersoft](https://avatars.githubusercontent.com/u/13007854?v=4)](https://github.com/kapersoft "kapersoft (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

phpstatic analysisrefactoringrector

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kapersoft-awesome-rector-rules/health.svg)

```
[![Health](https://phpackages.com/badges/kapersoft-awesome-rector-rules/health.svg)](https://phpackages.com/packages/kapersoft-awesome-rector-rules)
```

###  Alternatives

[bmitch/churn-php

Discover files in need of refactoring.

1.4k1.5M12](/packages/bmitch-churn-php)[mrpunyapal/rector-pest

Rector upgrade rules for Pest - refactoring and best practices for Pest testing framework

4717.6k18](/packages/mrpunyapal-rector-pest)[psalm/attributes

A collection of PHP 8 Attributes that Psalm can understand

19120.0k2](/packages/psalm-attributes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
