Skip to content

Commit b4b3433

Browse files
authored
Merge pull request #10 from GetStream/FEEDS-863
[FEEDS-863]fix: fix test array access errors, remove debug code, and improve DateTime error handling
2 parents ee229e0 + 8a39a20 commit b4b3433

1,119 files changed

Lines changed: 12356 additions & 4990 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/initiate_release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919

20-
- name: Update composer.json and push release branch
20+
- name: Update version in composer.json and Constant.php
2121
env:
2222
VERSION: ${{ github.event.inputs.version }}
2323
run: |
24-
sed -i 's/"version": ".*"/"version": "'$VERSION'"/' composer.json
24+
# Update composer.json
25+
sed -i 's/"version": ".*"/"version": "v'$VERSION'"/' composer.json
26+
# Update Constant.php (remove 'v' prefix for constant)
27+
sed -i "s/const VERSION = '.*'/const VERSION = '$VERSION'/" src/Constant.php
2528
git config --global user.name 'github-actions'
2629
git config --global user.email 'release@getstream.io'
2730
git checkout -q -b "release-$VERSION"
28-
git add composer.json
31+
git add composer.json src/Constant.php
2932
git commit -am "chore(release): $VERSION"
3033
git push -q -u origin "release-$VERSION"
3134
@@ -40,4 +43,5 @@ jobs:
4043
Once this is merged, another job will kick off automatically and publish the package.
4144
4245
## Changes
43-
- Updated version in composer.json to ${{ github.event.inputs.version }}"
46+
- Updated version in composer.json to v${{ github.event.inputs.version }}
47+
- Updated version in Constant.php to ${{ github.event.inputs.version }}"

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test-specific: ## Run a specific test (usage: make test-specific TEST=TestClassN
2424

2525
lint: ## Run all available code quality checks
2626
@echo "🔍 Running PHPStan static analysis..."
27-
./vendor/bin/phpstan analyse
27+
./vendor/bin/phpstan analyse --memory-limit=512M
2828
@echo "✅ PHPStan analysis complete"
2929
@if [ -f "./vendor/bin/php-cs-fixer" ]; then \
3030
echo ""; \
@@ -44,14 +44,14 @@ lint-fix: ## Run linting and fix issues automatically
4444
echo ""; \
4545
fi
4646
@echo "🔍 Running PHPStan analysis..."
47-
./vendor/bin/phpstan analyse
47+
./vendor/bin/phpstan analyse --memory-limit=512M
4848
@echo "✅ Linting complete"
4949

5050
phpstan: ## Run PHPStan static analysis only
51-
./vendor/bin/phpstan analyse
51+
./vendor/bin/phpstan analyse --memory-limit=512M
5252

5353
phpstan-baseline: ## Generate PHPStan baseline (ignore current errors)
54-
./vendor/bin/phpstan analyse --generate-baseline
54+
./vendor/bin/phpstan analyse --generate-baseline --memory-limit=512M
5555

5656
phpstan-clear-cache: ## Clear PHPStan cache
5757
./vendor/bin/phpstan clear-result-cache

generate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fi
3838
# Run PHPStan to check for any issues
3939
if [ -f "phpstan.neon" ]; then
4040
echo "Running PHPStan analysis..."
41-
./vendor/bin/phpstan analyse --no-progress || echo "PHPStan completed with warnings"
41+
./vendor/bin/phpstan analyse --no-progress --memory-limit=512M || echo "PHPStan completed with warnings"
4242
fi
4343

4444
# Update composer autoloader for new classes

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ parameters:
22
level: 8
33
paths:
44
- src
5+
memoryLimitFile: 512M
56
ignoreErrors:
67
# Add any specific errors to ignore here
78
-

