avstudnitz/AvS_DisableModules

Removable Modules report generator failed with error: Could not find module declaration in registration.php

Closed this issue · 1 comments

I can't generate report because I get an error of missing module declaration. This is a custom module but it has module declaration in registration.php file. And normally working well with composer.

composer.json file of module:

{
  "name": "namespace/module-name",
  "description": "description text",
  "type": "magento2-module",
  "authors": [
    {
      "name": "author1",
      "email": "author1@mail.com"
    },
    {
      "name": "author2",
      "email": "author2@mail.com"
    }
  ],
  "require": {
    "php": "~7.0.0",
    "magento/module-eav": "*"
  },
  "autoload": {
    "files": [
      "registration.php"
    ],
    "psr-4": {
      "Namespace\\Name\\": ""
    }
  }
}

registration.php file:

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    "Namespace_Name",
    __DIR__
);

Any idea where this module's declaration could be missing?

It's probably because you used double quotes " instead of the normal single quotes '. I agree the detection (in https://github.com/avstudnitz/AvS_DisableModules/blob/master/Console/Report/RemovableModules/Parser.php#L63) should be improved to handle double quotes too.