Skip to content

Commit 81c959b

Browse files
authored
Apply fixes from StyleCI (#55)
1 parent d69210a commit 81c959b

10 files changed

+153
-154
lines changed

Partial/PartialNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PartialNode
2626
* would be removed entirely.
2727
*
2828
* @param ArrayNode $node
29-
* @param string $breadcrumbPath
29+
* @param string $breadcrumbPath
3030
*/
3131
public static function excludeEverythingNotInBreadcrumbPath(ArrayNode $node, $breadcrumbPath)
3232
{
@@ -42,7 +42,7 @@ public static function excludeEverythingNotInBreadcrumbPath(ArrayNode $node, $br
4242
/**
4343
* @param array $path
4444
*/
45-
public static function excludeEverythingNotInPath(ArrayNode $node, array $path = array())
45+
public static function excludeEverythingNotInPath(ArrayNode $node, array $path = [])
4646
{
4747
if (empty($path)) {
4848
return;
@@ -72,7 +72,7 @@ public static function excludeEverythingNotInPath(ArrayNode $node, array $path =
7272

7373
/**
7474
* @param ArrayNode $node
75-
* @param string $childNodeName
75+
* @param string $childNodeName
7676
*
7777
* @return NodeInterface
7878
*/

PhpUnit/ConfigurationTestCaseTrait.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
/**
88
* Add this trait to your Test Case to add the ability of testing your configuration
9-
* which should implement Symfony\Component\Config\Definition\ConfigurationInterface
9+
* which should implement Symfony\Component\Config\Definition\ConfigurationInterface.
1010
*/
1111
trait ConfigurationTestCaseTrait
1212
{
1313
/**
1414
* Return the instance of ConfigurationInterface that should be used by the
15-
* Configuration-specific assertions in this test-case
15+
* Configuration-specific assertions in this test-case.
1616
*
1717
* @return \Symfony\Component\Config\Definition\ConfigurationInterface
1818
*/
@@ -26,9 +26,9 @@ abstract protected function getConfiguration();
2626
* You need to set useRegExp to true if you'd like
2727
* to match the exception message using a regular expression.
2828
*
29-
* @param array $configurationValues
29+
* @param array $configurationValues
3030
* @param string|null $expectedMessage
31-
* @param bool $useRegExp
31+
* @param bool $useRegExp
3232
*/
3333
protected function assertConfigurationIsInvalid(array $configurationValues, $expectedMessage = null, $useRegExp = false)
3434
{
@@ -50,10 +50,10 @@ protected function assertConfigurationIsInvalid(array $configurationValues, $exp
5050
* You need to set useRegExp to true if you'd like
5151
* to match the exception message using a regular expression.
5252
*
53-
* @param array $configurationValues
54-
* @param string $breadcrumbPath The path that should be validated, e.g. "doctrine.orm"
53+
* @param array $configurationValues
54+
* @param string $breadcrumbPath The path that should be validated, e.g. "doctrine.orm"
5555
* @param string|null $expectedMessage
56-
* @param bool $useRegExp
56+
* @param bool $useRegExp
5757
*/
5858
protected function assertPartialConfigurationIsInvalid(
5959
array $configurationValues,
@@ -77,7 +77,7 @@ protected function assertPartialConfigurationIsInvalid(
7777
*
7878
* Optionally provide the part of the configuration that you want to test, e.g. "doctrine.orm"
7979
*
80-
* @param array $configurationValues
80+
* @param array $configurationValues
8181
* @param string|null $breadcrumbPath
8282
*/
8383
protected function assertConfigurationIsValid(array $configurationValues, $breadcrumbPath = null)
@@ -96,8 +96,8 @@ protected function assertConfigurationIsValid(array $configurationValues, $bread
9696
*
9797
* Optionally provide the part of the configuration that you want to test, e.g. "doctrine.orm"
9898
*
99-
* @param array $configurationValues
100-
* @param array $expectedProcessedConfiguration
99+
* @param array $configurationValues
100+
* @param array $expectedProcessedConfiguration
101101
* @param string|null $breadcrumbPath
102102
*/
103103
protected function assertProcessedConfigurationEquals(

PhpUnit/ConfigurationValuesAreInvalidConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function toString(): string
4646
$toString = 'is invalid for the given configuration';
4747

4848
if ($this->expectedMessage !== null) {
49-
$toString .= ' (expected exception message: ' . $this->expectedMessage . ')';
49+
$toString .= ' (expected exception message: '.$this->expectedMessage.')';
5050
}
5151

5252
return $toString;

Tests/Partial/PartialNodeTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public function it_strips_children_that_are_not_in_the_given_path_with_one_name(
3333
->scalarNode('node_2_scalar_node');
3434

3535
$node = $treeBuilder->buildTree();
36-
/** @var ArrayNode $node */
36+
/* @var ArrayNode $node */
3737

38-
PartialNode::excludeEverythingNotInPath($node, array('node_2'));
38+
PartialNode::excludeEverythingNotInPath($node, ['node_2']);
3939

4040
$this->nodeOnlyHasChild($node, 'node_2');
4141
}
@@ -70,9 +70,9 @@ public function it_strips_children_that_are_not_in_the_given_path_with_several_n
7070
->scalarNode('scalar_node');
7171

7272
$node = $treeBuilder->buildTree();
73-
/** @var ArrayNode $node */
73+
/* @var ArrayNode $node */
7474

75-
PartialNode::excludeEverythingNotInPath($node, array('node_1', 'node_1_b'));
75+
PartialNode::excludeEverythingNotInPath($node, ['node_1', 'node_1_b']);
7676

7777
$node1 = $this->nodeOnlyHasChild($node, 'node_1');
7878
$this->nodeOnlyHasChild($node1, 'node_1_b');
@@ -98,9 +98,9 @@ public function it_strips_children_when_leaf_node_is_not_an_array()
9898
->scalarNode('node_3');
9999

100100
$node = $treeBuilder->buildTree();
101-
/** @var ArrayNode $node */
101+
/* @var ArrayNode $node */
102102

103-
PartialNode::excludeEverythingNotInPath($node, array('node_3'));
103+
PartialNode::excludeEverythingNotInPath($node, ['node_3']);
104104

105105
$this->nodeOnlyHasChild($node, 'node_3');
106106
}
@@ -123,16 +123,15 @@ public function it_does_not_crash_on_prototypes()
123123
->end()
124124
->arrayNode('node_2')
125125
->children()
126-
->scalarNode('node_2_scalar_node')
127-
;
126+
->scalarNode('node_2_scalar_node');
128127

129128
/** @var PrototypedArrayNode $node */
130129
$node = $treeBuilder->buildTree();
131130

132131
/** @var ArrayNode $prototypeNode */
133132
$prototypeNode = $node->getPrototype();
134133

135-
PartialNode::excludeEverythingNotInPath($node, array('*', 'node_1'));
134+
PartialNode::excludeEverythingNotInPath($node, ['*', 'node_1']);
136135

137136
$this->nodeOnlyHasChild($prototypeNode, 'node_1');
138137
}
@@ -155,7 +154,7 @@ public function it_fails_when_a_requested_child_node_does_not_exist()
155154
$this->expectException(UndefinedChildNode::class);
156155
$this->expectExceptionMessage('Undefined child node "non_existing_node" (the part of the path that was successful: "root.sub_node")');
157156

158-
PartialNode::excludeEverythingNotInPath($node, array('sub_node', 'non_existing_node'));
157+
PartialNode::excludeEverythingNotInPath($node, ['sub_node', 'non_existing_node']);
159158
}
160159

161160
/**
@@ -176,7 +175,7 @@ public function it_fails_when_a_requested_child_node_is_no_array_node_itself_and
176175
$this->expectException(ChildIsNotAnArrayNode::class);
177176
$this->expectExceptionMessage('Child node "scalar_node" is not an array node (current path: "root.sub_node")');
178177

179-
PartialNode::excludeEverythingNotInPath($node, array('sub_node', 'scalar_node', 'extra_node'));
178+
PartialNode::excludeEverythingNotInPath($node, ['sub_node', 'scalar_node', 'extra_node']);
180179
}
181180

182181
private function nodeOnlyHasChild(ArrayNode $node, $nodeName)

Tests/Partial/PartialProcessorTest.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,25 @@ public function it_processes_only_the_values_in_the_breadcrumb_path_for_a_given_
3333

3434
$partialProcessor = new PartialProcessor();
3535

36-
$processedConfig = $partialProcessor->process($node, 'only_test_this_node', array(
37-
array(
38-
'only_test_this_node' => array(
39-
'scalar_node' => 'no'
40-
)
41-
),
42-
array(
43-
'only_test_this_node' => array(
44-
'scalar_node' => 'yes'
45-
)
46-
)
47-
));
36+
$processedConfig = $partialProcessor->process($node, 'only_test_this_node', [
37+
[
38+
'only_test_this_node' => [
39+
'scalar_node' => 'no',
40+
],
41+
],
42+
[
43+
'only_test_this_node' => [
44+
'scalar_node' => 'yes',
45+
],
46+
],
47+
]);
4848

4949
$this->assertSame(
50-
array(
51-
'only_test_this_node' => array(
52-
'scalar_node' => 'yes'
53-
)
54-
), $processedConfig
50+
[
51+
'only_test_this_node' => [
52+
'scalar_node' => 'yes',
53+
],
54+
], $processedConfig
5555
);
5656
}
5757

@@ -65,21 +65,21 @@ public function it_processes_only_the_values_in_the_given_breadcrumb_path_for_a_
6565
$processedConfig = $partialProcessor->processConfiguration(
6666
new ConfigurationStub(),
6767
'only_test_this_node',
68-
array(
69-
array(
70-
'only_test_this_node' => array(
71-
'scalar_node' => 'yes'
72-
)
73-
)
74-
)
68+
[
69+
[
70+
'only_test_this_node' => [
71+
'scalar_node' => 'yes',
72+
],
73+
],
74+
]
7575
);
7676

7777
$this->assertSame(
78-
array(
79-
'only_test_this_node' => array(
80-
'scalar_node' => 'yes'
81-
)
82-
), $processedConfig
78+
[
79+
'only_test_this_node' => [
80+
'scalar_node' => 'yes',
81+
],
82+
], $processedConfig
8383
);
8484
}
8585
}

Tests/PhpUnit/ConfigurationTestCaseTraitTest.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ protected function getConfiguration()
2222
public function it_can_assert_that_a_configuration_is_invalid()
2323
{
2424
$this->assertConfigurationIsInvalid(
25-
array(
26-
array() // no configuration values
27-
),
25+
[
26+
[], // no configuration values
27+
],
2828
'required_value'
2929
);
3030
}
@@ -38,9 +38,9 @@ public function it_fails_when_a_configuration_is_valid_when_it_should_have_been_
3838
$this->expectExceptionMessage('invalid');
3939

4040
$this->assertConfigurationIsInvalid(
41-
array(
42-
array('required_value' => 'some value')
43-
)
41+
[
42+
['required_value' => 'some value'],
43+
]
4444
);
4545
}
4646

@@ -50,9 +50,9 @@ public function it_fails_when_a_configuration_is_valid_when_it_should_have_been_
5050
public function it_can_assert_that_a_configuration_is_valid()
5151
{
5252
$this->assertConfigurationIsValid(
53-
array(
54-
array('required_value' => 'some value')
55-
)
53+
[
54+
['required_value' => 'some value'],
55+
]
5656
);
5757
}
5858

@@ -65,9 +65,9 @@ public function it_fails_when_a_configuration_is_invalid_when_it_should_have_bee
6565
$this->expectExceptionMessage('The child node "required_value" at path "root" must be configured.');
6666

6767
$this->assertConfigurationIsValid(
68-
array(
69-
array()
70-
)
68+
[
69+
[],
70+
]
7171
);
7272
}
7373

@@ -79,13 +79,13 @@ public function it_can_assert_that_a_processed_configuration_matches_the_expecte
7979
$value = 'some value';
8080

8181
$this->assertProcessedConfigurationEquals(
82-
array(
83-
array(),
84-
array('required_value' => $value)
85-
),
86-
array(
87-
'required_value' => $value
88-
)
82+
[
83+
[],
84+
['required_value' => $value],
85+
],
86+
[
87+
'required_value' => $value,
88+
]
8989
);
9090
}
9191

@@ -100,12 +100,12 @@ public function it_fails_when_a_processed_configuration_does_not_match_the_expec
100100
$this->expectExceptionMessage('equal');
101101

102102
$this->assertProcessedConfigurationEquals(
103-
array(
104-
array('required_value' => $value)
105-
),
106-
array(
107-
'invalid_key' => 'invalid_value'
108-
)
103+
[
104+
['required_value' => $value],
105+
],
106+
[
107+
'invalid_key' => 'invalid_value',
108+
]
109109
);
110110
}
111111

@@ -116,13 +116,13 @@ public function it_throws_a_comparison_failed_exception_with_the_values_in_the_r
116116
{
117117
$value = 'some value';
118118

119-
$configurationValues = array(
120-
array('required_value' => $value)
121-
);
119+
$configurationValues = [
120+
['required_value' => $value],
121+
];
122122

123-
$expectedProcessedConfigurationValues = array(
124-
'invalid_key' => 'invalid_value'
125-
);
123+
$expectedProcessedConfigurationValues = [
124+
'invalid_key' => 'invalid_value',
125+
];
126126

127127
try {
128128
$this->assertProcessedConfigurationEquals(

0 commit comments

Comments
 (0)