Skip to content

Commit 24e0f52

Browse files
committed
Fix minor CS violations
Signed-off-by: George Steel <george@net-glue.co.uk>
1 parent 6400852 commit 24e0f52

11 files changed

+59
-64
lines changed

phpcs.xml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"
55
>
6+
<arg value="ps" />
67
<!-- Paths to check -->
78
<file>src</file>
89
<file>test</file>

src/Generator/ClassGenerator.php

-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use function sprintf;
2424
use function str_contains;
2525
use function str_replace;
26-
use function strpos;
2726
use function strrpos;
2827
use function strtolower;
2928
use function substr;
@@ -185,7 +184,6 @@ public static function fromReflection(ClassReflection $classReflection)
185184
* @configkey properties
186185
* @configkey methods
187186
* @throws Exception\InvalidArgumentException
188-
* @param array $array
189187
* @return static
190188
*/
191189
public static function fromArray(array $array)

src/Generator/DocBlockGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ public static function fromReflection(DocBlockReflection $reflectionDocBlock)
6161
* @configkey longdescription string The long description for this doc block
6262
* @configkey tags array
6363
* @throws Exception\InvalidArgumentException
64-
* @param array $array
6564
* @return DocBlockGenerator
6665
*/
6766
public static function fromArray(array $array)

src/Generator/FileGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public function __construct($options = null)
9393
* @deprecated this API is deprecated, and will be removed in the next major release. Please
9494
* use the other constructors of this class instead.
9595
*
96-
* @param array $values
9796
* @return FileGenerator
9897
*/
9998
public static function fromArray(array $values)

src/Generator/InterfaceGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public static function fromReflection(ClassReflection $classReflection)
7979
* @configkey constants
8080
* @configkey methods
8181
* @throws Exception\InvalidArgumentException
82-
* @param array $array
8382
* @return static
8483
*/
8584
public static function fromArray(array $array)

src/Generator/MethodGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ protected static function clearBodyIndention($body)
134134
* @configkey static bool
135135
* @configkey visibility string
136136
* @throws Exception\InvalidArgumentException
137-
* @param array $array
138137
* @return MethodGenerator
139138
*/
140139
public static function fromArray(array $array)

src/Generator/ParameterGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public static function fromReflection(ParameterReflection $reflectionParameter)
7272
* @configkey sourcecontent string
7373
* @configkey omitdefaultvalue bool
7474
* @throws Exception\InvalidArgumentException
75-
* @param array $array
7675
* @return ParameterGenerator
7776
*/
7877
public static function fromArray(array $array)

src/Generator/PropertyGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public static function fromReflection(PropertyReflection $reflectionProperty)
113113
* @configkey omitdefaultvalue bool
114114
* @configkey readonly bool
115115
* @configkey type null|TypeGenerator
116-
* @param array $array
117116
* @return static
118117
* @throws Exception\InvalidArgumentException
119118
*/

src/Generator/TraitGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public static function fromReflection(ClassReflection $classReflection)
7070
* @configkey properties
7171
* @configkey methods
7272
* @throws Exception\InvalidArgumentException
73-
* @param array $array
7473
* @return static
7574
*/
7675
public static function fromArray(array $array)

src/Generator/ValueGenerator.php

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class ValueGenerator extends AbstractGenerator
6262
/** @var self::OUTPUT_* */
6363
protected string $outputMode = self::OUTPUT_MULTIPLE_LINE;
6464

65-
/** @var array */
6665
protected array $allowedTypes = [];
6766

6867
/**

test/Reflection/ClassReflectionTest.php

+58-54
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use PHPUnit\Framework\TestCase;
1111

1212
use function array_shift;
13-
use function get_class;
1413
use function trim;
1514
use function uniqid;
1615

@@ -69,67 +68,72 @@ public function testInterfaceReturn()
6968
public function testGetContentsReturnsContents()
7069
{
7170
$reflectionClass = new ClassReflection(TestAsset\TestSampleClass2::class);
72-
$target = <<<EOS
73-
{
74-
protected \$_prop1 = null;
75-
76-
/**
77-
* @Sample({"foo":"bar"})
78-
*/
79-
protected \$_prop2 = null;
8071

81-
public function getProp1()
82-
{
83-
return \$this->_prop1;
84-
}
85-
86-
public function getProp2(\$param1, TestSampleClass \$param2)
87-
{
88-
return \$this->_prop2;
89-
}
90-
91-
public function getIterator(): \Traversable
92-
{
93-
return new \EmptyIterator();
94-
}
95-
96-
}
97-
EOS;
98-
$contents = $reflectionClass->getContents();
72+
// phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
73+
$target = <<<EOS
74+
{
75+
protected \$_prop1 = null;
76+
77+
/**
78+
* @Sample({"foo":"bar"})
79+
*/
80+
protected \$_prop2 = null;
81+
82+
public function getProp1()
83+
{
84+
return \$this->_prop1;
85+
}
86+
87+
public function getProp2(\$param1, TestSampleClass \$param2)
88+
{
89+
return \$this->_prop2;
90+
}
91+
92+
public function getIterator(): \Traversable
93+
{
94+
return new \EmptyIterator();
95+
}
96+
97+
}
98+
EOS;
99+
$contents = $reflectionClass->getContents();
99100
self::assertEquals(trim($target), trim($contents));
101+
// phpcs:enable
100102
}
101103

102104
public function testGetContentsReturnsContentsWithImplementsOnSeparateLine()
103105
{
104106
$reflectionClass = new ClassReflection(TestAsset\TestSampleClass9::class);
105-
$target = <<<EOS
106-
{
107-
protected \$_prop1 = null;
108-
109-
/**
110-
* @Sample({"foo":"bar"})
111-
*/
112-
protected \$_prop2 = null;
113-
114-
public function getProp1()
115-
{
116-
return \$this->_prop1;
117-
}
118-
119-
public function getProp2(\$param1, TestSampleClass \$param2)
120-
{
121-
return \$this->_prop2;
122-
}
123-
124-
public function getIterator(): \Traversable
125-
{
126-
return new \EmptyIterator();
127-
}
128-
129-
}
130-
EOS;
131-
$contents = $reflectionClass->getContents();
107+
// phpcs:disable SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
108+
$target = <<<EOS
109+
{
110+
protected \$_prop1 = null;
111+
112+
/**
113+
* @Sample({"foo":"bar"})
114+
*/
115+
protected \$_prop2 = null;
116+
117+
public function getProp1()
118+
{
119+
return \$this->_prop1;
120+
}
121+
122+
public function getProp2(\$param1, TestSampleClass \$param2)
123+
{
124+
return \$this->_prop2;
125+
}
126+
127+
public function getIterator(): \Traversable
128+
{
129+
return new \EmptyIterator();
130+
}
131+
132+
}
133+
EOS;
134+
$contents = $reflectionClass->getContents();
132135
self::assertEquals(trim($target), trim($contents));
136+
// phpcs:enable
133137
}
134138

135139
public function testStartLine()

0 commit comments

Comments
 (0)