Skip to content

Commit

Permalink
beautify git workflow, use proper parameter and return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Mitterhauser committed Apr 4, 2024
1 parent 8d08587 commit da35176
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
47 changes: 26 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,43 @@ on:
jobs:
# Composer config validation
composer:
name: Composer config validation
runs-on: ubuntu-latest
name: "Composer config validation"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: Validate composer.json
run: composer validate --strict
- uses: "actions/checkout@v3"
- name: "Validate composer.json"
run: "composer validate --strict"

# PHP syntax validation
php:
name: PHP syntax validation
runs-on: ubuntu-latest
name: "PHP syntax validation"
runs-on: "ubuntu-latest"
strategy:
matrix:
php_version: [ 8.0, 8.1, 8.2, 8.3 ]
steps:
- uses: actions/checkout@v3
- name: Check PHP syntax of config/phinx.php
run: php -l src/
- uses: "actions/checkout@v3"
- uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php_version }}"
- name: "Check PHP syntax of package"
run: "php -l src/"

# phpstan for several php versions
phpstan:
runs-on: ubuntu-latest
runs-on: "ubuntu-latest"
strategy:
matrix:
php_version: [8.1, 8.2, 8.3]
php_version: [8.0, 8.1, 8.2, 8.3]
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- uses: "actions/checkout@v3"
- uses: "php-actions/composer@v6"
with:
php_version: ${{ matrix.php_version }}
php_extensions: redis intl
php_version: "${{ matrix.php_version }}"
php_extensions: "redis intl"

- name: PHPStan Static Analysis
uses: php-actions/phpstan@v3
- name: "PHPStan Static Analysis"
uses: "php-actions/phpstan@v3"
with:
php_version: ${{ matrix.php_version }}
configuration: phpstan.neon
path: src/
php_version: "${{ matrix.php_version }}"
configuration: "phpstan.neon"
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
parameters:
level: 9
treatPhpDocTypesAsCertain: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
-
message: '#Call to an undefined method Predis\\Client::[a-zA-Z0-9\\_]+\(\)#'
Expand Down
6 changes: 3 additions & 3 deletions src/Cache/Engine/PredisEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class PredisEngine extends CacheEngine
* @param array<string, mixed> $config array of setting for the engine
* @return bool True if the engine has been successfully initialized, false if not
*/
public function init($config = array()): bool
public function init(array $config = []): bool
{
if (!class_exists('\Predis\Client')) {
return false;
Expand Down Expand Up @@ -302,7 +302,7 @@ public function deleteAsync(string $key): bool
* @param bool $check
* @return bool
*/
public function clear($check = false): bool
public function clear(bool $check = false): bool
{
if ($check) {
return true;
Expand Down Expand Up @@ -337,7 +337,7 @@ public function clearBlocking(): bool
while (true) {
$keys = $this->_Redis->scan($iterator, $pattern);

if ($keys === false) {
if (empty($keys)) {
break;
}

Expand Down

0 comments on commit da35176

Please sign in to comment.