The example also checks for the existence of the register_block_style method, for very old WordPress installations where Gutenberg was not available in core yet, but this is not really necessary anymore.
I am still not aware of a declarative approach for registering block styles (as in theme.json or by adding a file to specific directory), so this is currently the best practice approach.