Skip to content

Commit 7d3b360

Browse files
committed
[TASK] Fix code style and upgrade libraries
1 parent cfd0526 commit 7d3b360

359 files changed

Lines changed: 15032 additions & 10214 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_style = space
11+
indent_size = 4
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
# JSON-Files
16+
[*.json]
17+
indent_style = tab
18+
19+
[composer.json]
20+
indent_style = space
21+
indent_size = 4
22+
23+
# MD-Files
24+
[*.md]
25+
indent_size = 4
26+
max_line_length = 80
27+
28+
[*.xml]
29+
indent_style = tab
30+
insert_final_newline = false
31+
32+
[*.feature]
33+
insert_final_newline = true
34+
35+
[*.{yml,yaml}]
36+
indent_size = 2
37+
insert_final_newline = true

.gitattributes

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
5+
# Enforce checkout with linux lf consistent over all platforms
6+
*.html text eol=lf
7+
*.css text eol=lf
8+
*.tmpl text eol=lf
9+
*.less text eol=lf
10+
*.scss text eol=lf
11+
*.js text eol=lf
12+
*.json text eol=lf
13+
*.php text eol=lf
14+
*.rst text eol=lf
15+
*.md text eol=lf
16+
*.yml text eol=lf
17+
*.yaml text eol=lf
18+
*.ts text eol=lf
19+
*.typoscript text eol=lf
20+
*.xlf text eol=lf
21+
*.sh text eol=lf
22+
*.sql text eol=lf
23+
*.txt text eol=lf
24+
25+
/.* export-ignore
26+
/tests export-ignore
27+
/behat.yml export-ignore

.github/workflows/rector.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# github action that checks code with Rector
2+
name: Rector
3+
4+
on:
5+
pull_request: null
6+
7+
jobs:
8+
rector:
9+
runs-on: ubuntu-latest
10+
if: github.event.pull_request.head.repo.full_name == 'simonschaufi/php-libkml'
11+
steps:
12+
-
13+
if: github.event.pull_request.head.repo.full_name == github.repository
14+
uses: actions/checkout@v4
15+
with:
16+
# Must be used to trigger workflow after push
17+
token: ${{ secrets.ACCESS_TOKEN }}
18+
19+
-
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.2
23+
coverage: none
24+
25+
- uses: "ramsey/composer-install@v2"
26+
27+
- run: vendor/bin/rector --ansi
28+
# @todo apply coding standard if used
29+
30+
-
31+
# commit only to core contributors who have repository access
32+
uses: stefanzweifel/git-auto-commit-action@v4
33+
with:
34+
commit_message: '[rector] Rector fixes'
35+
commit_author: 'GitHub Action <actions@github.com>'
36+
commit_user_email: 'action@github.com'

.gitignore

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
## IDE
2-
.sonarlint/
3-
.idea/
4-
5-
## Dependencies
6-
vendor
7-
8-
## Generated
9-
reports
1+
/.idea/
2+
/vendor/
3+
/reports/
4+
/.php-cs-fixer.cache
5+
/.phpunit.result.cache

