Skip to content

Commit 335c9c1

Browse files
authored
PHP8 and external API stubs
2 parents 366aa34 + 8d2ab65 commit 335c9c1

Some content is hidden

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

77 files changed

+2602
-33476
lines changed

.github/workflows/linting.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
on:
3+
pull_request: null
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
php: ['7.4', '8.0', '8.1']
13+
14+
name: Linting - PHP ${{ matrix.php }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php }}
20+
coverage: none
21+
extensions: intl
22+
- run: composer install --no-progress
23+
- run: composer codestyle
24+
- run: composer phpstan

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
.idea
3-
.php_cs.cache
3+
.php-cs-fixer.cache
44
vendor/
55
kimai.phar
66
kimai.phar.sha1
7+
var/

.php_cs.dist .php-cs-fixer.dist.php

+23-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<?php
22

3-
// php-cs-fixer fix
4-
53
$fileHeaderComment = <<<COMMENT
6-
This file is part of the Kimai 2 - Remote Console.
4+
This file is part of the "Remote Console" for Kimai.
75
86
For the full copyright and license information, please view the LICENSE
97
file that was distributed with this source code.
108
COMMENT;
119

12-
return PhpCsFixer\Config::create()
10+
$fixer = new PhpCsFixer\Config();
11+
$fixer
1312
->setRiskyAllowed(true)
1413
->setRules([
1514
'encoding' => true,
@@ -21,7 +20,7 @@
2120
'function_declaration' => true,
2221
'indentation_type' => true,
2322
'line_ending' => true,
24-
'lowercase_constants' => true,
23+
'constant_case' => ['case' => 'lower'],
2524
'lowercase_keywords' => true,
2625
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
2726
'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'],
@@ -48,7 +47,7 @@
4847
'statements' => ['return'],
4948
],
5049
'cast_spaces' => true,
51-
'class_attributes_separation' => ['elements' => ['method']],
50+
'class_attributes_separation' => ['elements' => ['method' => 'one']],
5251
'concat_space' => ['spacing' => 'one'],
5352
'declare_equal_normalize' => true,
5453
'function_typehint_space' => true,
@@ -78,8 +77,7 @@
7877
'no_short_bool_cast' => true,
7978
'no_singleline_whitespace_before_semicolons' => true,
8079
'no_spaces_around_offset' => true,
81-
'no_trailing_comma_in_list_call' => true,
82-
'no_trailing_comma_in_singleline_array' => true,
80+
'no_trailing_comma_in_singleline' => true,
8381
'no_unneeded_curly_braces' => true,
8482
'no_unneeded_final_method' => true,
8583
'no_unused_imports' => true,
@@ -102,10 +100,10 @@
102100
],
103101
'phpdoc_annotation_without_dot' => true,
104102
'phpdoc_indent' => true,
105-
'phpdoc_inline_tag' => true,
103+
'phpdoc_inline_tag_normalizer' => true,
106104
'phpdoc_no_access' => true,
107105
'phpdoc_no_alias_tag' => true,
108-
'phpdoc_no_empty_return' => true,
106+
'phpdoc_no_empty_return' => false,
109107
'phpdoc_no_package' => true,
110108
'phpdoc_no_useless_inheritdoc' => true,
111109
'phpdoc_return_self_reference' => true,
@@ -132,7 +130,7 @@
132130
'standardize_increment' => true,
133131
'standardize_not_equals' => true,
134132
'ternary_operator_spaces' => true,
135-
'trailing_comma_in_multiline_array' => false,
133+
'trailing_comma_in_multiline' => false,
136134
'trim_array_spaces' => true,
137135
'unary_operator_spaces' => true,
138136
'whitespace_after_comma_in_array' => true,
@@ -143,6 +141,18 @@
143141
'method',
144142
'property',
145143
]],
144+
'native_function_invocation' => [
145+
'include' => [
146+
'@compiler_optimized'
147+
],
148+
'scope' => 'namespaced'
149+
],
150+
'native_function_type_declaration_casing' => true,
151+
'no_alias_functions' => [
152+
'sets' => [
153+
'@internal'
154+
]
155+
],
146156
])
147157
->setFinder(
148158
PhpCsFixer\Finder::create()
@@ -152,3 +162,5 @@
152162
)
153163
->setFormat('checkstyle')
154164
;
165+
166+
return $fixer;

