Skip to content

Commit

Permalink
Enable trailing_comma_in_multiline only for arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirone committed Aug 21, 2024
1 parent f4e8157 commit c7df023
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
'concat_space' => ['spacing' => 'none'],
'method_argument_space' => ['on_multiline' => 'ignore'],
'trailing_comma_in_multiline' => false,
// Since PHP 7.2 is supported we can't add trailing commas in arguments, parameters and match
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
'visibility_required' => false,
])
->setFinder(
Expand Down
6 changes: 3 additions & 3 deletions spec/Prophecy/Call/CallCenterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function it_executes_promise_of_method_prophecy_that_matches_signature_passed_to

$objectProphecy->getMethodProphecies()->willReturn(array(
'method1' => array($method1),
'method2' => array($method2, $method3)
'method2' => array($method2, $method3),
));
$objectProphecy->getMethodProphecies('getName')->willReturn(array($method1, $method3));
$objectProphecy->reveal()->willReturn(new \stdClass());
Expand Down Expand Up @@ -107,10 +107,10 @@ function it_executes_promise_of_method_prophecy_that_matches_with_highest_score_

$objectProphecy->getMethodProphecies()->willReturn(array(
'method1' => array($method1),
'method2' => array($method2, $method3)
'method2' => array($method2, $method3),
));
$objectProphecy->getMethodProphecies('getName')->willReturn(array(
$method1, $method2, $method3
$method1, $method2, $method3,
));
$objectProphecy->reveal()->willReturn(new \stdClass());

Expand Down
4 changes: 2 additions & 2 deletions spec/Prophecy/Doubler/Generator/ClassCodeGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function it_generates_proper_php_code_for_specific_ClassNode(
) {
$class->getParentClass()->willReturn('RuntimeException');
$class->getInterfaces()->willReturn(array(
'Prophecy\Doubler\Generator\MirroredInterface', 'ArrayAccess', 'ArrayIterator'
'Prophecy\Doubler\Generator\MirroredInterface', 'ArrayAccess', 'ArrayIterator',
));
$class->getProperties()->willReturn(array('name' => 'public', 'email' => 'private'));
$class->getMethods()->willReturn(array($method1, $method2, $method3, $method4, $method5));
Expand Down Expand Up @@ -155,7 +155,7 @@ function it_generates_proper_php_code_for_variadics(
$class->getInterfaces()->willReturn(array('Prophecy\Doubler\Generator\MirroredInterface'));
$class->getProperties()->willReturn(array());
$class->getMethods()->willReturn(array(
$method1, $method2, $method3, $method4
$method1, $method2, $method3, $method4,
));
$class->isReadOnly()->willReturn(false);

Expand Down
4 changes: 2 additions & 2 deletions spec/Prophecy/Doubler/Generator/Node/ClassNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function it_can_has_methods(MethodNode $method1, MethodNode $method2)

$this->getMethods()->shouldReturn(array(
'__construct' => $method1,
'getName' => $method2
'getName' => $method2,
));
}

Expand Down Expand Up @@ -126,7 +126,7 @@ function it_is_able_to_have_properties()
$this->addProperty('text', 'private');
$this->getProperties()->shouldReturn(array(
'title' => 'public',
'text' => 'private'
'text' => 'private',
));
}

Expand Down
12 changes: 6 additions & 6 deletions spec/Prophecy/Prophecy/ObjectProphecySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function its_addMethodProphecy_adds_method_prophecy(
$this->addMethodProphecy($methodProphecy);

$this->getMethodProphecies()->shouldReturn(array(
'getusername' => array($methodProphecy)
'getusername' => array($methodProphecy),
));
}

Expand All @@ -148,7 +148,7 @@ function its_addMethodProphecy_handles_prophecies_with_different_arguments(
'getusername' => array(
$methodProphecy1,
$methodProphecy2,
)
),
));
}

Expand All @@ -171,7 +171,7 @@ function its_addMethodProphecy_handles_prophecies_for_caseinsensitive_method_nam
'getusername' => array(
$methodProphecy1,
$methodProphecy2,
)
),
));
}

Expand All @@ -192,11 +192,11 @@ function its_addMethodProphecy_handles_prophecies_for_different_methods(

$this->getMethodProphecies()->shouldReturn(array(
'getusername' => array(
$methodProphecy1
$methodProphecy1,
),
'isusername' => array(
$methodProphecy2
)
$methodProphecy2,
),
));
}

Expand Down
4 changes: 2 additions & 2 deletions spec/Prophecy/Prophecy/RevealerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ function it_reveals_instances_of_ProphecyInterface_inside_array(

$this->reveal(array(
array('item' => $prophecy2),
$prophecy1
$prophecy1,
))->shouldReturn(array(
array('item' => $object2),
$object1
$object1,
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/Prophecy/Doubler/Generator/ClassMirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ClassMirror
'__wakeup',
'__toString',
'__call',
'__invoke'
'__invoke',
);

/**
Expand Down

0 comments on commit c7df023

Please sign in to comment.