Magento 2: composer fatal error while trying to update the composer or installing extensions

I have a very annoying problem on my Magento 2.3.3 installation. The composer doesn’t work properly. I can’t run any composer update, composer require etc. Every-time I try to do that, it gives me this error:

Fatal error: Uncaught TypeError: Return value of MagentoInventoryComposerInstallerPlugin::initModuleDeployment() must be an instance of MagentoInventoryComposerInstallervoid, none returned in /vendor/magento/inventory-composer-installer/src/Plugin.php:69
Stack trace:
#0 [internal function]: MagentoInventoryComposerInstallerPlugin->initModuleDeployment(Object(ComposerScriptEvent))
#1 phar:///opt/cpanel/composer/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(176): call_user_func(Array, Object(ComposerScriptEvent))
#2 phar:///opt/cpanel/composer/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): ComposerEventDispatcherEventDispatcher->doDispatch(Object(ComposerScriptEvent))
#3 phar:///opt/cpanel/composer/bin/composer/src/Composer/Installer.php(204): ComposerEventDispatcherEventDispatcher->dispatchScript('pre-update-cmd', true)
#4 phar:///opt/cpanel/composer/bin/composer/src/Composer/Command/UpdateCommand.php(162): ComposerInst in /vendor/magento/inventory-composer-installer/src/Plugin.php on line 69

Before answer this question saying “This is a compatibility issue, try to verify your memory limit, php version etc etc”, this is NOT a compatibility issue.

I have enough memory limit and I have PHP 7.1 installed.

PS, even if I try to run the composer ignoring requirements (--ignore-platform-reqs) it gives me the same error!

PLEASE, I need somebody to help me on that!