src/Client.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
class Client
1717
{
1818
use CommonTrait;
19+
1920
private string $apiKey;
2021
private string $apiSecret;
2122
private string $baseUrl;
@@ -54,7 +55,8 @@ public function __construct(
5455
$this->defaultHeaders = [
5556
'Content-Type' => 'application/json',
5657
'Accept' => 'application/json',
57-
'User-Agent' => 'getstream-php-sdk/1.0.0',
58+
'User-Agent' => 'getstream-php-sdk/' . Constant::VERSION,
59+
'x-stream-client' => 'stream-php-client-' . Constant::VERSION,
5860
];
5961
}
6062

src/Constant.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace GetStream;
6+
7+
class Constant
8+
{
9+
const VERSION = '1.0.0';
10+
}
11+

src/Generated/FeedsTrait.php

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,19 +1213,34 @@ public function createFeedsBatch(GeneratedModels\CreateFeedsBatchRequest $reques
12131213
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\CreateFeedsBatchResponse::class);
12141214
}
12151215
/**
1216-
* Retrieves capabilities for multiple feeds in a single request. Useful for batch processing when activities are added to feeds.
1216+
* Delete multiple feeds by their IDs. All feeds must exist. This endpoint is server-side only.
12171217
*
12181218
*
1219-
* @param GeneratedModels\OwnCapabilitiesBatchRequest $requestData
1220-
* @return StreamResponse<GeneratedModels\OwnCapabilitiesBatchResponse>
1219+
* @param GeneratedModels\DeleteFeedsBatchRequest $requestData
1220+
* @return StreamResponse<GeneratedModels\DeleteFeedsBatchResponse>
12211221
* @throws StreamException
12221222
*/
1223-
public function ownCapabilitiesBatch(GeneratedModels\OwnCapabilitiesBatchRequest $requestData): StreamResponse {
1224-
$path = '/api/v2/feeds/feeds/own_capabilities/batch';
1223+
public function deleteFeedsBatch(GeneratedModels\DeleteFeedsBatchRequest $requestData): StreamResponse {
1224+
$path = '/api/v2/feeds/feeds/delete';
12251225

12261226
$queryParams = [];
12271227
// Use the provided request data array directly
1228-
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\OwnCapabilitiesBatchResponse::class);
1228+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\DeleteFeedsBatchResponse::class);
1229+
}
1230+
/**
1231+
* Retrieves own_follows, own_capabilities, and/or own_membership for multiple feeds in a single request. If fields are not specified, all three fields are returned.
1232+
*
1233+
*
1234+
* @param GeneratedModels\OwnBatchRequest $requestData
1235+
* @return StreamResponse<GeneratedModels\OwnBatchResponse>
1236+
* @throws StreamException
1237+
*/
1238+
public function ownBatch(GeneratedModels\OwnBatchRequest $requestData): StreamResponse {
1239+
$path = '/api/v2/feeds/feeds/own/batch';
1240+
1241+
$queryParams = [];
1242+
// Use the provided request data array directly
1243+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\OwnBatchResponse::class);
12291244
}
12301245
/**
12311246
* Query feeds with filter query
@@ -1337,6 +1352,21 @@ public function followBatch(GeneratedModels\FollowBatchRequest $requestData): St
13371352
// Use the provided request data array directly
13381353
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\FollowBatchResponse::class);
13391354
}
1355+
/**
1356+
* Creates or updates multiple follows at once. Does not return an error if follows already exist. Broadcasts FollowAddedEvent only for newly created follows.
1357+
*
1358+
*
1359+
* @param GeneratedModels\FollowBatchRequest $requestData
1360+
* @return StreamResponse<GeneratedModels\FollowBatchResponse>
1361+
* @throws StreamException
1362+
*/
1363+
public function getOrCreateFollows(GeneratedModels\FollowBatchRequest $requestData): StreamResponse {
1364+
$path = '/api/v2/feeds/follows/batch/upsert';
1365+
1366+
$queryParams = [];
1367+
// Use the provided request data array directly
1368+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\FollowBatchResponse::class);
1369+
}
13401370
/**
13411371
* Query follows based on filters with pagination and sorting options
13421372
*
@@ -1481,20 +1511,36 @@ public function unfollowBatch(GeneratedModels\UnfollowBatchRequest $requestData)
14811511
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\UnfollowBatchResponse::class);
14821512
}
14831513
/**
1484-
* Delete all activities, reactions, comments, and bookmarks for a user
1514+
* Removes multiple follows and broadcasts FollowRemovedEvent for each. Does not return an error if follows don't exist.
1515+
*
1516+
*
1517+
* @param GeneratedModels\UnfollowBatchRequest $requestData
1518+
* @return StreamResponse<GeneratedModels\UnfollowBatchResponse>
1519+
* @throws StreamException
1520+
*/
1521+
public function getOrCreateUnfollows(GeneratedModels\UnfollowBatchRequest $requestData): StreamResponse {
1522+
$path = '/api/v2/feeds/unfollow/batch/upsert';
1523+
1524+
$queryParams = [];
1525+
// Use the provided request data array directly
1526+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\UnfollowBatchResponse::class);
1527+
}
1528+
/**
1529+
* Delete all feed data for a user including: feeds, activities, follows, comments, feed reactions, bookmark folders, bookmarks, and collections owned by the user
14851530
*
14861531
*
14871532
* @param string $userID
1533+
* @param GeneratedModels\DeleteFeedUserDataRequest $requestData
14881534
* @return StreamResponse<GeneratedModels\DeleteFeedUserDataResponse>
14891535
* @throws StreamException
14901536
*/
1491-
public function deleteFeedUserData(string $userID): StreamResponse {
1537+
public function deleteFeedUserData(string $userID, GeneratedModels\DeleteFeedUserDataRequest $requestData): StreamResponse {
14921538
$path = '/api/v2/feeds/users/{user_id}/delete';
14931539
$path = str_replace('{user_id}', (string) $userID, $path);
14941540

14951541
$queryParams = [];
1496-
$requestData = null;
1497-
return StreamResponse::fromJson($this->makeRequest('DELETE', $path, $queryParams, $requestData), GeneratedModels\DeleteFeedUserDataResponse::class);
1542+
// Use the provided request data array directly
1543+
return StreamResponse::fromJson($this->makeRequest('POST', $path, $queryParams, $requestData), GeneratedModels\DeleteFeedUserDataResponse::class);
14981544
}
14991545
/**
15001546
* Export all feed data for a user including: user profile, feeds, activities, follows, comments, feed reactions, bookmark folders, bookmarks, and collections owned by the user

src/GeneratedModels/AIImageConfig.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
33
declare(strict_types=1);
44

55
namespace GetStream\GeneratedModels;
6-
7-
use JsonSerializable;
86
/**
97
*
8+
*
9+
* @property bool|null $async
10+
* @property bool|null $enabled
11+
* @property array<OCRRule>|null $ocrRules
12+
* @property array<AWSRekognitionRule>|null $rules
1013
*/
1114
class AIImageConfig extends BaseModel
1215
{
1316
public function __construct(
1417
public ?bool $async = null,
1518
public ?bool $enabled = null,
19+
/** @var array<OCRRule>|null */
20+
#[ArrayOf(OCRRule::class)]
1621
public ?array $ocrRules = null,
22+
/** @var array<AWSRekognitionRule>|null */
23+
#[ArrayOf(AWSRekognitionRule::class)]
1724
public ?array $rules = null,
18-
) {}
25+
) {
26+
}
1927

2028
// BaseModel automatically handles jsonSerialize(), toArray(), and fromJson() using constructor types!
2129
// Use #[JsonKey('user_id')] to override field names if needed.

src/GeneratedModels/AITextConfig.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,29 @@
33
declare(strict_types=1);
44

55
namespace GetStream\GeneratedModels;
6-
7-
use JsonSerializable;
86
/**
97
*
8+
*
9+
* @property bool|null $async
10+
* @property bool|null $enabled
11+
* @property string|null $profile
12+
* @property array<BodyguardRule>|null $rules
13+
* @property array<BodyguardSeverityRule>|null $severityRules
1014
*/
1115
class AITextConfig extends BaseModel
1216
{
1317
public function __construct(
1418
public ?bool $async = null,
1519
public ?bool $enabled = null,
1620
public ?string $profile = null,
21+
/** @var array<BodyguardRule>|null */
22+
#[ArrayOf(BodyguardRule::class)]
1723
public ?array $rules = null,
24+
/** @var array<BodyguardSeverityRule>|null */
25+
#[ArrayOf(BodyguardSeverityRule::class)]
1826
public ?array $severityRules = null,
19-
) {}
27+
) {
28+
}
2029

2130
// BaseModel automatically handles jsonSerialize(), toArray(), and fromJson() using constructor types!
2231
// Use #[JsonKey('user_id')] to override field names if needed.

src/GeneratedModels/AIVideoConfig.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
33
declare(strict_types=1);
44

55
namespace GetStream\GeneratedModels;
6-
7-
use JsonSerializable;
86
/**
97
*
8+
*
9+
* @property bool|null $async
10+
* @property bool|null $enabled
11+
* @property array<AWSRekognitionRule>|null $rules
1012
*/
1113
class AIVideoConfig extends BaseModel
1214
{
1315
public function __construct(
1416
public ?bool $async = null,
1517
public ?bool $enabled = null,
18+
/** @var array<AWSRekognitionRule>|null */
19+
#[ArrayOf(AWSRekognitionRule::class)]
1620
public ?array $rules = null,
17-
) {}
21+
) {
22+
}
1823

1924
// BaseModel automatically handles jsonSerialize(), toArray(), and fromJson() using constructor types!
2025
// Use #[JsonKey('user_id')] to override field names if needed.

0 commit comments

Comments
 (0)