Skip to content
This repository was archived by the owner on Jul 8, 2023. It is now read-only.

Commit 36bfe0d

Browse files
committed
Updated to meet latest PHP CS fixer rules.
1 parent c47746b commit 36bfe0d

File tree

42 files changed

+886
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+886
-338
lines changed

.php_cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder\DefaultFinder::create()->in(__DIR__);
4+
5+
return Symfony\CS\Config\Config::create()
6+
->fixers(
7+
array(
8+
'-concat_without_spaces',
9+
'-new_with_braces',
10+
'concat_with_spaces',
11+
'ordered_use',
12+
)
13+
)
14+
->finder($finder);

src/Call/CallVerifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
use Eloquent\Phony\Assertion\Recorder\AssertionRecorderInterface;
1616
use Eloquent\Phony\Assertion\Renderer\AssertionRenderer;
1717
use Eloquent\Phony\Assertion\Renderer\AssertionRendererInterface;
18-
use Eloquent\Phony\Call\Event\CalledEventInterface;
1918
use Eloquent\Phony\Call\Event\CallEventCollectionInterface;
2019
use Eloquent\Phony\Call\Event\CallEventInterface;
20+
use Eloquent\Phony\Call\Event\CalledEventInterface;
2121
use Eloquent\Phony\Call\Event\ProducedEventInterface;
2222
use Eloquent\Phony\Call\Event\ReceivedEventInterface;
2323
use Eloquent\Phony\Call\Event\ReceivedExceptionEventInterface;

src/Call/Event/CallEventCollection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,5 @@ public function argument($index = null)
6060
}
6161

6262
throw new UndefinedArgumentException($index);
63-
6463
}
6564
}

src/Call/Factory/CallFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public function record(
125125

126126
try {
127127
$returnValue = $this->invoker->callWith($callback, $arguments);
128-
} catch (Exception $exception) {}
128+
} catch (Exception $exception) {
129+
}
129130

130131
$call->setResponseEvent(
131132
$this->eventFactory->createResponse($returnValue, $exception)

src/Mock/Exception/MockGenerationFailedException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public function __construct(
7070
);
7171
}
7272

73-
foreach ($lines as $lineNumber => $line) {}
73+
foreach ($lines as $lineNumber => $line) {
74+
}
7475

7576
$padSize = strlen($lineNumber + 1) + 4;
7677
$renderedLines = '';

src/Mock/Generator/MockGenerator.php

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ protected function generateConstants(MockDefinitionInterface $definition)
276276
$source .= "\n const " .
277277
$name .
278278
' = ' .
279-
(null === $value ? 'null' : var_export($value, true)) .
279+
(null === $value ? 'null' : $this->renderValue($value)) .
280280
';';
281281
}
282282

