<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://sugarclub.sugarai.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector</link><pubDate>Wed, 10 Sep 2025 18:23:34 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Current Revision posted to Dev Tutorials by Rafael Fernandes on 9/10/2025 6:23:34 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;/path/to/RECTOR/vendor/rector/rector/bin/rector/bin/rector process --clear-cache --dry-run &amp;gt; php83.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.3 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second &lt;code&gt;git commit&lt;/code&gt; to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) /path/to/RECTOR/vendor/rector/rector/bin/rector/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;h3 id="mcetoc_1gub18vs83" class="code-block  css-1si5tit"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;By executing git status you should see all the changes ready to work on PHP 8.3 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;pre class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.3.&lt;/pre&gt;
&lt;p class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.3 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.3 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;
&lt;div class="content"&gt;
&lt;h2 id="mcetoc_1gudgk28f0"&gt;You can move on to the Keeping Compatibility Phase:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/dev-club/w/dev-tutorials/838/keeping-compatibility"&gt;Keeping Compatibility&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/10</link><pubDate>Mon, 17 Mar 2025 13:07:06 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 10 posted to Dev Tutorials by Rafael Fernandes on 3/17/2025 1:07:06 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;/path/to/sugar/vendor/rector/rector/bin/rector/bin/rector process --clear-cache --dry-run &amp;gt; php83.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) /path/to/sugar/vendor/rector/rector/bin/rector/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
 &lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;h3 id="mcetoc_1gub18vs83" class="code-block  css-1si5tit"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;By executing git status you should see all the changes ready to work on PHP 8.3 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;pre class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.3.&lt;/pre&gt;
&lt;p class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.3 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.3 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;
&lt;div class="content"&gt;
&lt;h2 id="mcetoc_1gudgk28f0"&gt;You can move on to the Keeping Compatibility Phase:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/dev-club/w/dev-tutorials/838/keeping-compatibility"&gt;Keeping Compatibility&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/9</link><pubDate>Thu, 20 Apr 2023 14:34:35 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 9 posted to Dev Tutorials by Rafael Fernandes on 4/20/2023 2:34:35 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;By executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;pre class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.2.&lt;/pre&gt;
&lt;p class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/p&gt;
&lt;p class="code-block  css-1si5tit"&gt;&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.2 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.2 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;
&lt;div class="content"&gt;
&lt;h2 id="mcetoc_1gudgk28f0"&gt;You can move on to the Keeping Compatibility Phase:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/dev-club/w/dev-tutorials/838/keeping-compatibility"&gt;Keeping Compatibility&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/8</link><pubDate>Thu, 20 Apr 2023 14:12:58 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 8 posted to Dev Tutorials by Rafael Fernandes on 4/20/2023 2:12:58 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;By executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;pre class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.2.&lt;/pre&gt;
&lt;p class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/p&gt;
&lt;p class="code-block  css-1si5tit"&gt;&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.2 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.2 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/7</link><pubDate>Thu, 20 Apr 2023 14:12:30 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 7 posted to Dev Tutorials by Rafael Fernandes on 4/20/2023 2:12:30 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;pre class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.2.&lt;/pre&gt;
&lt;p class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/p&gt;
&lt;p class="code-block  css-1si5tit"&gt;&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.2 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.2 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/6</link><pubDate>Thu, 20 Apr 2023 14:11:47 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 6 posted to Dev Tutorials by Rafael Fernandes on 4/20/2023 2:11:47 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;p class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.2.&lt;/p&gt;
&lt;p class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.2 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.2 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/5</link><pubDate>Thu, 20 Apr 2023 14:11:03 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 5 posted to Dev Tutorials by Rafael Fernandes on 4/20/2023 2:11:03 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.2.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.2 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.2 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/4</link><pubDate>Wed, 19 Apr 2023 20:01:24 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 4 posted to Dev Tutorials by Rafael Fernandes on 4/19/2023 8:01:24 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;Congratulations, you now have your code compatible with PHP 8.2.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;You can now commit&amp;nbsp;your new code as follows:&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="text"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;PHP 8.2 upgrade refactor&amp;quot;
[master 7ad3bf22] PHP 8.2 upgrade refactor
 1 files changed, 1 insertions(+), 1 deletions(-)&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/3</link><pubDate>Wed, 19 Apr 2023 19:16:27 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 3 posted to Dev Tutorials by Rafael Fernandes on 4/19/2023 7:16:27 PM&lt;br /&gt;
