mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Fix CS (#11003)
This commit is contained in:
parent
6e205a0c84
commit
131da999ac
357 changed files with 5943 additions and 9174 deletions
|
@ -24,16 +24,16 @@ class RuleSetTest extends TestCase
|
|||
{
|
||||
public function testAdd(): void
|
||||
{
|
||||
$rules = array(
|
||||
RuleSet::TYPE_PACKAGE => array(),
|
||||
RuleSet::TYPE_REQUEST => array(
|
||||
new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
|
||||
new GenericRule(array(2), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
|
||||
),
|
||||
RuleSet::TYPE_LEARNED => array(
|
||||
new GenericRule(array(), Rule::RULE_LEARNED, 1),
|
||||
),
|
||||
);
|
||||
$rules = [
|
||||
RuleSet::TYPE_PACKAGE => [],
|
||||
RuleSet::TYPE_REQUEST => [
|
||||
new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
|
||||
new GenericRule([2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
|
||||
],
|
||||
RuleSet::TYPE_LEARNED => [
|
||||
new GenericRule([], Rule::RULE_LEARNED, 1),
|
||||
],
|
||||
];
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
|
@ -46,13 +46,13 @@ class RuleSetTest extends TestCase
|
|||
|
||||
public function testAddIgnoresDuplicates(): void
|
||||
{
|
||||
$rules = array(
|
||||
RuleSet::TYPE_REQUEST => array(
|
||||
new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
|
||||
new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
|
||||
new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)),
|
||||
),
|
||||
);
|
||||
$rules = [
|
||||
RuleSet::TYPE_REQUEST => [
|
||||
new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
|
||||
new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
|
||||
new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]),
|
||||
],
|
||||
];
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
|
@ -60,7 +60,7 @@ class RuleSetTest extends TestCase
|
|||
$ruleSet->add($rules[RuleSet::TYPE_REQUEST][1], RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add($rules[RuleSet::TYPE_REQUEST][2], RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertCount(1, $ruleSet->getIteratorFor(array(RuleSet::TYPE_REQUEST)));
|
||||
$this->assertCount(1, $ruleSet->getIteratorFor([RuleSet::TYPE_REQUEST]));
|
||||
}
|
||||
|
||||
public function testAddWhenTypeIsNotRecognized(): void
|
||||
|
@ -69,15 +69,15 @@ class RuleSetTest extends TestCase
|
|||
|
||||
self::expectException('OutOfBoundsException');
|
||||
// @phpstan-ignore-next-line
|
||||
$ruleSet->add(new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)), 7);
|
||||
$ruleSet->add(new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), 7);
|
||||
}
|
||||
|
||||
public function testCount(): void
|
||||
{
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
$ruleSet->add(new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)), RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add(new GenericRule(array(2), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)), RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add(new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add(new GenericRule([2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]), RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertEquals(2, $ruleSet->count());
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class RuleSetTest extends TestCase
|
|||
{
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
$rule = new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule = new GenericRule([], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$ruleSet->add($rule, RuleSet::TYPE_REQUEST);
|
||||
|
||||
$this->assertSame($rule, $ruleSet->ruleById[0]);
|
||||
|
@ -96,8 +96,8 @@ class RuleSetTest extends TestCase
|
|||
{
|
||||
$ruleSet = new RuleSet;
|
||||
|
||||
$rule1 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule2 = new GenericRule(array(2), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule1 = new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$ruleSet->add($rule1, RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_LEARNED);
|
||||
|
||||
|
@ -111,8 +111,8 @@ class RuleSetTest extends TestCase
|
|||
public function testGetIteratorFor(): void
|
||||
{
|
||||
$ruleSet = new RuleSet;
|
||||
$rule1 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule2 = new GenericRule(array(2), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule1 = new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$ruleSet->add($rule1, RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_LEARNED);
|
||||
|
@ -125,8 +125,8 @@ class RuleSetTest extends TestCase
|
|||
public function testGetIteratorWithout(): void
|
||||
{
|
||||
$ruleSet = new RuleSet;
|
||||
$rule1 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule2 = new GenericRule(array(2), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint));
|
||||
$rule1 = new GenericRule([1], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
$rule2 = new GenericRule([2], Rule::RULE_ROOT_REQUIRE, ['packageName' => '', 'constraint' => new MatchAllConstraint]);
|
||||
|
||||
$ruleSet->add($rule1, RuleSet::TYPE_REQUEST);
|
||||
$ruleSet->add($rule2, RuleSet::TYPE_LEARNED);
|
||||
|
@ -138,16 +138,16 @@ class RuleSetTest extends TestCase
|
|||
|
||||
public function testPrettyString(): void
|
||||
{
|
||||
$pool = new Pool(array(
|
||||
$pool = new Pool([
|
||||
$p = $this->getPackage('foo', '2.1'),
|
||||
));
|
||||
]);
|
||||
|
||||
$repositorySetMock = $this->getMockBuilder('Composer\Repository\RepositorySet')->disableOriginalConstructor()->getMock();
|
||||
$requestMock = $this->getMockBuilder('Composer\DependencyResolver\Request')->disableOriginalConstructor()->getMock();
|
||||
|
||||
$ruleSet = new RuleSet;
|
||||
$literal = $p->getId();
|
||||
$rule = new GenericRule(array($literal), Rule::RULE_ROOT_REQUIRE, array('packageName' => 'foo/bar', 'constraint' => new MatchNoneConstraint));
|
||||
$rule = new GenericRule([$literal], Rule::RULE_ROOT_REQUIRE, ['packageName' => 'foo/bar', 'constraint' => new MatchNoneConstraint]);
|
||||
|
||||
$ruleSet->add($rule, RuleSet::TYPE_REQUEST);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue