Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 185beaf

Browse files
michalbundyraOcramius
authored andcommitted
Auto CS fixes - zend-coding-standard with extended sniffs
1 parent 168a6dd commit 185beaf

File tree

78 files changed

+413
-394
lines changed

Some content is hidden

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

78 files changed

+413
-394
lines changed

phpcs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0"?>
22
<ruleset name="Zend Framework coding standard">
33
<rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/>
4-
54
<!-- Paths to check -->
65
<file>src</file>
76
<file>test</file>
87
<exclude-pattern>*/TestAsset/*</exclude-pattern>
8+
<exclude-pattern>*/_files/*</exclude-pattern>
99
</ruleset>

src/Annotation/AnnotationManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ public function createAnnotation(array $annotationData)
9999

100100
$eventManager = $this->getEventManager();
101101
$results = $eventManager->triggerEventUntil(function ($r) {
102-
return (is_object($r));
102+
return is_object($r);
103103
}, $event);
104104

105105
$annotation = $results->last();
106106

107-
return (is_object($annotation) ? $annotation : false);
107+
return is_object($annotation) ? $annotation : false;
108108
}
109109
}

src/Annotation/Parser/DoctrineAnnotationParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function registerAnnotations($annotations)
140140
throw new Exception\InvalidArgumentException(sprintf(
141141
'%s: expects an array or Traversable; received "%s"',
142142
__METHOD__,
143-
(is_object($annotations) ? get_class($annotations) : gettype($annotations))
143+
is_object($annotations) ? get_class($annotations) : gettype($annotations)
144144
));
145145
}
146146

src/Annotation/Parser/GenericAnnotationParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function registerAnnotation($annotation)
9696
'%s: expects an instance of %s\AnnotationInterface; received "%s"',
9797
__METHOD__,
9898
__NAMESPACE__,
99-
(is_object($annotation) ? get_class($annotation) : gettype($annotation))
99+
is_object($annotation) ? get_class($annotation) : gettype($annotation)
100100
));
101101
}
102102

@@ -126,7 +126,7 @@ public function registerAnnotations($annotations)
126126
throw new Exception\InvalidArgumentException(sprintf(
127127
'%s: expects an array or Traversable; received "%s"',
128128
__METHOD__,
129-
(is_object($annotations) ? get_class($annotations) : gettype($annotations))
129+
is_object($annotations) ? get_class($annotations) : gettype($annotations)
130130
));
131131
}
132132

@@ -203,7 +203,7 @@ protected function hasAlias($alias)
203203
{
204204
$alias = $this->normalizeAlias($alias);
205205

206-
return (isset($this->aliases[$alias]));
206+
return isset($this->aliases[$alias]);
207207
}
208208

209209
/**

src/Generator/AbstractGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ abstract class AbstractGenerator implements GeneratorInterface
3131
/**
3232
* @var string
3333
*/
34-
protected $sourceContent = null;
34+
protected $sourceContent;
3535

3636
/**
3737
* @param array $options
@@ -108,7 +108,7 @@ public function setOptions($options)
108108
throw new Exception\InvalidArgumentException(sprintf(
109109
'%s expects an array or Traversable object; received "%s"',
110110
__METHOD__,
111-
(is_object($options) ? get_class($options) : gettype($options))
111+
is_object($options) ? get_class($options) : gettype($options)
112112
));
113113
}
114114

src/Generator/AbstractMemberGenerator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ abstract class AbstractMemberGenerator extends AbstractGenerator
3434
/**
3535
* @var DocBlockGenerator
3636
*/
37-
protected $docBlock = null;
37+
protected $docBlock;
3838

3939
/**
4040
* @var string
4141
*/
42-
protected $name = null;
42+
protected $name;
4343

4444
/**
4545
* @var int
@@ -91,7 +91,7 @@ public function removeFlag($flag)
9191
*/
9292
public function setAbstract($isAbstract)
9393
{
94-
return (($isAbstract) ? $this->addFlag(self::FLAG_ABSTRACT) : $this->removeFlag(self::FLAG_ABSTRACT));
94+
return $isAbstract ? $this->addFlag(self::FLAG_ABSTRACT) : $this->removeFlag(self::FLAG_ABSTRACT);
9595
}
9696

9797
/**
@@ -108,7 +108,7 @@ public function isAbstract()
108108
*/
109109
public function setInterface($isInterface)
110110
{
111-
return (($isInterface) ? $this->addFlag(self::FLAG_INTERFACE) : $this->removeFlag(self::FLAG_INTERFACE));
111+
return $isInterface ? $this->addFlag(self::FLAG_INTERFACE) : $this->removeFlag(self::FLAG_INTERFACE);
112112
}
113113

