Skip to content

Commit 942d28c

Browse files
committed
Update to PHPStan v2.1.32
1 parent 6b1b427 commit 942d28c

33 files changed

+108
-166
lines changed

composer.lock

Lines changed: 5 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan-baseline.neon

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ parameters:
66
count: 1
77
path: wcfsetup/install/files/lib/acp/form/AbstractCategoryEditForm.class.php
88

9-
-
10-
message: '#^Strict comparison using \=\=\= between array and false will always evaluate to false\.$#'
11-
identifier: identical.alwaysFalse
12-
count: 1
13-
path: wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php
14-
159
-
1610
message: '#^Property wcf\\acp\\form\\LanguageImportForm\:\:\$language \(wcf\\data\\language\\Language\) does not accept wcf\\data\\language\\LanguageEditor\.$#'
1711
identifier: assign.propertyType
@@ -66,12 +60,6 @@ parameters:
6660
count: 2
6761
path: wcfsetup/install/files/lib/data/comment/CommentAction.class.php
6862

69-
-
70-
message: '#^While loop condition is always true\.$#'
71-
identifier: while.alwaysTrue
72-
count: 1
73-
path: wcfsetup/install/files/lib/data/user/notification/event/UserNotificationEventAction.class.php
74-
7563
-
7664
message: '#^Instanceof between wcf\\data\\search\\ISearchResultObject and wcf\\data\\search\\ISearchResultObject will always evaluate to true\.$#'
7765
identifier: instanceof.alwaysTrue
@@ -354,12 +342,6 @@ parameters:
354342
count: 1
355343
path: wcfsetup/install/files/lib/system/condition/AbstractMultiSelectCondition.class.php
356344

357-
-
358-
message: '#^Parameter \#2 \$array of function implode expects array\|null, string given\.$#'
359-
identifier: argument.type
360-
count: 1
361-
path: wcfsetup/install/files/lib/system/condition/AbstractObjectTextPropertyCondition.class.php
362-
363345
-
364346
message: '#^Strict comparison using \=\=\= between array\<mixed\> and null will always evaluate to false\.$#'
365347
identifier: identical.alwaysFalse
@@ -462,12 +444,6 @@ parameters:
462444
count: 1
463445
path: wcfsetup/install/files/lib/system/condition/user/UserLastActivityTimeIntervalDaysCondition.class.php
464446

465-
-
466-
message: '#^Strict comparison using \=\=\= between string and null will always evaluate to false\.$#'
467-
identifier: identical.alwaysFalse
468-
count: 1
469-
path: wcfsetup/install/files/lib/system/database/statement/PreparedStatement.class.php
470-
471447
-
472448
message: '#^Instanceof between wcf\\system\\database\\table\\column\\IDatabaseTableColumn and wcf\\system\\database\\table\\column\\IDatabaseTableColumn will always evaluate to true\.$#'
473449
identifier: instanceof.alwaysTrue
@@ -528,12 +504,6 @@ parameters:
528504
count: 1
529505
path: wcfsetup/install/files/lib/system/form/builder/CustomFormNode.class.php
530506

531-
-
532-
message: '#^Empty array passed to foreach\.$#'
533-
identifier: foreach.emptyArray
534-
count: 2
535-
path: wcfsetup/install/files/lib/system/form/builder/CustomFormNode.class.php
536-
537507
-
538508
message: '#^Result of && is always false\.$#'
539509
identifier: booleanAnd.alwaysFalse
@@ -582,12 +552,6 @@ parameters:
582552
count: 1
583553
path: wcfsetup/install/files/lib/system/form/builder/GridViewFormNode.class.php
584554

585-
-
586-
message: '#^Empty array passed to foreach\.$#'
587-
identifier: foreach.emptyArray
588-
count: 2
589-
path: wcfsetup/install/files/lib/system/form/builder/GridViewFormNode.class.php
590-
591555
-
592556
message: '#^Result of && is always false\.$#'
593557
identifier: booleanAnd.alwaysFalse
@@ -612,12 +576,6 @@ parameters:
612576
count: 1
613577
path: wcfsetup/install/files/lib/system/form/builder/LanguageItemFormNode.class.php
614578

615-
-
616-
message: '#^Empty array passed to foreach\.$#'
617-
identifier: foreach.emptyArray
618-
count: 2
619-
path: wcfsetup/install/files/lib/system/form/builder/LanguageItemFormNode.class.php
620-
621579
-
622580
message: '#^Result of && is always false\.$#'
623581
identifier: booleanAnd.alwaysFalse
@@ -642,12 +600,6 @@ parameters:
642600
count: 1
643601
path: wcfsetup/install/files/lib/system/form/builder/TemplateFormNode.class.php
644602

