Skip to content

Commit

Permalink
Add Magento projects to project type mapping (#66)
Browse files Browse the repository at this point in the history
* Add Magento projects to project type mapping

To make it easier to install the testing suite for Magento, it's
now possible to set the project type in the project's composer.json
file to `magento2-project` or `magento-project` to get the correct
coding standards files in the project.

* Add Magento projects to project type mapping

To make it easier to install the testing suite for Magento, it's
now possible to set the project type in the project's composer.json
file to `magento2-project` or `magento-project` to get the correct
coding standards files in the project.

Co-authored-by: Arjen Miedema <[email protected]>
  • Loading branch information
ArjenMiedema and Arjen Miedema authored Mar 25, 2021
1 parent c85c49c commit 7ac0b41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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

0 comments on commit 7ac0b41

Please sign in to comment.