Verbose boolean parameters

For the sake of readability, I do this in my PHP code, as well:

One would definitely call it like this:

this.updatePost(true);

The problem is, that’s not very explanatory. In other words, you can’t tell straight from the line what this true does. I propose a solution that takes advantage of loose typing: just pass a string containing a parameter name as an argument.

this.updatePost('highlight');

Now, this is definitily more verbose.

Leave a Reply