From 3990a8abdfccbe627606a36d2f96c750737145a9 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:16:22 +0330 Subject: [PATCH 01/19] chore: update rector and other task --- composer.json | 2 +- phpstan-baseline.php | 40 ++++++++++----------- src/Traits/ObfuscatesSensitiveDataTrait.php | 2 +- tests/Drivers/AmootsmsDriverTest.php | 5 ++- tests/Drivers/FarazsmsDriverTest.php | 5 ++- tests/Drivers/IdehpardazanDriverTest.php | 5 ++- tests/Responses/SMSMultiResponseTest.php | 2 +- tests/SMSRocketServiceTest.php | 22 +++++------- tests/_support/DatabaseTestCase.php | 2 +- 9 files changed, 39 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index 4b97be5..1c9c311 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "codeigniter4/framework": "^4.2.7", "mikey179/vfsstream": "^1.6.7", "mockery/mockery": "^1.0", - "rector/rector": "1.2.8" + "rector/rector": "^2.0" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/phpstan-baseline.php b/phpstan-baseline.php index cf60819..620194b 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -2,26 +2,26 @@ $ignoreErrors = []; -$ignoreErrors[] = [ - 'message' => '#^Access to an undefined property hasProperty\\(Status\\)\\:\\:\\$Data\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/src/Drivers/AmootsmsDriver.php', -]; +// $ignoreErrors[] = [ +// 'message' => '#^Access to an undefined property hasProperty\\(Status\\)\\:\\:\\$Data\\.$#', +// 'count' => 3, +// 'path' => __DIR__ . '/src/Drivers/AmootsmsDriver.php', +// ]; -$ignoreErrors[] = [ - 'message' => '#^Access to an undefined property hasProperty\\(status\\)\\:\\:\\$data\\.$#', - 'count' => 3, - 'path' => __DIR__ . '/src/Drivers/IdehpardazanDriver.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Access to an undefined property hasProperty\\(status\\)\\:\\:\\$data\\.$#', - 'count' => 2, - 'path' => __DIR__ . '/src/Drivers/FarazsmsDriver.php', -]; -$ignoreErrors[] = [ - 'message' => '#Access to an undefined property hasProperty\(sid\)::\$status.#', - 'count' => 1, - 'path' => __DIR__ . '/src/Drivers/TwilioDriver.php', -]; +// $ignoreErrors[] = [ +// 'message' => '#^Access to an undefined property hasProperty\\(status\\)\\:\\:\\$data\\.$#', +// 'count' => 3, +// 'path' => __DIR__ . '/src/Drivers/IdehpardazanDriver.php', +// ]; +// $ignoreErrors[] = [ +// 'message' => '#^Access to an undefined property hasProperty\\(status\\)\\:\\:\\$data\\.$#', +// 'count' => 2, +// 'path' => __DIR__ . '/src/Drivers/FarazsmsDriver.php', +// ]; +// $ignoreErrors[] = [ +// 'message' => '#Access to an undefined property hasProperty\(sid\)::\$status.#', +// 'count' => 1, +// 'path' => __DIR__ . '/src/Drivers/TwilioDriver.php', +// ]; return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; diff --git a/src/Traits/ObfuscatesSensitiveDataTrait.php b/src/Traits/ObfuscatesSensitiveDataTrait.php index dbf67b7..2cf721a 100644 --- a/src/Traits/ObfuscatesSensitiveDataTrait.php +++ b/src/Traits/ObfuscatesSensitiveDataTrait.php @@ -38,7 +38,7 @@ public function hideSensitive(string $message, ?array $customPatterns = null): s // Iterate through each pattern and replace sensitive data with a masked version foreach ($patterns as $pattern => $replacement) { - $message = preg_replace($pattern, $replacement, (string) $message); + $message = preg_replace($pattern, (string) $replacement, (string) $message); } return $message; diff --git a/tests/Drivers/AmootsmsDriverTest.php b/tests/Drivers/AmootsmsDriverTest.php index 8f35e01..8eec045 100644 --- a/tests/Drivers/AmootsmsDriverTest.php +++ b/tests/Drivers/AmootsmsDriverTest.php @@ -28,20 +28,19 @@ final class AmootsmsDriverTest extends TestCase { private AmootsmsDriver $driver; - private MockObject $mockModel; private MockObject $mockClient; protected function setUp(): void { parent::setUp(); - $this->mockModel = $this->createMock(SMSLogModel::class); + $mockModel = $this->createMock(SMSLogModel::class); $this->mockClient = $this->createMock(CURLRequest::class); $config = [ 'token' => 'test-token', ]; - $this->driver = new AmootsmsDriver($config, $this->mockModel, $this->mockClient); + $this->driver = new AmootsmsDriver($config, $mockModel, $this->mockClient); } public function testSendSuccess(): void diff --git a/tests/Drivers/FarazsmsDriverTest.php b/tests/Drivers/FarazsmsDriverTest.php index 9a1d849..7050829 100644 --- a/tests/Drivers/FarazsmsDriverTest.php +++ b/tests/Drivers/FarazsmsDriverTest.php @@ -28,15 +28,14 @@ final class FarazsmsDriverTest extends TestCase { private FarazsmsDriver $driver; private MockObject $client; - private MockObject $model; protected function setUp(): void { $this->client = $this->createMock(CURLRequest::class); - $this->model = $this->createMock(SMSLogModel::class); + $model = $this->createMock(SMSLogModel::class); $config = ['api_key' => 'test_api_key']; - $this->driver = new FarazsmsDriver($config, $this->model, $this->client); + $this->driver = new FarazsmsDriver($config, $model, $this->client); } public function testSendSuccess(): void diff --git a/tests/Drivers/IdehpardazanDriverTest.php b/tests/Drivers/IdehpardazanDriverTest.php index d7b5022..edc5934 100644 --- a/tests/Drivers/IdehpardazanDriverTest.php +++ b/tests/Drivers/IdehpardazanDriverTest.php @@ -28,7 +28,6 @@ final class IdehpardazanDriverTest extends CIUnitTestCase { private IdehpardazanDriver $driver; private MockObject $client; - private MockObject $model; protected function setUp(): void { @@ -36,10 +35,10 @@ protected function setUp(): void // Mocking the CURLRequest and SMSLogModel $this->client = $this->createMock(CURLRequest::class); - $this->model = $this->createMock(SMSLogModel::class); + $model = $this->createMock(SMSLogModel::class); // Initialize IdehpardazanDriver with mocked dependencies - $this->driver = new IdehpardazanDriver(['api_key' => 'test-api-key'], $this->model, $this->client); + $this->driver = new IdehpardazanDriver(['api_key' => 'test-api-key'], $model, $this->client); } public function testSend(): void diff --git a/tests/Responses/SMSMultiResponseTest.php b/tests/Responses/SMSMultiResponseTest.php index f59342f..d0e2224 100644 --- a/tests/Responses/SMSMultiResponseTest.php +++ b/tests/Responses/SMSMultiResponseTest.php @@ -46,7 +46,7 @@ public function testGetResponseNotFound(): void { $multiResponse = new SMSMultiResponse(); - $this->assertNull($multiResponse->getResponse('non_existent_recipient')); + $this->assertNotInstanceOf(SMSResponse::class, $multiResponse->getResponse('non_existent_recipient')); } /** diff --git a/tests/SMSRocketServiceTest.php b/tests/SMSRocketServiceTest.php index c4fbbc3..b54a2fa 100644 --- a/tests/SMSRocketServiceTest.php +++ b/tests/SMSRocketServiceTest.php @@ -36,22 +36,18 @@ final class SMSRocketServiceTest extends TestCase { private SMSRocketService $service; private SMSDriverInterface $driver; - private CacheInterface $cache; private MockObject $logger; - private CURLRequest $client; - private SMSRocketConfig $config; - private SMSLogModel $model; protected function setUp(): void { - $this->cache = $this->createMock(CacheInterface::class); - $this->config = new SMSRocketConfig(); - $this->model = $this->createMock(SMSLogModel::class); + $cache = $this->createMock(CacheInterface::class); + $config = new SMSRocketConfig(); + $model = $this->createMock(SMSLogModel::class); $this->logger = $this->createMock(Logger::class); - $this->client = $this->createMock(CURLRequest::class); + $client = $this->createMock(CURLRequest::class); - $this->config->defaultDriver = 'testDriver'; - $this->config->drivers = [ + $config->defaultDriver = 'testDriver'; + $config->drivers = [ 'testDriver' => [ 'class' => $this->createMock(SMSDriverInterface::class)::class, 'config' => [ @@ -59,10 +55,10 @@ protected function setUp(): void ], ], ]; - $this->config->retryAttempts = 3; - $this->config->retryDelay = 1; + $config->retryAttempts = 3; + $config->retryDelay = 1; - $this->service = new SMSRocketService($this->cache, $this->config, $this->model, $this->logger, $this->client); + $this->service = new SMSRocketService($cache, $config, $model, $this->logger, $client); } /** diff --git a/tests/_support/DatabaseTestCase.php b/tests/_support/DatabaseTestCase.php index c476847..2d47091 100644 --- a/tests/_support/DatabaseTestCase.php +++ b/tests/_support/DatabaseTestCase.php @@ -23,7 +23,7 @@ abstract class DatabaseTestCase extends TestCase { use DatabaseTestTrait; - protected $namespace = '\Datamweb\SMSRocket'; + // protected string $namespace = '\Datamweb\SMSRocket'; /** * SMSRocket Table name From a87c662723f24231c59223ff3bbf4dfe94fdb681 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:21:24 +0330 Subject: [PATCH 02/19] chore: update rector rules --- rector.php | 2 +- tests/_support/DatabaseTestCase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rector.php b/rector.php index 5a41e84..61db3b5 100644 --- a/rector.php +++ b/rector.php @@ -92,7 +92,7 @@ TypedPropertyFromAssignsRector::class => [ __DIR__ . '/src/Models/SMSLogModel.php', - + __DIR__ . '/tests/_support/DatabaseTestCase.php', __DIR__ . '/tests/_support/Config/Registrar.php', ], ]); diff --git a/tests/_support/DatabaseTestCase.php b/tests/_support/DatabaseTestCase.php index 2d47091..c476847 100644 --- a/tests/_support/DatabaseTestCase.php +++ b/tests/_support/DatabaseTestCase.php @@ -23,7 +23,7 @@ abstract class DatabaseTestCase extends TestCase { use DatabaseTestTrait; - // protected string $namespace = '\Datamweb\SMSRocket'; + protected $namespace = '\Datamweb\SMSRocket'; /** * SMSRocket Table name From c0ba3cdf150b4bd49942f09aa42ab89bf98601a0 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:22:50 +0330 Subject: [PATCH 03/19] chore: update phpstan ignoereErrors data --- phpstan-baseline.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 620194b..5b2e1b4 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -8,20 +8,4 @@ // 'path' => __DIR__ . '/src/Drivers/AmootsmsDriver.php', // ]; -// $ignoreErrors[] = [ -// 'message' => '#^Access to an undefined property hasProperty\\(status\\)\\:\\:\\$data\\.$#', -// 'count' => 3, -// 'path' => __DIR__ . '/src/Drivers/IdehpardazanDriver.php', -// ]; -// $ignoreErrors[] = [ -// 'message' => '#^Access to an undefined property hasProperty\\(status\\)\\:\\:\\$data\\.$#', -// 'count' => 2, -// 'path' => __DIR__ . '/src/Drivers/FarazsmsDriver.php', -// ]; -// $ignoreErrors[] = [ -// 'message' => '#Access to an undefined property hasProperty\(sid\)::\$status.#', -// 'count' => 1, -// 'path' => __DIR__ . '/src/Drivers/TwilioDriver.php', -// ]; - return ['parameters' => ['ignoreErrors' => $ignoreErrors]]; From 5dd2cd6acff0f59453ed7318291e92480162d1c6 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:26:04 +0330 Subject: [PATCH 04/19] chore: update action for php8.4 --- .github/workflows/phpunit.yml | 2 +- .github/workflows/rector.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 7165e73..0c9c0c3 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -32,7 +32,7 @@ jobs: if: (! contains(github.event.head_commit.message, '[ci skip]')) strategy: matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] db-platforms: ['MySQLi', 'SQLite3'] mysql-versions: ['5.7'] dependencies: ['highest'] diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index 7c2a7d5..bdd37dc 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout From b63e465f071e2d537a2334cc51cf0a44880a5068 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:32:20 +0330 Subject: [PATCH 05/19] style: fix code style --- php-cs-fixer.dist.php | 2 +- src/Enums/Amootsms/DeliveryStatus.php | 39 ++++++++++++----------- src/Enums/Farazsms/DeliveryStatus.php | 14 ++++---- src/Enums/Idehpardazan/DeliveryStatus.php | 18 +++++------ src/Enums/Twilio/DeliveryStatus.php | 29 +++++++++-------- src/Responses/SMSResponse.php | 2 +- tests/Drivers/AmootsmsDriverTest.php | 2 +- tests/Drivers/FarazsmsDriverTest.php | 2 +- tests/Drivers/IdehpardazanDriverTest.php | 2 +- tests/Drivers/TwilioDriverTest.php | 2 +- tests/SMSRocketServiceTest.php | 8 ++--- 11 files changed, 61 insertions(+), 59 deletions(-) diff --git a/php-cs-fixer.dist.php b/php-cs-fixer.dist.php index 28ed0ee..8f66124 100644 --- a/php-cs-fixer.dist.php +++ b/php-cs-fixer.dist.php @@ -45,5 +45,5 @@ return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( 'CodeIgniter SMSRocket', 'Pooya Parsa Dadashi', - 'admin@codeigniter4.ir' + 'admin@codeigniter4.ir', ); diff --git a/src/Enums/Amootsms/DeliveryStatus.php b/src/Enums/Amootsms/DeliveryStatus.php index 827d598..49971c3 100644 --- a/src/Enums/Amootsms/DeliveryStatus.php +++ b/src/Enums/Amootsms/DeliveryStatus.php @@ -18,6 +18,26 @@ */ enum DeliveryStatus: int { + case SendToTci = 0; + case RecievedPhone = 1; + case NotRecievedPhone = 2; + case TciError = 3; + case UnknownError = 5; + case TciReceived = 8; + case NotTciReceived = 16; + case BlackList = 35; + case Unknown = 100; + case Sent = 200; + case Filtered = 300; + case SendingList = 400; + case NoReceipt = 500; + case SendWithAvanak = 501; + case SendWithBackupVtel = 502; + case SendingQueue = 900; + case WrongNumber = 950; + case EmptyMessage = 951; + case ShortCodeInvalid = 952; + /** * Get the delivery status title directly from the code. */ @@ -68,23 +88,4 @@ public static function fromCode(int|string $code): DeliveryStatus default => self::Unknown, // Return Unknown as default if code is invalid }; } - case SendToTci = 0; - case RecievedPhone = 1; - case NotRecievedPhone = 2; - case TciError = 3; - case UnknownError = 5; - case TciReceived = 8; - case NotTciReceived = 16; - case BlackList = 35; - case Unknown = 100; - case Sent = 200; - case Filtered = 300; - case SendingList = 400; - case NoReceipt = 500; - case SendWithAvanak = 501; - case SendWithBackupVtel = 502; - case SendingQueue = 900; - case WrongNumber = 950; - case EmptyMessage = 951; - case ShortCodeInvalid = 952; } diff --git a/src/Enums/Farazsms/DeliveryStatus.php b/src/Enums/Farazsms/DeliveryStatus.php index 98b4df4..5bf7f1f 100644 --- a/src/Enums/Farazsms/DeliveryStatus.php +++ b/src/Enums/Farazsms/DeliveryStatus.php @@ -18,6 +18,13 @@ */ enum DeliveryStatus: int { + case Delivered = 2; + case Discarded = 4; + case Pending = 1; + case Failed = 3; + case Send = 0; + case Unknown = 99; // Default status for unknown codes + /** * Get the delivery status title directly from the code. */ @@ -54,11 +61,4 @@ public static function fromCode(int|string $code): DeliveryStatus default => self::Unknown, // Return Unknown as default if code is invalid }; } - - case Delivered = 2; - case Discarded = 4; - case Pending = 1; - case Failed = 3; - case Send = 0; - case Unknown = 99; // Default status for unknown codes } diff --git a/src/Enums/Idehpardazan/DeliveryStatus.php b/src/Enums/Idehpardazan/DeliveryStatus.php index 61d30e8..e3c7666 100644 --- a/src/Enums/Idehpardazan/DeliveryStatus.php +++ b/src/Enums/Idehpardazan/DeliveryStatus.php @@ -18,6 +18,15 @@ */ enum DeliveryStatus: int { + case Recieved = 1; + case NotRecievedPhone = 2; + case RecievedToTci = 3; + case NotRecievedToTci = 4; + case RecievedToOperator = 5; + case Failed = 6; + case BlackList = 7; + case Unknown = 8; + /** * Get the delivery status title directly from the code. */ @@ -57,13 +66,4 @@ public static function fromCode(int|string $code): DeliveryStatus default => self::Unknown, // Return Unknown as default if code is invalid }; } - - case Recieved = 1; - case NotRecievedPhone = 2; - case RecievedToTci = 3; - case NotRecievedToTci = 4; - case RecievedToOperator = 5; - case Failed = 6; - case BlackList = 7; - case Unknown = 8; } diff --git a/src/Enums/Twilio/DeliveryStatus.php b/src/Enums/Twilio/DeliveryStatus.php index e484b2f..2d6b76b 100644 --- a/src/Enums/Twilio/DeliveryStatus.php +++ b/src/Enums/Twilio/DeliveryStatus.php @@ -18,6 +18,21 @@ */ enum DeliveryStatus: string { + case Queued = 'queued'; + case Sending = 'sending'; + case Sent = 'sent'; + case Failed = 'failed'; + case Delivered = 'delivered'; + case Undelivered = 'undelivered'; + case Receiving = 'receiving'; + case Received = 'received'; + case Accepted = 'accepted'; + case Scheduled = 'scheduled'; + case Read = 'read'; + case PartiallyDelivered = 'partially_delivered'; + case Canceled = 'canceled'; + case Unknown = 'unknown'; + /** * Map status string to a numeric code for storage in database. */ @@ -113,18 +128,4 @@ public static function fromCode(string $code): DeliveryStatus default => self::Unknown, // Return Unknown as default if code is invalid }; } - case Queued = 'queued'; - case Sending = 'sending'; - case Sent = 'sent'; - case Failed = 'failed'; - case Delivered = 'delivered'; - case Undelivered = 'undelivered'; - case Receiving = 'receiving'; - case Received = 'received'; - case Accepted = 'accepted'; - case Scheduled = 'scheduled'; - case Read = 'read'; - case PartiallyDelivered = 'partially_delivered'; - case Canceled = 'canceled'; - case Unknown = 'unknown'; } diff --git a/src/Responses/SMSResponse.php b/src/Responses/SMSResponse.php index cd5aa1b..c012dae 100644 --- a/src/Responses/SMSResponse.php +++ b/src/Responses/SMSResponse.php @@ -40,7 +40,7 @@ public function __construct( /** * @var string|null The message ID of the SMS operation, or null if not available. */ - protected ?string $messageId = null + protected ?string $messageId = null, ) { } diff --git a/tests/Drivers/AmootsmsDriverTest.php b/tests/Drivers/AmootsmsDriverTest.php index 8eec045..09bf6ba 100644 --- a/tests/Drivers/AmootsmsDriverTest.php +++ b/tests/Drivers/AmootsmsDriverTest.php @@ -33,7 +33,7 @@ final class AmootsmsDriverTest extends TestCase protected function setUp(): void { parent::setUp(); - $mockModel = $this->createMock(SMSLogModel::class); + $mockModel = $this->createMock(SMSLogModel::class); $this->mockClient = $this->createMock(CURLRequest::class); $config = [ diff --git a/tests/Drivers/FarazsmsDriverTest.php b/tests/Drivers/FarazsmsDriverTest.php index 7050829..3e28505 100644 --- a/tests/Drivers/FarazsmsDriverTest.php +++ b/tests/Drivers/FarazsmsDriverTest.php @@ -32,7 +32,7 @@ final class FarazsmsDriverTest extends TestCase protected function setUp(): void { $this->client = $this->createMock(CURLRequest::class); - $model = $this->createMock(SMSLogModel::class); + $model = $this->createMock(SMSLogModel::class); $config = ['api_key' => 'test_api_key']; $this->driver = new FarazsmsDriver($config, $model, $this->client); diff --git a/tests/Drivers/IdehpardazanDriverTest.php b/tests/Drivers/IdehpardazanDriverTest.php index edc5934..5381998 100644 --- a/tests/Drivers/IdehpardazanDriverTest.php +++ b/tests/Drivers/IdehpardazanDriverTest.php @@ -35,7 +35,7 @@ protected function setUp(): void // Mocking the CURLRequest and SMSLogModel $this->client = $this->createMock(CURLRequest::class); - $model = $this->createMock(SMSLogModel::class); + $model = $this->createMock(SMSLogModel::class); // Initialize IdehpardazanDriver with mocked dependencies $this->driver = new IdehpardazanDriver(['api_key' => 'test-api-key'], $model, $this->client); diff --git a/tests/Drivers/TwilioDriverTest.php b/tests/Drivers/TwilioDriverTest.php index 21256f0..e476588 100644 --- a/tests/Drivers/TwilioDriverTest.php +++ b/tests/Drivers/TwilioDriverTest.php @@ -74,7 +74,7 @@ public function testSendSuccess(): void DeliveryStatus::fromCode('sent')->toNumericCode(), 'Test message', null, - 'TestSender' + 'TestSender', ); $messageId = $this->driver->send('+1234567890', 'Test message', 'TestSender'); diff --git a/tests/SMSRocketServiceTest.php b/tests/SMSRocketServiceTest.php index b54a2fa..85cbc8b 100644 --- a/tests/SMSRocketServiceTest.php +++ b/tests/SMSRocketServiceTest.php @@ -40,11 +40,11 @@ final class SMSRocketServiceTest extends TestCase protected function setUp(): void { - $cache = $this->createMock(CacheInterface::class); - $config = new SMSRocketConfig(); - $model = $this->createMock(SMSLogModel::class); + $cache = $this->createMock(CacheInterface::class); + $config = new SMSRocketConfig(); + $model = $this->createMock(SMSLogModel::class); $this->logger = $this->createMock(Logger::class); - $client = $this->createMock(CURLRequest::class); + $client = $this->createMock(CURLRequest::class); $config->defaultDriver = 'testDriver'; $config->drivers = [ From 5dfd5d7c6a2342618a5b32120f9549b8f44028e4 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:38:12 +0330 Subject: [PATCH 06/19] chore: fix psalm errors --- psalm.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/psalm.xml b/psalm.xml index ee76813..e02e076 100644 --- a/psalm.xml +++ b/psalm.xml @@ -11,6 +11,7 @@ errorBaseline="psalm-baseline.xml" findUnusedBaselineEntry="false" findUnusedCode="false" + ensureOverrideAttribute="false" > From 6d87c58376c744845b2b7bc04814017e570bf3a3 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 21:41:10 +0330 Subject: [PATCH 07/19] chore: add php84 for phpstan --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 439dbf0..ef196f5 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout From 77a04882ab13e5a8a62d5ef9eea781e28f9c9745 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:01:21 +0330 Subject: [PATCH 08/19] fix: try fix SQLSRV --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 0c9c0c3..48cf73f 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -111,7 +111,7 @@ jobs: steps: - name: Create database for MSSQL Server if: matrix.db-platforms == 'SQLSRV' - run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" + run: /opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" - name: Checkout uses: actions/checkout@v4 From ca69cd796d43cef6bf2375ddf96f27e1d6bf5cbe Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:08:19 +0330 Subject: [PATCH 09/19] fix: try fix SQLSRV --- .github/workflows/phpunit.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 48cf73f..8f0e1bc 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -53,10 +53,10 @@ jobs: mysql-versions: '5.7' dependencies: 'highest' # SQLSRV - - php-versions: '8.1' - db-platforms: SQLSRV - mysql-versions: '5.7' - dependencies: 'highest' + # - php-versions: '8.1' + # db-platforms: SQLSRV + # mysql-versions: '5.7' + # dependencies: 'highest' # OCI8 - php-versions: '8.1' db-platforms: OCI8 @@ -83,16 +83,16 @@ jobs: - 5432:5432 options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 - mssql: - image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 - env: - SA_PASSWORD: 1Secure*Password1 - ACCEPT_EULA: Y - MSSQL_PID: Developer - MSSQL_ENCRYPT: optional - ports: - - 1433:1433 - options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 + # mssql: + # image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 + # env: + # SA_PASSWORD: 1Secure*Password1 + # ACCEPT_EULA: Y + # MSSQL_PID: Developer + # MSSQL_ENCRYPT: optional + # ports: + # - 1433:1433 + # options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 oracle: image: gvenzl/oracle-xe:18 @@ -109,9 +109,9 @@ jobs: --health-retries 10 steps: - - name: Create database for MSSQL Server - if: matrix.db-platforms == 'SQLSRV' - run: /opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" + # - name: Create database for MSSQL Server + # if: matrix.db-platforms == 'SQLSRV' + # run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" - name: Checkout uses: actions/checkout@v4 From 92b51b047c9cb21ee5f3345c2861a87e60be3f4b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:15:01 +0330 Subject: [PATCH 10/19] fix: try fix SQLSRV --- .github/workflows/phpunit.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 8f0e1bc..b0a5863 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -53,10 +53,10 @@ jobs: mysql-versions: '5.7' dependencies: 'highest' # SQLSRV - # - php-versions: '8.1' - # db-platforms: SQLSRV - # mysql-versions: '5.7' - # dependencies: 'highest' + - php-versions: '8.1' + db-platforms: SQLSRV + mysql-versions: '8.0' + dependencies: 'highest' # OCI8 - php-versions: '8.1' db-platforms: OCI8 @@ -83,16 +83,16 @@ jobs: - 5432:5432 options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 - # mssql: - # image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 - # env: - # SA_PASSWORD: 1Secure*Password1 - # ACCEPT_EULA: Y - # MSSQL_PID: Developer - # MSSQL_ENCRYPT: optional - # ports: - # - 1433:1433 - # options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 + mssql: + image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 + env: + SA_PASSWORD: 1Secure*Password1 + ACCEPT_EULA: Y + MSSQL_PID: Developer + MSSQL_ENCRYPT: optional + ports: + - 1433:1433 + options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 oracle: image: gvenzl/oracle-xe:18 @@ -109,9 +109,9 @@ jobs: --health-retries 10 steps: - # - name: Create database for MSSQL Server - # if: matrix.db-platforms == 'SQLSRV' - # run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" + - name: Create database for MSSQL Server + if: matrix.db-platforms == 'SQLSRV' + run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" - name: Checkout uses: actions/checkout@v4 From 0cb783f42d13dda82e2c30a7cad2e5eb54b084aa Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:30:07 +0330 Subject: [PATCH 11/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index b0a5863..c5f9970 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -84,15 +84,18 @@ jobs: options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 mssql: - image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 + image: mcr.microsoft.com/mssql/server:2022-latest env: - SA_PASSWORD: 1Secure*Password1 + MSSQL_SA_PASSWORD: 1Secure*Password1 ACCEPT_EULA: Y MSSQL_PID: Developer - MSSQL_ENCRYPT: optional ports: - 1433:1433 - options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 + options: >- + --health-cmd="/opt/mssql-tools18/bin/sqlcmd -C -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION'" + --health-interval=10s + --health-timeout=5s + --health-retries=3 oracle: image: gvenzl/oracle-xe:18 @@ -147,7 +150,7 @@ jobs: COMPOSER_UPDATE_FLAGS: ${{ matrix.dependencies == 'lowest' && '--prefer-lowest' || '' }} - name: Test with PHPUnit - run: vendor/bin/phpunit --debug --coverage-text --testsuite main + run: vendor/bin/phpunit --coverage-text --testsuite main env: DB: ${{ matrix.db-platforms }} TERM: xterm-256color From 3d5921a138bada55bd9c503bbefbcd534b76872b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:35:19 +0330 Subject: [PATCH 12/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index c5f9970..3f67dc6 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -53,7 +53,7 @@ jobs: mysql-versions: '5.7' dependencies: 'highest' # SQLSRV - - php-versions: '8.1' + - php-versions: '8.4' db-platforms: SQLSRV mysql-versions: '8.0' dependencies: 'highest' From f757af4c8afd784dbafcc7ca370699092e13a87c Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:45:19 +0330 Subject: [PATCH 13/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 3f67dc6..d7920a4 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -53,7 +53,7 @@ jobs: mysql-versions: '5.7' dependencies: 'highest' # SQLSRV - - php-versions: '8.4' + - php-versions: '8.3' db-platforms: SQLSRV mysql-versions: '8.0' dependencies: 'highest' From c414799b7ce2565aa030ea82181642bbd51c821c Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 22:53:25 +0330 Subject: [PATCH 14/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index d7920a4..0ccd7b5 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -84,18 +84,15 @@ jobs: options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 mssql: - image: mcr.microsoft.com/mssql/server:2022-latest + image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 env: - MSSQL_SA_PASSWORD: 1Secure*Password1 + SA_PASSWORD: 1Secure*Password1 ACCEPT_EULA: Y MSSQL_PID: Developer + MSSQL_ENCRYPT: optional ports: - 1433:1433 - options: >- - --health-cmd="/opt/mssql-tools18/bin/sqlcmd -C -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION'" - --health-interval=10s - --health-timeout=5s - --health-retries=3 + options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 oracle: image: gvenzl/oracle-xe:18 @@ -114,7 +111,7 @@ jobs: steps: - name: Create database for MSSQL Server if: matrix.db-platforms == 'SQLSRV' - run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" + run: sqlcmd -S -C 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" - name: Checkout uses: actions/checkout@v4 From ab6f249291861032d8be4408f140bb931ecc3f5f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 23:01:51 +0330 Subject: [PATCH 15/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 0ccd7b5..57fb459 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -84,7 +84,7 @@ jobs: options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 mssql: - image: mcr.microsoft.com/mssql/server:2019-CU28-ubuntu-20.04 + image: mcr.microsoft.com/mssql/server:2022-latest env: SA_PASSWORD: 1Secure*Password1 ACCEPT_EULA: Y @@ -111,7 +111,7 @@ jobs: steps: - name: Create database for MSSQL Server if: matrix.db-platforms == 'SQLSRV' - run: sqlcmd -S -C 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" + run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test" - name: Checkout uses: actions/checkout@v4 From 6b5fbee4e83facc0be3b2eb357630cb11a7e65af Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 23:03:38 +0330 Subject: [PATCH 16/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 57fb459..0f0e4bc 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -92,7 +92,7 @@ jobs: MSSQL_ENCRYPT: optional ports: - 1433:1433 - options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 oracle: image: gvenzl/oracle-xe:18 From 057ff53336ffbe38b8a3c5951f027eb980214bd6 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 23:06:03 +0330 Subject: [PATCH 17/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 0f0e4bc..57fb459 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -92,7 +92,7 @@ jobs: MSSQL_ENCRYPT: optional ports: - 1433:1433 - options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 + options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 oracle: image: gvenzl/oracle-xe:18 From 6e249446e235c714843b0bfb965776d7eb6dbae7 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 23:18:18 +0330 Subject: [PATCH 18/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 57fb459..bd00f41 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -53,10 +53,10 @@ jobs: mysql-versions: '5.7' dependencies: 'highest' # SQLSRV - - php-versions: '8.3' + - php-versions: '8.1' db-platforms: SQLSRV mysql-versions: '8.0' - dependencies: 'highest' + dependencies: 'lowest' # OCI8 - php-versions: '8.1' db-platforms: OCI8 @@ -86,13 +86,16 @@ jobs: mssql: image: mcr.microsoft.com/mssql/server:2022-latest env: - SA_PASSWORD: 1Secure*Password1 + MSSQL_SA_PASSWORD: 1Secure*Password1 ACCEPT_EULA: Y MSSQL_PID: Developer - MSSQL_ENCRYPT: optional ports: - 1433:1433 - options: --health-cmd="/opt/mssql-tools18/bin/sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION' -N -C" --health-interval=10s --health-timeout=5s --health-retries=3 + options: >- + --health-cmd="/opt/mssql-tools18/bin/sqlcmd -C -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q 'SELECT @@VERSION'" + --health-interval=10s + --health-timeout=5s + --health-retries=3 oracle: image: gvenzl/oracle-xe:18 From df884fcfef113c0c5ea85c2a0c35cd0bf75de32b Mon Sep 17 00:00:00 2001 From: Pooya Parsa Dadashi Date: Fri, 21 Feb 2025 23:22:23 +0330 Subject: [PATCH 19/19] chore: fix phpunit --- .github/workflows/phpunit.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index bd00f41..e5a2748 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -112,6 +112,22 @@ jobs: --health-retries 10 steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: true + - name: Create database for MSSQL Server if: matrix.db-platforms == 'SQLSRV' run: sqlcmd -S 127.0.0.1 -U sa -P 1Secure*Password1 -Q "CREATE DATABASE test"