reformat code

This commit is contained in:
Daniel Seifert 2025-01-05 15:20:56 +01:00
parent 19338d2a58
commit 3911584ea7
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
28 changed files with 87 additions and 37 deletions

View File

@ -19,7 +19,7 @@ EOF;
$config = new PhpCsFixer\Config();
return $config->setRules([
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,
'@PSR12' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',

View File

@ -42,7 +42,7 @@
"scripts": {
"test": "./vendor/bin/phpunit --no-coverage",
"check-style": "./vendor/bin/php-cs-fixer fix --verbose --dry-run",
"fix-style": "./vendor/bin/php-cs-fixer fix --verbose",
"fix-style": "./vendor/bin/php-cs-fixer fix --verbose --allow-risky=yes",
"check-code": "./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --ansi"
}
}

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use D3\KlicktippPhpClient\Exceptions\BaseException;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use D3\KlicktippPhpClient\Exceptions\BaseException;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use Doctrine\Common\Collections\ArrayCollection;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use D3\KlicktippPhpClient\Exceptions\BaseException;
@ -158,9 +160,7 @@ class Subscriber extends ArrayCollection
public function getFields(): ArrayCollection
{
return $this->filter(
function ($value, $key) {
return str_starts_with($key, 'field');
}
fn ($value, $key) => str_starts_with($key, 'field')
);
}

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use Doctrine\Common\Collections\ArrayCollection;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use D3\KlicktippPhpClient\Exceptions\BaseException;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use Doctrine\Common\Collections\ArrayCollection;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use D3\KlicktippPhpClient\Exceptions\BaseException;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Entities;
use Doctrine\Common\Collections\ArrayCollection;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Exceptions;
use Exception;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Exceptions;
class NoCredentialsException extends BaseException

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Entities\Account as AccountEntity;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Entities\Field as FieldEntity;
@ -63,7 +65,7 @@ class Field extends Model
*/
public function create(string $name): string
{
return current(
return (string) current(
$this->connection->requestAndParse(
'POST',
'field.json',

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Connection;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Entities\Subscriber as SubscriberEntity;
@ -111,7 +113,7 @@ class Subscriber extends Model
*/
public function search(string $mailAddress): string
{
return current(
return (string) current(
$this->connection->requestAndParse(
'POST',
'subscriber/search.json',
@ -328,9 +330,9 @@ class Subscriber extends Model
/**
* @throws BaseException
*/
public function signoff(string $apikey, string $emailAddress): string
public function signoff(string $apikey, string $emailAddress): bool
{
return current(
return (bool) current(
$this->connection->requestAndParse(
'POST',
'subscriber/signoff.json',

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Entities\Subscription as SubscriptionEntity;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Entities\Tag as TagEntity;
@ -64,7 +66,7 @@ class Tag extends Model
*/
public function create(string $name): string
{
return current(
return (string) current(
$this->connection->requestAndParse(
'POST',
'tag.json',

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\integration;
use D3\KlicktippPhpClient\Connection;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\integration\Resources;
use D3\KlicktippPhpClient\Entities\Account as AccountEntity;
@ -139,7 +141,7 @@ class AccountTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Account::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false): void
{
$sut = new Account($this->getConnectionMock($response));
@ -180,7 +182,7 @@ class AccountTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Account::update
* @dataProvider updateDataProvider
*/
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false)
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
{
$sut = new Account($this->getConnectionMock($response));

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\integration\Resources;
use D3\KlicktippPhpClient\Entities\Field as FieldEntity;
@ -37,7 +39,7 @@ class FieldTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Field::index
* @dataProvider indexDataProvider
*/
public function testIndex(ResponseInterface $response, ?FieldList $expected, bool $expectException = false)
public function testIndex(ResponseInterface $response, ?FieldList $expected, bool $expectException = false): void
{
$sut = new Field($this->getConnectionMock($response));
@ -102,7 +104,7 @@ class FieldTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Field::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false): void
{
$sut = new Field($this->getConnectionMock($response));
@ -139,7 +141,7 @@ class FieldTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Field::create
* @dataProvider createDataProvider
*/
public function testCreate(ResponseInterface $response, ?string $expected, bool $expectException = false)
public function testCreate(ResponseInterface $response, ?string $expected, bool $expectException = false): void
{
$sut = new Field($this->getConnectionMock($response));
@ -170,7 +172,7 @@ class FieldTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Field::update
* @dataProvider updateDataProvider
*/
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false)
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
{
$sut = new Field($this->getConnectionMock($response));
@ -201,7 +203,7 @@ class FieldTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Field::delete
* @dataProvider deleteDataProvider
*/
public function testDelete(ResponseInterface $response, ?bool $expected, bool $expectException = false)
public function testDelete(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
{
$sut = new Field($this->getConnectionMock($response));

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\integration\Resources;
use D3\KlicktippPhpClient\Entities\Subscriber as SubscriberEntity;
@ -54,7 +56,7 @@ class SubscriberTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Subscriber::index
* @dataProvider indexDataProvider
*/
public function testIndex(ResponseInterface $response, ?SubscriberList $expected, bool $expectException = false)
public function testIndex(ResponseInterface $response, ?SubscriberList $expected, bool $expectException = false): void
{
$sut = new Subscriber($this->getConnectionMock($response));
@ -96,7 +98,7 @@ class SubscriberTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Subscriber::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false): void
{
$sut = new Subscriber($this->getConnectionMock($response));

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\integration\Resources;
use D3\KlicktippPhpClient\Entities\Subscription;
@ -36,7 +38,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::index
* @dataProvider indexDataProvider
*/
public function testIndex(ResponseInterface $response, ?SubscriptionList $expected, bool $expectException = false)
public function testIndex(ResponseInterface $response, ?SubscriptionList $expected, bool $expectException = false): void
{
$sut = new SubscriptionProcess($this->getConnectionMock($response));
@ -73,7 +75,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false): void
{
$sut = new SubscriptionProcess($this->getConnectionMock($response));
@ -121,7 +123,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::create
* @dataProvider getDataProvider
*/
public function testCreate(ResponseInterface $response, ?array $expected, bool $expectException = false)
public function testCreate(ResponseInterface $response, ?array $expected, bool $expectException = false): void
{
$sut = new SubscriptionProcess($this->getConnectionMock($response));
@ -145,7 +147,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::update
* @dataProvider updateDataProvider
*/
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false)
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
{
$sut = new SubscriptionProcess($this->getConnectionMock($response));
@ -176,7 +178,7 @@ class SubscriptionProcessTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\SubscriptionProcess::redirect
* @dataProvider redirectDataProvider
*/
public function testRedirect(ResponseInterface $response, ?string $expected, bool $expectException = false)
public function testRedirect(ResponseInterface $response, ?string $expected, bool $expectException = false): void
{
$sut = new SubscriptionProcess($this->getConnectionMock($response));

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\integration\Resources;
use D3\KlicktippPhpClient\Entities\Tag as TagEntity;
@ -36,7 +38,7 @@ class TagTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Tag::index
* @dataProvider indexDataProvider
*/
public function testIndex(ResponseInterface $response, ?TagList $expected, bool $expectException = false)
public function testIndex(ResponseInterface $response, ?TagList $expected, bool $expectException = false): void
{
$sut = new Tag($this->getConnectionMock($response));
@ -73,7 +75,7 @@ class TagTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Tag::getEntity
* @dataProvider getDataProvider
*/
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false)
public function testGet(ResponseInterface $response, ?array $expected, bool $expectException = false): void
{
$sut = new Tag($this->getConnectionMock($response));
@ -112,7 +114,7 @@ class TagTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Tag::create
* @dataProvider createDataProvider
*/
public function testCreate(ResponseInterface $response, ?string $expected, bool $expectException = false)
public function testCreate(ResponseInterface $response, ?string $expected, bool $expectException = false): void
{
$sut = new Tag($this->getConnectionMock($response));
@ -143,7 +145,7 @@ class TagTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Tag::update
* @dataProvider updateDataProvider
*/
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false)
public function testUpdate(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
{
$sut = new Tag($this->getConnectionMock($response));
@ -174,7 +176,7 @@ class TagTest extends IntegrationTestCase
* @covers \D3\KlicktippPhpClient\Resources\Tag::delete
* @dataProvider deleteDataProvider
*/
public function testDelete(ResponseInterface $response, ?bool $expected, bool $expectException = false)
public function testDelete(ResponseInterface $response, ?bool $expected, bool $expectException = false): void
{
$sut = new Tag($this->getConnectionMock($response));

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\unit\Entities;
use D3\KlicktippPhpClient\Entities\Account;

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\unit\Entities;
use D3\KlicktippPhpClient\Entities\Field;
@ -73,7 +75,7 @@ class FieldTest extends TestCase
* @covers \D3\KlicktippPhpClient\Entities\Field::getName
* @dataProvider getSomethingDataProvider
*/
public function testGetSomething(string $methodName, string $expectedValue)
public function testGetSomething(string $methodName, string $expectedValue): void
{
$this->assertSame(
$expectedValue,

View File

@ -13,6 +13,8 @@
* @link https://www.oxidmodule.com
*/
declare(strict_types=1);
namespace D3\KlicktippPhpClient\tests\unit\Entities;
use D3\KlicktippPhpClient\Entities\Subscriber;
@ -169,7 +171,7 @@ class SubscriberTest extends TestCase
* @covers \D3\KlicktippPhpClient\Entities\Subscriber::getSmsReferrer
* @dataProvider getSomethingDataProvider
*/
public function testGetSomething(string $methodName, string $expectedValue)
public function testGetSomething(string $methodName, string $expectedValue): void
{
$this->assertSame(
$expectedValue,
@ -371,7 +373,7 @@ class SubscriberTest extends TestCase
* @throws ReflectionException
* @covers \D3\KlicktippPhpClient\Entities\Subscriber::getFields
*/
public function testGetFields()
public function testGetFields(): void
{
$fields = $this->callMethod(
$this->entity,
@ -466,7 +468,7 @@ class SubscriberTest extends TestCase
* @covers \D3\KlicktippPhpClient\Entities\Subscriber::getOutbounds
* @dataProvider getTagsDataProvider
*/
public function testGetTags(string $methodName, int $expectedCount)
public function testGetTags(string $methodName, int $expectedCount): void
{
$tags = $this->callMethod(
$this->entity,
@ -497,7 +499,7 @@ class SubscriberTest extends TestCase
* @covers \D3\KlicktippPhpClient\Entities\Subscriber::isTagSet
* @dataProvider isTagSetDataProvider
*/
public function testIsTagSet(string $searchTagId, bool $expected)
public function testIsTagSet(string $searchTagId, bool $expected): void
{
$tagList = new ArrayCollection([
"12494453",
@ -628,7 +630,7 @@ class SubscriberTest extends TestCase
?array $newTagList,
InvokedCount $removeTagInvocation,
InvokedCount $setTagInvocation
) {
): void {
$entityMock = $this->getMockBuilder(Subscriber::class)
->disableOriginalConstructor()
->onlyMethods(['getTags'])
@ -671,7 +673,7 @@ class SubscriberTest extends TestCase
* @covers \D3\KlicktippPhpClient\Entities\Subscriber::isManualTagSet
* @dataProvider isManualTagSetDataProvider
*/
public function testIsManualTagSet(string $searchTagId, bool $expected)
public function testIsManualTagSet(string $searchTagId, bool $expected): void
{
$this->assertSame(
$expected,
@ -698,7 +700,7 @@ class SubscriberTest extends TestCase
* @covers \D3\KlicktippPhpClient\Entities\Subscriber::getFinishedCampaignTime
* @dataProvider getTagDataProvider
*/
public function testGetTag(string $testMethodName, string $invokedMethodName)
public function testGetTag(string $testMethodName, string $invokedMethodName): void
{
$fixtureDate = '2024-12-24 18:00:00';
$fixture = new DateTime($fixtureDate);