rectorphp / rector-book-feedback

[BOOK] Repository for feedback from readers of Rector book, to improve it continuously
https://leanpub.com/rector-the-power-of-automated-refactoring
15 stars 2 forks source link

Code Improvement page 97 #54

Closed neveldo closed 2 years ago

neveldo commented 2 years ago

Code Improvement

I think code on page 97 could be improved:

Why?

This is not really a mistake I guess, but in the code snippet from this page, you use $rectorConfig->services()->set() to load a rule whereas $rectorConfig->rule() is used everywhere else in the book.

I propose this change

-    $rectorConfig->services()
-        ->set(CaptureReturnValueRector::class);
+    $rectorConfig->rule(CaptureReturnValueRector::class);

Thanks!

TomasVotruba commented 2 years ago

This should be gone by next release :+1: