Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1aa8e5d
feat: add enrol stubs
imfelixyeung Jul 20, 2026
255ca31
feat: add base event stubs
imfelixyeung Jul 20, 2026
861935d
feat: add createElement stub
imfelixyeung Jul 20, 2026
e413622
feat: add filelib related stubs
imfelixyeung Jul 20, 2026
2b00252
feat: add fullname() stub
imfelixyeung Jul 20, 2026
cc1a2d9
feat: add lock stubs
imfelixyeung Jul 21, 2026
786ae26
feat: add grade stubs
imfelixyeung Jul 21, 2026
647f534
feat: add modinfo related stubs
imfelixyeung Jul 21, 2026
cb44a94
feat: add accesslib stubs
imfelixyeung Jul 21, 2026
89a8760
feat: add moodleform stubs
imfelixyeung Jul 21, 2026
fea91cc
feat: add string related stubs
imfelixyeung Jul 21, 2026
0d3be60
feat: add clean param stubs
imfelixyeung Jul 21, 2026
c2ded46
feat: add get_course_and_cm_from_cmid stub
imfelixyeung Jul 21, 2026
8b41ed4
feat: add grades stubs
imfelixyeung Jul 21, 2026
63f9da8
fix: resolve phpstan issues
imfelixyeung Jul 21, 2026
207a20a
feat: add navigation_node::text stub
imfelixyeung Jul 21, 2026
5114023
feat: add category::get stub
imfelixyeung Jul 22, 2026
8adf617
fix: less picky get_string
imfelixyeung Jul 22, 2026
d724dd2
feat: add unit tests stubs
imfelixyeung Jul 22, 2026
7e56aa3
feat: add form stubs
imfelixyeung Jul 22, 2026
91a62de
feat: add debugging stub
imfelixyeung Jul 22, 2026
08546ca
feat: add groups stubs
imfelixyeung Jul 22, 2026
0e6e93f
feat: add grade_tree stub
imfelixyeung Jul 22, 2026
7b3f728
fix: typo
imfelixyeung Jul 22, 2026
e083bc9
feat: add email_to_user stub
imfelixyeung Jul 22, 2026
082bb30
Merge remote-tracking branch 'origin/main' into feat/phpstan-stubs-ro…
imfelixyeung Jul 23, 2026
656bcc7
style: apply formatting
imfelixyeung Jul 24, 2026
5b726ab
feat: add more stubs
imfelixyeung Jul 24, 2026
ea1b0e1
feat: add more stubs
imfelixyeung Jul 28, 2026
eff506d
feat: more stubs
imfelixyeung Jul 29, 2026
7a94061
feat: add more stubs
imfelixyeung Aug 1, 2026
30138b8
feat: format in batches
imfelixyeung Aug 1, 2026
3cb9f3a
feat: add --check flag support
imfelixyeung Aug 1, 2026
62fb4d0
fix: resolve phpstan issues
imfelixyeung Aug 1, 2026
2907889
feat: add progress bar stubs
imfelixyeung Aug 10, 2026
460131f
style: auto format
imfelixyeung Aug 10, 2026
2c72fd1
feat: add editor_tiny\plugin_with_configuration stubs
imfelixyeung Aug 10, 2026
44cfd2d
feat: add more stubs
imfelixyeung Aug 26, 2026
d5f15a9
fix: add missing stub
imfelixyeung Aug 26, 2026
0100278
Merge branch 'main' into feat/phpstan-stubs-round-2
imfelixyeung Aug 26, 2026
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
6 changes: 6 additions & 0 deletions phpstan/stubs/public/ai/classes/aiactions/base.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

namespace core_ai\aiactions;

abstract class base {
}
27 changes: 27 additions & 0 deletions phpstan/stubs/public/ai/classes/placement.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace core_ai;

use core\context;
use core_ai\aiactions\base;

abstract class placement {
/**
* @return class-string<base>[]
*/
abstract public static function get_action_list(): array;

/**
* @return array{'action': string}[]
*/
public static function get_actions_available(context $context, bool $checkcontext = true): array {
return [];
}

/**
* @return array{'action': string}[]
*/
public function get_sub_actions(string $classname): array {
return [];
}
}
37 changes: 37 additions & 0 deletions phpstan/stubs/public/backup/converter/moodle1/handlerlib.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

