Published July 1, 2019

Which one is the most readable?

function getFirstUserFrom(SiretNumber $siretNumber): User {}
function get_first_user_from(Siret_Number $siret_number): User {}

I think the snake case version is much more readable than the camel case.

How we name our functions is not a technical choice, it's a convention. Nobody can say that the snake case version is worse than the camel case one. The people from the PSR committee decided a long time ago that, in PHP, methods will be named in camel case and classes will be named in studly case. But in Rust, or in Python, a different choice was made: it's snake case for functions and methods.

Don't let other people decide what works best for you. Recently, I started using snake case for all my functions, methods and variables. And I think I'll switch to the Siret_Number approach for all my classes.