645-
-
646-
message: '#^Empty array passed to foreach\.$#'
647-
identifier: foreach.emptyArray
648-
count: 2
649-
path: wcfsetup/install/files/lib/system/form/builder/TemplateFormNode.class.php
650-
651603
-
652604
message: '#^Result of && is always false\.$#'
653605
identifier: booleanAnd.alwaysFalse
@@ -672,12 +624,6 @@ parameters:
672624
count: 3
673625
path: wcfsetup/install/files/lib/system/form/builder/button/FormButton.class.php
674626

675-
-
676-
message: '#^Empty array passed to foreach\.$#'
677-
identifier: foreach.emptyArray
678-
count: 2
679-
path: wcfsetup/install/files/lib/system/form/builder/button/FormButton.class.php
680-
681627
-
682628
message: '#^Result of && is always false\.$#'
683629
identifier: booleanAnd.alwaysFalse
@@ -738,12 +684,6 @@ parameters:
738684
count: 3
739685
path: wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php
740686

741-
-
742-
message: '#^Empty array passed to foreach\.$#'
743-
identifier: foreach.emptyArray
744-
count: 2
745-
path: wcfsetup/install/files/lib/system/form/builder/field/AbstractFormField.class.php
746-
747687
-
748688
message: '#^Result of && is always false\.$#'
749689
identifier: booleanAnd.alwaysFalse
@@ -906,12 +846,6 @@ parameters:
906846
count: 1
907847
path: wcfsetup/install/files/lib/system/form/builder/wysiwyg/WysiwygSmileyFormNode.class.php
908848

909-
-
910-
message: '#^Empty array passed to foreach\.$#'
911-
identifier: foreach.emptyArray
912-
count: 2
913-
path: wcfsetup/install/files/lib/system/form/builder/wysiwyg/WysiwygSmileyFormNode.class.php
914-
915849
-
916850
message: '#^Result of && is always false\.$#'
917851
identifier: booleanAnd.alwaysFalse
@@ -1067,9 +1001,3 @@ parameters:
10671001
identifier: argument.type
10681002
count: 2
10691003
path: wcfsetup/install/files/lib/util/DirectoryUtil.class.php
1070-
1071-
-
1072-
message: '#^Property wcf\\util\\DirectoryUtil\:\:\$fileObjects \(array\<DirectoryIterator\>\) does not accept array\<SplFileInfo\>\.$#'
1073-
identifier: assign.propertyType
1074-
count: 1
1075-
path: wcfsetup/install/files/lib/util/DirectoryUtil.class.php

phpstan.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ includes:
44

55
parameters:
66
level: 6
7+
phpVersion:
8+
min: 80102
9+
max: 80499
710
paths:
811
- wcfsetup/install/files
912
excludePaths:

wcfsetup/install/files/lib/acp/form/PackageEnableUpgradeOverrideForm.class.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,17 @@ private function getIssuesPreventingUpgrade(): array
118118

