From 09d4f298cbb364b16ccb3ad1a0a478af29d6f94f Mon Sep 17 00:00:00 2001 From: jorisvanandel Date: Tue, 22 Jul 2025 11:47:00 +0200 Subject: [PATCH] chore: upgrade phpstan, rector to 2.0 and bump other dependencies --- composer.json | 12 ++++++------ phpstan.neon.dist | 5 ++++- rector.php | 8 -------- src/DataTransferObjects/Contact.php | 3 +++ src/DataTransferObjects/CustomField.php | 3 +++ src/Requests/Contacts/ContactCustomFieldsRequest.php | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 1293734..3883b89 100644 --- a/composer.json +++ b/composer.json @@ -18,18 +18,18 @@ "require": { "php": "^8.1", "saloonphp/saloon": "^3.7", - "thecodingmachine/safe": "^2.5" + "thecodingmachine/safe": "^3.0" }, "require-dev": { "ergebnis/composer-normalize": "^2.42", "laravel/pint": "^1.14", "pestphp/pest": "^2.34", "phpstan/extension-installer": "^1.3", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-deprecation-rules": "^1.1", - "rector/rector": "^1.0", - "spaze/phpstan-disallowed-calls": "^3.1", - "thecodingmachine/phpstan-safe-rule": "^1.2" + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0", + "rector/rector": "^2.0", + "spaze/phpstan-disallowed-calls": "^4.0", + "thecodingmachine/phpstan-safe-rule": "^1.3.1" }, "autoload": { "psr-4": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 028e8b5..60aaf47 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -6,8 +6,11 @@ includes: parameters: checkBenevolentUnionTypes: true - checkMissingIterableValueType: false level: max + ignoreErrors: + - + identifier: missingType.iterableValue + paths: - src diff --git a/rector.php b/rector.php index dd1d693..d179038 100644 --- a/rector.php +++ b/rector.php @@ -2,11 +2,8 @@ declare(strict_types=1); -use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector; -use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector; -use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector; return RectorConfig::configure() ->withPaths([ @@ -20,11 +17,6 @@ typeDeclarations: true, earlyReturn: true ) - ->withRules([ - AddVoidReturnTypeWhereNoReturnRector::class, - InlineConstructorDefaultToPropertyRector::class, - ]) ->withSkip([ - CallableThisArrayToAnonymousFunctionRector::class, ClosureToArrowFunctionRector::class, ]); diff --git a/src/DataTransferObjects/Contact.php b/src/DataTransferObjects/Contact.php index 71a04e7..6ceda53 100644 --- a/src/DataTransferObjects/Contact.php +++ b/src/DataTransferObjects/Contact.php @@ -6,6 +6,9 @@ class Contact { + /** + * @var list + */ public const DEFAULT_PROPERTIES = [ 'email', 'firstName', diff --git a/src/DataTransferObjects/CustomField.php b/src/DataTransferObjects/CustomField.php index 34e827d..d926124 100644 --- a/src/DataTransferObjects/CustomField.php +++ b/src/DataTransferObjects/CustomField.php @@ -16,6 +16,9 @@ public function __construct( ) { } + /** + * @param array{key: string, label: string, type: 'boolean'|'date'|'number'|'string'} $attributes + */ public static function from(array $attributes): CustomField { return new CustomField( diff --git a/src/Requests/Contacts/ContactCustomFieldsRequest.php b/src/Requests/Contacts/ContactCustomFieldsRequest.php index 503f247..b1ed86d 100644 --- a/src/Requests/Contacts/ContactCustomFieldsRequest.php +++ b/src/Requests/Contacts/ContactCustomFieldsRequest.php @@ -15,7 +15,7 @@ class ContactCustomFieldsRequest extends Request public function createDtoFromResponse(Response $response): array { - /** @var array $data */ + /** @var array $data */ $data = $response->json(); return array_map(fn (array $customField): CustomField => CustomField::from($customField), $data);