Try Rector
Docs
Hire Team
Find Rule
Blog
Contact
AST
Try Rector
Docs
Hire Team
Find Rule
Blog
Contact
AST
Rector run Failed:
{ "totals": { "changed_files": 0, "errors": 1 }, "errors": [ { "message": "System error: \"Attempt to assign property \"type\" on null\"\nRun Rector with \"--debug\" option and post the report here: https://github.com/rectorphp/rector/issues/new", "file": "/var/www/storage/demo/vy5a3fltk08ul6ytcatd/rector_analyzed_file.php", "line": 75 } ] }
Run Rector on your code to see what it can do for you:
PHP snippet to change
<?php use PHPUnit\Framework\TestCase; final class SomeTest extends TestCase { protected function setUp(): void { $this->someServiceMock = $this->createMock(SomeService::class); } public function testOne(): void { $someObject = new SomeClass($this->someServiceMock); } }
Config
rector.php
<?php declare(strict_types=1); use Rector\Config\RectorConfig; use Rector\PHPUnit\PHPUnit120\Rector\Class_\PropertyCreateMockToCreateStubRector; return RectorConfig::configure() ->withRules([PropertyCreateMockToCreateStubRector::class]);
Run Rector
Rector version:
bc1720
- released at 2026-06-02 21:36