@sarah I'd start by logging which files are loaded in production. For old code that doesn't have a central entry point, it's quite common to have entire folders of unused scripts. After removing those files, I use the various dead code detectors mentioned in the other comments.
@sarah PHPStorm highlights unused functions/methods in gray. It's... not perfect (some things I know are called dynamically in ways it wouldn't be able to catch, and neither would Rector) but is pretty good.
@Crell@sarah intelephense and NLS in nvim both highlight unused properties, methods, and variables. And tools like psalm or phpstan will tell you, too.
Add comment