Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 9 additions & 22 deletions .github/workflows/styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: php-cs-fixer, cs2pr
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: ./vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

Expand All @@ -26,36 +26,23 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: ./vendor/bin/phpmd ./ text ./phpmd.xml --suffixes php,inc,test --exclude vendor,bin,tests

phpcpd:
name: phpcpd
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/phpcpd ./ --suffix .php --suffix .inc --suffix .test --exclude vendor --exclude bin --exclude tests

phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: phpstan, cs2pr
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: ./vendor/bin/phpstan analyse ./src ./tests --error-format=checkstyle | cs2pr

Expand All @@ -66,9 +53,9 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- run: ./vendor/bin/psalm --output-format=github

Expand All @@ -80,6 +67,6 @@ jobs:
uses: shivammathur/setup-php@v2
with:
tools: composer:v2
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: composer install --prefer-dist
- uses: symfonycorp/security-checker-action@v3
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4']
php-versions: ['8.3', '8.4', '8.5']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- add tests coverage for PHP 8.5
- upgrade vimeo/psalm (4.30.0 = => 6.15.1)

### Removed
- removed support PHP 8.0
- removed support PHP 8.1
- removed support PHP 8.2
- remove phpcpd as abandoned
- remove unused php-mock/php-mock-phpunit

### Security
- upgrade phpstan/phpstan (0.12.100 => 2.1.39)
- upgrade phpunit/php-code-coverage (9.2.32 => 12.5.3)
- upgrade phpunit/phpunit (9.6.34 => 12.5.14)

### Changed
- remove deprecated usage of ReflectionProperty::setAccessible since PHP8.1

## [1.0.2] - 2025-06-03
### Added
Expand Down
24 changes: 17 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ Pull requests for bugs are more than welcome - please explain the bug you're try

## Developing

## 🧪 Running tests

Run the test suite without code coverage (no Xdebug required):

```bash
./vendor/bin/phpunit --no-coverage
```

