<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Henrik Gemal</title>
    <description>The latest articles on DEV Community by Henrik Gemal (@gemal).</description>
    <link>https://dev.to/gemal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1341909%2Feb364fdc-499c-44ac-b407-6f7e850a1af3.jpg</url>
      <title>DEV Community: Henrik Gemal</title>
      <link>https://dev.to/gemal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gemal"/>
    <language>en</language>
    <item>
      <title>How to Avoid Adding New Code that Uses Deprecated Code?</title>
      <dc:creator>Henrik Gemal</dc:creator>
      <pubDate>Tue, 25 Jun 2024 11:39:09 +0000</pubDate>
      <link>https://dev.to/gemal/how-to-avoid-adding-new-code-that-uses-deprecated-code-10hk</link>
      <guid>https://dev.to/gemal/how-to-avoid-adding-new-code-that-uses-deprecated-code-10hk</guid>
      <description>&lt;p&gt;Spring cleaning your code? Developers are constantly improving code and adding new features. Sometimes, this includes deprecating older code as newer, faster alternatives become available. However, it's not always feasible to immediately update all instances where the deprecated code is used.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://biz.dinnerbooking.com/"&gt;DinnerBooking&lt;/a&gt;, we've tackled this challenge using &lt;a href="https://phpstan.org/"&gt;PHPStan&lt;/a&gt;. Here’s how:&lt;/p&gt;

&lt;h2&gt;
  
  
  Mark Deprecated Code
&lt;/h2&gt;

&lt;p&gt;First, ensure all deprecated code is clearly marked so that static code analyzers like PHPStan can identify it. Typically, it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * @deprecated
 */
function count() {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Install PHPStan Deprecation Plugin
&lt;/h2&gt;

&lt;p&gt;Now install the PHPStan deprecation plugin from &lt;a href="https://github.com/phpstan/phpstan-deprecation-rules"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate a PHPStan Baseline
&lt;/h2&gt;

&lt;p&gt;Generate a &lt;a href="https://phpstan.org/user-guide/baseline"&gt;baseline&lt;/a&gt; that identifies all instances of deprecated code. You can do this by adding &lt;code&gt;--generate-baseline&lt;/code&gt; to your PHPStan command. The baseline is saved in &lt;code&gt;phpstan-baseline.neon&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrate with CI
&lt;/h2&gt;

&lt;p&gt;Integrate this baseline into your CI pipeline to ensure that no new code referencing deprecated code is introduced.&lt;/p&gt;

&lt;p&gt;By following these steps, we ensure that our codebase remains clean and maintainable, preventing the addition of new code that relies on deprecated functions.&lt;/p&gt;

</description>
      <category>php</category>
      <category>ci</category>
      <category>development</category>
    </item>
    <item>
      <title>Rector keeps your PHP code base fresh and perfect</title>
      <dc:creator>Henrik Gemal</dc:creator>
      <pubDate>Fri, 15 Mar 2024 09:51:10 +0000</pubDate>
      <link>https://dev.to/gemal/rector-keeps-your-php-code-base-fresh-and-perfect-257m</link>
      <guid>https://dev.to/gemal/rector-keeps-your-php-code-base-fresh-and-perfect-257m</guid>
      <description>&lt;p&gt;As part of the journey to PHP perfection, you should embrace &lt;a href="https://getrector.com/"&gt;Rector&lt;/a&gt;. It's a amazing, free, and open-source tool for migrations, code quality, type coverage, pushing &lt;a href="https://phpstan.org/"&gt;PHPStan&lt;/a&gt; to the highest levels, and yes, it can even auto-fix your existing code! It seamlessly integrates into the CI process, making your development workflow smoother than ever.&lt;/p&gt;

&lt;p&gt;No more manual formatting headaches! &lt;a href="https://getrector.com/"&gt;Rector&lt;/a&gt; effortlessly aligns your PHP code with your chosen standards. Plus, it's not just about looks - &lt;a href="https://getrector.com/"&gt;Rector&lt;/a&gt; dives deep into code quality, helping to catch potential bugs before they become issues.&lt;/p&gt;

&lt;p&gt;Did I mention Rector is open source and free to use? What's not to like! It's the latest addition to the arsenal of automated checking tools covering PHP, JavaScript, and CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://getrector.com/"&gt;Get Rector now&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>development</category>
    </item>
    <item>
      <title>Elevate Your PHP Development Game with Composer Tips</title>
      <dc:creator>Henrik Gemal</dc:creator>
      <pubDate>Tue, 12 Mar 2024 21:56:55 +0000</pubDate>
      <link>https://dev.to/gemal/elevate-your-php-development-game-with-composer-tips-1cmh</link>
      <guid>https://dev.to/gemal/elevate-your-php-development-game-with-composer-tips-1cmh</guid>
      <description>&lt;p&gt;Hey fellow PHP developers! If you're knee-deep in PHP code you probably understand the importance of keeping your composer.json file in shipshape. Here's a little gem of wisdom to level up your dependency management game!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Composer-Dependency-Analyser&lt;/strong&gt;: Uncover Hidden Issues! Ever wondered if there are any lurking dead, shadow, or misplaced dependencies in your project? Fear not! Composer-Dependency-Analyser is here to save the day. It meticulously inspects your composer.json, ensuring you're free from any coding cobwebs. 🕷️🚫&lt;br&gt;
More info here: &lt;a href="https://github.com/shipmonk-rnd/composer-dependency-analyser"&gt;https://github.com/shipmonk-rnd/composer-dependency-analyser&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Composer-Normalize&lt;/strong&gt;: Your Organization Sidekick! Let's talk about keeping things neat and tidy! Enter Composer-Normalize. This nifty tool ensures your composer.json file stays impeccably organized and sorted. No more chaotic dependency lists - it's all about that clean, structured vibe! 🌐📑&lt;br&gt;
More info here: &lt;a href="https://github.com/ergebnis/composer-normalize"&gt;https://github.com/ergebnis/composer-normalize&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And you can add both of the above tools to your CI pipeline! Soo embrac the power of automation in our CI process to keep things pristine at all times. Say goodbye to manual sorting headaches and hello to a well-orchestrated, organized development journey.&lt;/p&gt;

&lt;p&gt;Because in the world of PHP development, organized code is happy code!&lt;/p&gt;

</description>
      <category>php</category>
      <category>composer</category>
      <category>development</category>
    </item>
  </channel>
</rss>
