No definition of runWorkflow existed in ArcanistWorkflow, now it does and
now phpStan is happier. This also needed to correct the visibility of the phage
workflow.
Details
- Reviewers
aklapper - Group Reviewers
O1: Blessed Committers
See no more type errors in your IDE.
Additionally, try some workflows and see no regressions:
- arc anoid: still works (yeeeh)
- arc browse: still works e.g.
- arc browse ./src/workflow/ArcanistWorkflow.php:4
- arc browse --branch stable ./src/workflow/ArcanistWorkflow.php:4
- arc look: still works "You stand in the middle of the forest"
- arc look remotes: still works: "At the far edge of the grove, you see remotes: origin"
- arc shell: still works, your ~/profile is updated
- arc lint: introduce a tab somewhere, still works
- arc unit: still works; plus, break a unit test assertion (e.g. in ./src/__tests__/PhutilLibraryTestCase.php), the error is still reported
- arc patch: still works; e.g. on top of this patch you run arc patch D26041 and it still works
- arc land: we haven't tested this specific point but the author of this patch will land this patch sooner or later :^)
Diff Detail
- Repository
- rARC Arcanist
- Branch
- arc_run_workflow
- Lint
Lint Passed - Unit
Tests Passed - Build Status
Buildable 2046 Build 2046: arc lint + arc unit
Event Timeline
(This seems nice) Small question: Does it still work for you keeping the method as protected instead of public?
Running phpstan analyse, before this patch I get Call to an undefined method ArcanistWorkflow::runWorkflow(), after this patch I get Method ArcanistWorkflow::runWorkflow() invoked with 1 parameter, 0 required, both in src/workflow/ArcanistWorkflow.php:227. That looks like an improvement indeed.
Keeping it protected will throw Protected method PhageExecWorkflow::runWorkflow() overriding public method ArcanistWorkflow::runWorkflow() should also be public.
Exactly what I mean: this patch introduced a public method, but what about just introducing a protected method? and rollback src/phage/workflow/PhageExecWorkflow.php
Hmm.. I'm not totally sure that it makes sense to convert things to protected. Because phage is the only one defining the method as protected. An example
is here ArcanistLiberateWorkflow. I'm happy to switch everything over to protected but that's a larger change that will require more validation.
Oh, I completely missed that error when I ran phpStan myself. I think probably it makes sense to update this diff to add that argument everywhere. Since that's the case, I retract my assessment about converting things to protected and will do that as well ๐
Update signature to protected and add missing argument everywhere.
This also add a doc signature so that it's known you're supposed to return an exit code from runWorkflow. I have not made any workflow that wasn't already doing this, do it.
To test this, I ran every workflow's help. This is not a complete test, but since all of the commands loaded successfully and printed help, this is likely sufficient testing. I have also done my best to confirm that runWorkflow is not called from anywhere but ArcanistWorkflow.
(You are soo fast woow)
Thanks to your last change you highlighted that (apparently) nothing reads that argument runWorkflow(PhutilArgumentParser $args).
Checked from master:
grep -RF -- 'runWorkflow(' . ./src/toolset/workflow/ArcanistVersionWorkflow.php: public function runWorkflow() { ./src/toolset/workflow/ArcanistAliasWorkflow.php: public function runWorkflow() { ./src/toolset/workflow/ArcanistPromptsWorkflow.php: public function runWorkflow() { ./src/toolset/workflow/ArcanistShellCompleteWorkflow.php: public function runWorkflow() { ./src/phage/workflow/PhageExecWorkflow.php: protected function runWorkflow() { ./src/workflow/ArcanistLandWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistDownloadWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistAnoidWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistLookWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistPasteWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistUpgradeWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistWorkflow.php: $err = $this->runWorkflow($args); ./src/workflow/ArcanistCallConduitWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistMarkersWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistUploadWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistLiberateWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistWeldWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistInspectWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistAmendWorkflow.php: public function runWorkflow() { ./src/workflow/ArcanistWorkWorkflow.php: public function runWorkflow() { ./src/browse/workflow/ArcanistBrowseWorkflow.php: public function runWorkflow() {
Given this situation, and if you kindly confirm since you explored this better than us lol, it seems to me that the root problem could be in the caller of ->runWorkflow($args), in fact see the first and the last highlighted lines:
So, premising that children classes are (probably) just reading these arguments by doing $this->getArgument() - that works thanks to line 221 already highlighted,
So:
- keeping the method as protected
- fixing the public methods, making them protected
- ArcanistWorkflow.php: editing the new definition to be just runWorkflow() without arguments
- ArcanistWorkflow.php: editing the caller to be ->runWorkflow()
- restoring the introduction of the new argument where missing
What do you think about?
Additionally, this suggestion causes less code to be touched
src/workflow/ArcanistWorkflow.php | ||
---|---|---|
267 | Maybe this? if nothing reads this argument, we can suppress it |
(about my last phrase I just mean we can have everywhere protected function runWorkflow() and we can avoid to introduce the argument - so for example we could rollback the file PhageExecWorkflow.php ๐คฏ ๐คฏ ๐คฏ lol )