Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ indent_style = tab
indent_size = tab
tab_width = 4

[{*.json, *.yaml, *.yml, *.md}]
[*.{json,yaml,yml,md}]
indent_style = space
indent_size = 2
6 changes: 2 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Not archived
.docs export-ignore
tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
Makefile export-ignore
phpstan.neon export-ignore
README.md export-ignore
ruleset.xml export-ignore
tests export-ignore
10 changes: 0 additions & 10 deletions .github/.kodiak.toml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches: ["*"]

schedule:
- cron: "0 8 * * 1"
- cron: "0 9 * * 1"

jobs:
coverage:
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/phpstan.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Codesniffer"
name: "QA"

on:
pull_request:
Expand All @@ -11,6 +11,12 @@ on:
- cron: "0 8 * * 1"

jobs:
phpstan:
name: "PHPStan"
uses: contributte/.github/.github/workflows/phpstan.yml@master
with:
php: "8.2"

codesniffer:
name: "Codesniffer"
uses: contributte/.github/.github/workflows/codesniffer.yml@master
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,9 @@ jobs:
with:
php: "8.2"

test81:
name: "Nette Tester"
uses: contributte/.github/.github/workflows/nette-tester.yml@master
with:
php: "8.1"

testlower:
name: "Nette Tester"
uses: contributte/.github/.github/workflows/nette-tester.yml@master
with:
php: "8.1"
php: "8.2"
composer: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest"
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
/composer.lock

# Tests
/temp
/coverage.xml
/tests/tmp
/tests/**/*.log
/tests/**/*.html
/tests/**/*.expected
/tests/**/*.actual
/coverage.*
55 changes: 31 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
.PHONY: qa lint cs csf phpstan tests coverage

all:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs

vendor: composer.json composer.lock
composer install

qa: lint phpstan cs

lint: vendor
vendor/bin/linter src tests

cs: vendor
vendor/bin/codesniffer src tests

csf: vendor
vendor/bin/codefixer src tests

phpstan: vendor
vendor/bin/phpstan analyse -l 8 -c phpstan.neon src

tests: vendor
.PHONY: install
install:
composer update

.PHONY: qa
qa: phpstan cs

.PHONY: cs
cs:
ifdef GITHUB_ACTION
vendor/bin/phpcs --standard=ruleset.xml --extensions="php,phpt" --encoding=utf-8 --report=checkstyle -q src tests | cs2pr
else
vendor/bin/phpcs --standard=ruleset.xml --extensions="php,phpt" --encoding=utf-8 --colors -nsp src tests
endif

.PHONY: csf
csf:
vendor/bin/phpcbf --standard=ruleset.xml --extensions="php,phpt" --encoding=utf-8 --colors -nsp src tests

.PHONY: phpstan
phpstan:
vendor/bin/phpstan analyse -c phpstan.neon

.PHONY: tests
tests:
vendor/bin/tester -s -p php --colors 1 -C tests/cases

