Skip to content

Commit 4a314c4

Browse files
committed
Use symfony/console constants
1 parent 42e7419 commit 4a314c4

File tree

8 files changed

+22
-21
lines changed

8 files changed

+22
-21
lines changed

src/Commands/AddCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9191
$outputContent = "<info>Added persona <comment>{$persona}</comment>.</info>";
9292
$output->writeln($outputContent);
9393

94-
return 0;
94+
return self::SUCCESS;
9595
}
9696

9797
throw new CommandFailed("Failed to add persona {$persona}.");
9898
} catch (Exception $e) {
9999
$error = "<error>Error:</error> " . $e->getInforizedMessage();
100100
$output->writeln($error);
101101

102-
return 1;
102+
return self::FAILURE;
103103
}
104104
}
105105
}

src/Commands/ExportCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
106106
. "<comment>{$gubDotfile}</comment>.</info>";
107107
$output->writeln($outputContent);
108108

109-
return 0;
109+
return self::SUCCESS;
110110
}
111111

112112
throw new CommandFailed("Failed to export persona {$persona}.");
113113
} catch (Exception $e) {
114114
$error = "<error>Error:</error> " . $e->getInforizedMessage();
115115
$output->writeln($error);
116116

117-
return 1;
117+
return self::FAILURE;
118118
}
119119
}
120120
}

src/Commands/ImportCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
105105
$error = "<error>Error:</error> " . $e->getInforizedMessage();
106106
$output->writeln($error);
107107

108-
return 1;
108+
return self::FAILURE;
109109
}
110110
}
111111

@@ -124,7 +124,7 @@ private function importFromGubDotfile(OutputInterface $output): int
124124
. "from <comment>{$gubDotfile}</comment>.</info>";
125125
$output->writeln($outputContent);
126126

127-
return 0;
127+
return self::SUCCESS;
128128
}
129129

130130
$exceptionMessage = "Failed to import persona '{$persona}' "
@@ -134,7 +134,7 @@ private function importFromGubDotfile(OutputInterface $output): int
134134
$error = "<error>Error:</error> " . $e->getInforizedMessage();
135135
$output->writeln($error);
136136

137-
return 1;
137+
return self::FAILURE;
138138
}
139139
}
140140

@@ -158,7 +158,7 @@ private function importFromRepository(InputInterface $input, OutputInterface $ou
158158
. "<comment>{$directory}</comment>.</info>";
159159
$output->writeln($outputContent);
160160

161-
return 0;
161+
return self::SUCCESS;
162162
}
163163

164164
$exceptionMessage = "Failed to import persona '{$persona}' "
@@ -168,7 +168,7 @@ private function importFromRepository(InputInterface $input, OutputInterface $ou
168168
$error = "<error>Error:</error> " . $e->getInforizedMessage();
169169
$output->writeln($error);
170170

171-
return 1;
171+
return self::FAILURE;
172172
}
173173
}
174174
}

src/Commands/PairCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
100100
. "'{$pair}'</comment>.</info>";
101101
$output->writeln($outputContent);
102102

103-
return 0;
103+
return self::SUCCESS;
104104
}
105105

106106
throw new CommandFailed("Failed to set pair '{$pair}'.");
107107
} catch (Exception $e) {
108108
$error = "<error>Error:</error> " . $e->getInforizedMessage();
109109
$output->writeln($error);
110110

111-
return 1;
111+
return self::FAILURE;
112112
}
113113
}
114114
}

src/Commands/PersonasCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7474
if (file_exists(STORAGE_FILE)) {
7575
system($editor . ' ' . STORAGE_FILE . ((new OsHelper())->isWindows() ? '' : ' > `tty`'));
7676

77-
return 0;
77+
return self::SUCCESS;
7878
}
7979

8080
$error = '<error>Error:</error> No personas defined yet '
@@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8383
. 'command to define some.';
8484
$output->writeln($error);
8585

86-
return 1;
86+
return self::FAILURE;
8787
}
8888

8989
$personas = $this->storage->all();
@@ -93,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9393
. 'command to define some.';
9494
$output->writeln($error);
9595

96-
return 1;
96+
return self::FAILURE;
9797
}
9898

9999
$this->renderTable($output, $personas);

src/Commands/RetireCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969
$outputContent = "<info>Retired persona <comment>{$persona}</comment>.</info>";
7070
$output->writeln($outputContent);
7171

72-
return 0;
72+
return self::SUCCESS;
7373
}
7474

7575
throw new CommandFailed("Failed to retire persona {$persona}.");
7676
} catch (Exception $e) {
7777
$error = "<error>Error:</error> " . $e->getInforizedMessage();
7878
$output->writeln($error);
7979

80-
return 1;
80+
return self::FAILURE;
8181
}
8282
}
8383
}

src/Commands/UseCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
158158

159159
$output->writeln($outputContent);
160160

161-
return 0;
161+
return self::SUCCESS;
162162
}
163163

164164
throw new CommandFailed("Failed to set persona '{$persona}'.");
165165
} catch (Exception $e) {
166166
$error = "<error>Error:</error> " . $e->getInforizedMessage();
167167
$output->writeln($error);
168168

169-
return 1;
169+
return self::FAILURE;
170170
}
171171
}
172172

@@ -215,7 +215,8 @@ private function useFromGubDotfile(
215215
$outputContent = "<info>Set <comment>{$personaFromGubDotfile}</comment>"
216216
. " from <comment>{$gubDotfile}</comment>.</info>";
217217
$output->writeln($outputContent);
218-
return 0;
218+
219+
return self::SUCCESS;
219220
}
220221

221222
$exceptionMessage = "Failed to set persona '{$personaFromGubDotfile}' "
@@ -225,7 +226,7 @@ private function useFromGubDotfile(
225226
$error = "<error>Error:</error> " . $e->getInforizedMessage();
226227
$output->writeln($error);
227228

228-
return 1;
229+
return self::FAILURE;
229230
}
230231
}
231232
}

src/Commands/WhoamiCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9999
$error = "<error>Error:</error> " . $e->getInforizedMessage();
100100
$output->writeln($error);
101101

102-
return 1;
102+
return self::FAILURE;
103103
}
104104
}
105105
}

0 commit comments

Comments
 (0)