abstract class moodle1_handler implements loggable {
}

abstract class moodle1_xml_handler extends moodle1_handler {
/** @var null|xml_writer */
protected $xmlwriter;

/**
* @phpstan-assert !null $this->xmlwriter
* @param string $filename
* @return void
*/
protected function open_xml_writer($filename) {
}

/**
* @phpstan-assert null $this->xmlwriter
* @return void
*/
protected function close_xml_writer() {
}
}

abstract class moodle1_plugin_handler extends moodle1_xml_handler {
}

abstract class moodle1_mod_handler extends moodle1_plugin_handler {
/**
* @param int $instance
* @param string $modname
* @return mixed
*/
protected function get_cminfo($instance, $modname = null) {
}
}
4 changes: 4 additions & 0 deletions phpstan/stubs/public/backup/util/interfaces.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

interface loggable {
}
4 changes: 4 additions & 0 deletions phpstan/stubs/public/backup/util/xml.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

class xml_writer {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

namespace core_cache;

interface cacheable_object_interface {
}
40 changes: 40 additions & 0 deletions phpstan/stubs/public/course/classes/category.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

use core\output\renderable;
use core_cache\cacheable_object_interface;
use IteratorAggregate;
use Throwable;

use const IGNORE_MISSING;
use const IGNORE_MULTIPLE;
use const MUST_EXIST;

/**
* @property-read int $id
* @property-read string $name
* @property-read string $idnumber
* @property-read string $description
* @property-read int $descriptionformat
* @property-read int $parent
* @property-read int $sortorder
* @property-read int $coursecount
* @property-read int $visible
* @property-read int $visibleold
* @property-read int $timemodified
* @property-read int $depth
* @property-read string $path
* @property-read string $theme
* @implements IteratorAggregate<string, mixed>
*/
class core_course_category implements cacheable_object_interface, IteratorAggregate, renderable {
/**
* @param int $id
* @param IGNORE_MISSING|IGNORE_MULTIPLE|MUST_EXIST $strictness
* @param bool $alwaysreturnhidden
* @param int|stdClass|null $user
* @return ($strictness is MUST_EXIST ? self : null|self)
* @throws moodle_exception&Throwable
*/
public static function get($id, $strictness = MUST_EXIST, $alwaysreturnhidden = false, $user = null) {
}
}
62 changes: 62 additions & 0 deletions phpstan/stubs/public/course/classes/cm_info.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace core_course;

use core\context\module;
use core\url;
use IteratorAggregate;

/**
* @property-read int $id
* @property-read int $instance
* @property-read int $course
* @property-read string $idnumber
* @property-read int $added
* @property-read int $visible
* @property-read int $visibleoncoursepage
* @property-read int $visibleold
* @property-read int $groupmode
* @property-read int $groupingid
* @property-read bool $coursegroupmodeforce
* @property-read NOGROUPS|SEPARATEGROUPS|VISIBLEGROUPS $coursegroupmode
* @property-read NOGROUPS|SEPARATEGROUPS|VISIBLEGROUPS $effectivegroupmode
* @property-read int $indent
* @property-read COMPLETION_TRACKING_NONE|COMPLETION_TRACKING_MANUAL|COMPLETION_TRACKING_AUTOMATIC $completion
* @property-read mixed $completiongradeitemnumber
* @property-read 1|0 $completionview
* @property-read int $completionexpected
* @property-read string|null $availability
* @property-read 0|1 $showdescription
* @property-read string $icon
* @property-read string $iconcomponent
* @property-read string $modname
* @property-read int $module
* @property-read string $name Na
* @property-read int $sectionnum
* @property-read int $sectionid
* @property-read mixed[] $conditionscompletion
* @property-read mixed[] $conditionsgrade
* @property-read mixed[] $conditionsfield
* @property-read bool $available
* @property-read string $availableinfo
* @property-read bool $uservisible
* @property-read module $context
* @property-read string $modfullname
* @property-read string $modplural
* @property-read string $content
* @property-read url|null $url
* @property-read url|null $navigationurl
* @property-read string $extraclasses
* @property-read string $onclick
* @property-read mixed $customdata
* @property-read string $afterlink
* @property-read string $afterediticons
* @property-read bool $deletioninprogress
* @property-read bool $downloadcontent
* @property-read bool $lang
* @property-read int|null $enableaitools
* @property-read string|null $enabledaiactions
* @implements IteratorAggregate<string, mixed>
*/
class cm_info implements IteratorAggregate {
}
14 changes: 14 additions & 0 deletions phpstan/stubs/public/course/classes/modinfo.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace core_course;

/**
* @property-read int $courseid
* @property-read int $userid
* @property-read array<int, int[]> $sections
* @property-read cm_info[] $cms
* @property-read array<string, array<int, cm_info>> $instances
* @property-read array<int, array<int, int>> $groups
*/
class modinfo {
}
20 changes: 20 additions & 0 deletions phpstan/stubs/public/course/moodleform_mod.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use core\exception\coding_exception;
use Throwable;

abstract class moodleform_mod extends moodleform {
/**
* @param string|null $customlabel
* @return void
* @throws coding_exception&Throwable
*/
protected function standard_intro_elements($customlabel = null) {
}

/**
* @return stdClass|null
*/
public function get_data() {
}
}
40 changes: 40 additions & 0 deletions phpstan/stubs/public/enrol/_plugins.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

class enrol_category_plugin extends enrol_plugin {
}

class enrol_cohort_plugin extends enrol_plugin {
}

class enrol_database_plugin extends enrol_plugin {
}

class enrol_fee_plugin extends enrol_plugin {
}

class enrol_flatfile_plugin extends enrol_plugin {
}

class enrol_guest_plugin extends enrol_plugin {
}

class enrol_imsenterprise_plugin extends enrol_plugin {
}

class enrol_ldap_plugin extends enrol_plugin {
}

class enrol_lti_plugin extends enrol_plugin {
}

class enrol_manual_plugin extends enrol_plugin {
}

class enrol_meta_plugin extends enrol_plugin {
}

class enrol_paypal_plugin extends enrol_plugin {
}

class enrol_self_plugin extends enrol_plugin {
}
10 changes: 10 additions & 0 deletions phpstan/stubs/public/grade/lib.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

class grade_structure {
}

/**
* @property grade_item[] $items
*/
class grade_tree extends grade_structure {
}
89 changes: 89 additions & 0 deletions phpstan/stubs/public/lib/accesslib.stub
Original file line number Diff line number Diff line change
@@ -1,6 +1,95 @@
<?php

use core\context;

define('CAP_INHERIT', 0);
define('CAP_ALLOW', 1);
define('CAP_PREVENT', -1);
define('CAP_PROHIBIT', -1000);

/**
* @param string[] $capabilities
* @param context $context
* @param int|stdClass|null $user
* @param bool $doanything
* @return bool
*/
function has_any_capability(array $capabilities, context $context, $user = null, $doanything = true) {
}

/**
* @param string[] $capabilities
* @param context $context
* @param int|stdClass|null $user
* @param bool $doanything
* @return bool
*/
function has_all_capabilities(array $capabilities, context $context, $user = null, $doanything = true) {
}

/**
* @param string $capability
* @param context $context
* @param int $userid
* @param bool $doanything
* @param string $errormessage
* @param string $stringfile
* @return void|never
*/
function require_capability(
$capability,
context $context,
$userid = null,
$doanything = true,
$errormessage = 'nopermissions',
$stringfile = '',
) {
}

/**
* @param string[] $capabilities
* @param context $context
* @param int $userid
* @param bool $doanything
* @param string $errormessage
* @param string $stringfile
* @return void|never
*/
function require_all_capabilities(
array $capabilities,
context $context,
$userid = null,
$doanything = true,
$errormessage = 'nopermissions',
$stringfile = '',
): void {
}

/**
* @param context $context
* @param string|string[] $capability
* @param string $fields
* @param string $sort
* @param int $limitfrom
* @param int $limitnum
* @param int|string|(int|string)[] $groups
* @param int|string|(int|string)[] $exceptions
* @param bool $notuseddoanything
* @param bool $notusedview
* @param bool $useviewallgroups
* @return stdClass[]
*/
function get_users_by_capability(
context $context,
$capability,
$fields = '',
$sort = '',
$limitfrom = '',
$limitnum = '',
$groups = '',
$exceptions = '',
$notuseddoanything = null,
$notusedview = null,
$useviewallgroups = false,
) {
}
Loading