/**
 * Initialize the plugin.
 *
 * @wp-hook plugins_loaded
 *
 * @return void
 */
function initialize()
{
    $autoloader = new Autoloader\Autoloader();
    $autoloader->add_rule(new Autoloader\NamespaceRule(__DIR__ . '/inc', __NAMESPACE__));
    $plugin = new Plugin(__FILE__);
    $plugin->initialize();
}
<?php

# -*- coding: utf-8 -*-
namespace tfrommen\ExternalContent;

use tfrommen\Autoloader;
if (!defined('WP_UNINSTALL_PLUGIN')) {
    return;
}
/** @var \wpdb $wpdb */
global $wpdb;
require_once __DIR__ . '/inc/Autoloader/bootstrap.php';
$autoloader = new Autoloader\Autoloader();
$autoloader->add_rule(new Autoloader\NamespaceRule(__DIR__ . '/inc', __NAMESPACE__));
// Delete plugin posts
$query = "\nSELECT ID\nFROM {$wpdb->posts}\nWHERE post_type = %s\nLIMIT 500";
$post_type = new Models\PostType();
$query = $wpdb->prepare($query, $post_type->get_post_type());
while ($post_ids = $wpdb->get_col($query)) {
    foreach ($post_ids as $post_id) {
        wp_delete_post($post_id, TRUE);
    }
}