From 9aaaa0ad262a86bcc855573a421b550d3184c493 Mon Sep 17 00:00:00 2001 From: Snider Date: Fri, 30 Jan 2026 20:06:51 +0000 Subject: [PATCH] refactor(php): rename analyse to stan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename "analyse" check to "stan" (PHPStan is commonly called "stan") - Command: `core php stan` (with "analyse" alias for compatibility) - Update QA pipeline to use "stan" for check name - Update dependency chain: fmt → stan → psalm → test Co-Authored-By: Claude Opus 4.5 --- cmd/php/commands.go | 2 +- cmd/php/php.go | 2 +- cmd/php/php_quality.go | 27 ++++++++++++++------------- cmd/php/qa_runner.go | 12 ++++++------ pkg/php/quality.go | 2 +- pkg/php/quality_test.go | 2 +- 6 files changed, 24 insertions(+), 23 deletions(-) diff --git a/cmd/php/commands.go b/cmd/php/commands.go index 61d4b0a..c0a2444 100644 --- a/cmd/php/commands.go +++ b/cmd/php/commands.go @@ -15,7 +15,7 @@ // Code Quality: // - test: Run PHPUnit/Pest tests // - fmt: Format code with Laravel Pint -// - analyse: Run PHPStan/Larastan static analysis +// - stan: Run PHPStan/Larastan static analysis // - psalm: Run Psalm static analysis // - audit: Security audit for dependencies // - security: Security vulnerability scanning diff --git a/cmd/php/php.go b/cmd/php/php.go index 5326543..efb0fdc 100644 --- a/cmd/php/php.go +++ b/cmd/php/php.go @@ -72,7 +72,7 @@ func AddPHPCommands(root *cobra.Command) { // Quality (existing) addPHPTestCommand(phpCmd) addPHPFmtCommand(phpCmd) - addPHPAnalyseCommand(phpCmd) + addPHPStanCommand(phpCmd) // Quality (new) addPHPPsalmCommand(phpCmd) diff --git a/cmd/php/php_quality.go b/cmd/php/php_quality.go index 2da84a4..70e1017 100644 --- a/cmd/php/php_quality.go +++ b/cmd/php/php_quality.go @@ -138,15 +138,16 @@ func addPHPFmtCommand(parent *cobra.Command) { } var ( - analyseLevel int - analyseMemory string + stanLevel int + stanMemory string ) -func addPHPAnalyseCommand(parent *cobra.Command) { - analyseCmd := &cobra.Command{ - Use: "analyse [paths...]", - Short: i18n.T("cmd.php.analyse.short"), - Long: i18n.T("cmd.php.analyse.long"), +func addPHPStanCommand(parent *cobra.Command) { + stanCmd := &cobra.Command{ + Use: "stan [paths...]", + Aliases: []string{"analyse"}, + Short: i18n.T("cmd.php.analyse.short"), + Long: i18n.T("cmd.php.analyse.long"), RunE: func(cmd *cobra.Command, args []string) error { cwd, err := os.Getwd() if err != nil { @@ -169,8 +170,8 @@ func addPHPAnalyseCommand(parent *cobra.Command) { opts := phppkg.AnalyseOptions{ Dir: cwd, - Level: analyseLevel, - Memory: analyseMemory, + Level: stanLevel, + Memory: stanMemory, Output: os.Stdout, } @@ -188,10 +189,10 @@ func addPHPAnalyseCommand(parent *cobra.Command) { }, } - analyseCmd.Flags().IntVar(&analyseLevel, "level", 0, i18n.T("cmd.php.analyse.flag.level")) - analyseCmd.Flags().StringVar(&analyseMemory, "memory", "", i18n.T("cmd.php.analyse.flag.memory")) + stanCmd.Flags().IntVar(&stanLevel, "level", 0, i18n.T("cmd.php.analyse.flag.level")) + stanCmd.Flags().StringVar(&stanMemory, "memory", "", i18n.T("cmd.php.analyse.flag.memory")) - parent.AddCommand(analyseCmd) + parent.AddCommand(stanCmd) } // ============================================================================= @@ -588,7 +589,7 @@ func getQAFixCommand(checkName string, fixEnabled bool) string { return "" } return "core php fmt --fix" - case "analyse": + case "stan": return i18n.T("cmd.php.qa.fix_phpstan") case "psalm": return i18n.T("cmd.php.qa.fix_psalm") diff --git a/cmd/php/qa_runner.go b/cmd/php/qa_runner.go index 2a78c96..eb199bf 100644 --- a/cmd/php/qa_runner.go +++ b/cmd/php/qa_runner.go @@ -102,7 +102,7 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec { } return nil - case "analyse": + case "stan": _, found := phppkg.DetectAnalyser(r.dir) if !found { return nil @@ -113,7 +113,7 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec { cmd = vendorBin } return &process.RunSpec{ - Name: "analyse", + Name: "stan", Command: cmd, Args: []string{"analyse", "--no-progress"}, Dir: r.dir, @@ -139,7 +139,7 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec { Command: cmd, Args: args, Dir: r.dir, - After: []string{"analyse"}, + After: []string{"stan"}, } case "test": @@ -156,8 +156,8 @@ func (r *QARunner) buildSpec(check string) *process.RunSpec { return nil } - // Tests depend on analyse (or psalm if available) - after := []string{"analyse"} + // Tests depend on stan (or psalm if available) + after := []string{"stan"} if _, found := phppkg.DetectPsalm(r.dir); found { after = []string{"psalm"} } @@ -323,7 +323,7 @@ func (r QACheckRunResult) GetIssueMessage() string { return i18n.T("cmd.php.qa.issue_audit") case "fmt": return i18n.T("cmd.php.qa.issue_style") - case "analyse": + case "stan": return i18n.T("cmd.php.qa.issue_analysis") case "psalm": return i18n.T("cmd.php.qa.issue_types") diff --git a/pkg/php/quality.go b/pkg/php/quality.go index 5237408..e071a84 100644 --- a/pkg/php/quality.go +++ b/pkg/php/quality.go @@ -705,7 +705,7 @@ func GetQAStages(opts QAOptions) []QAStage { func GetQAChecks(dir string, stage QAStage) []string { switch stage { case QAStageQuick: - checks := []string{"audit", "fmt", "analyse"} + checks := []string{"audit", "fmt", "stan"} return checks case QAStageStandard: checks := []string{} diff --git a/pkg/php/quality_test.go b/pkg/php/quality_test.go index a465dcc..710e3fa 100644 --- a/pkg/php/quality_test.go +++ b/pkg/php/quality_test.go @@ -345,7 +345,7 @@ func TestGetQAChecks_Good(t *testing.T) { checks := GetQAChecks(dir, QAStageQuick) assert.Contains(t, checks, "audit") assert.Contains(t, checks, "fmt") - assert.Contains(t, checks, "analyse") + assert.Contains(t, checks, "stan") }) t.Run("standard stage includes test", func(t *testing.T) {