FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PHP_CodeSniffer/scripts/BuildRequirementsCheckMatrix.php at 4.x · PHPCSStandards/PHP_CodeSniffer · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
PHPCSStandards
/
PHP_CodeSniffer
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
115
Star
1.6k
Code
Issues
166
Pull requests
33
Discussions
Actions
Wiki
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
PHP_CodeSniffer
/
scripts
/
BuildRequirementsCheckMatrix.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
181 lines (159 loc) · 5.06 KB
Breadcrumbs
PHP_CodeSniffer
/
scripts
/
BuildRequirementsCheckMatrix.php
Copy path
File metadata and controls
181 lines (159 loc) · 5.06 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
/**
* Build a dynamic matrix for the requirements check workflow.
*
* This matrix is used in two different GH Actions jobs and would be excruciating
* (and pretty error-prone) to manually maintain, so better to generate it dynamically.
*
* @copyright 2024 PHPCSStandards and contributors
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/HEAD/licence.txt BSD Licence
*/
namespace
PHP_CodeSniffer
;
class
BuildRequirementsCheckMatrix
{
/**
* Range of valid PHP versions against which select tests should run.
*
* @var array<string>
*/
private
$
validPhp
= [
'
7.2
'
,
'
latest
'
,
'
nightly
'
,
];
/**
* Range of *in*valid PHP versions against which select tests should run.
*
* @var array<string>
*/
private
$
invalidPhp
= [
'
5.3
'
,
'
7.1
'
,
];
/**
* The PHPCS commands with which the tests should run.
*
* @var array<string>
*/
private
$
cmd
= [
'
phpcs
'
,
'
phpcbf
'
,
];
/**
* The operating systems against which the tests should run.
*
* @var array<string>
*/
private
$
os
= [
'
ubuntu-latest
'
,
'
windows-latest
'
,
];
/**
* Get all the builds.
*
* @return array<array<string, string>>
*/
public
function
getBuilds
()
{
$
builds
=
array_merge
(
self
::
getValidBuilds
(),
self
::
getInvalidPHPBuilds
(),
self
::
getMissingExtensionsBuilds
()
);
return
$
builds
;
}
/**
* Get the builds for tests which should succeed.
*
* I.e. these build comply with the minimum requirements for PHPCS.
*
* @return array<array<string, string>>
*/
private
function
getValidBuilds
()
{
$
extensions
= [
'
minimal
'
=>
'
none, tokenizer, libxml, xmlwriter, SimpleXML
'
];
$
builds
= [];
foreach
(
$
this
->
validPhp
as
$
php
) {
foreach
(
$
this
->
cmd
as
$
cmd
) {
foreach
(
$
extensions
as
$
name
=>
$
exts
) {
foreach
(
$
this
->
os
as
$
os
) {
$
builds
[] = [
'
name
'
=>
"
✔ exts:
$
name
"
,
'
os
'
=>
$
os
,
'
cmd
'
=>
$
cmd
,
'
php
'
=>
$
php
,
'
extensions
'
=>
$
exts
,
'
expect
'
=>
'
success
'
,
];
}
}
}
}
return
$
builds
;
}
/**
* Get the builds for tests which should fail because the PHP version does not comply with the minimum PHP requirement.
*
* @return array<array<string, string>>
*/
private
function
getInvalidPHPBuilds
()
{
$
extensions
= [
'
default
'
=>
''
];
$
builds
= [];
foreach
(
$
this
->
invalidPhp
as
$
php
) {
foreach
(
$
this
->
cmd
as
$
cmd
) {
foreach
(
$
extensions
as
$
exts
) {
foreach
(
$
this
->
os
as
$
os
) {
$
builds
[] = [
'
name
'
=>
'
❌ PHP too low
'
,
'
os
'
=>
$
os
,
'
cmd
'
=>
$
cmd
,
'
php
'
=>
$
php
,
'
extensions
'
=>
$
exts
,
'
expect
'
=>
'
fail
'
,
];
}
}
}
}
return
$
builds
;
}
/**
* Get the builds for tests which should fail because the PHP extensions do not comply with the requirements of PHPCS.
*
* @return array<array<string, string>>
*/
private
function
getMissingExtensionsBuilds
()
{
$
extensions
= [
'
missing tokenizer
'
=>
'
none, xmlwriter, SimpleXML
'
,
'
missing xmlwriter
'
=>
'
:xmlwriter
'
,
'
missing SimpleXML
'
=>
'
:SimpleXML
'
,
'
missing all XML exts
'
=>
'
none, tokenizer
'
,
];
$
builds
= [];
foreach
(
$
this
->
validPhp
as
$
php
) {
foreach
(
$
this
->
cmd
as
$
cmd
) {
foreach
(
$
extensions
as
$
name
=>
$
exts
) {
foreach
(
$
this
->
os
as
$
os
) {
// Skip the extension requirements check on Windows as the required extensions cannot be
// disabled on Windows. They are compiled statically into the PHP binary.
// {@link https://github.com/shivammathur/setup-php/issues/887}.
if
(
$
os
===
'
windows-latest
'
) {
continue
;
}
$
builds
[] = [
'
name
'
=>
"
❌
$
name
"
,
'
os
'
=>
$
os
,
'
cmd
'
=>
$
cmd
,
'
php
'
=>
$
php
,
'
extensions
'
=>
$
exts
,
'
expect
'
=>
'
fail
'
,
];
}
}
}
}
return
$
builds
;
}
}
Back
|
FazBrowse Home
|
New Git URL