This is wrong (at least in modern PHP versions). `is_dir()` always behave correctly, even when a file has no extension.