authentication_storage = $authentication_storage; } public function register_hook() { add_action( 'deleted_user', [ $this, 'delete_authentications' ] ); } /** * @param int $user_id * * @throws DateTime_Creation_Exception */ public function delete_authentications( int $user_id ) { $authentication = $this->authentication_storage->get_authentication( $user_id ); if ( $authentication instanceof Authentication ) { $this->authentication_storage->close_authentication( $authentication ); } } }