forked from ampproject/amp-wp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpstan-baseline.php
74 lines (71 loc) · 2.74 KB
/
phpstan-baseline.php
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
68
69
70
71
72
73
74
<?php
/**
* PHPStan Baseline File.
* All static analysis errors included in this file will be ignored by PHPStan.
*
* NOTE: `phpstan analyse --generate-baseline phpstan-baseline.php` should not be used to rewrite this file.
*
* How to include new errors to be ignored:
* 1. Run `phpstan analyse --generate-baseline temp-baseline.php` to generate a new temp baseline file.
* 2. Copy the contents of the temp baseline file to this file.
*
* Please be sure to explain why the error should be ignored in the remark above the error.
*
* @codeCoverageIgnore
*
* @package AMP
*/
/**
* Errors to be ignored in class-amp-allowed-tags-generated.php
* Note: class-amp-allowed-tags-generated.php is a auto-generated file.
*/
$ignore_errors_in_class_amp_allowed_tags_generated = [
[
'message' => '#^Static property AMP_Allowed_Tags_Generated\\:\\:\\$minimum_validator_revision_required is never read, only written\\.$#',
'count' => 1,
'path' => __DIR__ . '/includes/sanitizers/class-amp-allowed-tags-generated.php',
],
[
'message' => '#^Static property AMP_Allowed_Tags_Generated\\:\\:\\$spec_file_revision is never read, only written\\.$#',
'count' => 1,
'path' => __DIR__ . '/includes/sanitizers/class-amp-allowed-tags-generated.php',
],
];
/**
* Errors due `function_exists() and method_exists() always evaluating to true` in PHPStan.
*
* @see https://github.com/phpstan/phpstan/issues/8980
* @see https://github.com/phpstan/phpstan/issues/8980#issuecomment-1451284041
*
* @todo Remove once this is fixed in PHPStan.
*/
$ignore_errors_due_to_function_and_method_exists_always_evaluating_to_true = [
[
'message' => '#^Call to function method_exists\\(\\) with WP_Query and \'is_favicon\' will always evaluate to true\\.$#',
'count' => 1,
'path' => __DIR__ . '/includes/amp-helper-functions.php',
],
[
'message' => '#^Call to function function_exists\\(\\) with \'amp_activate\'\\|\'amp_backcompat_use…\'\\|\'amp_init_customizer\'\\|\'amp_load_classes\' will always evaluate to true\\.$#',
'count' => 1,
'path' => __DIR__ . '/includes/bootstrap.php',
],
[
'message' => '#^Call to function function_exists\\(\\) with \'curl_multi_add…\'\\|\'curl_multi_exec\'\\|\'curl_multi_init\' will always evaluate to true\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Admin/SiteHealth.php',
],
[
'message' => '#^Call to function method_exists\\(\\) with ReflectionType and \'isBuiltin\' will always evaluate to true\\.$#',
'count' => 1,
'path' => __DIR__ . '/src/Infrastructure/Injector/SimpleInjector.php',
],
];
return [
'parameters' => [
'ignoreErrors' => array_merge(
$ignore_errors_in_class_amp_allowed_tags_generated,
$ignore_errors_due_to_function_and_method_exists_always_evaluating_to_true
),
],
];