<?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: Aliu-zhongzheng</title>
    <description>The latest articles on DEV Community by Aliu-zhongzheng (@aliuzhongzheng).</description>
    <link>https://dev.to/aliuzhongzheng</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4265725%2Ff5c002e1-4396-4e76-9195-d40665dfb285.png</url>
      <title>DEV Community: Aliu-zhongzheng</title>
      <link>https://dev.to/aliuzhongzheng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aliuzhongzheng"/>
    <language>en</language>
    <item>
      <title>Nobody can tell you whether the language layer of an old Laravel project breaks — so I built a CLI</title>
      <dc:creator>Aliu-zhongzheng</dc:creator>
      <pubDate>Thu, 26 Nov 2026 01:28:52 +0000</pubDate>
      <link>https://dev.to/aliuzhongzheng/nobody-can-tell-you-whether-the-language-layer-of-an-old-laravel-project-breaks-so-i-built-a-cli-i4</link>
      <guid>https://dev.to/aliuzhongzheng/nobody-can-tell-you-whether-the-language-layer-of-an-old-laravel-project-breaks-so-i-built-a-cli-i4</guid>
      <description>&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;When someone asks "how much work is it to upgrade this old Laravel app", the answer almost always comes back as one big number. Nobody separates the two very different halves of the job: the language layer (PHP syntax and removed functions) and the framework layer (facades, contracts, config keys, scheduler methods).&lt;/p&gt;

&lt;p&gt;I picked 3 real, unmaintained open-source Laravel projects and ran a static check against PHP 8.0 on all of them with the same tool and the same flags.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;repo&lt;/th&gt;
&lt;th&gt;framework&lt;/th&gt;
&lt;th&gt;stars&lt;/th&gt;
&lt;th&gt;last commit&lt;/th&gt;
&lt;th&gt;PHP files&lt;/th&gt;
&lt;th&gt;hits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;mylxsw/wizard&lt;/td&gt;
&lt;td&gt;5.8&lt;/td&gt;
&lt;td&gt;2267&lt;/td&gt;
&lt;td&gt;2023-03&lt;/td&gt;
&lt;td&gt;194&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vuedo/vuedo&lt;/td&gt;
&lt;td&gt;5.2&lt;/td&gt;
&lt;td&gt;2262&lt;/td&gt;
&lt;td&gt;2020-10&lt;/td&gt;
&lt;td&gt;102&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;drehimself/laravel-ecommerce-example&lt;/td&gt;
&lt;td&gt;6.0&lt;/td&gt;
&lt;td&gt;1018&lt;/td&gt;
&lt;td&gt;2023-01&lt;/td&gt;
&lt;td&gt;168&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;464 files, 4 hits. After reading every hit by hand, exactly &lt;strong&gt;one&lt;/strong&gt; of them is a real language-layer blocker: a call to &lt;code&gt;money_format()&lt;/code&gt;, a function that was removed in PHP 8.0. The other 2 hits are the same false positive, reproduced across projects.&lt;/p&gt;

&lt;p&gt;That is not what most people expect. The thing that actually stops an old Laravel app from running on PHP 8 is not &lt;code&gt;each()&lt;/code&gt;, not PHP 4 style constructors — it is the framework layer, and a static check cannot see any of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the tool does
&lt;/h2&gt;

&lt;p&gt;The CLI is &lt;code&gt;aliu-zhongzheng/laravel-compat&lt;/code&gt;, MIT, on Packagist. It writes no rules of its own. All the actual checking is delegated to PHPCompatibility, invoked through PHP_CodeSniffer. The CLI only does three things: aggregate the results, assign severity, and render a report a human can read.&lt;/p&gt;

&lt;p&gt;One command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vendor/bin/scan ./app --php=8.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It produces two artifacts: &lt;code&gt;build/phpcs.json&lt;/code&gt; (machine-readable raw output) and &lt;code&gt;build/report.md&lt;/code&gt; (a readable Chinese report).&lt;/p&gt;

&lt;p&gt;All three repos used the same exclusions: &lt;code&gt;vendor/&lt;/code&gt;, &lt;code&gt;node_modules/&lt;/code&gt;, &lt;code&gt;storage/&lt;/code&gt;, &lt;code&gt;bootstrap/cache/&lt;/code&gt;, &lt;code&gt;*_ide_helper*.php&lt;/code&gt;, &lt;code&gt;*.blade.php&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The first four are dependencies and runtime artifacts — not the project's own code. &lt;code&gt;_ide_helper.php&lt;/code&gt; is generated by IDE helpers, so scanning it means scanning someone else's docblocks.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;*.blade.php&lt;/code&gt; is worth a paragraph, because it was my first real mistake. PHP_CodeSniffer selects files by extension, so blade templates get treated as PHP files with no code in them, and every one of them raises &lt;code&gt;Internal.NoCodeFound&lt;/code&gt;. On a real 267-file project, that single exclusion dropped the reported file count to 264, cut the hits from 6 to 3, and shortened the run from 5.382s to 4.855s — all of it noise removed.&lt;/p&gt;

&lt;p&gt;Here is what the generated report looks like (sample project, 264 files — not one of the three above):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Faka.doubaocdn.com%2Fs%2FPZuVUT6T4b" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Faka.doubaocdn.com%2Fs%2FPZuVUT6T4b" alt="Generated report" width="801" height="642"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Sample output with labels translated into English for this post. The CLI currently emits Chinese only; an English locale is not implemented yet.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The three repos
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Vuedo/vuedo (Laravel 5.2, 2262 stars, abandoned since Oct 2020)
&lt;/h3&gt;

&lt;p&gt;102 PHP files, zero hits.&lt;/p&gt;

