Skip to content

Commit cf56a39

Browse files
authored
Merge pull request #65 from utopia-php/copilot/sub-pr-63
Replace PHPStan ignores with official phpredis stub file
2 parents b553547 + b865335 commit cf56a39

4 files changed

Lines changed: 1448 additions & 8 deletions

File tree

phpstan.neon

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,4 @@ parameters:
77

88
scanDirectories:
99
- vendor/swoole
10-
11-
# phpredis stubs don't include Redis Streams methods (xAdd, xGroup, etc.)
12-
# These methods exist at runtime but PHPStan's stubs are incomplete
13-
# See: https://github.com/phpredis/phpredis-stubs/issues
14-
ignoreErrors:
15-
-
16-
message: '#Call to an undefined method RedisCluster::(x(Add|Group|ReadGroup|Ack|Pending|Claim|AutoClaim|Del|Len|Trim|Info|Range|RevRange)|eval)\(\)#'
17-
path: src/Queue/Connection/RedisStreamCluster.php
10+
- stubs

pint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"preset": "psr12",
3+
"exclude": [
4+
"stubs"
5+
],
36
"rules": {
47
"single_quote": true
58
}

stubs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# PHPStan Stubs
2+
3+
This directory contains stub files for PHPStan static analysis.
4+
5+
## RedisCluster.stub.php
6+
7+
This file is the official stub file from the [phpredis](https://github.com/phpredis/phpredis) extension.
8+
9+
- **Source**: https://github.com/phpredis/phpredis/blob/develop/redis_cluster.stub.php
10+
- **Purpose**: Provides type definitions for Redis Streams methods (xAdd, xGroup, xReadGroup, etc.) and other RedisCluster methods
11+
- **License**: PHP License (same as phpredis extension)
12+
13+
The phpredis extension provides these stub files in their repository for static analysis tools like PHPStan. Since the stub files are not distributed with the compiled extension, we include them here for PHPStan to use during static analysis.
14+
15+
This is the recommended approach from the phpredis maintainers for using their extension with static analysis tools.

0 commit comments

Comments
 (0)