Skip to content

Commit 6a7dd67

Browse files
author
Lars Moelleken
committed
[+]: ignore "Exception" errors
-> because there is currently no types for e.g. "code" or "message"
1 parent 22b68d6 commit 6a7dd67

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

src/voku/PHPDoctor/PhpDocCheck/CheckClasses.php

+10
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ private static function checkMethods(
7777
$skipMethodsWithLeadingUnderscore
7878
) as $methodName => $methodInfo) {
7979

80+
// INFO: ignore "missing type for Exception"
81+
if (is_a(($class->name ?? ''), \Exception::class, true)) {
82+
return $error;
83+
}
84+
8085
if (!$skipParseErrorsAsError && $methodInfo['error']) {
8186
$error[$methodInfo['file'] ?? ''][] = '[' . ($methodInfo['line'] ?? '?') . ']: ' . str_replace("\n", ' ', $methodInfo['error']);
8287
}
@@ -257,6 +262,11 @@ private static function checkProperties(
257262
array $error
258263
): array
259264
{
265+
// INFO: ignore "missing type for Exception"
266+
if (is_a(($class->name ?? ''), \Exception::class, true)) {
267+
return $error;
268+
}
269+
260270
foreach ($class->getPropertiesInfo(
261271
$access,
262272
$skipMethodsWithLeadingUnderscore

tests/CheckerTest.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,20 @@ public function testCheckPhpClasses(): void
138138
],
139139
], $phpCodeErrors
140140
);
141+
}
141142

142-
// --------------------------
143+
// --------------------------
143144

144-
}
145+
$phpCodeErrors = PhpCodeChecker::checkPhpFiles(__DIR__ . '/Dummy12.php');
146+
147+
$phpCodeErrors = self::removeLocalPathForTheTest($phpCodeErrors);
148+
149+
static::assertSame(
150+
[
151+
], $phpCodeErrors
152+
);
153+
154+
// --------------------------
145155
}
146156

147157
public function testSimpleStringInput(): void

tests/Dummy12.php

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace voku\tests;
6+
7+
class Dummy12 extends \Exception
8+
{
9+
10+
}

0 commit comments

Comments
 (0)