119119
/**
120120
* @return ?array{title: string, description: string}
121+
* @phpstan-ignore return.unusedType
121122
*/
122123
private function checkMinimumPhpVersion(): ?array
123124
{
124125
// Minimum: PHP 8.1.2
126+
// @phpstan-ignore greaterOrEqual.alwaysTrue
125127
if (\PHP_VERSION_ID >= 80102) {
126128
return null;
127129
}
128130

131+
// @phpstan-ignore deadCode.unreachable
129132
if (WCF::getLanguage()->getFixedLanguageCode() === 'de') {
130133
return [
131134
'title' => 'Unzureichende PHP-Version',

wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function execute(): JsonResponse
3333
// background job's memory usage without a memory-heavy job skewing the numbers for
3434
// the following jobs.
3535
if (\PHP_VERSION_ID >= 80200) {
36+
// @phpstan-ignore function.notFound
3637
\memory_reset_peak_usage();
3738
}
3839

wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
*
2626
* @property-read int $articleContentID unique id of the article content
2727
* @property-read int $articleID id of the article the article content belongs to
28-
* @property-read int $languageID id of the article content's language
28+
* @property-read ?int $languageID id of the article content's language
2929
* @property-read string $title title of the article in the associated language
30-
* @property-read string $content actual content of the article in the associated language
31-
* @property-read string $teaser teaser of the article in the associated language or empty if no teaser exists
32-
* @property-read int|null $imageID id of the (image) media object used as article image for the associated language or `null` if no image is used
33-
* @property-read int|null $teaserImageID id of the (image) media object used as article teaser image for the associated language or `null` if no image is used
30+
* @property-read ?string $content actual content of the article in the associated language
31+
* @property-read ?string $teaser teaser of the article in the associated language or empty if no teaser exists
32+
* @property-read ?int $imageID id of the (image) media object used as article image for the associated language or `null` if no image is used
33+
* @property-read ?int $teaserImageID id of the (image) media object used as article teaser image for the associated language or `null` if no image is used
3434
* @property-read int $hasEmbeddedObjects is `1` if there are embedded objects in the article content, otherwise `0`
3535
* @property-read string $metaTitle title of the article used in the title tag
3636
* @property-read string $metaDescription meta description of the article

wcfsetup/install/files/lib/data/category/AbstractDecoratedCategory.class.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public function getParentCategories()
114114
public function getParentCategory()
115115
{
116116
if ($this->parentCategoryID && $this->parentCategory === null) {
117+
// @phpstan-ignore assign.propertyType
117118
$this->parentCategory = new static($this->getDecoratedObject()->getParentCategory());
118119
}
119120

@@ -139,6 +140,7 @@ public static function getCategory($categoryID)
139140
{
140141
$category = CategoryHandler::getInstance()->getCategory($categoryID);
141142
if ($category) {
143+
// @phpstan-ignore return.type
142144
return new static($category);
143145
}
144146

wcfsetup/install/files/lib/data/comment/Comment.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @property-read int $objectTypeID id of the `com.woltlab.wcf.comment.commentableContent` object type
2323
* @property-read int $objectID id of the commented object of the object type represented by `$objectTypeID`
2424
* @property-read int $time timestamp at which the comment has been written
25-
* @property-read int|null $userID id of the user who wrote the comment or `null` if the user does not exist anymore or if the comment has been written by a guest
25+
* @property-read ?int $userID id of the user who wrote the comment or `null` if the user does not exist anymore or if the comment has been written by a guest
2626
* @property-read string $username name of the user or guest who wrote the comment
2727
* @property-read string $message comment message
2828
* @property-read int $responses number of responses on the comment
@@ -44,7 +44,7 @@ class Comment extends DatabaseObject implements IMessage
4444
*/
4545
public function getResponseIDs()
4646
{
47-
if ($this->responseIDs === null || $this->responseIDs == '') {
47+
if ($this->responseIDs === '') {
4848
return [];
4949
}
5050

@@ -63,7 +63,7 @@ public function getResponseIDs()
6363
*/
6464
public function getUnfilteredResponseIDs()
6565
{
66-
if ($this->unfilteredResponseIDs === null || $this->unfilteredResponseIDs == '') {
66+
if ($this->unfilteredResponseIDs === '') {
6767
return [];
6868
}
6969

wcfsetup/install/files/lib/data/devtools/missing/language/item/DevtoolsMissingLanguageItem.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* @since 5.3
1818
*
1919
* @property-read int $itemID unique id of the missing language item log entry
20-
* @property-read int $languageID id of the language the missing language item was requested for
20+
* @property-read ?int $languageID id of the language the missing language item was requested for
2121
* @property-read string $languageItem name of the missing language item
2222
* @property-read int $lastTime timestamp of the last time the missing language item was requested
2323
* @property-read string $stackTrace stack trace of how the missing language item was requested for the last time

wcfsetup/install/files/lib/data/like/object/LikeObject.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
* @property-read int $likeObjectID unique id of the liked object
2020
* @property-read int $objectTypeID id of the `com.woltlab.wcf.like.likeableObject` object type
2121
* @property-read int $objectID id of the liked object
22-
* @property-read int|null $objectUserID id of the user who created the liked object or null if user has been deleted or object was created by guest
22+
* @property-read ?int $objectUserID id of the user who created the liked object or null if user has been deleted or object was created by guest
2323
* @property-read int $likes number of likes of the liked object
2424
* @property-read int $dislikes legacy column, not used anymore
2525
* @property-read int $cumulativeLikes number of likes of the liked object
26-
* @property-read string $cachedUsers serialized array with the ids and names of the three users who liked (+1) the object last
27-
* @property-read string $cachedReactions serialized array with the reactionTypeIDs and the count of the reactions
26+
* @property-read ?string $cachedUsers serialized array with the ids and names of the three users who liked (+1) the object last
27+
* @property-read ?string $cachedReactions serialized array with the reactionTypeIDs and the count of the reactions
2828
* @property-read int $reactionTypeID
2929
* @phpstan-type ReactionData array{
3030
* reactionCount: int,

0 commit comments

Comments
 (0)