So if you really want my opinion, the shell should be aware that it's in a function. You could possibly implement this by keeping track of the parent pid. Another solution would be to not check the syntax of the function until the function is actually run. I wouldn't do strict posix soley because that's what PHP does and doing that makes php programs stop on errors that really should be recoverable. Thats not the most wonderful reason however. Regarding comments that it's not a function, of course it's a function! It says function at the beginning. Nagging implementation problems do not make it not a function.
The argument that syntax errors should actually be checked beforehand is a good one, however that's not how bash is currently implemented in non-posix mode. This is definetely a bug, because: