How to identify 'dead code'

Silverstripe Version:

I’m new to SilverStripe and php but have to maintain an existing code base.
My first goal is to understand the existing code.

I’m assuming that several functions & complete php code files are actually no longer used.
Is there a trick to enable function call logging globally?
Or any other hint how to address the question with little effort?

You could use any PHP tool available for the job, see e.g. this StackOverflow answer for some idea.

Keep in mind static code analyzers can (and will) make mistakes: I would personally never use it, more so on big or unfamiliar codebases.

1 Like