Skip to content

Commit

Permalink
Apply CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirone committed Mar 20, 2024
1 parent d5f9bd8 commit 16bbfc7
Show file tree
Hide file tree
Showing 67 changed files with 301 additions and 358 deletions.
2 changes: 1 addition & 1 deletion spec/Prophecy/Argument/Token/ArrayCountTokenSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function it_does_not_score_if_argument_is_neither_array_nor_countable_object()
{
$this->scoreArgument('string')->shouldBe(false);
$this->scoreArgument(5)->shouldBe(false);
$this->scoreArgument(new \stdClass)->shouldBe(false);
$this->scoreArgument(new \stdClass())->shouldBe(false);
}

function it_does_not_score_if_argument_array_has_wrong_count()
Expand Down
10 changes: 5 additions & 5 deletions spec/Prophecy/Argument/Token/ArrayEntryTokenSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function it_scores_array_half_of_combined_scores_from_key_and_value_tokens($key,
{
$key->scoreArgument('key')->willReturn(4);
$value->scoreArgument('value')->willReturn(6);
$this->scoreArgument(array('key'=>'value'))->shouldBe(5);
$this->scoreArgument(array('key' => 'value'))->shouldBe(5);
}

function it_scores_traversable_object_half_of_combined_scores_from_key_and_value_tokens(
Expand Down Expand Up @@ -82,7 +82,7 @@ function it_throws_exception_during_scoring_of_array_accessible_object_if_key_is
\ArrayAccess $object
) {
$key->__toString()->willReturn('any_token');
$this->beConstructedWith($key,$value);
$this->beConstructedWith($key, $value);
$errorMessage = 'You can only use exact value tokens to match key of ArrayAccess object'.PHP_EOL.
'But you used `any_token`.';
$this->shouldThrow(new InvalidArgumentException($errorMessage))->duringScoreArgument($object);
Expand Down Expand Up @@ -116,13 +116,13 @@ function it_accepts_any_key_token_type_to_score_object_that_is_both_traversable_
(\PHP_VERSION_ID < 80100) ? $object->rewind()->willReturn(null) : $object->rewind()->shouldBeCalled();
(\PHP_VERSION_ID < 80100) ? $object->next()->willReturn(null) : $object->next()->shouldBeCalled();
$object->valid()->willReturn(true);
$this->shouldNotThrow(new InvalidArgumentException)->duringScoreArgument($object);
$this->shouldNotThrow(new InvalidArgumentException())->duringScoreArgument($object);
}

function it_does_not_score_if_argument_is_neither_array_nor_traversable_nor_array_accessible()
{
$this->scoreArgument('string')->shouldBe(false);
$this->scoreArgument(new \stdClass)->shouldBe(false);
$this->scoreArgument(new \stdClass())->shouldBe(false);
}

function it_does_not_score_empty_array()
Expand Down Expand Up @@ -197,6 +197,6 @@ function its_score_is_capped_at_8($key, $value)
{
$key->scoreArgument('key')->willReturn(10);
$value->scoreArgument('value')->willReturn(10);
$this->scoreArgument(array('key'=>'value'))->shouldBe(8);
$this->scoreArgument(array('key' => 'value'))->shouldBe(8);
}
}
2 changes: 1 addition & 1 deletion spec/Prophecy/Argument/Token/ArrayEveryEntryTokenSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function it_wraps_non_token_value_into_ExactValueToken(\stdClass $stdClass)
function it_does_not_score_if_argument_is_neither_array_nor_traversable()
{
$this->scoreArgument('string')->shouldBe(false);
$this->scoreArgument(new \stdClass)->shouldBe(false);
$this->scoreArgument(new \stdClass())->shouldBe(false);
}

function it_does_not_score_empty_array()
Expand Down
4 changes: 2 additions & 2 deletions spec/Prophecy/Argument/Token/ExactValueTokenSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function it_generates_proper_string_representation_for_object(\stdClass $object)
$objHash = sprintf('exact(%s#%s',
get_class($object->getWrappedObject()),
spl_object_id($object->getWrappedObject())
) . " Object (\n 'objectProphecyClosure' => Closure#%s Object (\n 0 => Closure#%s Object\n )\n))";
)." Object (\n 'objectProphecyClosure' => Closure#%s Object (\n 0 => Closure#%s Object\n )\n))";

