Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Psalm

on:
push:
paths:
- '**.php'
- 'psalm.xml.dist'

jobs:
psalm:
name: psalm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: json
coverage: none

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}

- name: Run composer install
run: composer install -n --prefer-dist

- name: Run psalm
run: ./vendor/bin/psalm --output-format=github
38 changes: 38 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: run-tests

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
timeout-minutes: 15
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: ["7.4", "8.0", "8.1"]
dependency-version: ["prefer-lowest", "prefer-stable"]
os: ["ubuntu-latest", "windows-latest"]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json
coverage: none

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: vendor/bin/phpunit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
vendor
.phpunit.result.cache
.phpunit.cache
composer.lock
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"type": "library",
"keywords": [],
"require": {
"php": ">=7.4",
"php": "^7.4 || ^8.0",
"ext-json": "*",
"psr/http-factory": "^1.0",
"psr/http-client": "^1.0",
"guzzlehttp/guzzle": "^6.0 || ^7.0"
"guzzlehttp/guzzle": "^6.5.2 || ^7.0",
"guzzlehttp/psr7": "^1.7.0"
},
"require-dev": {
"http-interop/http-factory-guzzle": "^1.0",
Expand Down
24 changes: 24 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
verbose="true"
colors="true"
>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
File renamed without changes.
4 changes: 2 additions & 2 deletions src/Offers/OffersListDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OffersListDto extends BaseOfferDto
protected int $noticePercentOvercap;
protected float $cr;
protected float $epc;
protected ?string $notes;
protected string $notes;
protected string $allowedIp;
protected string $disallowedIp;
protected string $hashPassword;
Expand Down Expand Up @@ -86,7 +86,7 @@ public function __construct(array $attributes)
$this->noticePercentOvercap = $attributes['notice_percent_overcap'];
$this->cr = $attributes['cr'];
$this->epc = $attributes['epc'];
$this->notes = $attributes['notes'];
$this->notes = $attributes['notes'] ?? '';
$this->allowedIp = $attributes['allowed_ip'];
$this->disallowedIp = $attributes['disallowed_ip'];
$this->hashPassword = $attributes['hash_password'];
Expand Down