114114
/**
@@ -125,7 +125,7 @@ public function isInterface()
125125
*/
126126
public function setFinal($isFinal)
127127
{
128-
return (($isFinal) ? $this->addFlag(self::FLAG_FINAL) : $this->removeFlag(self::FLAG_FINAL));
128+
return $isFinal ? $this->addFlag(self::FLAG_FINAL) : $this->removeFlag(self::FLAG_FINAL);
129129
}
130130

131131
/**
@@ -142,7 +142,7 @@ public function isFinal()
142142
*/
143143
public function setStatic($isStatic)
144144
{
145-
return (($isStatic) ? $this->addFlag(self::FLAG_STATIC) : $this->removeFlag(self::FLAG_STATIC));
145+
return $isStatic ? $this->addFlag(self::FLAG_STATIC) : $this->removeFlag(self::FLAG_STATIC);
146146
}
147147

148148
/**
@@ -183,9 +183,9 @@ public function setVisibility($visibility)
183183
public function getVisibility()
184184
{
185185
switch (true) {
186-
case ($this->flags & self::FLAG_PROTECTED):
186+
case $this->flags & self::FLAG_PROTECTED:
187187
return self::VISIBILITY_PROTECTED;
188-
case ($this->flags & self::FLAG_PRIVATE):
188+
case $this->flags & self::FLAG_PRIVATE:
189189
return self::VISIBILITY_PRIVATE;
190190
default:
191191
return self::VISIBILITY_PUBLIC;

src/Generator/BodyGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class BodyGenerator extends AbstractGenerator
1414
/**
1515
* @var string
1616
*/
17-
protected $content = null;
17+
protected $content;
1818

1919
/**
2020
* @param string $content

src/Generator/ClassGenerator.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@
1313

1414
class ClassGenerator extends AbstractGenerator
1515
{
16-
const OBJECT_TYPE = "class";
17-
const IMPLEMENTS_KEYWORD = "implements";
16+
const OBJECT_TYPE = 'class';
17+
const IMPLEMENTS_KEYWORD = 'implements';
1818

1919
const FLAG_ABSTRACT = 0x01;
2020
const FLAG_FINAL = 0x02;
2121

2222
/**
2323
* @var FileGenerator
2424
*/
25-
protected $containingFileGenerator = null;
25+
protected $containingFileGenerator;
2626

2727
/**
2828
* @var string
2929
*/
30-
protected $namespaceName = null;
30+
protected $namespaceName;
3131

3232
/**
3333
* @var DocBlockGenerator
3434
*/
35-
protected $docBlock = null;
35+
protected $docBlock;
3636

3737
/**
3838
* @var string
3939
*/
40-
protected $name = null;
40+
protected $name;
4141

4242
/**
4343
* @var bool
@@ -47,7 +47,7 @@ class ClassGenerator extends AbstractGenerator
4747
/**
4848
* @var string
4949
*/
50-
protected $extendedClass = null;
50+
protected $extendedClass;
5151

5252
/**
5353
* @var array Array of string names
@@ -131,7 +131,7 @@ public static function fromReflection(ClassReflection $classReflection)
131131
foreach ($classReflection->getConstants() as $name => $value) {
132132
$constants[] = [
133133
'name' => $name,
134-
'value' => $value
134+
'value' => $value,
135135
];
136136
}
137137

@@ -140,7 +140,7 @@ public static function fromReflection(ClassReflection $classReflection)
140140
$methods = [];
141141

142142
foreach ($classReflection->getMethods() as $reflectionMethod) {
143-
$className = ($cg->getNamespaceName()) ? $cg->getNamespaceName() . "\\" . $cg->getName() : $cg->getName();
143+
$className = $cg->getNamespaceName() ? $cg->getNamespaceName() . '\\' . $cg->getName() : $cg->getName();
144144

145145
if ($reflectionMethod->getDeclaringClass()->getName() == $className) {
146146
$methods[] = MethodGenerator::fromReflection($reflectionMethod);
@@ -188,7 +188,7 @@ public static function fromArray(array $array)
188188
$cg->setNamespaceName($value);
189189
break;
190190
case 'docblock':
191-
$docBlock = ($value instanceof DocBlockGenerator) ? $value : DocBlockGenerator::fromArray($value);
191+
$docBlock = $value instanceof DocBlockGenerator ? $value : DocBlockGenerator::fromArray($value);
192192
$cg->setDocBlock($docBlock);
193193
break;
194194
case 'flags':
@@ -383,7 +383,7 @@ public function removeFlag($flag)
383383
*/
384384
public function setAbstract($isAbstract)
385385
{
386-
return (($isAbstract) ? $this->addFlag(self::FLAG_ABSTRACT) : $this->removeFlag(self::FLAG_ABSTRACT));
386+
return $isAbstract ? $this->addFlag(self::FLAG_ABSTRACT) : $this->removeFlag(self::FLAG_ABSTRACT);
387387
}
388388

