Skip to content

Commit 24ba9ac

Browse files
authored
PHP 8.4 support (#53)
* Update composer.json to latest and require PHP 8.0 or higher * Convert to GitHub Actions for testing * Modernize PHPUnit * Convert to PHP 8.0 * Run PHP-CS-Fixer with PSR2 rules * Install PHPStan
1 parent fe8890c commit 24ba9ac

29 files changed

+1097
-1202
lines changed

.github/workflows/tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
php-tests:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [8.3, 8.2, 8.1, 8.0]
12+
dependency-version: [prefer-stable]
13+
os: [ubuntu-latest]
14+
15+
name: ${{ matrix.os }} - PHP${{ matrix.php }} - ${{ matrix.dependency-version }}
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Cache dependencies
22+
uses: actions/cache@v4
23+
with:
24+
path: ~/.composer/cache/files
25+
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
extensions: dom, curl, libxml, mbstring, zip, intl, mongodb
32+
coverage: none
33+
34+
- name: Install dependencies
35+
run: |
36+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
37+
38+
- name: Execute tests
39+
run: vendor/bin/phpunit
40+

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,11 @@
55
composer.lock
66
/vendor
77

8+
# PHPUnit
9+
.phpunit.result.cache
10+
.phpunit.cache
11+
12+
# PHP CS Fixer
13+
.php-cs-fixer.cache
14+
815
/build

.php-cs-fixer.dist.php

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?php
2+
/*
3+
* This document has been generated with
4+
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.48.0|configurator
5+
* you can change this configuration by importing this file.
6+
*/
7+
$config = new PhpCsFixer\Config();
8+
9+
return $config
10+
->setRiskyAllowed(true)
11+
->setRules([
12+
'@PSR2' => true,
13+
'align_multiline_comment' => true,
14+
'array_indentation' => true,
15+
'array_push' => true,
16+
'array_syntax' => true,
17+
'backtick_to_shell_exec' => true,
18+
'binary_operator_spaces' => true,
19+
'blank_line_after_namespace' => true,
20+
'blank_line_after_opening_tag' => true,
21+
'blank_line_before_statement' => true,
22+
'blank_lines_before_namespace' => true,
23+
'cast_spaces' => true,
24+
'class_attributes_separation' => true,
25+
'class_definition' => true,
26+
'clean_namespace' => true,
27+
'combine_consecutive_issets' => true,
28+
'combine_consecutive_unsets' => true,
29+
'combine_nested_dirname' => true,
30+
'compact_nullable_type_declaration' => true,
31+
'concat_space' => true,
32+
'constant_case' => true,
33+
'declare_equal_normalize' => true,
34+
'dir_constant' => true,
35+
'elseif' => true,
36+
'encoding' => true,
37+
'ereg_to_preg' => true,
38+
'explicit_indirect_variable' => true,
39+
'explicit_string_variable' => true,
40+
'fopen_flag_order' => true,
41+
'full_opening_tag' => true,
42+
'function_declaration' => true,
43+
'function_to_constant' => true,
44+
'general_phpdoc_tag_rename' => true,
45+
'implode_call' => true,
46+
'include' => true,
47+
'indentation_type' => true,
48+
'is_null' => true,
49+
'line_ending' => true,
50+
'linebreak_after_opening_tag' => true,
51+
'list_syntax' => true,
52+
'logical_operators' => true,
53+
'lowercase_cast' => true,
54+
'lowercase_keywords' => true,
55+
'lowercase_static_reference' => true,
56+
'magic_constant_casing' => true,
57+
'magic_method_casing' => true,
58+
'method_argument_space' => true,
59+
'method_chaining_indentation' => true,
60+
'modernize_types_casting' => true,
61+
'multiline_whitespace_before_semicolons' => true,
62+
'native_function_casing' => true,
63+
'native_function_invocation' => true,
64+
'native_type_declaration_casing' => true,
65+
'new_with_parentheses' => true,
66+
'no_alias_functions' => true,
67+
'no_alias_language_construct_call' => true,
68+
'no_alternative_syntax' => true,
69+
'no_blank_lines_after_phpdoc' => true,
70+
'no_break_comment' => true,
71+
'no_closing_tag' => true,
72+
'no_empty_comment' => true,
73+
'no_empty_phpdoc' => true,
74+
'no_empty_statement' => true,
75+
'no_homoglyph_names' => true,
76+
'no_leading_import_slash' => true,
77+
'no_leading_namespace_whitespace' => true,
78+
'no_mixed_echo_print' => true,
79+
'no_multiline_whitespace_around_double_arrow' => true,
80+
'no_php4_constructor' => true,
81+
'no_short_bool_cast' => true,
82+
'no_spaces_after_function_name' => true,
83+
'no_superfluous_phpdoc_tags' => true,
84+
'no_trailing_whitespace' => true,
85+
'no_trailing_whitespace_in_comment' => true,
86+
'no_unneeded_braces' => true,
87+
'no_unneeded_control_parentheses' => true,
88+
'no_unneeded_final_method' => true,
89+
'no_unreachable_default_argument_value' => true,
90+
'no_unset_cast' => true,
91+
'no_unset_on_property' => true,
92+
'no_unused_imports' => true,
93+
'no_useless_else' => true,
94+
'no_useless_return' => true,
95+
'no_useless_sprintf' => true,
96+
'no_whitespace_before_comma_in_array' => true,
97+
'no_whitespace_in_blank_line' => true,
98+
'non_printable_character' => true,
99+
'normalize_index_brace' => true,
100+
'not_operator_with_successor_space' => true,
101+
'nullable_type_declaration_for_default_null_value' => true,
102+
'object_operator_without_whitespace' => true,
103+
'ordered_class_elements' => true,
104+
'ordered_imports' => true,
105+
'ordered_interfaces' => true,
106+
'ordered_traits' => true,
107+
'phpdoc_no_useless_inheritdoc' => true,
108+
'phpdoc_order' => true,
109+
'phpdoc_return_self_reference' => true,
110+
'phpdoc_scalar' => true,
111+
'phpdoc_tag_casing' => true,
112+
'protected_to_private' => true,
113+
'psr_autoloading' => true,
114+
'return_type_declaration' => true,
115+
'semicolon_after_instruction' => true,
116+
'set_type_to_cast' => true,
117+
'short_scalar_cast' => true,
118+
'simple_to_complex_string_variable' => true,
119+
'simplified_if_return' => true,
120+
'simplified_null_return' => true,
121+
'single_blank_line_at_eof' => true,
122+
'single_class_element_per_statement' => true,
123+
'single_import_per_statement' => true,
124+
'single_line_after_imports' => true,
125+
'single_line_comment_style' => true,
126+
'single_quote' => true,
127+
'single_trait_insert_per_statement' => true,
128+
'spaces_inside_parentheses' => false,
129+
'standardize_not_equals' => true,
130+
'static_lambda' => true,
131+
'string_line_ending' => true,
132+
'switch_case_semicolon_to_colon' => true,
133+
'switch_case_space' => true,
134+
'switch_continue_to_break' => true,
135+
'ternary_operator_spaces' => true,
136+
'ternary_to_elvis_operator' => true,
137+
'ternary_to_null_coalescing' => true,
138+
'trim_array_spaces' => true,
139+
'type_declaration_spaces' => true,
140+
'unary_operator_spaces' => true,
141+
'visibility_required' => true,
142+
'whitespace_after_comma_in_array' => true,
143+
'yoda_style' => true,
144+
])
145+
->setFinder(PhpCsFixer\Finder::create()
146+
->exclude('vendor')
147+
->in(__DIR__.'\src')
148+
->in(__DIR__.'\test')
149+
)
150+
;
151+

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

composer.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"chunks"
2020
],
2121
"require": {
22-
"php": ">=5.4"
22+
"php": ">=8.0"
2323
},
2424
"require-dev": {
25-
"mikey179/vfsstream": "v1.2.0",
26-
"league/phpunit-coverage-listener": "~1.1",
27-
"fabpot/php-cs-fixer": "~2.2",
28-
"phpunit/phpunit": "4.*",
25+
"mikey179/vfsstream": "^1.2",
26+
"friendsofphp/php-cs-fixer": "^3.65",
27+
"phpunit/phpunit": ">=9.0",
2928
"mongodb/mongodb": "^1.4.0",
30-
"ext-mongodb": "*"
29+
"ext-mongodb": "*",
30+
"phpstan/phpstan": "^2.0"
3131
},
3232
"suggest": {
3333
"mongodb/mongodb":"Required to use this package with Mongo DB"
@@ -36,5 +36,10 @@
3636
"psr-0": {
3737
"Flow": "src"
3838
}
39+
},
40+
"autoload-dev": {
41+
"psr-0": {
42+
"Unit": "test"
43+
}
3944
}
4045
}

phpstan.neon.dist

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
parameters:
2+
level: 5
3+
errorFormat: raw
4+
editorUrl: '%%file%% %%line%% %%column%%: %%error%%'
5+
paths:
6+
- src
7+
- test

phpunit.xml

Lines changed: 0 additions & 29 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
4+
colors="true"
5+
processIsolation="false"
6+
stopOnFailure="false"
7+
failOnWarning="true"
8+
displayDetailsOnTestsThatTriggerDeprecations="true"
9+
failOnNotice="true"
10+
bootstrap="./test/bootstrap.php"
11+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
12+
cacheDirectory=".phpunit.cache"
13+
backupStaticProperties="false">
14+
<testsuites>
15+
<testsuite name="Flow Test Suite">
16+
<directory>./test/Unit/</directory>
17+
</testsuite>
18+
</testsuites>
19+
</phpunit>

src/Flow/Autoloader.php

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)