Skip to content

Commit 376a10d

Browse files
committed
Improve configs, php versions and update readme
1 parent 173f375 commit 376a10d

File tree

7 files changed

+194
-14
lines changed

7 files changed

+194
-14
lines changed

.editorconfig

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ trim_trailing_whitespace = true
1212
trim_trailing_whitespace = false
1313

1414
[*.yml]
15-
indent_style = space
16-
indent_size = 4
15+
indent_size = 2

.gitattributes

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
* text=auto
22

33
/.github export-ignore
4+
45
/tests export-ignore
6+
phpunit.xml export-ignore
57

68
.editorconfig export-ignore
79
.gitattributes export-ignore
810
.gitignore export-ignore
9-
.styleci.yml export-ignore
10-
.travis.yml export-ignore
1111

12-
monorepo-builder.php export-ignore
13-
phpunit.xml export-ignore

.github/workflows/main.yml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
security:
7+
name: Security
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
php: [ '8.1' ]
13+
os: [ ubuntu-latest ]
14+
steps:
15+
- name: Set Git To Use LF
16+
run: |
17+
git config --global core.autocrlf false
18+
git config --global core.eol lf
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Setup PHP ${{ matrix.php }}
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
- name: Install Dependencies
26+
uses: nick-invision/retry@v1
27+
with:
28+
timeout_minutes: 5
29+
max_attempts: 5
30+
command: composer update --prefer-dist --no-interaction --no-progress
31+
- name: Security Advisories
32+
run: composer require --dev roave/security-advisories:dev-latest
33+
34+
static-analysis:
35+
name: Psalm
36+
runs-on: ${{ matrix.os }}
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
php: [ '8.1' ]
41+
os: [ ubuntu-latest ]
42+
43+
steps:
44+
- name: Set Git To Use LF
45+
run: |
46+
git config --global core.autocrlf false
47+
git config --global core.eol lf
48+
49+
- name: Checkout
50+
uses: actions/checkout@v2
51+
52+
- name: Setup PHP ${{ matrix.php }}
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ matrix.php }}
56+
tools: composer:v2
57+
58+
- name: Install Dependencies
59+
uses: nick-invision/retry@v1
60+
with:
61+
timeout_minutes: 5
62+
max_attempts: 5
63+
command: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress
64+
65+
- name: Static Analysis
66+
continue-on-error: true
67+
run: vendor/bin/psalm --no-cache
68+
69+
coding-standards:
70+
name: Coding Standards
71+
runs-on: ${{ matrix.os }}
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
php: [ '8.1' ]
76+
os: [ ubuntu-latest ]
77+
78+
steps:
79+
- name: Checkout
80+
uses: actions/checkout@v2
81+
82+
- name: Setup PHP ${{ matrix.php }}
83+
uses: shivammathur/setup-php@v2
84+
with:
85+
php-version: ${{ matrix.php }}
86+
tools: composer:v2
87+
88+
- name: Install Dependencies
89+
uses: nick-invision/retry@v1
90+
with:
91+
timeout_minutes: 5
92+
max_attempts: 5
93+
command: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress
94+
95+
- name: Check Coding Standards
96+
run: vendor/bin/phpcs --standard=phpcs.xml
97+
98+
test:
99+
name: Build (${{matrix.php}}, ${{ matrix.os }}, ${{ matrix.stability }})
100+
runs-on: ${{ matrix.os }}
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
php: [ '7.4', '8.0', '8.1', '8.2' ]
105+
os: [ ubuntu-latest, macos-latest, windows-latest ]
106+
stability: [ prefer-lowest, prefer-stable ]
107+
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@v2
111+
112+
- name: Setup PHP ${{ matrix.php }}
113+
uses: shivammathur/setup-php@v2
114+
with:
115+
php-version: ${{ matrix.php }}
116+
tools: composer:v2
117+
118+
- name: Install Dependencies
119+
uses: nick-invision/retry@v1
120+
with:
121+
timeout_minutes: 5
122+
max_attempts: 5
123+
command: composer update --${{ matrix.stability }} --ignore-platform-reqs --prefer-dist --no-interaction --no-progress
124+
125+
- name: Execute Tests
126+
run: vendor/bin/phpunit

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
.idea/
22
vendor/
33