coverage: vendor
.PHONY: coverage
coverage:
ifdef GITHUB_ACTION
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases
else
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.html --coverage-src ./src tests/cases
endif
21 changes: 12 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,25 @@
}
],
"require": {
"php": ">= 8.1"
"php": ">=8.2"
},
"require-dev": {
"ninjify/qa": "^0.12",
"ninjify/nunjuck": "^0.3",
"nette/di": "^3.0.0",
"mockery/mockery": "^1.2.0",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-nette": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0"
"contributte/qa": "~0.4.0",
"contributte/phpstan": "~0.2.0",
"contributte/tester": "~0.3.0",
"nette/di": "^3.2.0",
"mockery/mockery": "^1.6.0"
},
"autoload": {
"psr-4": {
"Contributte\\Fio\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
Expand All @@ -46,6 +48,7 @@
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
Expand Down
39 changes: 33 additions & 6 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
includes:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/contributte/phpstan/phpstan.neon

parameters:
level: 9
phpVersion: 80200

scanDirectories:
- src

fileExtensions:
- php

paths:
- src

ignoreErrors:
# curl_exec returns result thanks to option CURLOPT_RETURNTRANSFER - wtf is that api?
- '#^Method Contributte\\Fio\\Http\\HttpClient\:\:sendRequest\(\) should return string but returns string\|true\.$#'

# Probably bug, LibXMLError does not use Throwable
- '#^Parameter \#3 \$previous of class Contributte\\Fio\\Exceptions\\InvalidResponseException constructor expects Throwable\|null, LibXMLError given\.$#'

- '#Property Contributte\\Fio\\(.*)::\$(.*) \(float\) in isset\(\) is not nullable\.#'
- '#Property Contributte\\Fio\\(.*)::\$(.*) \(string\) in isset\(\) is not nullable\.#'
# HttpClient curl_setopt type issues
- '#^Parameter \#3 \$value of function curl_setopt expects non-empty-string, string given\.$#'
- '#^Parameter \#3 \$value of function curl_setopt expects non-empty-string\|null, string given\.$#'
- '#^Parameter \#3 \$value of function curl_setopt expects bool, int given\.$#'
- '#^Offset .uri. might not exist on array\{#'
- '#^Parameter \#1 \$message of class Contributte\\Fio\\Exceptions\\IOException constructor expects string, string\|null given\.$#'

# SimpleXMLElement property access
- '#^Access to an undefined property iterable<SimpleXMLElement>&Traversable::\$#'

# ExportXmlGenerator mixed type issues
-
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
path: src/Utils/ExportXmlGenerator.php
-
message: '#^Parameter \#1 \$qualifiedName of method SimpleXMLElement::addChild\(\) expects string, mixed given\.$#'
path: src/Utils/ExportXmlGenerator.php
-
message: '#^Cannot cast mixed to string\.$#'
path: src/Utils/ExportXmlGenerator.php
26 changes: 13 additions & 13 deletions ruleset.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0"?>
<ruleset name="Contributte">
<!-- Contributte Coding Standard -->
<rule ref="./vendor/ninjify/coding-standard/contributte.xml"/>
<!-- Contributte Coding Standard -->
<rule ref="./vendor/contributte/qa/ruleset-8.2.xml"/>

<!-- Specific rules -->
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array" value="
src=>Contributte\Fio,
tests/fixtures=>Tests\Fixtures
"/>
</properties>
</rule>
<!-- Specific rules -->
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
<properties>
<property name="rootNamespaces" type="array">
<element key="src" value="Contributte\Fio"/>
<element key="tests" value="Tests"/>
</property>
</properties>
</rule>

<!-- Exclude folders -->
<exclude-pattern>/tests/tmp</exclude-pattern>
<!-- Exclude folders -->
<exclude-pattern>/tests/tmp</exclude-pattern>
</ruleset>
2 changes: 1 addition & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Config
{

/** @var Account[] */
private $accounts;
private array $accounts;

public function addAccount(string $name, Account $account): void
{
Expand Down
6 changes: 2 additions & 4 deletions src/Entity/Account/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
class Account
{

/** @var string */
private $token;
private string $token;

/** @var string */
private $accountNum;
private string $accountNum;

public function __construct(string $token, string $accountNum)
{
Expand Down
27 changes: 11 additions & 16 deletions src/Entity/Transaction/DomesticTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,31 @@ final class DomesticTransaction extends Transaction

// Standardní
public const PAYMENT_TYPE_STANDARD = 431001;

// Zrychlená
public const PAYMENT_TYPE_FASTER = 431004;

// Prioritní
public const PAYMENT_TYPE_PRIORITY = 431005;

// Příkaz k inkasu
public const PAYMENT_TYPE_COLLECTION = 431022;

/** @var int */
private $paymentType;
private int $paymentType;

/** @var string */
private $bankCode;
private string $bankCode;

/** @var string */
private $ks;
private string $ks;

/** @var string */
private $vs;
private string $vs;

/** @var string */
private $ss;
private string $ss;

/** @var string */
private $messageForRecipient;
private string $messageForRecipient;

/** @var string */
private $comment;
private string $comment;

/** @var int */
private $paymentReason;
private int $paymentReason;

public function setPaymentType(int $paymentType): void
{
Expand Down
Loading