@@ -293,8 +293,9 @@ protected function generateConstants(MockDefinitionInterface $definition)
293293
*
294294
* @return string The source code.
295295
*/
296-
protected function generateMagicCallStatic(MockDefinitionInterface $definition)
297-
{
296+
protected function generateMagicCallStatic(
297+
MockDefinitionInterface $definition
298+
) {
298299
$methods = $definition->methods()->publicStaticMethods();
299300

300301
if (!isset($methods['__callStatic'])) {
@@ -408,11 +409,11 @@ protected function generateMethods(array $methods)
408409
foreach ($signature as $parameter) {
409410
$argumentPacking .= "\n if (\$argumentCount > " .
410411
++$index .
411-
') $arguments[] = ' .
412+
") {\n \$arguments[] = " .
412413
$parameter[1] .
413414
'$a' .
414415
$index .
415-
';';
416+
";\n }";
416417
}
417418
} else {
418419
$argumentPacking = '';
@@ -539,8 +540,9 @@ public function __call(
539540
*
540541
* @return string The source code.
541542
*/
542-
protected function generateCallParentMethods(MockDefinitionInterface $definition)
543-
{
543+
protected function generateCallParentMethods(
544+
MockDefinitionInterface $definition
545+
) {
544546
$hasTraits = (boolean) $definition->traitNames();
545547
$parentClassName = $definition->parentClassName();
546548
$hasParentClass = null !== $parentClassName;
@@ -576,7 +578,7 @@ private static function _callTraitStatic(
576578
'_callTrait_' .
577579
\str_replace('\\', "\xc2\xa6", $traitName) .
578580
"\xc2\xbb" .
579-
$name
581+
$name,
580582
),
581583
$arguments->all()
582584
);
@@ -672,7 +674,7 @@ private function _callTrait(
672674
'_callTrait_' .
673675
\str_replace('\\', "\xc2\xa6", $traitName) .
674676
"\xc2\xbb" .
675-
$name
677+
$name,
676678
),
677679
$arguments->all()
678680
);
@@ -718,7 +720,7 @@ protected function generateProperties(MockDefinitionInterface $definition)
718720
"\n public static \$" .
719721
$name .
720722
' = ' .
721-
(null === $value ? 'null' : var_export($value, true)) .
723+
(null === $value ? 'null' : $this->renderValue($value)) .
722724
';';
723725
}
724726

@@ -727,7 +729,7 @@ protected function generateProperties(MockDefinitionInterface $definition)
727729
"\n public \$" .
728730
$name .
729731
' = ' .
730-
(null === $value ? 'null' : var_export($value, true)) .
732+
(null === $value ? 'null' : $this->renderValue($value)) .
731733
';';
732734
}
733735

@@ -747,15 +749,15 @@ protected function generateProperties(MockDefinitionInterface $definition)
747749
$source .= "\n private static \$_uncallableMethods = ";
748750

749751
if ($uncallableMethodNames) {
750-
$source .= var_export($uncallableMethodNames, true);
752+
$source .= $this->renderValue($uncallableMethodNames);
751753
} else {
752754
$source .= 'array()';
753755
}
754756

755757
$source .= ";\n private static \$_traitMethods = ";
756758

757759
if ($traitMethodNames) {
758-
$source .= var_export($traitMethodNames, true);
760+
$source .= $this->renderValue($traitMethodNames);
759761
} else {
760762
$source .= 'array()';
761763
}
@@ -767,6 +769,18 @@ protected function generateProperties(MockDefinitionInterface $definition)
767769
return $source;
768770
}
769771

772+
/**
773+
* Render the supplied value.
774+
*
775+
* @param mixed $value The value.
776+
*
777+
* @return string The rendered value.
778+
*/
779+
protected function renderValue($value)
780+
{
781+
return str_replace('array (', 'array(', var_export($value, true));
782+
}
783+
770784
private static $instance;
771785
private $labelSequencer;
772786
private $signatureInspector;

src/Mock/Method/AbstractWrappedMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(ReflectionMethod $method, ProxyInterface $proxy)
4040
$this->mock = null;
4141
$callback = array(
4242
$method->getDeclaringClass()->getName(),
43-
$this->name
43+
$this->name,
4444
);
4545
} else {
4646
$this->mock = $proxy->mock();

src/Reflection/FunctionSignatureInspector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ public function signature(ReflectionFunctionAbstract $function)
153153
switch ($defaultValue) {
154154
case ' = NULL':
155155
$defaultValue = ' = null';
156+
157+
break;
158+
159+
default:
160+
$defaultValue =
161+
str_replace('array (', 'array(', $defaultValue);
156162
}
157163
} elseif ('optional' === $match[1]) {
158164
$defaultValue = ' = null';

test/benchmarks/Mock/Generator/IsolatorMockEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use Eloquent\Phony\Phpunit\Phony;
1616
use Mock;
1717
use Mockery;
18-
use Phake;
1918
use PHPUnit_Framework_MockObject_Generator;
19+
use Phake;
2020
use Prophecy\Prophet;
2121
use SimpleTest;
2222
use SimpleTestCase;

test/benchmarks/Mock/Generator/TypicalMockEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
use Eloquent\Phony\Phpunit\Phony;
1616
use Mock;
1717
use Mockery;
18-
use Phake;
1918
use PHPUnit_Framework_MockObject_Generator;
19+
use Phake;
2020
use Prophecy\Prophet;
2121
use SimpleTest;
2222
use SimpleTestCase;

0 commit comments

Comments
 (0)