Skip to content

Conversation

@brianstoop
Copy link
Contributor

@brianstoop brianstoop commented Mar 12, 2025

Depends on #36 for the typos fix

@brianstoop brianstoop changed the base branch from master to release/0.11.x March 12, 2025 14:57
@brianstoop brianstoop marked this pull request as ready for review March 12, 2025 15:07
@brianstoop brianstoop requested a review from pprkut March 12, 2025 15:12
Comment on lines 18 to 22
* @phpstan-type Endpoint array{
* platform: string,
* payloadType: string,
* endpoint: string,
* message_id?: string|null,
* }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's this easy. This breaks the current pass-through use-case, where any additional fields coming in are also going out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean it should be more generic? That for example there could be more fields in the array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just had a revelation that we can intersect array types, I changed that here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be documented yet, but I think this would be preferred over an intersection: https://github.com/phpstan/phpdoc-parser/pull/250/files

The main problem is the "in = out" part though. So, typing that the output of one method is equals to the input of another. That just might be too hard to statically do though.

The alternative is to make this a strict shape somehow, and break all current flows that allow extra fields in there.

@brianstoop brianstoop force-pushed the phpstan/shapes/general branch from 6a648f6 to 009f633 Compare March 13, 2025 09:43
@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants