If Iām not mistaken they removed them in 4.9 in favor of just using _mint, _burn and _update
Not sure what was reasoning behind it but people smarter then me made that decision
Previously, function _beforeTokenTransfer was called from each one of the following functions:
_safeTransferFrom
_safeBatchTransferFrom
_mint
_mintBatch
_burn
_burnBatch
In the current version, function _update is called from each one of these functions instead.
So you could say that function _beforeTokenTransfer was simply replaced with function _update, though it wouldn't be entirely accurate, since the latter seems to encompass quite a bit of code-reuse.
_beforeTokenTransfer is present in 4.9. If you get your contracts from NPM or from the github releases it will be available.
Note: you shoud NOT use the master branch for your dependency. This is where development happens. It contains unaudited code.
In 5.0 (due to ship in a few weeks-months) the _beforeTokenTransfer and _afterTokenTransfer hooks are removed in favor of directly overloading _update:
function _update(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
// put the code to run **before** the transfer HERE
super._update(from, to, ids, amounts, data);
// put the code to run **after** the transfer HERE
}