Run the test suite with code coverage (requires [Xdebug](https://xdebug.org/) or [PCOV](https://github.com/krakjoe/pcov)):

```bash
XDEBUG_MODE=coverage ./vendor/bin/phpunit
```

> **Note:** Running `./vendor/bin/phpunit` without `--no-coverage` and without a coverage driver will fail with _"No code coverage driver available"_. Use `--no-coverage` for day-to-day local development.

## 🚔 Check Symfony 4 coding standards & best practices

You need to run composer before using [FriendsOfPHP/PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer).
Expand All @@ -37,20 +53,14 @@ It can modernize your code (like converting the pow function to the ** operator
./vendor/bin/phpstan analyse ./ --error-format=checkstyle
```

### Improve global code quality using PHPCPD (Code duplication) & PHPMD (PHP Mess Detector)
### Improve global code quality using PHPMD (PHP Mess Detector)

Detect overcomplicated expressions & Unused parameters, methods, properties

```bash
./vendor/bin/phpmd ./ text ./phpmd.xml --suffixes php,inc,test --exclude vendor,bin,tests
```

Copy/Paste Detector

```bash
./vendor/bin/phpcpd ./ --names=*.php,*.inc,*.test --names-exclude=*.md --ansi --exclude=vendor --exclude=bin --exclude=tests
```

### Checks compatibility with PHP interpreter versions

```bash
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Convert World Coordinates to Swiss Coordinates - and vice versa
[![Build](https://github.com/antistatique/swisstopo/actions/workflows/tests.yml/badge.svg)](https://github.com/antistatique/swisstopo/actions/workflows/tests.yml)
[![Packagist](https://img.shields.io/packagist/dt/antistatique/swisstopo.svg?maxAge=2592000)](https://packagist.org/packages/antistatique/swisstopo)
[![License](https://poser.pugx.org/antistatique/swisstopo/license)](https://packagist.org/packages/antistatique/swisstopo)
[![PHP Versions Supported](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg)](https://packagist.org/packages/antistatique/swisstopo)
[![PHP Versions Supported](https://img.shields.io/badge/php-%3E%3D%208.3-8892BF.svg)](https://packagist.org/packages/antistatique/swisstopo)

Super-simple PHP library to transpose GPS (WGS84) coordinates to/from the Swiss military and civilian coordinate
systems CH1903/LV03 (MN03) or CH1995/LV95 (MN95).
Expand Down
3 changes: 0 additions & 3 deletions bin/post-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ echo "\n🚔 \033[0;32mRunning Code Sniffer Symfony for /public ...\033[0m"
echo "\n💩 \033[0;32mRunning PHP Mess Detector ...\033[0m"
./vendor/bin/phpmd ./ text ./phpmd.xml --suffixes php,inc,test --exclude vendor,bin,tests

echo "\n🛂 \033[0;32mRunning PHP Copy/Paste Detector ...\033[0m"
./vendor/bin/phpcpd ./ --names=*.php,*.inc,*.test --names-exclude=*.md --ansi --exclude=vendor --exclude=bin --exclude=tests

echo "\n🍫 \033[0;32mRunning PhpCodeFixer ...\033[0m"
./vendor/bin/phpcf --target 7.3 --file-extensions php,inc,test ./

Expand Down
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
"description": "Convert GPS (WGS84) to Swiss (LV03 and LV95) coordinates (and vice versa)",
"license": "MIT",
"require": {
"php": ">=8.0"
"php": ">=8.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0.0",
"phpunit/php-code-coverage": "^9.2.0",
"phpunit/phpunit": "^12",
"phpunit/php-code-coverage": "^12",
"friendsofphp/php-cs-fixer": "^3.21",
"phpmd/phpmd": "^2.8",
"sebastian/phpcpd": "^6.0",
"php-coveralls/php-coveralls": "^2.1",
"php-mock/php-mock-phpunit": "^2.4",
"vimeo/psalm": "^4.29",
"phpstan/phpstan-deprecation-rules": "^0.12.2"
"vimeo/psalm": "^6.0",
"phpstan/phpstan-deprecation-rules": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
parameters:
# Ignore tests
excludes_analyse:
excludePaths:
- *Test.php
- *TestBase.php
# PHPStan Level 1
Expand Down
31 changes: 18 additions & 13 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" failOnRisky="true" failOnWarning="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<phpunit colors="true"
failOnRisky="true"
failOnWarning="true"
stopOnFailure="false"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnPhpunitNotices="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true">
<testsuites>
<testsuite name="Swisstopo Test Suite">
<directory suffix=".php">./tests/</directory>
<exclude>./tests/Traits/</exclude>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
<coverage>
<report>
<clover outputFile="./build/logs/clover.xml"/>
<html outputDirectory="./build/logs/coverage-html"/>
</report>
</coverage>
<testsuites>
<testsuite name="Swisstopo Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
<logging/>
<php>
<!-- Temporarily preventing https://github.com/xdebug/xdebug/pull/699 -->
<const name="XDEBUG_CC_UNUSED" value=""/>
<const name="XDEBUG_CC_DEAD_CODE" value="-1"/>
</php>
</phpunit>
22 changes: 6 additions & 16 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
autoloader="vendor/autoload.php"
requireVoidReturnType="false"
resolveFromConfigFile="true"
findUnusedBaselineEntry="true"
findUnusedCode="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config file:///app/vendor/vimeo/psalm/config.xsd">

xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />

<ignoreFiles>
<directory name="vendor" />
<directory name="bin" />
</ignoreFiles>
</projectFiles>

<fileExtensions>
<extension name="php" />
<extension name="inc" />
</fileExtensions>

<issueHandlers>
<!-- Suppress some errors -->
<!-- @see https://github.com/vimeo/psalm/blob/master/docs/dealing_with_code_issues.md -->
</issueHandlers>

</psalm>
Loading
Loading