This issue has already been the topic of #24610.
macOS, sadly, does not ship with a bash version that is compatible with all lint tests since they now include the usage of mapfile. mapfile was introduced in bash 4.0 but macOS still uses 3.x because the newer version changed their license from GPL2 to GPL3. macOS has changed the default shell to zsh but that doesn't help since bash 3.x is still installed and will be used due to the shebang. Also, zsh does not have mapfile the same way bash has. Confusingly, the zsh version of the command does something completely different than the bash version.
Including guard code was rejected in #24610 and I guess this is probably reasonable since only a hand full of developers will ever run into this. But I think it should still be mentioned in the docs.