<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Refactoring on Murat Useinov</title>
    <link>https://useinov.com/tags/refactoring/</link>
    <description>Recent content in Refactoring on Murat Useinov</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 08 Feb 2018 15:40:00 +0300</lastBuildDate>
    <atom:link href="https://useinov.com/tags/refactoring/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Rector: refactoring by machine</title>
      <link>https://useinov.com/posts/2018/rector-machine-refactoring/</link>
      <pubDate>Thu, 08 Feb 2018 15:40:00 +0300</pubDate>
      <guid>https://useinov.com/posts/2018/rector-machine-refactoring/</guid>
      <description>&lt;p&gt;Search for &lt;code&gt;-&amp;gt;fetch(&lt;/code&gt; in a project with old Kohana code and count the hits. A method call on a model, a comment, a line in a test fixture, an unrelated class that happens to have a method with the same name. That is what regex refactoring looks like. Regex does not know a method call from a string literal.&lt;/p&gt;
&lt;p&gt;Rector does. A young tool I found this month: it parses PHP into an AST with nikic/php-parser, applies transformation rules, prints the code back. Rename a class across the whole project. Change a method call, add an argument everywhere. The AST sees that this &lt;code&gt;fetch&lt;/code&gt; is called on that type and touches only those places. Mechanical change becomes exact.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