.php-cs-fixer.php

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
if (PHP_SAPI !== 'cli') {
6+
die('This script supports command line usage only. Please check your command.');
7+
}
8+
9+
return (new \PhpCsFixer\Config())
10+
->setFinder(
11+
(new \PhpCsFixer\Finder())
12+
->ignoreVCSIgnored(true)
13+
->in([
14+
__DIR__ . '/src/',
15+
__DIR__ . '/tests/',
16+
])
17+
)
18+
->setRiskyAllowed(true)
19+
->setRules([
20+
'@DoctrineAnnotation' => true,
21+
'@PSR2' => true,
22+
'array_indentation' => true,
23+
'array_syntax' => ['syntax' => 'short'],
24+
'blank_line_after_opening_tag' => true,
25+
'braces' => ['allow_single_line_closure' => true],
26+
'cast_spaces' => ['space' => 'none'],
27+
'compact_nullable_typehint' => true,
28+
// @todo: Can be dropped once we enable @PER-CS2.0
29+
'concat_space' => ['spacing' => 'one'],
30+
'declare_equal_normalize' => ['space' => 'none'],
31+
'declare_parentheses' => true,
32+
'dir_constant' => true,
33+
// @todo: Can be dropped once we enable @PER-CS2.0
34+
'function_declaration' => [
35+
'closure_fn_spacing' => 'none',
36+
],
37+
'function_typehint_space' => true,
38+
'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']],
39+
'type_declaration_spaces' => true,
40+
'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false],
41+
'lowercase_cast' => true,
42+
'list_syntax' => ['syntax' => 'short'],
43+
// @todo: Can be dropped once we enable @PER-CS2.0
44+
'method_argument_space' => true,
45+
'modernize_strpos' => true,
46+
'modernize_types_casting' => true,
47+
'native_function_casing' => true,
48+
'new_with_braces' => true,
49+
'no_alias_functions' => true,
50+
'no_blank_lines_after_phpdoc' => true,
51+
'no_empty_phpdoc' => true,
52+
'no_empty_statement' => true,
53+
'no_extra_blank_lines' => true,
54+
'no_leading_import_slash' => true,
55+
'no_leading_namespace_whitespace' => true,
56+
'no_null_property_initialization' => true,
57+
'no_short_bool_cast' => true,
58+
'no_singleline_whitespace_before_semicolons' => true,
59+
'no_superfluous_elseif' => true,
60+
'no_trailing_comma_in_singleline' => true,
61+
'no_trailing_comma_in_singleline_array' => true,
62+
'no_unneeded_control_parentheses' => true,
63+
'no_unused_imports' => true,
64+
'no_useless_else' => true,
65+
'no_useless_nullsafe_operator' => true,
66+
'no_whitespace_in_blank_line' => true,
67+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
68+
'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']],
69+
'php_unit_mock_short_will_return' => true,
70+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
71+
'phpdoc_no_access' => true,
72+
'phpdoc_no_empty_return' => true,
73+
'phpdoc_no_package' => true,
74+
'phpdoc_scalar' => true,
75+
'phpdoc_trim' => true,
76+
'phpdoc_types' => true,
77+
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
78+
'return_type_declaration' => ['space_before' => 'none'],
79+
'single_quote' => true,
80+
'single_space_around_construct' => true,
81+
'single_line_comment_style' => ['comment_types' => ['hash']],
82+
// @todo: Can be dropped once we enable @PER-CS2.0
83+
'single_line_empty_body' => true,
84+
'single_trait_insert_per_statement' => true,
85+
'trailing_comma_in_multiline' => ['elements' => ['arrays']],
86+
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
87+
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
88+
'header_comment' => [
89+
'header' => '',
90+
'comment_type' => 'comment',
91+
'location' => 'after_declare_strict',
92+
'separate' => 'both'
93+
],
94+
'protected_to_private' => true,
95+
//'final_class' => true,
96+
//'php_unit_construct' => true,
97+
'php_unit_set_up_tear_down_visibility' => true,
98+
'php_unit_test_annotation' => true,
99+
]);

.travis.yml

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

behat.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
default:
22
suites:
3-
parser:
3+
default:
4+
paths:
5+
- "%paths.base%/tests/features"
46
contexts:
5-
- LibKml\Tests\Bdd\Read\Kml\ParserKmlContext
7+
- 'LibKml\Tests\Bdd\Read\Kml\ParserKmlContext'
68
extensions:
7-
LeanPHP\Behat\CodeCoverage\Extension:
8-
drivers:
9-
- local
9+
DVDoug\Behat\CodeCoverage\Extension:
1010
filter:
11-
whitelist:
12-
include:
13-
directories:
14-
'src': ~
15-
report:
16-
format: clover
17-
options:
11+
include:
12+
directories:
13+
'src': ~
14+
reports:
15+
clover:
1816
target: reports/behat-coverage.xml

composer.json

