A PHP function that connects to an external system uses optional parameters with default empty strings for credentials, then throws exceptions if they're empty — making required fields syntactically optional. Worse, the error message for a missing password incorrectly says 'username is required', making debugging needlessly confusing. A classic example of misleading API ergonomics and copy-paste error message bugs.
4.7K Impressions1 Comment