389389
/**
@@ -400,15 +400,15 @@ public function isAbstract()
400400
*/
401401
public function setFinal($isFinal)
402402
{
403-
return (($isFinal) ? $this->addFlag(self::FLAG_FINAL) : $this->removeFlag(self::FLAG_FINAL));
403+
return $isFinal ? $this->addFlag(self::FLAG_FINAL) : $this->removeFlag(self::FLAG_FINAL);
404404
}
405405

406406
/**
407407
* @return bool
408408
*/
409409
public function isFinal()
410410
{
411-
return ($this->flags & self::FLAG_FINAL);
411+
return $this->flags & self::FLAG_FINAL;
412412
}
413413

414414
/**
@@ -767,7 +767,6 @@ public function getUses()
767767
return $this->traitUsageGenerator->getUses();
768768
}
769769

770-
771770
/**
772771
* @param string $propertyName
773772
* @return self
@@ -1050,7 +1049,7 @@ public function generate()
10501049
$output .= static::OBJECT_TYPE . ' ' . $this->getName();
10511050

10521051
if (! empty($this->extendedClass)) {
1053-
$output .= ' extends ' . $this->generateShortOrCompleteClassname($this->extendedClass);
1052+
$output .= ' extends ' . $this->generateShortOrCompleteClassname($this->extendedClass);
10541053
}
10551054

10561055
$implemented = $this->getImplementedInterfaces();

src/Generator/DocBlock/Tag/AbstractTypeableTag.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414
/**
1515
* This abstract class can be used as parent for all tags
1616
* that use a type part in their content.
17+
*
1718
* @see http://www.phpdoc.org/docs/latest/for-users/phpdoc/types.html
1819
*/
1920
abstract class AbstractTypeableTag extends AbstractGenerator
2021
{
2122
/**
2223
* @var string
2324
*/
24-
protected $description = null;
25+
protected $description;
2526

2627
/**
2728
* @var array

src/Generator/DocBlock/Tag/AuthorTag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ class AuthorTag extends AbstractGenerator implements TagInterface
1818
/**
1919
* @var string
2020
*/
21-
protected $authorName = null;
21+
protected $authorName;
2222

2323
/**
2424
* @var string
2525
*/
26-
protected $authorEmail = null;
26+
protected $authorEmail;
2727

2828
/**
2929
* @param string $authorName
@@ -102,8 +102,8 @@ public function getAuthorName()
102102
public function generate()
103103
{
104104
$output = '@author'
105-
. ((! empty($this->authorName)) ? ' ' . $this->authorName : '')
106-
. ((! empty($this->authorEmail)) ? ' <' . $this->authorEmail . '>' : '');
105+
. (! empty($this->authorName) ? ' ' . $this->authorName : '')
106+
. (! empty($this->authorEmail) ? ' <' . $this->authorEmail . '>' : '');
107107

108108
return $output;
109109
}

src/Generator/DocBlock/Tag/GenericTag.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ class GenericTag extends AbstractGenerator implements TagInterface, PrototypeGen
1717
/**
1818
* @var string
1919
*/
20-
protected $name = null;
20+
protected $name;
2121

2222
/**
2323
* @var string
2424
*/
25-
protected $content = null;
25+
protected $content;
2626

2727
/**
2828
* @param string $name
@@ -81,7 +81,7 @@ public function getContent()
8181
public function generate()
8282
{
8383
$output = '@' . $this->name
84-
. ((! empty($this->content)) ? ' ' . $this->content : '');
84+
. (! empty($this->content) ? ' ' . $this->content : '');
8585

8686
return $output;
8787
}

src/Generator/DocBlock/Tag/LicenseTag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ class LicenseTag extends AbstractGenerator implements TagInterface
1818
/**
1919
* @var string
2020
*/
21-
protected $url = null;
21+
protected $url;
2222

2323
/**
2424
* @var string
2525
*/
26-
protected $licenseName = null;
26+
protected $licenseName;
2727

2828
/**
2929
* @param string $url
@@ -102,8 +102,8 @@ public function getLicenseName()
102102
public function generate()
103103
{
104104
$output = '@license'
105-
. ((! empty($this->url)) ? ' ' . $this->url : '')
106-
. ((! empty($this->licenseName)) ? ' ' . $this->licenseName : '');
105+
. (! empty($this->url) ? ' ' . $this->url : '')
106+
. (! empty($this->licenseName) ? ' ' . $this->licenseName : '');
107107

108108
return $output;
109109
}

0 commit comments

Comments
 (0)