Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP lint using multiple PHP versions #255

Merged
merged 45 commits into from
Mar 7, 2022
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
93e8609
Rename test.
gudmdharalds Mar 2, 2022
8dc850b
Transforming test into unit-test.
gudmdharalds Mar 2, 2022
adedb56
Test was renamed and transformed to unit-test.
gudmdharalds Mar 2, 2022
47a01bc
Update test, apply WP CS.
gudmdharalds Mar 2, 2022
8ce9547
Test was renamed.
gudmdharalds Mar 2, 2022
cf345e7
Renaming test class.
gudmdharalds Mar 2, 2022
3b070c9
Applying WP CS, adjusting test.
gudmdharalds Mar 2, 2022
0fa2c45
Test was renamed.
gudmdharalds Mar 2, 2022
6a267e6
Update @covers.
gudmdharalds Mar 2, 2022
078af70
Report all PHP interpreter versions.
gudmdharalds Mar 2, 2022
7624237
vipgoci_util_php_interpreter_get_version(): Cache results, use trim().
gudmdharalds Mar 2, 2022
0b2498e
Implementing multi PHP version linting.
gudmdharalds Mar 2, 2022
33943e1
Add support for linting using multiple PHP versions.
gudmdharalds Mar 2, 2022
3d4d891
Merge branch 'main' into lint-multi-version
gudmdharalds Mar 2, 2022
743e077
Rename test class.
gudmdharalds Mar 2, 2022
3e4d37b
Update example output.
gudmdharalds Mar 3, 2022
7948067
Adding defines for error message when PHP linting fails.
gudmdharalds Mar 3, 2022
9371fc2
Update --help message & comment, remove failure message on start up.
gudmdharalds Mar 3, 2022
d6174b4
Escape output, catch when PHP linting fails and notify users.
gudmdharalds Mar 3, 2022
284e40f
Remove white spacing in string.
gudmdharalds Mar 3, 2022
8e61877
Detect if shell returns with a file not found error.
gudmdharalds Mar 4, 2022
0369f0e
Check path to PHP interpreter, array values not to lower case.
gudmdharalds Mar 4, 2022
38eec7c
Move info message around, add function to report files that could not…
gudmdharalds Mar 4, 2022
fab1ed3
Update to match tests.
gudmdharalds Mar 4, 2022
ef0dd7d
Use function that reports when scanning files fails.
gudmdharalds Mar 4, 2022
8d2fbb1
Add HTML entity decode ability.
gudmdharalds Mar 4, 2022
0e5a269
Update test to lint using multiple PHP versions.
gudmdharalds Mar 4, 2022
ee60936
Adding PHP linting emulator.
gudmdharalds Mar 4, 2022
ec53c47
Updating helper, can now return different PHP versions depending on p…
gudmdharalds Mar 4, 2022
7d46efd
Adding comment.
gudmdharalds Mar 4, 2022
55ccce7
Helper functions.
gudmdharalds Mar 4, 2022
cd14a4b
Updating config to match new unittests.ini.dist and updated tests.
gudmdharalds Mar 4, 2022
41763eb
Update test to match function.
gudmdharalds Mar 4, 2022
489c65e
Update test to match function.
gudmdharalds Mar 4, 2022
7b48508
Adding helper.
gudmdharalds Mar 4, 2022
1c3d28d
Do not ask for commit info, not used.
gudmdharalds Mar 4, 2022
9f6aa62
Adding helper directory to exception list.
gudmdharalds Mar 4, 2022
b92f259
Adding test
gudmdharalds Mar 4, 2022
8b28936
Check if returned value is not null.
gudmdharalds Mar 4, 2022
9dd8149
Update html_entity_decode() usage.
gudmdharalds Mar 4, 2022
540de65
New test
gudmdharalds Mar 4, 2022
7aae71f
Update test to match function, check failure situation.
gudmdharalds Mar 5, 2022
c4e5c7c
Remove option not needed anymore.
gudmdharalds Mar 5, 2022
23ce64b
Rename option to match unittests.ini.dist
gudmdharalds Mar 5, 2022
e060179
Update README with information about new options.
gudmdharalds Mar 7, 2022
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
Prev Previous commit
Next Next commit
Updating helper, can now return different PHP versions depending on p…
…ath used.
  • Loading branch information
gudmdharalds committed Mar 4, 2022
commit ec53c4712083cef7b6a7170314724bf5a45c3294
17 changes: 15 additions & 2 deletions tests/unit/helper/ReportCreateScanDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
declare(strict_types=1);

/**
* Helper function that does nothing.
* Helper function that does not call PHP interpreter
* but returns version number. Will return different
* version depending on which interpreter path was
* used.
*
* @param string $php_path Path to PHP.
*
Expand All @@ -18,7 +21,17 @@
function vipgoci_util_php_interpreter_get_version(
string $php_path
) :string {
return '7.4.3';
if ( str_contains( $php_path, 'php7.3' ) ) {
return '7.3.1';
} elseif ( str_contains( $php_path, 'php7.4' ) ) {
return '7.4.2';
} elseif ( str_contains( $php_path, 'php8.0' ) ) {
return '8.0.3';
} elseif ( str_contains( $php_path, 'php8.1' ) ) {
return '8.1.4';
}

return '7.4.20';
}

/**
Expand Down