$this->beConstructedWith($object);

Expand Down Expand Up @@ -164,7 +164,7 @@ function it_does_not_scores_if_value_an_numeric_and_equal_to_argument_as_stringa

function it_does_not_scores_if_value_an_object_and_not_equal_to_argument_object()
{
$value = new ExactValueTokenFixtureA;
$value = new ExactValueTokenFixtureA();
$argument = new ExactValueTokenC("example");

$this->beConstructedWith($value);
Expand Down
2 changes: 1 addition & 1 deletion spec/Prophecy/Argument/Token/IdenticalValueTokenSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function it_generates_proper_string_representation_for_object($object)
$objHash = sprintf('identical(%s#%s',
get_class($object->getWrappedObject()),
spl_object_id($object->getWrappedObject())
) . " Object (\n 'objectProphecyClosure' => Closure#%s Object (\n 0 => Closure#%s Object\n )\n))";
)." Object (\n 'objectProphecyClosure' => Closure#%s Object (\n 0 => Closure#%s Object\n )\n))";

$this->beConstructedWith($object);

Expand Down
7 changes: 2 additions & 5 deletions spec/Prophecy/Call/CallCenterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

class CallCenterSpec extends ObjectBehavior
{
function let(ObjectProphecy $objectProphecy)
{
}
function let(ObjectProphecy $objectProphecy) {}

function it_records_calls_made_through_makeCall_method(ObjectProphecy $objectProphecy, ArgumentsWildcard $wildcard)
{
Expand All @@ -33,8 +31,7 @@ function it_records_calls_made_through_makeCall_method(ObjectProphecy $objectPro

function it_returns_null_for_any_call_through_makeCall_if_no_method_prophecies_added(
$objectProphecy
)
{
) {
$objectProphecy->getMethodProphecies()->willReturn(array());

$this->makeCall($objectProphecy, 'setValues', array(5, 2, 3))->shouldReturn(null);
Expand Down
12 changes: 6 additions & 6 deletions spec/Prophecy/Comparator/ClosureComparatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ function it_accepts_only_closures()
$this->accepts('string', 'string')->shouldReturn(false);
$this->accepts(false, true)->shouldReturn(false);
$this->accepts(true, false)->shouldReturn(false);
$this->accepts((object)array(), (object)array())->shouldReturn(false);
$this->accepts(function(){}, (object)array())->shouldReturn(false);
$this->accepts(function(){}, (object)array())->shouldReturn(false);
$this->accepts((object) array(), (object) array())->shouldReturn(false);
$this->accepts(function () {}, (object) array())->shouldReturn(false);
$this->accepts(function () {}, (object) array())->shouldReturn(false);

$this->accepts(function(){}, function(){})->shouldReturn(true);
$this->accepts(function () {}, function () {})->shouldReturn(true);
}

function it_asserts_that_different_closures_are_different()
{
$this->shouldThrow()->duringAssertEquals(function(){}, function(){});
$this->shouldThrow()->duringAssertEquals(function () {}, function () {});
}

function it_asserts_that_closures_are_equal_if_its_the_same_closure()
{
$closure = function(){};
$closure = function () {};

$this->shouldNotThrow()->duringAssertEquals($closure, $closure);
}
Expand Down
2 changes: 1 addition & 1 deletion spec/Prophecy/Comparator/FactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function it_extends_Sebastian_Comparator_Factory()

function it_should_have_ClosureComparator_registered()
{
$comparator = $this->getInstance()->getComparatorFor(function(){}, function(){});
$comparator = $this->getInstance()->getComparatorFor(function () {}, function () {});
$comparator->shouldHaveType('Prophecy\Comparator\ClosureComparator');
}
}
6 changes: 3 additions & 3 deletions spec/Prophecy/Comparator/ProphecyComparatorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ function it_accepts_only_prophecy_objects()
$this->accepts('string', 'string')->shouldReturn(false);
$this->accepts(false, true)->shouldReturn(false);
$this->accepts(true, false)->shouldReturn(false);
$this->accepts((object)array(), (object)array())->shouldReturn(false);
$this->accepts(function(){}, (object)array())->shouldReturn(false);
$this->accepts(function(){}, function(){})->shouldReturn(false);
$this->accepts((object) array(), (object) array())->shouldReturn(false);
$this->accepts(function () {}, (object) array())->shouldReturn(false);
$this->accepts(function () {}, function () {})->shouldReturn(false);

$prophet = new Prophet();
$prophecy = $prophet->prophesize('Prophecy\Prophecy\ObjectProphecy');
Expand Down
4 changes: 1 addition & 3 deletions spec/Prophecy/Doubler/CachedDoublerSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,4 @@ function it_creates_two_different_class_definitions_for_the_same_class_with_same
}
}

