@@ -127,6 +127,7 @@ class Configuration
127127 private $ presenter ;
128128 private $ autoCompleter ;
129129 private $ checker ;
130+ /** @deprecated */
130131 private $ prompt ;
131132 private $ configPaths ;
132133
@@ -1628,11 +1629,19 @@ public function getStartupMessage()
16281629 /**
16291630 * Set the prompt.
16301631 *
1631- * @param string $prompt
1632+ * @deprecated The `prompt` configuration has been replaced by Themes and support will
1633+ * eventually be removed. In the meantime, prompt is applied first by the Theme, then overridden
1634+ * by any explicitly defined prompt.
1635+ *
1636+ * Note that providing a prompt but not a theme config will implicitly use the `classic` theme.
16321637 */
16331638 public function setPrompt (string $ prompt )
16341639 {
16351640 $ this ->prompt = $ prompt ;
1641+
1642+ if (isset ($ this ->theme )) {
1643+ $ this ->theme ->setPrompt ($ prompt );
1644+ }
16361645 }
16371646
16381647 /**
@@ -1676,6 +1685,10 @@ public function setTheme($theme)
16761685
16771686 $ this ->theme = $ theme ;
16781687
1688+ if (isset ($ this ->prompt )) {
1689+ $ this ->theme ->setPrompt ($ this ->prompt );
1690+ }
1691+
16791692 if (isset ($ this ->output )) {
16801693 $ this ->output ->setTheme ($ theme );
16811694 $ this ->applyFormatterStyles ();
@@ -1688,7 +1701,12 @@ public function setTheme($theme)
16881701 public function theme (): Theme
16891702 {
16901703 if (!isset ($ this ->theme )) {
1691- $ this ->theme = new Theme ();
1704+ // If a prompt is explicitly set, and a theme is not, base it on the `classic` theme.
1705+ $ this ->theme = $ this ->prompt ? new Theme ('classic ' ) : new Theme ();
1706+ }
1707+
1708+ if (isset ($ this ->prompt )) {
1709+ $ this ->theme ->setPrompt ($ this ->prompt );
16921710 }
16931711
16941712 return $ this ->theme ;
0 commit comments