Skip to content

Commit d486902

Browse files
authored
Merge pull request #132 from IanDelMar/getting-6.4-back
Adding back changes from the "unmergeable"
2 parents 73c5580 + bf01dad commit d486902

File tree

6 files changed

+124
-141
lines changed

6 files changed

+124
-141
lines changed

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
"homepage": "https://github.com/php-stubs/wordpress-stubs",
1111
"require-dev": {
1212
"php": "^7.4 || ~8.0.0",
13+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
1314
"nikic/php-parser": "^4.13",
1415
"php-stubs/generator": "^0.8.3",
1516
"phpdocumentor/reflection-docblock": "^5.3",
1617
"phpstan/phpstan": "^1.10.12",
17-
"phpunit/phpunit": "^9.5"
18+
"phpunit/phpunit": "^9.5",
19+
"szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset": "^0.8"
1820
},
1921
"suggest": {
2022
"paragonie/sodium_compat": "Pure PHP implementation of libsodium",
@@ -41,9 +43,12 @@
4143
"post-update-cmd": "@composer --working-dir=source/ update --no-interaction",
4244
"cleanup": "git status --short --ignored | sed -n -e 's#^!! ##p' | xargs -r rm -vrf",
4345
"test": [
46+
"@test:cs",
4447
"@test:phpstan",
4548
"@test:phpunit"
4649
],
50+
"test:cs": "phpcs",
51+
"test:cs:fix": "phpcbf",
4752
"test:phpstan": "phpstan analyze",
4853
"test:phpunit": "phpunit"
4954
},

functionMap.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
}
88
$cronArgsType = 'list<mixed>';
99
$wpWidgetRssFormArgsType = 'array{number: int, error: bool, title?: string, url?: string, items?: int, show_summary?: int, show_author?: int, show_date?: int}';
10-
$wpWidgetRssFormInputType = 'array{title?: bool, url?: bool, items?: bool, show_summary?: bool, show_author?: bool, show_date?: bool}';
10+
$wpWidgetRssFormInputsType = 'array{title?: bool, url?: bool, items?: bool, show_summary?: bool, show_author?: bool, show_date?: bool}';
1111
$filesystemDirlistReturnType = "false|array<string, array{name: string, perms: string, permsn: string, owner: string|false, size: int|string|false, lastmodunix: int|string|false, lastmod: string|false, time: string|false, type: 'f'|'d'|'l', group?: string|false, number?: int|string|false, files?: array|false}>";
1212

