Skip to content

[SOLID] Single set local value to constant #2804

@TomasVotruba

Description

@TomasVotruba

Before

$replacements = [
    'PHPUnit\Framework\TestCase\Notice' => 'expectNotice',
    'PHPUnit\Framework\TestCase\Deprecated' => 'expectDeprecation',
    'PHPUnit\Framework\TestCase\Error' => 'expectError',
    'PHPUnit\Framework\TestCase\Warning' => 'expectWarning',
];

foreach ($replacements as $class => $method) {
   // ...
}

After

private const REPLACEMENTS = [
    'PHPUnit\Framework\TestCase\Notice' => 'expectNotice',
    'PHPUnit\Framework\TestCase\Deprecated' => 'expectDeprecation',
    'PHPUnit\Framework\TestCase\Error' => 'expectError',
    'PHPUnit\Framework\TestCase\Warning' => 'expectWarning',
];

// ...

foreach (self::REPLACEMENTS as $class => $method) {
   // ...
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions