Skip to content

Commit de29c59

Browse files
authored
Merge pull request #3 from middlewares/php84-or-improvements
Add support for php8.4 and other improvements
2 parents 95c2c9a + 53c2f3b commit de29c59

File tree

11 files changed

+140
-54
lines changed

11 files changed

+140
-54
lines changed

.gitattributes

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
* text=auto eol=lf
22

3-
/tests export-ignore
4-
.editorconfig export-ignore
5-
.gitattributes export-ignore
6-
.gitignore export-ignore
7-
.travis.yml export-ignore
8-
phpunit.xml export-ignore
9-
phpcs.xml export-ignore
3+
/tests export-ignore
4+
.editorconfig export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.php-cs-fixer.php export-ignore
8+
phpcs.xml.dist export-ignore
9+
phpunit.xml.dist export-ignore
10+
.phpstan.neon export-ignore

.github/workflows/main.yaml

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: "testing"
22

33
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
88

99
jobs:
1010
qa:
@@ -13,19 +13,19 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717

1818
- name: Validate composer.json and composer.lock
1919
run: composer validate
2020

2121
- name: Cache Composer packages
2222
id: composer-cache
23-
uses: actions/cache@v2
23+
uses: actions/cache@v4
2424
with:
25-
path: vendor
26-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-php-
25+
path: vendor
26+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-php-
2929
3030
- name: Install dependencies
3131
if: steps.composer-cache.outputs.cache-hit != 'true'
@@ -40,37 +40,34 @@ jobs:
4040

4141
strategy:
4242
matrix:
43-
php:
44-
- 7.2
45-
- 7.3
46-
- 7.4
47-
composer-args: [ "" ]
48-
include:
49-
- php: 8.0
50-
composer-args: --ignore-platform-reqs
51-
fail-fast: false
43+
php:
44+
- 7.2
45+
- 7.3
46+
- 7.4
47+
- 8.0
48+
- 8.1
49+
- 8.2
50+
- 8.3
51+
- 8.4
5252

5353
steps:
5454
- name: Checkout
55-
uses: actions/checkout@v2
55+
uses: actions/checkout@v4
5656

5757
- name: Install PHP
5858
uses: shivammathur/setup-php@v2
5959
with:
6060
php-version: ${{ matrix.php }}
6161

6262
- name: Cache PHP dependencies
63-
uses: actions/cache@v2
63+
uses: actions/cache@v4
6464
with:
6565
path: vendor
6666
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
6767
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-
6868

6969
- name: Install dependencies
70-
run: composer install --prefer-dist --no-progress ${{ matrix.composer-args }}
70+
run: composer install --prefer-dist --no-progress
7171

7272
- name: Tests
7373
run: composer test
74-
75-
- name: Tests coverage
76-
run: composer coverage

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ composer.lock
33
.php_cs.cache
44
coverage
55
.phpunit.result.cache
6+
.idea
7+
kit
8+
*.cache

.php-cs-fixer.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
4+
return My\PhpCsFixerConfig::create()
5+
->setFinder(
6+
PhpCsFixer\Finder::create()
7+
->files()
8+
->name('*.php')
9+
->in(__DIR__.'/src')
10+
->in(__DIR__.'/tests')
11+
);

.phpstan.neon

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
#treatPhpDocTypesAsCertain: false
3+
reportUnmatchedIgnoredErrors: false
4+
inferPrivatePropertyTypeFromConstructor: true
5+
level: 8
6+
paths:
7+
- src
8+
- tests

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [3.1.0] - 2025-03-21
9+
### Added
10+
- Support for PHP 8.4
11+
812
## [3.0.0] - 2020-12-04
913
### Added
1014
- Support for PHP 8
@@ -60,6 +64,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6064
## 0.1.0 - 2016-10-10
6165
First version
6266

67+
[3.1.0]: https://github.com/middlewares/geolocation/compare/v3.0.0...v3.1.0
6368
[3.0.0]: https://github.com/middlewares/geolocation/compare/v2.0.0...v3.0.0
6469
[2.0.0]: https://github.com/middlewares/geolocation/compare/v1.0.0...v2.0.0
6570
[1.0.0]: https://github.com/middlewares/geolocation/compare/v0.5.0...v1.0.0

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018
3+
Copyright (c) 2018-2025
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@
1919
},
2020
"require": {
2121
"php": "^7.2 || ^8.0",
22-
"willdurand/geocoder": "^4.0",
23-
"php-http/message": "^1.6",
24-
"psr/http-server-middleware": "^1.0"
22+
"willdurand/geocoder": "^4",
23+
"php-http/message": "^1",
24+
"psr/http-server-middleware": "^1"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^8|^9",
28-
"friendsofphp/php-cs-fixer": "^2.0",
29-
"squizlabs/php_codesniffer": "^3.0",
30-
"middlewares/utils": "^2.1",
31-
"eloquent/phony-phpunit": "^6.0|^7.0",
32-
"php-http/guzzle6-adapter": "^1.1",
33-
"geocoder-php/free-geoip-provider": "^4.1",
34-
"phpstan/phpstan": "^0.12",
35-
"laminas/laminas-diactoros": "^2.3"
27+
"phpunit/phpunit": "^8 || ^9",
28+
"friendsofphp/php-cs-fixer": "^3",
29+
"squizlabs/php_codesniffer": "^3",
30+
"middlewares/utils": "^2 || ^3 || ^4",
31+
"php-http/guzzle7-adapter": "^1",
32+
"geocoder-php/free-geoip-provider": "^4",
33+
"phpstan/phpstan": "^1 || ^2",
34+
"laminas/laminas-diactoros": "^2 || ^3",
35+
"oscarotero/php-cs-fixer-config": "^2"
3636
},
3737
"autoload": {
3838
"psr-4": {
@@ -51,5 +51,10 @@
5151
"test": "phpunit",
5252
"coverage": "phpunit --coverage-text",
5353
"coverage-html": "phpunit --coverage-html=coverage"
54+
},
55+
"config": {
56+
"allow-plugins": {
57+
"php-http/discovery": false
58+
}
5459
}
5560
}

phpcs.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Middlewares coding standard">
3+
<description>Middlewares coding standard</description>
4+
5+
<!-- display progress -->
6+
<arg value="p"/>
7+
<arg name="report" value="full"/>
8+
<arg name="colors"/>
9+
10+
<!-- coding standard -->
11+
<rule ref="PSR2"/>
12+
13+
<!-- Paths to check -->
14+
<file>src</file>
15+
<file>tests</file>
16+
</ruleset>

phpunit.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
beStrictAboutOutputDuringTests="true"
8+
beStrictAboutTestsThatDoNotTestAnything="true"
9+
beStrictAboutTodoAnnotatedTests="true"
10+
colors="true"
11+
verbose="true"
12+
convertErrorsToExceptions="true"
13+
convertNoticesToExceptions="true"
14+
convertWarningsToExceptions="true"
15+
processIsolation="false"
16+
stopOnFailure="false"
17+
failOnWarning="true">
18+
<testsuites>
19+
<testsuite name="Geolocation test suite">
20+
<directory>tests</directory>
21+
</testsuite>
22+
</testsuites>
23+
24+
<filter>
25+
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="true">
26+
<directory>./src</directory>
27+
<exclude>
28+
<directory>./tests</directory>
29+
<directory>./vendor</directory>
30+
</exclude>
31+
</whitelist>
32+
</filter>
33+
</phpunit>

0 commit comments

Comments
 (0)