Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Magento projects to project type mapping #66

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Depending on the composer type of the project an other standard will be used:

- `magento-module`: [MediaCT Coding Standard Magento1](https://github.com/mediact/coding-standard-magento1)
- `magento2-module`: [MediaCT Coding Standard Magento2](https://github.com/mediact/coding-standard-magento2)
- `magento-project`: [MediaCT Coding Standard Magento1](https://github.com/mediact/coding-standard-magento1)
- `magento2-project`: [MediaCT Coding Standard Magento2](https://github.com/mediact/coding-standard-magento2)

### Overriding the type

Expand Down
3 changes: 3 additions & 0 deletions src/ProjectTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ProjectTypeResolver
private $mapping = [
'magento2-module' => 'magento2',
'magento-module' => 'magento1',
'magento2-project' => 'magento2',
'magento-project' => 'magento2',
'alumio-project' => 'alumio',
];

Expand All @@ -54,6 +56,7 @@ public function __construct(Composer $composer, array $mapping = null)
public function resolve(): string
{
$config = $this->composer->getConfig();

if ($config->has(static::COMPOSER_CONFIG_KEY)) {
$configNode = $config->get(static::COMPOSER_CONFIG_KEY);
if (isset($configNode[static::COMPOSER_CONFIG_TYPE_KEY])) {
Expand Down