README.md

+5-14
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A PHP application to access your Kimai 2 installation via its API (http).
44

55
**Requirements**
66

7-
- PHP 7.3
7+
- PHP 7.4, 8.0 or 8.1
88
- cURL extension
99
- json extension
1010
- iconv extension
@@ -40,10 +40,8 @@ chmod 600 ~/.kimai2-console.json
4040

4141
That's it, you can use Kimai from the command line now.
4242

43-
By default the configuration file targets the demo installation and will work... but now its time to target your own Kimai, so
44-
edit the config file and change the settings: URL, username and API token.
45-
46-
The following config keys are available:
43+
By default, the configuration file targets the demo installation and will work...
44+
but now it's time to target your own Kimai, so please edit the config file and change the settings:
4745

4846
- `URL`: the Kimai installation URL
4947
- `USERNAME`: the Kimai installation URL
@@ -122,15 +120,7 @@ The following environment variables are supported:
122120

123121
### Updating the Console tools
124122

125-
The following commands will help you with updating the Console tools:
126-
127-
- `kimai self:check` - check if there is a new version available
128-
- `kimai self:update` - update your local version to the latest release
129-
- `kimai self:rollback` - rollback to a previous release
130-
131-
There are security concerns with this approach, if you are cautious stick to the initial installation process.
132-
133-
The `update` command will create a copy beside the original executable (if you wondered what `kimai-old.phar` is: now you know!), which is used by the `rollback` command.
123+
Redo the initial installation process and overwrite the file `/usr/local/bin/kimai` with the [latest release](https://github.com/kevinpapst/kimai2-console/releases).
134124

135125
### Check the contents of the PHAR
136126

@@ -159,6 +149,7 @@ box compile
159149
### Release on GitHub
160150

161151
- Bump version in `src/Constants.php`
152+
- Execute `composer install --no-dev`
162153
- Execute `box compile`
163154
- Execute `sha1sum kimai.phar > kimai.phar.sha1`
164155
- Prepare a new GitHub release

bin/kimai

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ if ($require) {
5656
unset($require);
5757
// -------------------------- AUTOLOAD --------------------------
5858

59+
error_reporting(E_ALL & ~E_DEPRECATED); // swagger generates php 5.5 code, which triggers deprecations on PHP 8
5960
set_time_limit(0);
6061

6162
use KimaiConsole\Application;

composer.json

+19-5
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,29 @@
22
"name": "kevinpapst/kimai2-console",
33
"license": "MIT",
44
"type": "project",
5-
"description": "Kimai 2 - console application to manage your time-tracking data remotely",
5+
"description": "Kimai - console application to manage your time-tracking data remotely",
66
"authors": [
77
{
88
"name": "Kevin Papst",
99
"homepage": "https://www.kevinpapst.de"
1010
}
1111
],
1212
"require": {
13-
"php": "^7.2.5",
13+
"php": "7.4.*||8.0.*||8.1.*",
1414
"ext-iconv": "*",
1515
"ext-json": "*",
1616
"guzzlehttp/guzzle": "^6.5",
17-
"padraic/phar-updater": "^1.0",
18-
"symfony/console": "5.0.*"
17+
"kimai/api-php": "^0.1.0",
18+
"symfony/console": "5.*"
19+
},
20+
"require-dev": {
21+
"friendsofphp/php-cs-fixer": "^3.2",
22+
"phpstan/phpstan": "^1.0"
1923
},
2024
"config": {
25+
"platform": {
26+
"php": "7.4"
27+
},
2128
"preferred-install": {
2229
"*": "dist"
2330
},
@@ -38,7 +45,14 @@
3845
"extra": {
3946
"symfony": {
4047
"allow-contrib": false,
41-
"require": "5.0.*"
48+
"require": "5.*"
4249
}
50+
},
51+
"scripts": {
52+
"phpstan": [
53+
"vendor/bin/phpstan analyse src -c phpstan.neon --level=5"
54+
],
55+
"codestyle": "vendor/bin/php-cs-fixer fix --dry-run --verbose --show-progress=none",
56+
"codestyle-fix": "vendor/bin/php-cs-fixer fix"
4357
}
4458
}

0 commit comments

Comments
 (0)