8000 Fix typing · phpmd/phpmd@5aacc5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 5aacc5d

Browse files
committed
Fix typing
1 parent 30e3f99 commit 5aacc5d

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

src/main/php/PHPMD/AbstractNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function getImage()
200200
* Returns the source name for this node, maybe a class or interface name,
201201
* or a package, method, function name.
202202
*
203-
* @return string
203+
* @return string|null
204204
*/
205205
public function getName()
206206
{

src/main/php/PHPMD/Rule/Naming/LongMethodName.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ class LongMethodName extends AbstractRule implements MethodAware, FunctionAware
3838
public function apply(AbstractNode $node)
3939
{
4040
$threshold = $this->getIntProperty('maximum');
41+
$name = (string) $node->getName();
4142

42-
if (strlen($node->getName()) <= $threshold) {
43+
if (strlen($name) <= $threshold) {
4344
return;
4445
}
4546

4647
$exceptions = $this->getExceptionsList();
4748

48-
if (in_array($node->getName(), $exceptions, true)) {
49+
if (in_array($name, $exceptions, true)) {
4950
return;
5051
}
5152

src/main/php/PHPMD/Rule/Naming/ShortMethodName.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ class ShortMethodName extends AbstractRule implements MethodAware, FunctionAware
3838
public function apply(AbstractNode $node)
3939
{
4040
$threshold = $this->getIntProperty('minimum');
41+
$name = (string) $node->getName();
4142

42-
if (strlen($node->getName()) >= $threshold) {
43+
if (strlen($name) >= $threshold) {
4344
return;
4445
}
4546

4647
$exceptions = $this->getExceptionsList();
4748

48-
if (in_array($node->getName(), $exceptions, true)) {
49+
if (in_array($name, $exceptions, true)) {
4950
return;
5051
}
5152

src/test/php/PHPMD/TextUI/CommandLineOptionsTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testThrowsExpectedExceptionWhenRequiredArgumentsNotSet()
154154
* @expectedException \InvalidArgumentException
155155
* @expectedExceptionMessage Unknown option --help.
156156
*
157-
* @covers \PHPMD\TextUI\ArgumentsValidator
157+
* @covers \PHPMD\Utility\ArgumentsValidator
158158
*/
159159
public function testThrowsExpectedExceptionWhenOptionNotFound()
160160
{
@@ -175,7 +175,7 @@ public function testThrowsExpectedExceptionWhenOptionNotFound()
175175
* @expectedException \InvalidArgumentException
176176
* @expectedExceptionMessage Unknown option -foobar
177177
*
178-
* @covers \PHPMD\TextUI\ArgumentsValidator
178+
* @covers \PHPMD\Utility\ArgumentsValidator
179179
*/
180180
public function testThrowsExpectedExceptionWhenOptionNotFoundInFront()
181181
{
@@ -196,7 +196,7 @@ public function testThrowsExpectedExceptionWhenOptionNotFoundInFront()
196196
* @expectedException \InvalidArgumentException
197197
* @expectedExceptionMessage Unknown option --help.
198198
*
199-
* @covers \PHPMD\TextUI\ArgumentsValidator
199+
* @covers \PHPMD\Utility\ArgumentsValidator
200200
*/
201201
public function testThrowsExpectedExceptionWhenOptionNotFoundUsingArgumentSeparator()
202202
{
@@ -217,7 +217,7 @@ public function testThrowsExpectedExceptionWhenOptionNotFoundUsingArgumentSepara
217217
* @expectedException \InvalidArgumentException
218218
* @expectedExceptionMessage --color option does not accept a value
219219
*
220-
* @covers \PHPMD\TextUI\ArgumentsValidator
220+
* @covers \PHPMD\Utility\ArgumentsValidator
221221
*/
222222
public function testThrowsExpectedExceptionWhenBooleanOptionReceiveValue()
223223
{
@@ -226,7 +226,7 @@ public function testThrowsExpectedExceptionWhenBooleanOptionReceiveValue()
226226
}
227227

228228
/**
229-
* @covers \PHPMD\TextUI\ArgumentsValidator
229+
* @covers \PHPMD\Utility\ArgumentsValidator
230230
*/
231231
public function testOptionEqualSyntax()
232232
{
@@ -237,7 +237,7 @@ public function testOptionEqualSyntax()
237237
}
238238

239239
/**
240-
* @covers \PHPMD\TextUI\ArgumentsValidator
240+
* @covers \PHPMD\Utility\ArgumentsValidator
241241
*/
242242
public function testArgumentSeparatorEnforced()
243243
{

src/test/php/fix-php-compatibility.php

Lines changed: 6 additions & 0 deletions
< 4783 /tr>
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@
172172
'#[\\ReturnTypeWillChange]',
173173
),
174174
),
175+
__DIR__ . '/../../../../vendor/phpunit/phpunit/src/Util/Getopt.php' => array(
176+
array(
177+
'strlen($opt_arg)',
178+
'strlen((string) $opt_arg)',
179+
),
180+
),
175181
__DIR__ . '/../../../vendor/phpunit/php-code-coverage/src/CodeCoverage.php' => (PHP_VERSION >= 7) ? array(
176182
array(
177183
'$docblock = $token->getDocblock();',

0 commit comments

Comments
 (0)
0