class aClass
{
}
class aClass {}
28 changes: 6 additions & 22 deletions spec/Prophecy/Doubler/ClassPatch/MagicCallPatchSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,44 +94,28 @@ class MagicalApi
/**
* @return void
*/
public function definedMethod()
{

}
public function definedMethod() {}
}

/**
* @method
*/
class MagicalApiInvalidMethodDefinition
{
}
class MagicalApiInvalidMethodDefinition {}

/**
* @method void definedMethod()
*/
class MagicalApiExtended extends MagicalApi
{

}
class MagicalApiExtended extends MagicalApi {}

/**
*/
class MagicalApiImplemented implements MagicalApiInterface
{

}
class MagicalApiImplemented implements MagicalApiInterface {}

/**
*/
class MagicalApiImplementedExtended extends MagicalApiImplemented
{
}
class MagicalApiImplementedExtended extends MagicalApiImplemented {}

/**
* @method void implementedMethod()
*/
interface MagicalApiInterface
{

}
interface MagicalApiInterface {}
6 changes: 3 additions & 3 deletions spec/Prophecy/Doubler/ClassPatch/SplFileInfoPatchSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function it_should_not_supply_a_file_for_a_directory_iterator(ClassNode $node, M
$node->getMethod('__construct')->willReturn($method);
$node->getParentClass()->willReturn('DirectoryIterator');

$method->setCode(Argument::that(function($value) {
$method->setCode(Argument::that(function ($value) {
return strpos($value, '.php') === false;
}))->shouldBeCalled();

Expand All @@ -76,7 +76,7 @@ function it_should_supply_a_file_for_a_spl_file_object(ClassNode $node, MethodNo
$node->getMethod('__construct')->willReturn($method);
$node->getParentClass()->willReturn('SplFileObject');

$method->setCode(Argument::that(function($value) {
$method->setCode(Argument::that(function ($value) {
return strpos($value, '.php') !== false;
}))->shouldBeCalled();

Expand All @@ -89,7 +89,7 @@ function it_should_supply_a_file_for_a_symfony_spl_file_info(ClassNode $node, Me
$node->getMethod('__construct')->willReturn($method);
$node->getParentClass()->willReturn('Symfony\\Component\\Finder\\SplFileInfo');

$method->setCode(Argument::that(function($value) {
$method->setCode(Argument::that(function ($value) {
return strpos($value, '.php') !== false;
}))->shouldBeCalled();

Expand Down
24 changes: 10 additions & 14 deletions spec/Prophecy/Doubler/Generator/ClassCodeGeneratorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ function it_overrides_properly_methods_with_args_passed_by_reference(
$argument->getTypeNode()->willReturn(new ArgumentTypeNode('array'));

$code = $this->generate('CustomClass', $class);
$expected =<<<'PHP'
$expected = <<<'PHP'
namespace {
class CustomClass extends \RuntimeException implements \Prophecy\Doubler\Generator\MirroredInterface {
Expand All @@ -283,12 +283,10 @@ public function getName(array &$fullname = NULL) {
$code->shouldBe($expected);
}

function it_generates_proper_code_for_union_return_types
(
function it_generates_proper_code_for_union_return_types(
ClassNode $class,
MethodNode $method
)
{
) {
$class->getParentClass()->willReturn('stdClass');
$class->getInterfaces()->willReturn([]);
$class->getProperties()->willReturn([]);
Expand All @@ -305,7 +303,7 @@ function it_generates_proper_code_for_union_return_types

$code = $this->generate('CustomClass', $class);

$expected =<<<'PHP'
$expected = <<<'PHP'
namespace {
class CustomClass extends \stdClass implements {
Expand All @@ -321,13 +319,11 @@ public function foo(): int|string|null {
$code->shouldBe($expected);
}

function it_generates_proper_code_for_union_argument_types
(
function it_generates_proper_code_for_union_argument_types(
ClassNode $class,
MethodNode $method,
ArgumentNode $argument
)
{
) {
$class->getParentClass()->willReturn('stdClass');
$class->getInterfaces()->willReturn([]);
$class->getProperties()->willReturn([]);
Expand All @@ -350,7 +346,7 @@ function it_generates_proper_code_for_union_argument_types

$code = $this->generate('CustomClass', $class);

$expected =<<<'PHP'
$expected = <<<'PHP'
namespace {
class CustomClass extends \stdClass implements {
Expand All @@ -375,7 +371,7 @@ function it_generates_empty_class_for_empty_ClassNode(ClassNode $class)
$class->isReadOnly()->willReturn(false);

$code = $this->generate('CustomClass', $class);
$expected =<<<'PHP'
$expected = <<<'PHP'
namespace {
class CustomClass extends \stdClass implements \Prophecy\Doubler\Generator\MirroredInterface {
Expand All @@ -396,7 +392,7 @@ function it_wraps_class_in_namespace_if_it_is_namespaced(ClassNode $class)
$class->isReadOnly()->willReturn(false);

$code = $this->generate('My\Awesome\CustomClass', $class);
$expected =<<<'PHP'
$expected = <<<'PHP'
namespace My\Awesome {
class CustomClass extends \stdClass implements \Prophecy\Doubler\Generator\MirroredInterface {
Expand All @@ -417,7 +413,7 @@ function it_generates_read_only_class_if_parent_class_is_read_only(ClassNode $cl
$class->isReadOnly()->willReturn(true);

$code = $this->generate('CustomClass', $class);
$expected =<<<'PHP'
$expected = <<<'PHP'
namespace {
readonly class CustomClass extends \ReadOnlyClass implements \Prophecy\Doubler\Generator\MirroredInterface {
Expand Down
12 changes: 6 additions & 6 deletions spec/Prophecy/Doubler/Generator/Node/ArgumentTypeNodeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function it_does_not_allow_union_mixed()
{
$this->beConstructedWith('mixed', 'int');

if (PHP_VERSION_ID >=80000) {
if (PHP_VERSION_ID >= 80000) {
$this->shouldThrow(DoubleException::class)->duringInstantiation();
}
}
Expand All @@ -89,7 +89,7 @@ function it_allows_standalone_false()
{
$this->beConstructedWith('false');

if (PHP_VERSION_ID >=80000 && PHP_VERSION_ID < 80200) {
if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80200) {
$this->shouldThrow(DoubleException::class)->duringInstantiation();
}

Expand All @@ -102,7 +102,7 @@ function it_allows_standalone_null()
{
$this->beConstructedWith('null');

if (PHP_VERSION_ID >=80000 && PHP_VERSION_ID < 80200) {
if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80200) {
$this->shouldThrow(DoubleException::class)->duringInstantiation();
}

Expand All @@ -115,7 +115,7 @@ function it_allows_standalone_true()
{
$this->beConstructedWith('true');

if (PHP_VERSION_ID >=80000 && PHP_VERSION_ID < 80200) {
if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80200) {
$this->shouldThrow(DoubleException::class)->duringInstantiation();
}

Expand All @@ -128,7 +128,7 @@ function it_allows_nullable_false()
{
$this->beConstructedWith('null', 'false');

if (PHP_VERSION_ID >=80000 && PHP_VERSION_ID < 80200) {
if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80200) {
$this->shouldThrow(DoubleException::class)->duringInstantiation();
}

Expand All @@ -141,7 +141,7 @@ function it_allows_nullable_true()
{
$this->beConstructedWith('null', 'true');

if (PHP_VERSION_ID >=80000 && PHP_VERSION_ID < 80200) {
if (PHP_VERSION_ID >= 80000 && PHP_VERSION_ID < 80200) {
$this->shouldThrow(DoubleException::class)->duringInstantiation();
}

Expand Down
Loading

0 comments on commit 16bbfc7

Please sign in to comment.