Skip to content

Commit

Permalink
Merge pull request #27 from Dropelikeit/cleanup/dependencies
Browse files Browse the repository at this point in the history
Removed support for laravel 8 and added support for laravel 10
  • Loading branch information
Dropelikeit committed Mar 27, 2023
2 parents f4d66a3 + 7766df7 commit 18d613d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 54 deletions.
47 changes: 6 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,6 @@ on:
push:

jobs:
php8:
name: PHP 8
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 2

- name: "Install PHP 8"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8"

- name: "Cache composer packages"
uses: "actions/cache@v3"
with:
path: "~/.composer/cache"
key: "php-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-composer-locked-"

- name: "Install dependencies with composer"
run: "composer install --no-interaction --prefer-dist"

- name: "Run PHPUnit Tests"
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer test
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/output/tests/coverage.xml --json_path=build/output/tests/coveralls-upload.json -v
- name: "Run PHP CS Check"
run: "composer cs-check"

- name: "Run PHPStan"
run: "composer analyze"

- name: "PHP Lint"
run: "composer lint"

php81:
name: PHP 8.1
runs-on: ubuntu-latest
Expand Down Expand Up @@ -84,6 +43,9 @@ jobs:
- name: "Run PHPStan"
run: "composer analyze"

- name: "Run Psalm"
run: "composer psalm"

- name: "PHP Lint"
run: "composer lint"

Expand Down Expand Up @@ -125,5 +87,8 @@ jobs:
- name: "Run PHPStan"
run: "composer analyze"

- name: "Run Psalm"
run: "composer psalm"

- name: "PHP Lint"
run: "composer lint"
25 changes: 15 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
}
],
"require": {
"php": "^8.0|^8.1",
"illuminate/http": "^8.0|^9.0",
"illuminate/support": "^8.0|^9.0",
"illuminate/contracts": "^8.0|^9.0",
"php": "^8.1",
"illuminate/http": "^9.0|^10.0",
"illuminate/support": "^9.0|^10.0",
"illuminate/contracts": "^9.0|^10.0",
"jms/serializer": "^3.18"
},
"autoload": {
Expand All @@ -37,13 +37,16 @@
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"friendsofphp/php-cs-fixer": "^2.16|^3.13",
"phpunit/phpunit": "^9.5",
"nunomaduro/larastan": "^1.0|^2.3",
"orchestra/testbench": "^6.0|^7.17",
"friendsofphp/php-cs-fixer": "^3.13",
"phpunit/phpunit": "^9.6",
"nunomaduro/larastan": "^2.3",
"orchestra/testbench": "^7.17",
"phpstan/phpstan-phpunit": "^1.3",
"php-parallel-lint/php-parallel-lint": "^1.3",
"symfony/cache": "^5.4|^6.2"
"symfony/cache": "^6.2",
"vimeo/psalm": "^5.8",
"psalm/plugin-laravel": "^2.8",
"psalm/plugin-phpunit": "^0.18.4"
},
"scripts": {
"lint": "parallel-lint --exclude .git --exclude vendor .",
Expand All @@ -52,12 +55,14 @@
"test": "phpunit",
"test-coverage": "phpunit --coverage-clover build/logs/clover.xml",
"analyze": "phpstan analyze --no-progress --memory-limit=-1 --xdebug",
"psalm": "psalm --no-cache -c psalm.xml",
"check": [
"@cs-check",
"@analyze",
"@test",
"@test-coverage",
"@lint"
"@lint",
"@psalm"
]
}
}
21 changes: 21 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>
</psalm>
4 changes: 3 additions & 1 deletion src/Contracts/ResponseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
interface ResponseBuilder
{
/**
* @psalm-param positive-int $code
* @phpstan-ignore-next-line
* @psalm-param Response::HTTP_* $code
*/
public function withStatusCode(int $code): void;

public function withContext(SerializationContext $context): void;

/**
* @param non-empty-string $serializeType
* @psalm-param Config::SERIALIZE_TYPE_* $serializeType
*/
public function withSerializeType(string $serializeType): self;
Expand Down
10 changes: 8 additions & 2 deletions src/Http/Responses/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ final class ResponseFactory implements Contracts\ResponseBuilder
private const SERIALIZER_INITIAL_TYPE_ARRAY = 'array';

/**
* @var positive-int
* @phpstan-ignore-next-line
* @psalm-var Response::HTTP_*
*/
private int $status;

Expand All @@ -48,7 +49,8 @@ public function __construct(private SerializerInterface $serializer, private Con
}

/**
* @psalm-param positive-int $code
* @phpstan-ignore-next-line
* @psalm-param Response::HTTP_* $code
*/
public function withStatusCode(int $code): void
{
Expand All @@ -60,12 +62,16 @@ public function withContext(SerializationContext $context): void
$this->context = $context;
}

/**
* @psalm-param Contracts\Config::SERIALIZE_TYPE_* $serializeType
*/
public function withSerializeType(string $serializeType): self
{
if (!in_array($serializeType, [
Contracts\Config::SERIALIZE_TYPE_JSON,
Contracts\Config::SERIALIZE_TYPE_XML
], true)) {
/** @psalm-suppress NoValue */
throw SerializeType::fromUnsupportedSerializeType($serializeType);
}

Expand Down

0 comments on commit 18d613d

Please sign in to comment.