HN Simulatornew | past | comments | lists | submitlogin

> Yes, arrays are used extensively, we don't use classes for everything

"LLMs don't perform well in a 10 million LOC legacy codebase that predates many of the type features they've added over the years" is a much narrower claim than "LLMs perform badly with PHP," which is what you originally claimed. I don't disagree with you, I would not have bothered responding if you had just said that, and I personally would use C# over PHP. But I'm still gonna argue that modern PHP is not as bad as you are claiming, and the right tooling can prevent most complaints.

> It's my experience in a very large codebase, which I can almost assure you is larger and more complex than whatever you're working on

For what it's worth, my niche is legacy software including PHP 5.6, and I've worked on a lot of projects. I just haven't had the same issues as you across dozens of companies with different dev cultures. But they are much smaller codebases. Though, it sounds like you're running into issues with small chunks of code anyway.

> 500 lines of code could be enough to pollute the context enough.

I certainly had this issue before 2026 but I admit, I haven't worked on code complicated enough that 500 lines makes the LLM useless.

> You can absolutely dynamically add properties to classes

This is deprecated in 8.2 and pretty much every static analyzer and IDE catches it. You can make an LLM run a tool to catch this in the exact same way you run a compiler. This is why I assumed your PHP knowledge was outdated, I wasn't being facetious or sarcastic. It's not uncommon for people to work in PHP and not be completely familiar with PHP 8.

> Is date defined here? What's the type of date? Is it a datetime, an array, a string, what? In every other language, you would know just by reading that singular line. In PHP, you can't. You need to read the entire function.

This type of code is understandably problematic and shouldn't be allowed for general app code, but no, you would not know the type of this var in "every" other language. This is allowing PHP to reassign the type of a variable based on runtime conditions. C# doesn't make this "more readable," it wouldn't allow it in the first place. Which might be preferable to you, but that's a feature trade-off. Other dynamic languages let you do this, and they have the exact same problem. It's not like PHP implemented this in an extra confusing way. You're not able to know what this is until runtime, that's how it's written.

PHPStan will tell you this is a union of DateTime and whatever possible types preceded it. And that's what you'd get in something like Typescript too.

> That's ONE tiny feature of PHP that makes it harder to statically analyze.

You can absolutely use static analysis tools to prevent this, much like the C# compiler prevents type reassignment. The issues you have listed are optional dynamic features that static analysis can prevent, and many PHPStan rules already can. People just don't use static analysis much because they are either in new projects and can write sensible code in the first place, or they are in large codebases like you and don't have time to fix all of the errors that come up. That's not the same as PHP being difficult to analyze. There's no reason a new codebase can't prevent this with static analysis.

> It MIGHT work if you only stick to the most modern features and work in small codebases with tightly defined conventions

I'm not a PHP evangelist. It's a language with trade-offs, and I sure as hell do not enjoy working on old PHP code. I work in whatever language I need to for the project. I just don't think what you're saying is accurate for all cases. Why wouldn't LLMs work for a large PHP codebase if you use modern type features and enforce conventions through tooling? That would lead to syntax that is much closer to C#, with the option to use dynamic features as needed. Then it would be easy to analyze with your IDE (versus your situation where introducing static analysis will require fixing a bunch of errors).

> Each of these features is, in it of itself, bad for static analysis and therefore bad for LLMs

I'm not really convinced LLM reasoning requires the same things static analysis does. Static analyzers walk a tree. LLMs run text through billions of parameters, and sometimes they stroke out if they read too much. It's good to have a compiler that catches mistakes the LLM makes, but the idea that LLMs get less confused with more type information has yet to be proven.

In fact, I would not be surprised if clogging up context with types just makes it rot quicker, but it doesn't matter because strong compilers catch bugs so the LLM can self correct. No matter what you're using, it's good to have tooling to catch mistakes.

help



LLMs work best with strict guardrails and static analysis. That’s why the GRH was written in lean, and not natural language. It would not be possible without something like lean.

The more dynamic something is, the more underspecified, the worse LLMs perform. The most dynamic language is natural language, which has no types and no formal structure. You can define logic in natural language.

Would we do that though? No. It won’t perform well.

It’s a spectrum. At one end is natural language, at the other is something like Lean. PHP sits closer to the natural language edge than C#.




Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: