@@ -66,7 +66,7 @@ |
||
66 | 66 | function it_generates_proper_string_representation_for_resource() |
67 | 67 | { |
68 | 68 | $resource = fopen(__FILE__, 'r'); |
69 | - $this->stringify($resource)->shouldReturn('stream:'.$resource); |
|
69 | + $this->stringify($resource)->shouldReturn('stream:' . $resource); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -83,7 +83,7 @@ |
||
83 | 83 | public function __toString() |
84 | 84 | { |
85 | 85 | if (null === $this->string) { |
86 | - $this->string = implode(', ', array_map(function ($token) { |
|
86 | + $this->string = implode(', ', array_map(function($token) { |
|
87 | 87 | return (string) $token; |
88 | 88 | }, $this->tokens)); |
89 | 89 | } |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | |
61 | - $keyScores = array_map(array($this->key,'scoreArgument'), array_keys($argument)); |
|
62 | - $valueScores = array_map(array($this->value,'scoreArgument'), $argument); |
|
63 | - $scoreEntry = function ($value, $key) { |
|
61 | + $keyScores = array_map(array($this->key, 'scoreArgument'), array_keys($argument)); |
|
62 | + $valueScores = array_map(array($this->value, 'scoreArgument'), $argument); |
|
63 | + $scoreEntry = function($value, $key) { |
|
64 | 64 | return $value && $key ? min(8, ($key + $value) / 2) : false; |
65 | 65 | }; |
66 | 66 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | if (!$this->key instanceof ExactValueToken) { |
132 | 132 | throw new InvalidArgumentException(sprintf( |
133 | - 'You can only use exact value tokens to match key of ArrayAccess object'.PHP_EOL. |
|
133 | + 'You can only use exact value tokens to match key of ArrayAccess object' . PHP_EOL . |
|
134 | 134 | 'But you used `%s`.', |
135 | 135 | $this->key |
136 | 136 | )); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function __construct($value) |
28 | 28 | { |
29 | - $this->token = $value instanceof TokenInterface? $value : new ExactValueToken($value); |
|
29 | + $this->token = $value instanceof TokenInterface ? $value : new ExactValueToken($value); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $tagList = $phpdoc->getTagsByName('method'); |
50 | 50 | |
51 | - foreach($tagList as $tag) { |
|
51 | + foreach ($tagList as $tag) { |
|
52 | 52 | $methodName = $tag->getMethodName(); |
53 | 53 | |
54 | 54 | if (!$reflectionClass->hasMethod($methodName)) { |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | public function __construct(ClassMirror $mirror = null, ClassCreator $creator = null, |
51 | 51 | NameGenerator $namer = null) |
52 | 52 | { |
53 | - $this->mirror = $mirror ?: new ClassMirror; |
|
53 | + $this->mirror = $mirror ?: new ClassMirror; |
|
54 | 54 | $this->creator = $creator ?: new ClassCreator; |
55 | - $this->namer = $namer ?: new NameGenerator; |
|
55 | + $this->namer = $namer ?: new NameGenerator; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->patches[] = $patch; |
76 | 76 | |
77 | - @usort($this->patches, function (ClassPatchInterface $patch1, ClassPatchInterface $patch2) { |
|
77 | + @usort($this->patches, function(ClassPatchInterface $patch1, ClassPatchInterface $patch2) { |
|
78 | 78 | return $patch2->getPriority() - $patch1->getPriority(); |
79 | 79 | }); |
80 | 80 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | foreach ($interfaces as $interface) { |
96 | 96 | if (!$interface instanceof ReflectionClass) { |
97 | 97 | throw new InvalidArgumentException(sprintf( |
98 | - "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". |
|
98 | + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . |
|
99 | 99 | "a second argument to `Doubler::double(...)`, but got %s.", |
100 | - is_object($interface) ? get_class($interface).' class' : gettype($interface) |
|
100 | + is_object($interface) ? get_class($interface) . ' class' : gettype($interface) |
|
101 | 101 | )); |
102 | 102 | } |
103 | 103 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | $code = sprintf("class %s extends \%s implements %s {\n", |
37 | 37 | $classname, $class->getParentClass(), implode(', ', |
38 | - array_map(function ($interface) {return '\\'.$interface;}, $class->getInterfaces()) |
|
38 | + array_map(function($interface) {return '\\' . $interface; }, $class->getInterfaces()) |
|
39 | 39 | ) |
40 | 40 | ); |
41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $code .= "\n"; |
46 | 46 | |
47 | 47 | foreach ($class->getMethods() as $method) { |
48 | - $code .= $this->generateMethod($method)."\n"; |
|
48 | + $code .= $this->generateMethod($method) . "\n"; |
|
49 | 49 | } |
50 | 50 | $code .= "\n}"; |
51 | 51 | |
@@ -57,33 +57,33 @@ discard block |
||
57 | 57 | $php = sprintf("%s %s function %s%s(%s)%s {\n", |
58 | 58 | $method->getVisibility(), |
59 | 59 | $method->isStatic() ? 'static' : '', |
60 | - $method->returnsReference() ? '&':'', |
|
60 | + $method->returnsReference() ? '&' : '', |
|
61 | 61 | $method->getName(), |
62 | 62 | implode(', ', $this->generateArguments($method->getArguments())), |
63 | 63 | $method->hasReturnType() ? sprintf(': %s', $method->getReturnType()) : '' |
64 | 64 | ); |
65 | - $php .= $method->getCode()."\n"; |
|
65 | + $php .= $method->getCode() . "\n"; |
|
66 | 66 | |
67 | - return $php.'}'; |
|
67 | + return $php . '}'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | private function generateArguments(array $arguments) |
71 | 71 | { |
72 | - return array_map(function (Node\ArgumentNode $argument) { |
|
72 | + return array_map(function(Node\ArgumentNode $argument) { |
|
73 | 73 | $php = ''; |
74 | 74 | |
75 | 75 | if ($hint = $argument->getTypeHint()) { |
76 | 76 | if ('array' === $hint || 'callable' === $hint) { |
77 | 77 | $php .= $hint; |
78 | 78 | } else { |
79 | - $php .= '\\'.$hint; |
|
79 | + $php .= '\\' . $hint; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - $php .= ' '.($argument->isPassedByReference() ? '&' : '').'$'.$argument->getName(); |
|
83 | + $php .= ' ' . ($argument->isPassedByReference() ? '&' : '') . '$' . $argument->getName(); |
|
84 | 84 | |
85 | 85 | if ($argument->isOptional()) { |
86 | - $php .= ' = '.var_export($argument->getDefault(), true); |
|
86 | + $php .= ' = ' . var_export($argument->getDefault(), true); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $php; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (null !== $class) { |
52 | 52 | if (true === $class->isInterface()) { |
53 | 53 | throw new InvalidArgumentException(sprintf( |
54 | - "Could not reflect %s as a class, because it\n". |
|
54 | + "Could not reflect %s as a class, because it\n" . |
|
55 | 55 | "is interface - use the second argument instead.", |
56 | 56 | $class->getName() |
57 | 57 | )); |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | foreach ($interfaces as $interface) { |
64 | 64 | if (!$interface instanceof ReflectionClass) { |
65 | 65 | throw new InvalidArgumentException(sprintf( |
66 | - "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n". |
|
66 | + "[ReflectionClass \$interface1 [, ReflectionClass \$interface2]] array expected as\n" . |
|
67 | 67 | "a second argument to `ClassMirror::reflect(...)`, but got %s.", |
68 | - is_object($interface) ? get_class($interface).' class' : gettype($interface) |
|
68 | + is_object($interface) ? get_class($interface) . ' class' : gettype($interface) |
|
69 | 69 | )); |
70 | 70 | } |
71 | 71 | if (false === $interface->isInterface()) { |
72 | 72 | throw new InvalidArgumentException(sprintf( |
73 | - "Could not reflect %s as an interface, because it\n". |
|
73 | + "Could not reflect %s as an interface, because it\n" . |
|
74 | 74 | "is class - use the first argument instead.", |
75 | 75 | $interface->getName() |
76 | 76 | )); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * @var MethodNode[] |
29 | 29 | */ |
30 | - private $methods = array(); |
|
30 | + private $methods = array(); |
|
31 | 31 | |
32 | 32 | public function getParentClass() |
33 | 33 | { |