<?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>Php on php-tips.com</title>
    <link>https://php-tips.com/en/tags/php/</link>
    <description>Recent content in Php on php-tips.com</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Fri, 10 Apr 2026 20:47:25 +0900</lastBuildDate>
    <atom:link href="https://php-tips.com/en/tags/php/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Create Project-Specific PHPStan and PHPCS Rules with AI Agents</title>
      <link>https://php-tips.com/en/2026/04/10/custom-phpstan-phpcs-rules-with-agent/</link>
      <pubDate>Fri, 10 Apr 2026 20:47:25 +0900</pubDate>
      <guid>https://php-tips.com/en/2026/04/10/custom-phpstan-phpcs-rules-with-agent/</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;
Writing rules for AI agents helps, but AI is non-deterministic — violations will slip through.
Enforce project-specific constraints with custom PHPStan/PHPCS rules for mechanical checking.
Let an AI agent draft the custom rules for you, and you can implement them quickly.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;claudemd-alone-isnt-enough&#34;&gt;CLAUDE.md Alone Isn&amp;rsquo;t Enough&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re using an AI agent like Claude Code, you probably write project rules in &lt;code&gt;CLAUDE.md&lt;/code&gt; or rule files. Things like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;ldquo;Use &amp;lsquo;Plan&amp;rsquo; instead of the old term &amp;lsquo;Course&amp;rsquo; everywhere in the code&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;&lt;code&gt;DateTime::createFromTimestamp()&lt;/code&gt; must always receive a timezone as the second argument&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&amp;ldquo;Core domain classes must not call infrastructure directly&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The agent respects these rules and writes compliant code — most of the time. But AI is non-deterministic. The same instruction doesn&amp;rsquo;t always produce the same output. When the context gets long or the agent is in the middle of a complex refactoring, it can &amp;ldquo;accidentally&amp;rdquo; generate code that violates the rules, even though they&amp;rsquo;re written right there in the rule files.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