Lines changed: 55 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,58 @@
11
{
2-
"name": "earelin/php-libkml",
3-
"description": "A library to manipulate KML/KMZ files",
4-
"type": "library",
5-
"keywords": ["kml", "gis"],
6-
"homepage": "https://github.com/earelin/php-libkml",
7-
"readme": "README.md",
8-
"license": "GPL-3.0",
9-
"support": {
10-
"issues": "https://github.com/earelin/php-libkml/issues",
11-
"source": "https://github.com/earelin/php-libkml"
12-
},
13-
"minimum-stability": "dev",
14-
"prefer-stable": true,
15-
"require": {
16-
"php": "^7.1",
17-
"ext-simplexml": "*"
18-
},
19-
"require-dev": {
20-
"phpunit/phpunit": "^7.4",
21-
"drupal/coder": "^8.2.12",
22-
"behat/behat": "^3.5",
23-
"leanphp/behat-code-coverage": "^3.4"
24-
},
25-
"autoload": {
26-
"psr-4": {
27-
"LibKml\\": "src/"
2+
"name": "simonschaufi/php-libkml",
3+
"description": "A library to manipulate KML/KMZ files",
4+
"license": "GPL-3.0",
5+
"keywords": [
6+
"kml",
7+
"gis"
8+
],
9+
"homepage": "https://github.com/simonschaufi/php-libkml",
10+
"support": {
11+
"issues": "https://github.com/simonschaufi/php-libkml/issues",
12+
"source": "https://github.com/simonschaufi/php-libkml"
13+
},
14+
"require": {
15+
"php": "^7.4 || ^8.0",
16+
"ext-simplexml": "*"
17+
},
18+
"require-dev": {
19+
"behat/behat": "^3.0",
20+
"dvdoug/behat-code-coverage": "^5.0",
21+
"ergebnis/composer-normalize": "^2.0.0",
22+
"friendsofphp/php-cs-fixer": "^3.0.0",
23+
"phpunit/phpunit": "^9.0",
24+
"rector/rector": "^1.0",
25+
"squizlabs/php_codesniffer": "^3.8.1"
26+
},
27+
"minimum-stability": "dev",
28+
"prefer-stable": true,
29+
"autoload": {
30+
"psr-4": {
31+
"LibKml\\": "src/"
32+
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"LibKml\\Tests\\": "tests/"
37+
}
38+
},
39+
"config": {
40+
"allow-plugins": {
41+
"dealerdirect/phpcodesniffer-composer-installer": true,
42+
"ergebnis/composer-normalize": true
43+
}
44+
},
45+
"scripts": {
46+
"ci:composer:normalize": "@composer normalize --no-check-lock --dry-run",
47+
"ci:php:php-cs-fixer": "vendor/bin/php-cs-fixer fix -v --dry-run --diff",
48+
"ci:tests:acceptance": "XDEBUG_MODE=coverage vendor/bin/behat --no-colors --no-snippets --format junit --out reports",
49+
"ci:tests:unit": "vendor/bin/phpunit --colors=never",
50+
"ci:rector": "vendor/bin/rector process --dry-run",
51+
"fix:composer:normalize": "@composer normalize --no-check-lock",
52+
"fix:php:php-cs-fixer": "vendor/bin/php-cs-fixer fix",
53+
"fix:rector": "vendor/bin/rector process",
54+
"local:clean": "rm -Rf reports",
55+
"local:tests:acceptance": "XDEBUG_MODE=coverage vendor/bin/behat --colors --no-snippets",
56+
"local:tests:unit": "vendor/bin/phpunit --colors=always"
2857
}
29-
},
30-
"autoload-dev": {
31-
"psr-4": {
32-
"LibKml\\Tests\\": "tests/src/"
33-
}
34-
},
35-
"scripts": {
36-
"clean": "rm -Rf reports",
37-
"test": "phpunit --colors=always --bootstrap vendor/autoload.php -c phpunit.xml",
38-
"test-ci": "phpunit --colors=never --bootstrap vendor/autoload.php -c phpunit.xml",
39-
"acceptance-test": "behat --colors --no-snippets",
40-
"acceptance-test-ci": "behat --no-colors --no-snippets --format junit --out reports",
41-
"phpcs": "phpcs --bootstrap=vendor/autoload.php --standard=vendor/drupal/coder/coder_sniffer/Drupal --exclude=Drupal.Commenting.FunctionComment src",
42-
"phpcbf": "phpcbf --bootstrap=vendor/autoload.php --standard=vendor/drupal/coder/coder_sniffer/Drupal --exclude=Drupal.Commenting.FunctionComment,Drupal.Commenting.ClassComment src"
43-
}
4458
}

0 commit comments

Comments
 (0)