-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathphpstan.stubs
More file actions
67 lines (59 loc) · 2.67 KB
/
Copy pathphpstan.stubs
File metadata and controls
67 lines (59 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Constants, functions, etc. used by GatherPress
* should be understood by PHPStan.
*/
namespace {
define( 'GATHERPRESS_CACHE_GROUP', '');
define( 'GATHERPRESS_CORE_FILE', './gatherpress.php');
define( 'GATHERPRESS_CORE_PATH', '.');
define( 'GATHERPRESS_CORE_URL', '');
define( 'GATHERPRESS_REST_NAMESPACE', '');
define( 'GATHERPRESS_REQUIRES_PHP', '');
define( 'GATHERPRESS_VERSION', '');
/**
* Used in includes/core/classes/class-export.php
*
* @see https://github.com/szepeviktor/phpstan-wordpress/issues/241
*
* @param string $str String to wrap in XML CDATA tag.
* @return string
*/
function wxr_cdata( string $str ): string {}
/**
* GD image resource. Introduced in PHP 8.0; on PHP 7.4 the GD extension
* returns a plain `resource`. Stubbed here so PHPStan recognizes the
* class name in docblocks such as `@return \GdImage|resource|null` —
* GatherPress never instantiates it directly. Guarded with class_exists
* because this file is loaded as a bootstrap on PHP 8+, where the real
* class already exists and redeclaring would fatal.
*/
if ( ! class_exists( '\GdImage', false ) ) {
class GdImage {}
}
/**
* Mirror the class aliases registered at runtime in
* `includes/core/register-class-aliases.php`. PHPStan does not execute the
* plugin bootstrap and cannot see runtime `class_alias` calls, so without
* this declaration every consumer of the prior fully-qualified class name
* reports `class.notFound`. Loading the source file first defines the
* current class so `class_alias` can resolve it.
*/
if ( ! class_exists( 'GatherPress\\Core\\Event', false ) ) {
require_once __DIR__ . '/includes/core/classes/event/class-event.php';
class_alias( 'GatherPress\\Core\\Event\\Event', 'GatherPress\\Core\\Event' );
}
if ( ! class_exists( 'GatherPress\\Core\\Rsvp', false ) ) {
require_once __DIR__ . '/includes/core/classes/rsvp/class-rsvp.php';
class_alias( 'GatherPress\\Core\\Rsvp\\Rsvp', 'GatherPress\\Core\\Rsvp' );
}
if ( ! class_exists( 'GatherPress\\Core\\Venue', false ) ) {
require_once __DIR__ . '/includes/core/classes/venue/class-venue.php';
class_alias( 'GatherPress\\Core\\Venue\\Venue', 'GatherPress\\Core\\Venue' );
}
if ( ! class_exists( 'GatherPress\\Core\\Venue\\Map', false ) ) {
require_once __DIR__ . '/includes/core/classes/traits/class-singleton.php';
require_once __DIR__ . '/includes/core/classes/venue/map/class-map.php';
class_alias( 'GatherPress\\Core\\Venue\\Map\\Map', 'GatherPress\\Core\\Venue\\Map' );
}
}