Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed May 12, 2019
1 parent a8a09e0 commit b44f56c
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Application/Adapters/Symfony/Preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace NunoMaduro\PhpInsights\Application\Adapters\Symfony;

use NunoMaduro\PhpInsights\Domain\Contracts\Preset as PresetContract;
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;

/**
* @internal
Expand All @@ -29,7 +30,15 @@ public static function get(): array
'var',
'translations',
'config',
'public'
'public',
],
'config' => [
ForbiddenFunctionsSniff::class => [
'forbiddenFunctions' => [
'dd' => null,
'dump' => null,
],
],
],
];
}
Expand Down
63 changes: 63 additions & 0 deletions src/Application/Adapters/Yii/Preset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

declare(strict_types=1);

namespace NunoMaduro\PhpInsights\Application\Adapters\Yii;

use NunoMaduro\PhpInsights\Domain\Contracts\Preset as PresetContract;

/**
* @internal
*/
final class Preset implements PresetContract
{
/**
* {@inheritDoc}
*/
public static function getName(): string
{
return 'yii';
}

/**
* {@inheritDoc}
*/
public static function get(): array
{
return [
'exclude' => [
'web',
'views',
'vagrant',
'runtime',
],
'add' => [
// ...
],
'remove' => [
// ...
],
'config' => [
// ...
],
];
}

/**
* {@inheritDoc}
*/
public static function shouldBeApplied(array $composer): bool
{
/** @var string[] $requirements */
$requirements = $composer['require'];

foreach (array_keys($requirements) as $requirement) {
$requirement = (string) $requirement;
if (strpos($requirement, 'yiisoft/yii2') !== false) {
return true;
}
}

return false;
}
}
2 changes: 2 additions & 0 deletions src/Application/ConfigResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use NunoMaduro\PhpInsights\Application\Adapters\Laravel\Preset as LaravelPreset;
use NunoMaduro\PhpInsights\Application\Adapters\Symfony\Preset as SymfonyPreset;
use NunoMaduro\PhpInsights\Application\Adapters\Yii\Preset as YiiPreset;

/**
* @internal
Expand All @@ -18,6 +19,7 @@ final class ConfigResolver
private static $presets = [
LaravelPreset::class,
SymfonyPreset::class,
YiiPreset::class,
DefaultPreset::class,
];

Expand Down

0 comments on commit b44f56c

Please sign in to comment.