Skip to content

fix: make FlowMigration project clients pass phpstan against manage-api ^10 - #119

Open
jirkasemmler wants to merge 1 commit into
mainfrom
jirka/fix-phpstan-flow-migration
Open

fix: make FlowMigration project clients pass phpstan against manage-api ^10#119
jirkasemmler wants to merge 1 commit into
mainfrom
jirka/fix-phpstan-flow-migration

Conversation

@jirkasemmler

Copy link
Copy Markdown
Contributor

Changes:

  • FlowMigration/ProjectClientsFactory: cast $projectId to int for getProject() and createProjectStorageToken(), and narrow $tokenInfo['token'] to a string with an is_string() assert.

phpstan goes from 4 errors to 0. phpcs and phpunit (76 tests) stay green.

Why main is red. #111 bumped the manage-api client to ^10, where those two methods take int instead of string. #113 added FlowMigration, which passes the project id through as a string. Each PR was green on its own; the combination is not, so nothing flagged it until it was already on main (c4ef6b4).

Why cast instead of retyping. projectId is a string the whole way from CLI input through BatchRunner, ProjectResult and the test fakes. Threading int through all of it is a much larger change than this bug justifies, so the conversion happens at the manage-api boundary and the pipeline is untouched.

Why not the baseline. phpstan-baseline.neon already carries 20+ entries for exactly these two messages, so adding four more would have matched precedent. Four real fixes seemed better than four more suppressions, but say the word and I will swap it for baseline entries instead.

Worth merging before #115, #116, #117 and #118 - all four currently show red CI for this reason and nothing of their own.


Additional notes

⚠️ Don't forget to release new version after merge

🤖 Generated with Claude Code

…pi ^10

CI on main has been red since c4ef6b4. #111 bumped the manage-api client to ^10,
where getProject() and createProjectStorageToken() take int rather than string,
and #113 added FlowMigration passing the project id through as a string. Both
were green on their own; together they are not.

Cast at the manage-api boundary rather than retyping the pipeline: projectId is a
string all the way from the CLI input through BatchRunner, ProjectResult and the
test fakes, and threading int through all of that is a bigger change than this
bug warrants.

The two remaining errors were $tokenInfo['token'] being mixed, since the token
info is array<mixed>. Pulled into a local with an is_string() assert, the same
way the other commands in this repo narrow API responses, which also drops the
duplicate array access.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant