Skip to content

Commit

Permalink
Consistent generation & github workflow (#9)
Browse files Browse the repository at this point in the history
* Make the client generation consistent
* Add github workflow
  • Loading branch information
janvernieuwe authored Sep 21, 2022
1 parent 1bcbe3f commit c81be51
Show file tree
Hide file tree
Showing 259 changed files with 87 additions and 1,268 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/grumphp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: GrumPHP

on: [push, pull_request]
permissions:
contents: read

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0', '8.1']
composer-options: ['']
composer-versions: ['composer:v2']
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} with ${{ matrix.composer-versions }} ${{ matrix.composer-options }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Install PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
tools: ${{ matrix.composer-versions }}
extensions: xdebug, mbstring, posix
- name: Check Versions
run: |
php -v
php -m
composer --version
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
# - name: Install dependencies (Ignore platform)
# if: matrix.php-versions == '8.1'
# run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} --ignore-platform-req=php
- name: Set git variables
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
- name: Run the tests on unix
if: runner.os != 'Windows'
run: php vendor/bin/grumphp run --no-interaction
continue-on-error: ${{ matrix.composer-options == '--prefer-lowest' }}
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,18 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpro/grumphp": true
}
},
"scripts": {
"update-jikan": [
"rm -rf src/*",
"php vendor/bin/jane-openapi generate --config-file=config/jikan.php",
"php vendor/bin/php-cs-fixer -q --allow-risky=yes --config=.php-cs-fixer.dist.php fix",
"php vendor/bin/rector --no-diffs",
"php vendor/bin/php-cs-fixer -q --allow-risky=yes --config=.php-cs-fixer.dist.php fix",
"php vendor/bin/php-cs-fixer -q --allow-risky=yes --config=config/.php-cs-fixer.dist.php fix",
"php vendor/bin/rector --no-diffs --clear-cache --config=config/rector.php",
"php vendor/bin/php-cs-fixer -q --allow-risky=yes --config=config/.php-cs-fixer.dist.php fix",
"php vendor/bin/grumphp run"
]
}
Expand Down
6 changes: 3 additions & 3 deletions .php-cs-fixer.dist.php → config/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
->setFinder(
(new PhpCsFixer\Finder())
->in([
getcwd().'/src',
getcwd().'/tests',
getcwd() . '/src',
getcwd() . '/tests',
])
->exclude([
'var',
Expand Down Expand Up @@ -50,7 +50,7 @@
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => false,
'no_superfluous_phpdoc_tags' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
Expand Down
File renamed without changes.
15 changes: 8 additions & 7 deletions rector.php → config/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector;
use Rector\CodeQuality\Rector\New_\NewStaticToNewSelfRector;
use Rector\CodingStyle\Rector\Property\InlineSimplePropertyAnnotationRector;
use Rector\Compatibility\Rector\Class_\AttributeCompatibleAnnotationRector;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\FunctionLike\UnionTypesRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictNativeCallRector;
use Rector\TypeDeclaration\Rector\FunctionLike\ReturnTypeDeclarationRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/../src',
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
SetList::PHP_70,
SetList::PHP_71,
SetList::PHP_72,
SetList::PHP_73,
SetList::PHP_74,
SetList::PHP_80,
SetList::PHP_81,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::NAMING,
Expand Down
4 changes: 2 additions & 2 deletions grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ grumphp:
phpunit: ~
phpstan:
level: 1
configuration: "phpstan.neon"
configuration: "config/phpstan.neon"
ignore_patterns:
- src/Runtime/Client/BaseEndpoint.php
metadata:
priority: 200
phpcsfixer2:
allow_risky: true
cache_file: ~
config: ".php-cs-fixer.dist.php"
config: "config/.php-cs-fixer.dist.php"
using_cache: ~
config_contains_finder: true
verbose: true
Expand Down
28 changes: 6 additions & 22 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ public function getAnimeStaff(int $id, string $fetch = self::FETCH_OBJECT)
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -372,7 +371,6 @@ public function getAnimeEpisodeById(int $id, int $episode, string $fetch = self:
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -419,7 +417,6 @@ public function getAnimeVideos(int $id, string $fetch = self::FETCH_OBJECT)
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -485,7 +482,6 @@ public function getAnimeRecommendations(int $id, string $fetch = self::FETCH_OBJ
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand All @@ -503,7 +499,6 @@ public function getAnimeUserUpdates(int $id, array $queryParameters = [], string
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -651,7 +646,6 @@ public function getClubsById(int $id, string $fetch = self::FETCH_OBJECT)
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -785,7 +779,6 @@ public function getMangaCharacters(int $id, string $fetch = self::FETCH_OBJECT)
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -868,7 +861,6 @@ public function getMangaRecommendations(int $id, string $fetch = self::FETCH_OBJ
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand All @@ -886,7 +878,6 @@ public function getMangaUserUpdates(int $id, array $queryParameters = [], string
}

/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down Expand Up @@ -1377,9 +1368,7 @@ public function getProducers(array $queryParameters = [], string $fetch = self::
}

/**
* @param int $year
* @param string $season
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var int $page
* }
Expand Down Expand Up @@ -1607,8 +1596,7 @@ public function getUserAbout(string $username, string $fetch = self::FETCH_OBJEC
}

/**
* @param string $username
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var string $type
* }
Expand All @@ -1625,8 +1613,7 @@ public function getUserHistory(string $username, array $queryParameters = [], st
}

/**
* @param string $username
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var int $page
* }
Expand Down Expand Up @@ -1671,8 +1658,7 @@ public function getUserMangaList(string $username, string $fetch = self::FETCH_O
}

/**
* @param string $username
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var int $page
* }
Expand All @@ -1689,8 +1675,7 @@ public function getUserReviews(string $username, array $queryParameters = [], st
}

/**
* @param string $username
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var int $page
* }
Expand All @@ -1707,8 +1692,7 @@ public function getUserRecommendations(string $username, array $queryParameters
}

/**
* @param string $username
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var int $page
* }
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetAnimeEpisodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetAnimeEpisodes extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetAnimeNews.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetAnimeNews extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetAnimeReviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetAnimeReviews extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetAnimeUserUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetAnimeUserUpdates extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetAnimeVideosEpisodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetAnimeVideosEpisodes extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetClubMembers.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetClubMembers extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetMangaNews.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetMangaNews extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetMangaReviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetMangaReviews extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
1 change: 0 additions & 1 deletion src/Endpoint/GetMangaUserUpdates.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
class GetMangaUserUpdates extends BaseEndpoint implements Endpoint
{
/**
* @param int $id
* @param array $queryParameters {
*
* @var int $page
Expand Down
4 changes: 1 addition & 3 deletions src/Endpoint/GetSeason.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
class GetSeason extends BaseEndpoint implements Endpoint
{
/**
* @param int $year
* @param string $season
* @param array $queryParameters {
* @param array $queryParameters {
*
* @var int $page
* }
Expand Down
Loading

0 comments on commit c81be51

Please sign in to comment.