&lt;p&gt;Now that you have your Rector properly configured with your customization, either via MLP or custom code you can continue with a dry-run or run rector automatically.&lt;/p&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/2</link><pubDate>Wed, 19 Apr 2023 13:32:46 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 2 posted to Dev Tutorials by Rafael Fernandes on 4/19/2023 1:32:46 PM&lt;br /&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Now that you have your Rector properly configured with your MLP data.&lt;/p&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending on the config you specified)&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item><item><title>Executing Rector</title><link>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector/revision/1</link><pubDate>Tue, 18 Apr 2023 20:36:58 GMT</pubDate><guid isPermaLink="false">5c521d64-519d-47a6-9065-134618b211bf:9077db19-d8a3-40ae-af68-ef3aae2e8fbd</guid><dc:creator>Rafael Fernandes</dc:creator><comments>https://sugarclub.sugarai.com/dev-club/w/dev-tutorials/836/executing-rector#comments</comments><description>Revision 1 posted to Dev Tutorials by Rafael Fernandes on 4/18/2023 8:36:58 PM&lt;br /&gt;
&lt;h2 id="mcetoc_1guavo72a0"&gt;Dry-run Rector&lt;/h2&gt;
&lt;p&gt;Now that you have your Rector properly configured with your MLP data.&lt;/p&gt;
&lt;p&gt;Dry-run gives you the opportunity to see what Rector has found and will execute/change before it actually does it on your behalf.&lt;/p&gt;
&lt;p&gt;it&amp;#39;s time to dry-run rector by executing the following command.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;cd /path/to/sugar &amp;amp;&amp;amp; rector-0.15.24/bin/rector process --clear-cache --dry-run &amp;gt; php82.diff&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dry run produces a very detailed output file (if you spooled it off to a file) containing the diff and the list of rector rules that were applied to make your code compatible with PHP 8.2 (which we configured it to)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;1 file with changes
===================

1) custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php:0

    ---------- begin diff ----------
@@ @@
 &amp;lt;?php 
  //WARNING: The contents of this file are auto-generated
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, count($active_users));
- $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.count($active_users).&amp;quot;&amp;#39;&amp;quot;);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;current_users&amp;quot;, is_countable($active_users) ? count($active_users) : 0);
+ $this-&amp;gt;ss-&amp;gt;assign(&amp;quot;user_count_param&amp;quot;, &amp;quot;user_count: &amp;#39;&amp;quot;.(is_countable($active_users) ? count($active_users) : 0).&amp;quot;&amp;#39;&amp;quot;);
  
 ?&amp;gt;
    ----------- end diff -----------

Applied rules:
 * AddDefaultValueForUndefinedVariableRector (https://github.com/vimeo/psalm/blob/29b70442b11e3e66113935a2ee22e165a70c74a4/docs/fixing_code.md#possiblyundefinedvariable)
 * CountOnNullRector (https://3v4l.org/Bndc9)

 [OK] 1 file would have changed (dry-run) by Rector                                                                     &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;h2 id="mcetoc_1gub0q34a0"&gt;Execute Rector&lt;/h2&gt;
&lt;p&gt;If your dry-run is clear or you are ready to let Rector auto-update your code, now it&amp;#39;s time&amp;nbsp;to get a second git commit to &amp;quot;clear&amp;quot; the system so we know exactly what rector has done to our system.&lt;/p&gt;
&lt;h3 id="mcetoc_1gub12ta51"&gt;Prepare Git&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   config_override.php
        modified:   custom/application/Ext/Include/modules.ext.php

Untracked files:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to include in what will be committed)
        custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php
        custom/Extension/application/Ext/Include/orderMapping.php
        custom/clients/
        custom/modules/ActivityStream/
        custom/modules/Forecasts/Ext/clients/
        custom/modules/pmse_Project/

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Commit&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;sh-3.2$ git add . &amp;amp;&amp;amp; git commit -am &amp;quot;Before Rector&amp;quot;
[master 33a18416] Before Rector
 422 files changed, 96500 insertions(+)
&lt;/pre&gt;&lt;/p&gt;
&lt;h3 id="mcetoc_1gub14s0p2"&gt;Execute&lt;/h3&gt;
&lt;p&gt;Run the rector process once again, but without &lt;code&gt;--dry-run&lt;/code&gt; and &lt;code&gt;--clear-cache&lt;/code&gt; options as the cache is up to date (the process should look like this):&lt;/p&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="batchfile"&gt;➜  sugar git:(master) rector-0.15.20/bin/rector process                                           
 10/30 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  33%
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;*&amp;nbsp;This may take time, depending on the complexity of the code. In some cases, this can take more than an hour.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;h3 class="code-block  css-1si5tit" id="mcetoc_1gub18vs83"&gt;After Execution (Git diff)&lt;/h3&gt;
&lt;div class="code-block  css-1si5tit"&gt;Once finished, Rector will provide&amp;nbsp;a similar report to the dry-run, but now those files have actually been modified in the filesystem.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;by executing git status you should see all the changes ready to work on PHP 8.2 (or depending the config you specified.&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;/div&gt;
&lt;div class="code-block  css-1si5tit"&gt;&lt;pre class="ui-code" data-mode="php"&gt;sh-3.2$ git status
On branch main
Changes not staged for commit:
  (use &amp;quot;git add &amp;lt;file&amp;gt;...&amp;quot; to update what will be committed)
  (use &amp;quot;git restore &amp;lt;file&amp;gt;...&amp;quot; to discard changes in working directory)
        modified:   custom/Extension/application/Ext/Include/BuildingBlock_HelloWorldDashlet.php

no changes added to commit (use &amp;quot;git add&amp;quot; and/or &amp;quot;git commit -a&amp;quot;)&lt;/pre&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>