4-
# Local testing
5-
include/
6-
test.php
7-
84
composer.lock
95
.phpunit.result.cache

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# FFI Environment
22

3+
<p align="center">
4+
<a href="https://packagist.org/packages/ffi/env"><img src="https://poser.pugx.org/ffi/env/require/php?style=for-the-badge" alt="PHP 8.1+"></a>
5+
<a href="https://packagist.org/packages/ffi/env"><img src="https://poser.pugx.org/ffi/env/version?style=for-the-badge" alt="Latest Stable Version"></a>
6+
<a href="https://packagist.org/packages/ffi/env"><img src="https://poser.pugx.org/ffi/env/v/unstable?style=for-the-badge" alt="Latest Unstable Version"></a>
7+
<a href="https://packagist.org/packages/ffi/env"><img src="https://poser.pugx.org/ffi/env/downloads?style=for-the-badge" alt="Total Downloads"></a>
8+
<a href="https://raw.githubusercontent.com/php-ffi/env/master/LICENSE.md"><img src="https://poser.pugx.org/ffi/env/license?style=for-the-badge" alt="License MIT"></a>
9+
</p>
10+
<p align="center">
11+
<a href="https://github.com/php-ffi/env/actions"><img src="https://github.com/php-ffi/env/workflows/build/badge.svg"></a>
12+
</p>
13+
314
A set of API methods for working with the FFI environment.
415

516
## Requirements

composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=7.4"
21+
"php": "^7.4|^8.0"
2222
},
2323
"autoload": {
2424
"psr-4": {
2525
"FFI\\Env\\": "src"
2626
}
2727
},
2828
"require-dev": {
29-
"vimeo/psalm": "^4.9",
30-
"jetbrains/phpstorm-attributes": "^1.0",
31-
"phpunit/phpunit": "^9.0"
29+
"vimeo/psalm": "^5.4",
30+
"phpunit/phpunit": "^9.5",
31+
"squizlabs/php_codesniffer": "^3.7",
32+
"jetbrains/phpstorm-attributes": "^1.0"
3233
},
3334
"autoload-dev": {
3435
"psr-4": {

phpcs.xml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Code Style Ruleset">
3+
<!-- config -->
4+
<rule ref="PSR12">
5+
<exclude name="PSR12.Classes.AnonClassDeclaration"/>
6+
</rule>
7+
<rule ref="Generic.PHP.ForbiddenFunctions">
8+
<properties>
9+
<property name="forbiddenFunctions" type="array" extend="true">
10+
<!-- deprecated/aliased functions -->
11+
<element key="join" value="implode" />
12+
<element key="chop" value="rtrim" />
13+
<element key="strchr" value="strstr" />
14+
<element key="show_source" value="highlight_file" />
15+
<element key="ini_alter" value="ini_set" />
16+
<element key="dns_check_record" value="checkdnsrr" />
17+
<element key="dns_get_mx" value="getmxrr" />
18+
<element key="doubleval" value="floatval" />
19+
<element key="is_long" value="is_int" />
20+
<element key="is_integer" value="is_int" />
21+
<element key="is_double" value="is_float" />
22+
<element key="is_real" value="is_float" />
23+
<element key="fputs" value="fwrite" />
24+
<element key="set_file_buffer" value="stream_set_write_buffer" />
25+
<element key="set_socket_blocking" value="stream_set_blocking" />
26+
<element key="socket_set_blocking" value="stream_set_blocking" />
27+
<element key="stream_register_wrapper" value="stream_wrapper_register" />
28+
<element key="socket_set_timeout" value="stream_set_timeout" />
29+
<element key="socket_get_status" value="stream_get_meta_data" />
30+
<element key="is_writeable" value="is_writable" />
31+
<element key="pos" value="current" />
32+
<element key="sizeof" value="count" />
33+
34+
<!-- deprecated/aliased operators -->
35+
<element key="delete" value="unset" />
36+
<element key="print" value="echo" />
37+
<element key="create_function" value="null" />
38+
</property>
39+
</properties>
40+
</rule>
41+
42+
<arg name="colors"/>
43+
44+
<!-- includes -->
45+
<file>./src</file>
46+
47+
<!-- excludes -->
48+
<exclude-pattern type="relative">*/tests/*</exclude-pattern>
49+
</ruleset>

0 commit comments

Comments
 (0)