1313
/**
@@ -31,47 +31,47 @@
3131
'stripslashes_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
3232
'urldecode_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
3333
'urlencode_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
34-
'wp_clear_scheduled_hook' => ['(0|positive-int|($wp_error is false ? false : \WP_Error))', 'args'=>$cronArgsType],
35-
'wp_get_schedule' => [null, 'args'=>$cronArgsType],
36-
'wp_get_scheduled_event' => [null, 'args'=>$cronArgsType],
34+
'wp_clear_scheduled_hook' => ['(0|positive-int|($wp_error is false ? false : \WP_Error))', 'args' => $cronArgsType],
35+
'wp_get_schedule' => [null, 'args' => $cronArgsType],
36+
'wp_get_scheduled_event' => [null, 'args' => $cronArgsType],
3737
'WP_Http::get' => [$httpReturnType],
3838
'WP_Http::head' => [$httpReturnType],
3939
'WP_Http::post' => [$httpReturnType],
4040
'WP_Http::request' => [$httpReturnType],
4141
'WP_List_Table::display_tablenav' => ['void', 'which' => '"top"|"bottom"'],
4242
'WP_List_Table::pagination' => ['void', 'which' => '"top"|"bottom"'],
4343
'WP_List_Table::set_pagination_args' => ['void', 'args' => 'array{total_items?: int, total_pages?: int, per_page?: int}'],
44-
'wp_next_scheduled' => [null, 'args'=>$cronArgsType],
44+
'wp_next_scheduled' => [null, 'args' => $cronArgsType],
4545
'WP_Query::have_posts' => [null, '@phpstan-impure' => ''],
4646
'wp_remote_get' => [$httpReturnType],
4747
'wp_remote_head' => [$httpReturnType],
4848
'wp_remote_post' => [$httpReturnType],
4949
'wp_remote_request' => [$httpReturnType],
50-
'wp_reschedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args'=>$cronArgsType],
50+
'wp_reschedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args' => $cronArgsType],
5151
'wp_safe_remote_get' => [$httpReturnType],
5252
'wp_safe_remote_head' => [$httpReturnType],
5353
'wp_safe_remote_post' => [$httpReturnType],
5454
'wp_safe_remote_request' => [$httpReturnType],
55-
'wp_schedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args'=>$cronArgsType],
56-
'wp_schedule_single_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args'=>$cronArgsType],
55+
'wp_schedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args' => $cronArgsType],
56+
'wp_schedule_single_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args' => $cronArgsType],
5757
'wp_slash' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
58-
'wp_unschedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args'=>$cronArgsType],
58+
'wp_unschedule_event' => ['($wp_error is false ? bool : true|\WP_Error)', 'args' => $cronArgsType],
5959
'wp_unslash' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
60-
'wp_widget_rss_form' => ['void', 'args'=>$wpWidgetRssFormArgsType, 'input'=>$wpWidgetRssFormInputType],
60+
'wp_widget_rss_form' => ['void', 'args' => $wpWidgetRssFormArgsType, 'inputs' => $wpWidgetRssFormInputsType],
6161
'WP_REST_Request' => [null, '@phpstan-template' => 'T of array', '@phpstan-implements' => 'ArrayAccess<key-of<T>, value-of<T>>'],
6262
'WP_REST_Request::offsetExists' => [null, 'offset' => '@param key-of<T>'],
6363
'WP_REST_Request::offsetGet' => ['T[TOffset]', '@phpstan-template' => 'TOffset of key-of<T>', 'offset' => 'TOffset'],
6464
'WP_REST_Request::offsetSet' => ['void', '@phpstan-template' => 'TOffset of key-of<T>', 'offset' => 'TOffset', 'value' => 'T[TOffset]'],
6565
'WP_REST_Request::offsetUnset' => ['void', '@phpstan-template' => 'TOffset of key-of<T>', 'offset' => 'TOffset'],
66-
'WP_Theme' => [null, '@phpstan-type'=>"ThemeKey 'Name'|'Version'|'Status'|'Title'|'Author'|'Author Name'|'Author URI'|'Description'|'Template'|'Stylesheet'|'Template Files'|'Stylesheet Files'|'Template Dir'|'Stylesheet Dir'|'Screenshot'|'Tags'|'Theme Root'|'Theme Root URI'|'Parent Theme'"],
66+
'WP_Theme' => [null, '@phpstan-type' => "ThemeKey 'Name'|'Version'|'Status'|'Title'|'Author'|'Author Name'|'Author URI'|'Description'|'Template'|'Stylesheet'|'Template Files'|'Stylesheet Files'|'Template Dir'|'Stylesheet Dir'|'Screenshot'|'Tags'|'Theme Root'|'Theme Root URI'|'Parent Theme'"],
6767
'WP_Theme::get' => ["(\$header is 'Name'|'ThemeURI'|'Description'|'Author'|'AuthorURI'|'Version'|'Template'|'Status'|'Tags'|'TextDomain'|'DomainPath'|'RequiresWP'|'RequiresPHP'|'UpdateURI' ? (\$header is 'Tags' ? string[] : string) : false)"],
6868
'WP_Theme::offsetExists' => ['($offset is ThemeKey ? true : false)'],
6969
'WP_Theme::offsetGet' => ['($offset is ThemeKey ? mixed : null)'],
7070
'WP_Block_List' => [null, '@phpstan-implements' => 'ArrayAccess<int, WP_Block>'],
71-
'WP_Block_List::offsetExists' => [null, 'index' => 'int'],
72-
'WP_Block_List::offsetGet' => ['WP_Block|null', 'index' => 'int'],
73-
'WP_Block_List::offsetSet' => ['void', 'index' => 'int|null'],
74-
'WP_Block_List::offsetUnset' => ['void', 'index' => 'int'],
71+
'WP_Block_List::offsetExists' => [null, 'offset' => 'int'],
72+
'WP_Block_List::offsetGet' => ['WP_Block|null', 'offset' => 'int'],
73+
'WP_Block_List::offsetSet' => ['void', 'offset' => 'int|null'],
74+
'WP_Block_List::offsetUnset' => ['void', 'offset' => 'int'],
7575
'is_wp_error' => ['($thing is \WP_Error ? true : false)', '@phpstan-assert-if-true' => '\WP_Error $thing'],
7676
'current_time' => ["(\$type is 'timestamp'|'U' ? int : string)"],
7777
'mysql2date' => ["(\$format is 'G'|'U' ? int|false : string|false)"],

phpcs.xml.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<file>finder.php</file>
4+
<file>functionMap.php</file>
5+
<file>visitor.php</file>
6+
7+
<rule ref="PSR12NeutronRuleset">
8+
<exclude name="Generic.Files.LineLength"/>
9+
<exclude name="PEAR.Commenting.ClassComment"/>
10+
<exclude name="PEAR.Commenting.FileComment"/>
11+
</rule>
12+
</ruleset>

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ parameters:
22
level: 8
33
paths:
44
- finder.php
5+
- functionMap.php
56
- visitor.php
67
- tests/
78
excludePaths:

0 commit comments

Comments
 (0)