Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions stubs/xoops.stub
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ namespace {
public function getInfo(string $name = ''): mixed {}

public function dirname(): string {}

public static function getByDirname(string $dirname): ?XoopsModule {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In XOOPS core, XoopsModule::getByDirname() (which delegates to XoopsModuleHandler::getByDirname()) returns false on failure rather than null.\n\nUsing ?XoopsModule (which resolves to XoopsModule|null) will cause PHPStan to reject strict comparisons against false (e.g., $module === false), potentially forcing developers to use $module === null which would fail at runtime.\n\nTo prevent this type-safety mismatch, the return type should be declared as XoopsModule|false.

        public static function getByDirname(string $dirname): XoopsModule|false {}

}

class XoopsUser extends XoopsObject
Expand All @@ -171,11 +173,6 @@ namespace {
public function getGroups(): array {}
}

class XoopsModules
{
public static function getByDirname(string $dirname): mixed {}
}

class XoopsPreloadItem
{
public function __construct() {}
Expand Down
Loading