PHPackages                             wernerkrauss/silverstripe-rector - 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. wernerkrauss/silverstripe-rector

ActiveRector-extension[Utility &amp; Helpers](/categories/utility)

wernerkrauss/silverstripe-rector
================================

Rector rules for Silverstripe CMS

v1.3(2mo ago)1322.0k↑51.7%7[11 issues](https://github.com/wernerkrauss/silverstripe-rector/issues)[2 PRs](https://github.com/wernerkrauss/silverstripe-rector/pulls)19MITPHPPHP ^7.4 | ^8CI passing

Since Sep 29Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/wernerkrauss/silverstripe-rector)[ Packagist](https://packagist.org/packages/wernerkrauss/silverstripe-rector)[ RSS](/packages/wernerkrauss-silverstripe-rector/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (9)Versions (17)Used By (19)

[![Latest Stable Version](https://camo.githubusercontent.com/8f495b6c2adeac2a10a145f491c2a9fb9848f7628aeb6174a50589c430952b55/687474703a2f2f706f7365722e707567782e6f72672f7765726e65726b72617573732f73696c7665727374726970652d726563746f722f76)](https://packagist.org/packages/wernerkrauss/silverstripe-rector)[![Total Downloads](https://camo.githubusercontent.com/5acda9ee715d820817fc3801f4cfc582c58553ac6de52bc944744ba3a317d15a/687474703a2f2f706f7365722e707567782e6f72672f7765726e65726b72617573732f73696c7665727374726970652d726563746f722f646f776e6c6f616473)](https://packagist.org/packages/wernerkrauss/silverstripe-rector)[![Latest Unstable Version](https://camo.githubusercontent.com/809fa0b31ef83cf0ab89937f21ab7dd22e37e58ee1757d9221971d959a52b162/687474703a2f2f706f7365722e707567782e6f72672f7765726e65726b72617573732f73696c7665727374726970652d726563746f722f762f756e737461626c65)](https://packagist.org/packages/wernerkrauss/silverstripe-rector)[![License](https://camo.githubusercontent.com/76553177d82f9ef26e74434f20a4686e543389300c3c6522aa7bafd386e131df/687474703a2f2f706f7365722e707567782e6f72672f7765726e65726b72617573732f73696c7665727374726970652d726563746f722f6c6963656e7365)](https://packagist.org/packages/wernerkrauss/silverstripe-rector)[![PHPunit](https://github.com/wernerkrauss/silverstripe-rector/actions/workflows/phpunit.yml/badge.svg)](https://github.com/wernerkrauss/silverstripe-rector/actions/workflows/phpunit.yml)

silverstripe-rector
===================

[](#silverstripe-rector)

A developer utility for automatically upgrading deprecated code for Silverstripe CMS. With rules for upgrades for Silverstripe 6.

Table of Contents
-----------------

[](#table-of-contents)

- [About rector](#about-rector)
- [Installation](#installation)
- [Running rector](#running-rector)
- [Docs](#docs)
- [IDE Support (PHPStorm)](#ide-support-phpstorm)
- [Other useful modules you should know about](#other-useful-modules-you-should-know-about)
- [Developing](#developing)
- [TODO](#todo)
- [Thanks to](#thanks-to)
- [Need Help?](#need-help)

About rector
------------

[](#about-rector)

`rector` is a tool for automatic code upgrades and refactorings. See [rector homepage](https://getrector.org/) for more information.

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

[](#installation)

This module is installable via composer. As Rector uses PHPstan, it's a good idea to install `cambis/silverstan`, too.

> Note: if you need to use PHPStan v1 in your project, use v0.x of this module

```
composer require phpstan/extension-installer --dev
composer require cambis/silverstan  --dev
composer require wernerkrauss/silverstripe-rector --dev
vendor/bin/rector init
```

Create a basic `phpstan.neon` file in your project root:

```
parameters:
  level: 1
  paths:
    - app/src
```

This will add all requirements and create a file called `rector.php` in your project root. You'll need to adjust it, e.g. add the code directories to upgrade and the rules to use.

A basic Rector config can look like

```
