Skip to content

Commit 75ad188

Browse files
authored
Merge pull request #3 from InteractionDesignFoundation/ixdf
Update dependencies, migrate from Travis to GitHub actions
2 parents bb6870a + 1bea21e commit 75ad188

File tree

9 files changed

+93
-30
lines changed

9 files changed

+93
-30
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Ignore all test and documentation with "export-ignore".
22
/.gitattributes export-ignore
33
/.gitignore export-ignore
4-
/.travis.yml export-ignore
54
/phpunit.xml export-ignore
65
/tests export-ignore

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 50
8+
labels:
9+
- "dependencies"

.github/run-tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: run-tests
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ ubuntu-latest ]
12+
php: [ 8.0, 8.1 ]
13+
laravel: [ 8.* ]
14+
dependency-version: [ prefer-stable ]
15+
include:
16+
- laravel: 8.*
17+
18+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: curl
29+
coverage: none
30+
31+
- name: Setup problem matchers
32+
run: |
33+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
34+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
35+
36+
- name: Install dependencies
37+
run: |
38+
composer install --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress --no-scripts
39+
env:
40+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
41+
42+
- name: Execute tests
43+
run: composer test

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
/vendor
22
composer.phar
33
composer.lock
4+
auth.json
5+
6+
phpunit.xml
47
.phpunit.result.cache
8+
59
.DS_Store
6-
.idea/*
10+
Thumbs.db
11+
/.idea

.travis.yml

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

composer.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
],
2020
"require": {
21-
"php": "^7.3|^8.0",
21+
"php": "^8.0|^8.1",
2222
"illuminate/support": "^8.0",
2323
"illuminate/console": "^8.0",
2424
"illuminate/cache": "^8.0"
@@ -28,12 +28,12 @@
2828
"monolog/monolog": "Allows for storing location not found errors to the log"
2929
},
3030
"require-dev": {
31-
"phpunit/phpunit": "^8.0",
32-
"mockery/mockery": "^1.3",
31+
"phpunit/phpunit": "^9.5",
32+
"mockery/mockery": "^1.4",
3333
"geoip2/geoip2": "~2.1",
3434
"vlucas/phpdotenv": "^5.0",
35-
"phpstan/phpstan": "^0.12.14",
36-
"squizlabs/php_codesniffer": "^3.5"
35+
"phpstan/phpstan": "^1.2",
36+
"squizlabs/php_codesniffer": "^3.6"
3737
},
3838
"autoload": {
3939
"files": [
@@ -51,6 +51,11 @@
5151
"Torann\\GeoIP\\Tests\\": "tests/"
5252
}
5353
},
54+
"scripts": {
55+
"test": "vendor/bin/phpunit",
56+
"phpcs": "vendor/bin/phpcs --standard=phpcs.xml src",
57+
"phpstan": "vendor/bin/phpstan --level=0 --no-progress analyse --configuration phpstan.neon --memory-limit 2G"
58+
},
5459
"extra": {
5560
"branch-alias": {
5661
"dev-master": "1.0-dev"

phpstan.neon

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
parameters:
2-
excludes_analyse:
3-
- vendor
4-
- resources
2+
# The level 9 is the highest level
3+
level: 9
4+
reportUnmatchedIgnoredErrors: false
5+
6+
paths:
7+
- src
8+
- tests
9+
10+
excludePaths:
11+
analyse:
12+
- vendor
13+
- resources
14+
515
ignoreErrors:
616
- '#Function config_path not found#'
717
- '#Function config not found#'

phpunit.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4+
backupGlobals="false"
35
backupStaticAttributes="false"
46
bootstrap="vendor/autoload.php"
57
colors="true"
@@ -10,6 +12,11 @@
1012
stopOnFailure="false"
1113
verbose="true"
1214
>
15+
<coverage>
16+
<include>
17+
<directory suffix=".php">src/</directory>
18+
</include>
19+
</coverage>
1320
<testsuites>
1421
<testsuite name="GeoIP Package Test Suite">
1522
<directory>./tests</directory>

src/Location.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function __set($key, $value)
154154
*
155155
* @return bool
156156
*/
157-
public function offsetExists($offset)
157+
public function offsetExists(mixed $offset): bool
158158
{
159159
return isset($this->$offset);
160160
}
@@ -166,7 +166,7 @@ public function offsetExists($offset)
166166
*
167167
* @return mixed
168168
*/
169-
public function offsetGet($offset)
169+
public function offsetGet(mixed $offset): mixed
170170
{
171171
return $this->$offset;
172172
}
@@ -179,7 +179,7 @@ public function offsetGet($offset)
179179
*
180180
* @return void
181181
*/
182-
public function offsetSet($offset, $value)
182+
public function offsetSet(mixed $offset, mixed $value): void
183183
{
184184
$this->$offset = $value;
185185
}
@@ -191,7 +191,7 @@ public function offsetSet($offset, $value)
191191
*
192192
* @return void
193193
*/
194-
public function offsetUnset($offset)
194+
public function offsetUnset(mixed $offset): void
195195
{
196196
unset($this->$offset);
197197
}

0 commit comments

Comments
 (0)