&lt;p&gt;That zero has to be read precisely. It means there is no language-level leftover that PHP 8.0 would break outright: no &lt;code&gt;each()&lt;/code&gt;, no &lt;code&gt;create_function()&lt;/code&gt;, no reversed &lt;code&gt;implode()&lt;/code&gt;, no PHP 4 style constructors. It does &lt;strong&gt;not&lt;/strong&gt; mean this app can run on PHP 8. Laravel 5.2 will not boot on PHP 8, and the reasons are almost entirely in the framework layer, where this tool sees nothing.&lt;/p&gt;

&lt;h3&gt;
  
  
  mylxsw/wizard (Laravel 5.8, 2267 stars, abandoned since Mar 2023)
&lt;/h3&gt;

&lt;p&gt;194 PHP files, 1 hit — and it is a false positive.&lt;/p&gt;

&lt;p&gt;The hit is in &lt;code&gt;routes/console.php&lt;/code&gt;: a closure uses &lt;code&gt;$this&lt;/code&gt;. The rule says a closure outside a class should not have &lt;code&gt;$this&lt;/code&gt;, but Laravel's &lt;code&gt;Artisan::command&lt;/code&gt; binds the closure to a command instance, so &lt;code&gt;$this&lt;/code&gt; is perfectly legal there. This false positive reproduces across projects: two of the three repos have it, at exactly the same path, because it is Laravel's own skeleton file.&lt;/p&gt;

&lt;h3&gt;
  
  
  drehimself/laravel-ecommerce-example (Laravel 6.0, 1018 stars)
&lt;/h3&gt;

&lt;p&gt;168 PHP files, 3 hits, 2 of them real — both on the same function:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;app/Product.php:42&lt;/code&gt; — &lt;code&gt;money_format(...)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app/helpers.php:7&lt;/code&gt; — &lt;code&gt;money_format(...)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;money_format()&lt;/code&gt; was deprecated in PHP 7.4 and removed in PHP 8.0. The official references are the "Backward incompatible changes" section of the PHP 8.0 migration guide, and the removal notice at the top of the function page: &lt;a href="https://www.php.net/manual/en/function.money-format.php" rel="noopener noreferrer"&gt;https://www.php.net/manual/en/function.money-format.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On PHP 8.0 this is not a warning, it is a fatal error: the function does not exist. It is the only real language-layer blocker across all three repos, and the repair surface is small — swap it for &lt;code&gt;NumberFormatter::formatCurrency()&lt;/code&gt; at those two call sites.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this tool cannot tell you
&lt;/h2&gt;

&lt;p&gt;This section matters more than the results, because it decides whether the results can be used as a basis for anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It does not check the framework layer.&lt;/strong&gt; Facade aliases, contract signatures, scheduler methods, renamed config keys — the bulk of the work in a 5.2/5.8/6.0 to 8.x upgrade lives there, and the tool sees none of it. Every report states this in its scope line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Its false positive rate is not low.&lt;/strong&gt; 4 hits across 3 projects, 2 of them the same class of false positive. With a sample of 4, that ratio means nothing statistically, but it does mean one thing: the output is not a to-do list you can hand off unread.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zero hits does not mean upgradable.&lt;/strong&gt; It only rules out one dimension, the PHP language layer. Everything that remains still has to be walked through the framework's own upgrade guide, item by item.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The sample is too small.&lt;/strong&gt; 3 repos and 4 hits is enough to say "the language layer of these projects is usually fairly clean". It is not enough to claim any ratio.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the report is actually good for
&lt;/h2&gt;

&lt;p&gt;If you read it as "tell me whether to upgrade", it does not qualify — half the answer is missing.&lt;/p&gt;

&lt;p&gt;Its only defensible use is the opposite one: before touching the framework layer, get the language layer clean, and put "the language layer is clean" into a deliverable. What a client or a reviewer wants is not a dump of phpcs JSON. It is a report that says which dimension was checked and which one was not — that is harder to produce than raw output, and far more useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  If your results differ
&lt;/h2&gt;

&lt;p&gt;If you run this on your own project and get something different — especially a false positive, or a PHP 8.0 breakage I missed — open an issue in the repo with a minimal reproducible directory structure and the report output, and I will fold the rule or the exclusion into the defaults. If you would rather not sign up for GitHub, describing the project in the comments (framework version, file count, what it hit) counts too.&lt;/p&gt;

&lt;p&gt;Two known false positives so far: a closure using &lt;code&gt;$this&lt;/code&gt; inside &lt;code&gt;routes/console.php&lt;/code&gt; (because &lt;code&gt;Artisan::command&lt;/code&gt; binds the closure, which a static check cannot see), and generated files like &lt;code&gt;_ide_helper.php&lt;/code&gt; being treated as source. Both are now excluded or annotated by default — but there are certainly ones I have not run into yet.&lt;/p&gt;

&lt;p&gt;If English report output is what you actually need, say so in the comments. It is a small change, but I have not prioritized it because there were no users to ask.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/Aliu-zhongzheng/laravel-compat" rel="noopener noreferrer"&gt;https://github.com/Aliu-zhongzheng/laravel-compat&lt;/a&gt;&lt;br&gt;
Package: &lt;a href="https://packagist.org/packages/aliu-zhongzheng/laravel-compat" rel="noopener noreferrer"&gt;https://packagist.org/packages/aliu-zhongzheng/laravel-compat&lt;/a&gt;&lt;br&gt;
Raw reports and case notes: &lt;a href="https://github.com/Aliu-zhongzheng/laravel-compat/tree/master/docs/cases" rel="noopener noreferrer"&gt;https://github.com/Aliu-zhongzheng/laravel-compat/tree/master/docs/cases&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>opensource</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
