@@ -15,195 +15,195 @@ |
||
15 | 15 | |
16 | 16 | class Index extends AbstractAsset implements Constraint |
17 | 17 | { |
18 | - /** |
|
19 | - * Asset identifier instances of the column names the index is associated with. |
|
20 | - * array($columnName => Identifier) |
|
21 | - * |
|
22 | - * @var Identifier[] |
|
23 | - */ |
|
24 | - protected $_columns = []; |
|
25 | - |
|
26 | - /** @var bool */ |
|
27 | - protected $_isUnique = false; |
|
28 | - |
|
29 | - /** @var bool */ |
|
30 | - protected $_isPrimary = false; |
|
31 | - |
|
32 | - /** |
|
33 | - * Platform specific flags for indexes. |
|
34 | - * array($flagName => true) |
|
35 | - * |
|
36 | - * @var true[] |
|
37 | - */ |
|
38 | - protected $_flags = []; |
|
39 | - |
|
40 | - /** |
|
41 | - * @param string $name |
|
42 | - * @param string[] $columns |
|
43 | - * @param bool $isUnique |
|
44 | - * @param bool $isPrimary |
|
45 | - * @param string[] $flags |
|
46 | - * @param mixed[] $options |
|
47 | - */ |
|
48 | - public function __construct($name, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = []) |
|
49 | - { |
|
50 | - } |
|
51 | - |
|
52 | - /** @throws InvalidArgumentException */ |
|
53 | - protected function _addColumn(string $column): void |
|
54 | - { |
|
55 | - } |
|
56 | - |
|
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - */ |
|
60 | - public function getColumns() |
|
61 | - { |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * {@inheritDoc} |
|
66 | - */ |
|
67 | - public function getQuotedColumns(AbstractPlatform $platform) |
|
68 | - { |
|
69 | - } |
|
70 | - |
|
71 | - /** @return string[] */ |
|
72 | - public function getUnquotedColumns() |
|
73 | - { |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * Is the index neither unique nor primary key? |
|
78 | - * |
|
79 | - * @return bool |
|
80 | - */ |
|
81 | - public function isSimpleIndex() |
|
82 | - { |
|
83 | - } |
|
84 | - |
|
85 | - /** @return bool */ |
|
86 | - public function isUnique() |
|
87 | - { |
|
88 | - } |
|
89 | - |
|
90 | - /** @return bool */ |
|
91 | - public function isPrimary() |
|
92 | - { |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * @param string $name |
|
97 | - * @param int $pos |
|
98 | - * |
|
99 | - * @return bool |
|
100 | - */ |
|
101 | - public function hasColumnAtPosition($name, $pos = 0) |
|
102 | - { |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Checks if this index exactly spans the given column names in the correct order. |
|
107 | - * |
|
108 | - * @param string[] $columnNames |
|
109 | - * |
|
110 | - * @return bool |
|
111 | - */ |
|
112 | - public function spansColumns(array $columnNames) |
|
113 | - { |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * Keeping misspelled function name for backwards compatibility |
|
118 | - * |
|
119 | - * @deprecated Use {@see isFulfilledBy()} instead. |
|
120 | - * |
|
121 | - * @return bool |
|
122 | - */ |
|
123 | - public function isFullfilledBy(Index $other) |
|
124 | - { |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * Checks if the other index already fulfills all the indexing and constraint needs of the current one. |
|
129 | - */ |
|
130 | - public function isFulfilledBy(Index $other): bool |
|
131 | - { |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * Detects if the other index is a non-unique, non primary index that can be overwritten by this one. |
|
136 | - * |
|
137 | - * @return bool |
|
138 | - */ |
|
139 | - public function overrules(Index $other) |
|
140 | - { |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Returns platform specific flags for indexes. |
|
145 | - * |
|
146 | - * @return string[] |
|
147 | - */ |
|
148 | - public function getFlags() |
|
149 | - { |
|
150 | - } |
|
151 | - |
|
152 | - /** |
|
153 | - * Adds Flag for an index that translates to platform specific handling. |
|
154 | - * |
|
155 | - * @param string $flag |
|
156 | - * |
|
157 | - * @return Index |
|
158 | - * |
|
159 | - * @example $index->addFlag('CLUSTERED') |
|
160 | - */ |
|
161 | - public function addFlag($flag) |
|
162 | - { |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Does this index have a specific flag? |
|
167 | - * |
|
168 | - * @param string $flag |
|
169 | - * |
|
170 | - * @return bool |
|
171 | - */ |
|
172 | - public function hasFlag($flag) |
|
173 | - { |
|
174 | - } |
|
175 | - |
|
176 | - /** |
|
177 | - * Removes a flag. |
|
178 | - * |
|
179 | - * @param string $flag |
|
180 | - * |
|
181 | - * @return void |
|
182 | - */ |
|
183 | - public function removeFlag($flag) |
|
184 | - { |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
188 | - * @param string $name |
|
189 | - * |
|
190 | - * @return bool |
|
191 | - */ |
|
192 | - public function hasOption($name) |
|
193 | - { |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * @param string $name |
|
198 | - * |
|
199 | - * @return mixed |
|
200 | - */ |
|
201 | - public function getOption($name) |
|
202 | - { |
|
203 | - } |
|
204 | - |
|
205 | - /** @return mixed[] */ |
|
206 | - public function getOptions() |
|
207 | - { |
|
208 | - } |
|
18 | + /** |
|
19 | + * Asset identifier instances of the column names the index is associated with. |
|
20 | + * array($columnName => Identifier) |
|
21 | + * |
|
22 | + * @var Identifier[] |
|
23 | + */ |
|
24 | + protected $_columns = []; |
|
25 | + |
|
26 | + /** @var bool */ |
|
27 | + protected $_isUnique = false; |
|
28 | + |
|
29 | + /** @var bool */ |
|
30 | + protected $_isPrimary = false; |
|
31 | + |
|
32 | + /** |
|
33 | + * Platform specific flags for indexes. |
|
34 | + * array($flagName => true) |
|
35 | + * |
|
36 | + * @var true[] |
|
37 | + */ |
|
38 | + protected $_flags = []; |
|
39 | + |
|
40 | + /** |
|
41 | + * @param string $name |
|
42 | + * @param string[] $columns |
|
43 | + * @param bool $isUnique |
|
44 | + * @param bool $isPrimary |
|
45 | + * @param string[] $flags |
|
46 | + * @param mixed[] $options |
|
47 | + */ |
|
48 | + public function __construct($name, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = []) |
|
49 | + { |
|
50 | + } |
|
51 | + |
|
52 | + /** @throws InvalidArgumentException */ |
|
53 | + protected function _addColumn(string $column): void |
|
54 | + { |
|
55 | + } |
|
56 | + |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + */ |
|
60 | + public function getColumns() |
|
61 | + { |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * {@inheritDoc} |
|
66 | + */ |
|
67 | + public function getQuotedColumns(AbstractPlatform $platform) |
|
68 | + { |
|
69 | + } |
|
70 | + |
|
71 | + /** @return string[] */ |
|
72 | + public function getUnquotedColumns() |
|
73 | + { |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * Is the index neither unique nor primary key? |
|
78 | + * |
|
79 | + * @return bool |
|
80 | + */ |
|
81 | + public function isSimpleIndex() |
|
82 | + { |
|
83 | + } |
|
84 | + |
|
85 | + /** @return bool */ |
|
86 | + public function isUnique() |
|
87 | + { |
|
88 | + } |
|
89 | + |
|
90 | + /** @return bool */ |
|
91 | + public function isPrimary() |
|
92 | + { |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * @param string $name |
|
97 | + * @param int $pos |
|
98 | + * |
|
99 | + * @return bool |
|
100 | + */ |
|
101 | + public function hasColumnAtPosition($name, $pos = 0) |
|
102 | + { |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Checks if this index exactly spans the given column names in the correct order. |
|
107 | + * |
|
108 | + * @param string[] $columnNames |
|
109 | + * |
|
110 | + * @return bool |
|
111 | + */ |
|
112 | + public function spansColumns(array $columnNames) |
|
113 | + { |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * Keeping misspelled function name for backwards compatibility |
|
118 | + * |
|
119 | + * @deprecated Use {@see isFulfilledBy()} instead. |
|
120 | + * |
|
121 | + * @return bool |
|
122 | + */ |
|
123 | + public function isFullfilledBy(Index $other) |
|
124 | + { |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * Checks if the other index already fulfills all the indexing and constraint needs of the current one. |
|
129 | + */ |
|
130 | + public function isFulfilledBy(Index $other): bool |
|
131 | + { |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * Detects if the other index is a non-unique, non primary index that can be overwritten by this one. |
|
136 | + * |
|
137 | + * @return bool |
|
138 | + */ |
|
139 | + public function overrules(Index $other) |
|
140 | + { |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Returns platform specific flags for indexes. |
|
145 | + * |
|
146 | + * @return string[] |
|
147 | + */ |
|
148 | + public function getFlags() |
|
149 | + { |
|
150 | + } |
|
151 | + |
|
152 | + /** |
|
153 | + * Adds Flag for an index that translates to platform specific handling. |
|
154 | + * |
|
155 | + * @param string $flag |
|
156 | + * |
|
157 | + * @return Index |
|
158 | + * |
|
159 | + * @example $index->addFlag('CLUSTERED') |
|
160 | + */ |
|
161 | + public function addFlag($flag) |
|
162 | + { |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Does this index have a specific flag? |
|
167 | + * |
|
168 | + * @param string $flag |
|
169 | + * |
|
170 | + * @return bool |
|
171 | + */ |
|
172 | + public function hasFlag($flag) |
|
173 | + { |
|
174 | + } |
|
175 | + |
|
176 | + /** |
|
177 | + * Removes a flag. |
|
178 | + * |
|
179 | + * @param string $flag |
|
180 | + * |
|
181 | + * @return void |
|
182 | + */ |
|
183 | + public function removeFlag($flag) |
|
184 | + { |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | + * @param string $name |
|
189 | + * |
|
190 | + * @return bool |
|
191 | + */ |
|
192 | + public function hasOption($name) |
|
193 | + { |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * @param string $name |
|
198 | + * |
|
199 | + * @return mixed |
|
200 | + */ |
|
201 | + public function getOption($name) |
|
202 | + { |
|
203 | + } |
|
204 | + |
|
205 | + /** @return mixed[] */ |
|
206 | + public function getOptions() |
|
207 | + { |
|
208 | + } |
|
209 | 209 | } |
@@ -25,147 +25,147 @@ |
||
25 | 25 | */ |
26 | 26 | abstract class AbstractAsset |
27 | 27 | { |
28 | - /** @var string */ |
|
29 | - protected $_name = ''; |
|
30 | - |
|
31 | - /** |
|
32 | - * Namespace of the asset. If none isset the default namespace is assumed. |
|
33 | - * |
|
34 | - * @var string|null |
|
35 | - */ |
|
36 | - protected $_namespace; |
|
37 | - |
|
38 | - /** @var bool */ |
|
39 | - protected $_quoted = false; |
|
40 | - |
|
41 | - /** |
|
42 | - * Sets the name of this asset. |
|
43 | - * |
|
44 | - * @param string $name |
|
45 | - * |
|
46 | - * @return void |
|
47 | - */ |
|
48 | - protected function _setName($name) |
|
49 | - { |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Is this asset in the default namespace? |
|
54 | - * |
|
55 | - * @param string $defaultNamespaceName |
|
56 | - * |
|
57 | - * @return bool |
|
58 | - */ |
|
59 | - public function isInDefaultNamespace($defaultNamespaceName) |
|
60 | - { |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Gets the namespace name of this asset. |
|
65 | - * |
|
66 | - * If NULL is returned this means the default namespace is used. |
|
67 | - * |
|
68 | - * @return string|null |
|
69 | - */ |
|
70 | - public function getNamespaceName() |
|
71 | - { |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * The shortest name is stripped of the default namespace. All other |
|
76 | - * namespaced elements are returned as full-qualified names. |
|
77 | - * |
|
78 | - * @param string|null $defaultNamespaceName |
|
79 | - * |
|
80 | - * @return string |
|
81 | - */ |
|
82 | - public function getShortestName($defaultNamespaceName) |
|
83 | - { |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * The normalized name is full-qualified and lower-cased. Lower-casing is |
|
88 | - * actually wrong, but we have to do it to keep our sanity. If you are |
|
89 | - * using database objects that only differentiate in the casing (FOO vs |
|
90 | - * Foo) then you will NOT be able to use Doctrine Schema abstraction. |
|
91 | - * |
|
92 | - * Every non-namespaced element is prefixed with the default namespace |
|
93 | - * name which is passed as argument to this method. |
|
94 | - * |
|
95 | - * @deprecated Use {@see getNamespaceName()} and {@see getName()} instead. |
|
96 | - * |
|
97 | - * @param string $defaultNamespaceName |
|
98 | - * |
|
99 | - * @return string |
|
100 | - */ |
|
101 | - public function getFullQualifiedName($defaultNamespaceName) |
|
102 | - { |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Checks if this asset's name is quoted. |
|
107 | - * |
|
108 | - * @return bool |
|
109 | - */ |
|
110 | - public function isQuoted() |
|
111 | - { |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Checks if this identifier is quoted. |
|
116 | - * |
|
117 | - * @param string $identifier |
|
118 | - * |
|
119 | - * @return bool |
|
120 | - */ |
|
121 | - protected function isIdentifierQuoted($identifier) |
|
122 | - { |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Trim quotes from the identifier. |
|
127 | - * |
|
128 | - * @param string $identifier |
|
129 | - * |
|
130 | - * @return string |
|
131 | - */ |
|
132 | - protected function trimQuotes($identifier) |
|
133 | - { |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Returns the name of this schema asset. |
|
138 | - * |
|
139 | - * @return string |
|
140 | - */ |
|
141 | - public function getName() |
|
142 | - { |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Gets the quoted representation of this asset but only if it was defined with one. Otherwise |
|
147 | - * return the plain unquoted value as inserted. |
|
148 | - * |
|
149 | - * @return string |
|
150 | - */ |
|
151 | - public function getQuotedName(AbstractPlatform $platform) |
|
152 | - { |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Generates an identifier from a list of column names obeying a certain string length. |
|
157 | - * |
|
158 | - * This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, |
|
159 | - * however building idents automatically for foreign keys, composite keys or such can easily create |
|
160 | - * very long names. |
|
161 | - * |
|
162 | - * @param string[] $columnNames |
|
163 | - * @param string $prefix |
|
164 | - * @param int $maxSize |
|
165 | - * |
|
166 | - * @return string |
|
167 | - */ |
|
168 | - protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) |
|
169 | - { |
|
170 | - } |
|
28 | + /** @var string */ |
|
29 | + protected $_name = ''; |
|
30 | + |
|
31 | + /** |
|
32 | + * Namespace of the asset. If none isset the default namespace is assumed. |
|
33 | + * |
|
34 | + * @var string|null |
|
35 | + */ |
|
36 | + protected $_namespace; |
|
37 | + |
|
38 | + /** @var bool */ |
|
39 | + protected $_quoted = false; |
|
40 | + |
|
41 | + /** |
|
42 | + * Sets the name of this asset. |
|
43 | + * |
|
44 | + * @param string $name |
|
45 | + * |
|
46 | + * @return void |
|
47 | + */ |
|
48 | + protected function _setName($name) |
|
49 | + { |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Is this asset in the default namespace? |
|
54 | + * |
|
55 | + * @param string $defaultNamespaceName |
|
56 | + * |
|
57 | + * @return bool |
|
58 | + */ |
|
59 | + public function isInDefaultNamespace($defaultNamespaceName) |
|
60 | + { |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Gets the namespace name of this asset. |
|
65 | + * |
|
66 | + * If NULL is returned this means the default namespace is used. |
|
67 | + * |
|
68 | + * @return string|null |
|
69 | + */ |
|
70 | + public function getNamespaceName() |
|
71 | + { |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * The shortest name is stripped of the default namespace. All other |
|
76 | + * namespaced elements are returned as full-qualified names. |
|
77 | + * |
|
78 | + * @param string|null $defaultNamespaceName |
|
79 | + * |
|
80 | + * @return string |
|
81 | + */ |
|
82 | + public function getShortestName($defaultNamespaceName) |
|
83 | + { |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * The normalized name is full-qualified and lower-cased. Lower-casing is |
|
88 | + * actually wrong, but we have to do it to keep our sanity. If you are |
|
89 | + * using database objects that only differentiate in the casing (FOO vs |
|
90 | + * Foo) then you will NOT be able to use Doctrine Schema abstraction. |
|
91 | + * |
|
92 | + * Every non-namespaced element is prefixed with the default namespace |
|
93 | + * name which is passed as argument to this method. |
|
94 | + * |
|
95 | + * @deprecated Use {@see getNamespaceName()} and {@see getName()} instead. |
|
96 | + * |
|
97 | + * @param string $defaultNamespaceName |
|
98 | + * |
|
99 | + * @return string |
|
100 | + */ |
|
101 | + public function getFullQualifiedName($defaultNamespaceName) |
|
102 | + { |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Checks if this asset's name is quoted. |
|
107 | + * |
|
108 | + * @return bool |
|
109 | + */ |
|
110 | + public function isQuoted() |
|
111 | + { |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Checks if this identifier is quoted. |
|
116 | + * |
|
117 | + * @param string $identifier |
|
118 | + * |
|
119 | + * @return bool |
|
120 | + */ |
|
121 | + protected function isIdentifierQuoted($identifier) |
|
122 | + { |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Trim quotes from the identifier. |
|
127 | + * |
|
128 | + * @param string $identifier |
|
129 | + * |
|
130 | + * @return string |
|
131 | + */ |
|
132 | + protected function trimQuotes($identifier) |
|
133 | + { |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * Returns the name of this schema asset. |
|
138 | + * |
|
139 | + * @return string |
|
140 | + */ |
|
141 | + public function getName() |
|
142 | + { |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Gets the quoted representation of this asset but only if it was defined with one. Otherwise |
|
147 | + * return the plain unquoted value as inserted. |
|
148 | + * |
|
149 | + * @return string |
|
150 | + */ |
|
151 | + public function getQuotedName(AbstractPlatform $platform) |
|
152 | + { |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Generates an identifier from a list of column names obeying a certain string length. |
|
157 | + * |
|
158 | + * This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, |
|
159 | + * however building idents automatically for foreign keys, composite keys or such can easily create |
|
160 | + * very long names. |
|
161 | + * |
|
162 | + * @param string[] $columnNames |
|
163 | + * @param string $prefix |
|
164 | + * @param int $maxSize |
|
165 | + * |
|
166 | + * @return string |
|
167 | + */ |
|
168 | + protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) |
|
169 | + { |
|
170 | + } |
|
171 | 171 | } |
@@ -34,409 +34,409 @@ |
||
34 | 34 | */ |
35 | 35 | class Command |
36 | 36 | { |
37 | - // see https://tldp.org/LDP/abs/html/exitcodes.html |
|
38 | - public const SUCCESS = 0; |
|
39 | - public const FAILURE = 1; |
|
40 | - public const INVALID = 2; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var string|null The default command name |
|
44 | - * |
|
45 | - * @deprecated since Symfony 6.1, use the AsCommand attribute instead |
|
46 | - */ |
|
47 | - protected static $defaultName; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string|null The default command description |
|
51 | - * |
|
52 | - * @deprecated since Symfony 6.1, use the AsCommand attribute instead |
|
53 | - */ |
|
54 | - protected static $defaultDescription; |
|
55 | - |
|
56 | - public static function getDefaultName(): ?string |
|
57 | - { |
|
58 | - } |
|
59 | - |
|
60 | - public static function getDefaultDescription(): ?string |
|
61 | - { |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * @param string|null $name The name of the command; passing null means it must be set in configure() |
|
66 | - * |
|
67 | - * @throws LogicException When the command name is empty |
|
68 | - */ |
|
69 | - public function __construct(?string $name = null) |
|
70 | - { |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * Ignores validation errors. |
|
75 | - * |
|
76 | - * This is mainly useful for the help command. |
|
77 | - * |
|
78 | - * @return void |
|
79 | - */ |
|
80 | - public function ignoreValidationErrors() |
|
81 | - { |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * @return void |
|
86 | - */ |
|
87 | - public function setApplication(?Application $application = null) |
|
88 | - { |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return void |
|
93 | - */ |
|
94 | - public function setHelperSet(HelperSet $helperSet) |
|
95 | - { |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Gets the helper set. |
|
100 | - */ |
|
101 | - public function getHelperSet(): ?HelperSet |
|
102 | - { |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Gets the application instance for this command. |
|
107 | - */ |
|
108 | - public function getApplication(): ?Application |
|
109 | - { |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Checks whether the command is enabled or not in the current environment. |
|
114 | - * |
|
115 | - * Override this to check for x or y and return false if the command cannot |
|
116 | - * run properly under the current conditions. |
|
117 | - * |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - public function isEnabled() |
|
121 | - { |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Configures the current command. |
|
126 | - * |
|
127 | - * @return void |
|
128 | - */ |
|
129 | - protected function configure() |
|
130 | - { |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Executes the current command. |
|
135 | - * |
|
136 | - * This method is not abstract because you can use this class |
|
137 | - * as a concrete class. In this case, instead of defining the |
|
138 | - * execute() method, you set the code to execute by passing |
|
139 | - * a Closure to the setCode() method. |
|
140 | - * |
|
141 | - * @return int 0 if everything went fine, or an exit code |
|
142 | - * |
|
143 | - * @throws LogicException When this abstract method is not implemented |
|
144 | - * |
|
145 | - * @see setCode() |
|
146 | - */ |
|
147 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
148 | - { |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * Interacts with the user. |
|
153 | - * |
|
154 | - * This method is executed before the InputDefinition is validated. |
|
155 | - * This means that this is the only place where the command can |
|
156 | - * interactively ask for values of missing required arguments. |
|
157 | - * |
|
158 | - * @return void |
|
159 | - */ |
|
160 | - protected function interact(InputInterface $input, OutputInterface $output) |
|
161 | - { |
|
162 | - } |
|
163 | - |
|
164 | - /** |
|
165 | - * Initializes the command after the input has been bound and before the input |
|
166 | - * is validated. |
|
167 | - * |
|
168 | - * This is mainly useful when a lot of commands extends one main command |
|
169 | - * where some things need to be initialized based on the input arguments and options. |
|
170 | - * |
|
171 | - * @see InputInterface::bind() |
|
172 | - * @see InputInterface::validate() |
|
173 | - * |
|
174 | - * @return void |
|
175 | - */ |
|
176 | - protected function initialize(InputInterface $input, OutputInterface $output) |
|
177 | - { |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * Runs the command. |
|
182 | - * |
|
183 | - * The code to execute is either defined directly with the |
|
184 | - * setCode() method or by overriding the execute() method |
|
185 | - * in a sub-class. |
|
186 | - * |
|
187 | - * @return int The command exit code |
|
188 | - * |
|
189 | - * @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. |
|
190 | - * |
|
191 | - * @see setCode() |
|
192 | - * @see execute() |
|
193 | - */ |
|
194 | - public function run(InputInterface $input, OutputInterface $output): int |
|
195 | - { |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * Adds suggestions to $suggestions for the current completion input (e.g. option or argument). |
|
200 | - */ |
|
201 | - public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void |
|
202 | - { |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Sets the code to execute when running this command. |
|
207 | - * |
|
208 | - * If this method is used, it overrides the code defined |
|
209 | - * in the execute() method. |
|
210 | - * |
|
211 | - * @param callable $code A callable(InputInterface $input, OutputInterface $output) |
|
212 | - * |
|
213 | - * @return $this |
|
214 | - * |
|
215 | - * @throws InvalidArgumentException |
|
216 | - * |
|
217 | - * @see execute() |
|
218 | - */ |
|
219 | - public function setCode(callable $code): static |
|
220 | - { |
|
221 | - } |
|
222 | - |
|
223 | - /** |
|
224 | - * Merges the application definition with the command definition. |
|
225 | - * |
|
226 | - * This method is not part of public API and should not be used directly. |
|
227 | - * |
|
228 | - * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments |
|
229 | - * |
|
230 | - * @internal |
|
231 | - */ |
|
232 | - public function mergeApplicationDefinition(bool $mergeArgs = true): void |
|
233 | - { |
|
234 | - } |
|
235 | - |
|
236 | - /** |
|
237 | - * Sets an array of argument and option instances. |
|
238 | - * |
|
239 | - * @return $this |
|
240 | - */ |
|
241 | - public function setDefinition(array|InputDefinition $definition): static |
|
242 | - { |
|
243 | - } |
|
244 | - |
|
245 | - /** |
|
246 | - * Gets the InputDefinition attached to this Command. |
|
247 | - */ |
|
248 | - public function getDefinition(): InputDefinition |
|
249 | - { |
|
250 | - } |
|
251 | - |
|
252 | - /** |
|
253 | - * Gets the InputDefinition to be used to create representations of this Command. |
|
254 | - * |
|
255 | - * Can be overridden to provide the original command representation when it would otherwise |
|
256 | - * be changed by merging with the application InputDefinition. |
|
257 | - * |
|
258 | - * This method is not part of public API and should not be used directly. |
|
259 | - */ |
|
260 | - public function getNativeDefinition(): InputDefinition |
|
261 | - { |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * Adds an argument. |
|
266 | - * |
|
267 | - * @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL |
|
268 | - * @param $default The default value (for InputArgument::OPTIONAL mode only) |
|
269 | - * @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion |
|
270 | - * |
|
271 | - * @return $this |
|
272 | - * |
|
273 | - * @throws InvalidArgumentException When argument mode is not valid |
|
274 | - */ |
|
275 | - public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null): static |
|
276 | - { |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * Adds an option. |
|
281 | - * |
|
282 | - * @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
|
283 | - * @param $mode The option mode: One of the InputOption::VALUE_* constants |
|
284 | - * @param $default The default value (must be null for InputOption::VALUE_NONE) |
|
285 | - * @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion |
|
286 | - * |
|
287 | - * @return $this |
|
288 | - * |
|
289 | - * @throws InvalidArgumentException If option mode is invalid or incompatible |
|
290 | - */ |
|
291 | - public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static |
|
292 | - { |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * Sets the name of the command. |
|
297 | - * |
|
298 | - * This method can set both the namespace and the name if |
|
299 | - * you separate them by a colon (:) |
|
300 | - * |
|
301 | - * $command->setName('foo:bar'); |
|
302 | - * |
|
303 | - * @return $this |
|
304 | - * |
|
305 | - * @throws InvalidArgumentException When the name is invalid |
|
306 | - */ |
|
307 | - public function setName(string $name): static |
|
308 | - { |
|
309 | - } |
|
310 | - |
|
311 | - /** |
|
312 | - * Sets the process title of the command. |
|
313 | - * |
|
314 | - * This feature should be used only when creating a long process command, |
|
315 | - * like a daemon. |
|
316 | - * |
|
317 | - * @return $this |
|
318 | - */ |
|
319 | - public function setProcessTitle(string $title): static |
|
320 | - { |
|
321 | - } |
|
322 | - |
|
323 | - /** |
|
324 | - * Returns the command name. |
|
325 | - */ |
|
326 | - public function getName(): ?string |
|
327 | - { |
|
328 | - } |
|
329 | - |
|
330 | - /** |
|
331 | - * @param bool $hidden Whether or not the command should be hidden from the list of commands |
|
332 | - * |
|
333 | - * @return $this |
|
334 | - */ |
|
335 | - public function setHidden(bool $hidden = true): static |
|
336 | - { |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * @return bool whether the command should be publicly shown or not |
|
341 | - */ |
|
342 | - public function isHidden(): bool |
|
343 | - { |
|
344 | - } |
|
345 | - |
|
346 | - /** |
|
347 | - * Sets the description for the command. |
|
348 | - * |
|
349 | - * @return $this |
|
350 | - */ |
|
351 | - public function setDescription(string $description): static |
|
352 | - { |
|
353 | - } |
|
354 | - |
|
355 | - /** |
|
356 | - * Returns the description for the command. |
|
357 | - */ |
|
358 | - public function getDescription(): string |
|
359 | - { |
|
360 | - } |
|
361 | - |
|
362 | - /** |
|
363 | - * Sets the help for the command. |
|
364 | - * |
|
365 | - * @return $this |
|
366 | - */ |
|
367 | - public function setHelp(string $help): static |
|
368 | - { |
|
369 | - } |
|
370 | - |
|
371 | - /** |
|
372 | - * Returns the help for the command. |
|
373 | - */ |
|
374 | - public function getHelp(): string |
|
375 | - { |
|
376 | - } |
|
377 | - |
|
378 | - /** |
|
379 | - * Returns the processed help for the command replacing the %command.name% and |
|
380 | - * %command.full_name% patterns with the real values dynamically. |
|
381 | - */ |
|
382 | - public function getProcessedHelp(): string |
|
383 | - { |
|
384 | - } |
|
385 | - |
|
386 | - /** |
|
387 | - * Sets the aliases for the command. |
|
388 | - * |
|
389 | - * @param string[] $aliases An array of aliases for the command |
|
390 | - * |
|
391 | - * @return $this |
|
392 | - * |
|
393 | - * @throws InvalidArgumentException When an alias is invalid |
|
394 | - */ |
|
395 | - public function setAliases(iterable $aliases): static |
|
396 | - { |
|
397 | - } |
|
398 | - |
|
399 | - /** |
|
400 | - * Returns the aliases for the command. |
|
401 | - */ |
|
402 | - public function getAliases(): array |
|
403 | - { |
|
404 | - } |
|
405 | - |
|
406 | - /** |
|
407 | - * Returns the synopsis for the command. |
|
408 | - * |
|
409 | - * @param bool $short Whether to show the short version of the synopsis (with options folded) or not |
|
410 | - */ |
|
411 | - public function getSynopsis(bool $short = false): string |
|
412 | - { |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Add a command usage example, it'll be prefixed with the command name. |
|
417 | - * |
|
418 | - * @return $this |
|
419 | - */ |
|
420 | - public function addUsage(string $usage): static |
|
421 | - { |
|
422 | - } |
|
423 | - |
|
424 | - /** |
|
425 | - * Returns alternative usages of the command. |
|
426 | - */ |
|
427 | - public function getUsages(): array |
|
428 | - { |
|
429 | - } |
|
430 | - |
|
431 | - /** |
|
432 | - * Gets a helper instance by name. |
|
433 | - * |
|
434 | - * @return HelperInterface |
|
435 | - * |
|
436 | - * @throws LogicException if no HelperSet is defined |
|
437 | - * @throws InvalidArgumentException if the helper is not defined |
|
438 | - */ |
|
439 | - public function getHelper(string $name): mixed |
|
440 | - { |
|
441 | - } |
|
37 | + // see https://tldp.org/LDP/abs/html/exitcodes.html |
|
38 | + public const SUCCESS = 0; |
|
39 | + public const FAILURE = 1; |
|
40 | + public const INVALID = 2; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var string|null The default command name |
|
44 | + * |
|
45 | + * @deprecated since Symfony 6.1, use the AsCommand attribute instead |
|
46 | + */ |
|
47 | + protected static $defaultName; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string|null The default command description |
|
51 | + * |
|
52 | + * @deprecated since Symfony 6.1, use the AsCommand attribute instead |
|
53 | + */ |
|
54 | + protected static $defaultDescription; |
|
55 | + |
|
56 | + public static function getDefaultName(): ?string |
|
57 | + { |
|
58 | + } |
|
59 | + |
|
60 | + public static function getDefaultDescription(): ?string |
|
61 | + { |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * @param string|null $name The name of the command; passing null means it must be set in configure() |
|
66 | + * |
|
67 | + * @throws LogicException When the command name is empty |
|
68 | + */ |
|
69 | + public function __construct(?string $name = null) |
|
70 | + { |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * Ignores validation errors. |
|
75 | + * |
|
76 | + * This is mainly useful for the help command. |
|
77 | + * |
|
78 | + * @return void |
|
79 | + */ |
|
80 | + public function ignoreValidationErrors() |
|
81 | + { |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * @return void |
|
86 | + */ |
|
87 | + public function setApplication(?Application $application = null) |
|
88 | + { |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return void |
|
93 | + */ |
|
94 | + public function setHelperSet(HelperSet $helperSet) |
|
95 | + { |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Gets the helper set. |
|
100 | + */ |
|
101 | + public function getHelperSet(): ?HelperSet |
|
102 | + { |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Gets the application instance for this command. |
|
107 | + */ |
|
108 | + public function getApplication(): ?Application |
|
109 | + { |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Checks whether the command is enabled or not in the current environment. |
|
114 | + * |
|
115 | + * Override this to check for x or y and return false if the command cannot |
|
116 | + * run properly under the current conditions. |
|
117 | + * |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + public function isEnabled() |
|
121 | + { |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Configures the current command. |
|
126 | + * |
|
127 | + * @return void |
|
128 | + */ |
|
129 | + protected function configure() |
|
130 | + { |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Executes the current command. |
|
135 | + * |
|
136 | + * This method is not abstract because you can use this class |
|
137 | + * as a concrete class. In this case, instead of defining the |
|
138 | + * execute() method, you set the code to execute by passing |
|
139 | + * a Closure to the setCode() method. |
|
140 | + * |
|
141 | + * @return int 0 if everything went fine, or an exit code |
|
142 | + * |
|
143 | + * @throws LogicException When this abstract method is not implemented |
|
144 | + * |
|
145 | + * @see setCode() |
|
146 | + */ |
|
147 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
148 | + { |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * Interacts with the user. |
|
153 | + * |
|
154 | + * This method is executed before the InputDefinition is validated. |
|
155 | + * This means that this is the only place where the command can |
|
156 | + * interactively ask for values of missing required arguments. |
|
157 | + * |
|
158 | + * @return void |
|
159 | + */ |
|
160 | + protected function interact(InputInterface $input, OutputInterface $output) |
|
161 | + { |
|
162 | + } |
|
163 | + |
|
164 | + /** |
|
165 | + * Initializes the command after the input has been bound and before the input |
|
166 | + * is validated. |
|
167 | + * |
|
168 | + * This is mainly useful when a lot of commands extends one main command |
|
169 | + * where some things need to be initialized based on the input arguments and options. |
|
170 | + * |
|
171 | + * @see InputInterface::bind() |
|
172 | + * @see InputInterface::validate() |
|
173 | + * |
|
174 | + * @return void |
|
175 | + */ |
|
176 | + protected function initialize(InputInterface $input, OutputInterface $output) |
|
177 | + { |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * Runs the command. |
|
182 | + * |
|
183 | + * The code to execute is either defined directly with the |
|
184 | + * setCode() method or by overriding the execute() method |
|
185 | + * in a sub-class. |
|
186 | + * |
|
187 | + * @return int The command exit code |
|
188 | + * |
|
189 | + * @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. |
|
190 | + * |
|
191 | + * @see setCode() |
|
192 | + * @see execute() |
|
193 | + */ |
|
194 | + public function run(InputInterface $input, OutputInterface $output): int |
|
195 | + { |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * Adds suggestions to $suggestions for the current completion input (e.g. option or argument). |
|
200 | + */ |
|
201 | + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void |
|
202 | + { |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Sets the code to execute when running this command. |
|
207 | + * |
|
208 | + * If this method is used, it overrides the code defined |
|
209 | + * in the execute() method. |
|
210 | + * |
|
211 | + * @param callable $code A callable(InputInterface $input, OutputInterface $output) |
|
212 | + * |
|
213 | + * @return $this |
|
214 | + * |
|
215 | + * @throws InvalidArgumentException |
|
216 | + * |
|
217 | + * @see execute() |
|
218 | + */ |
|
219 | + public function setCode(callable $code): static |
|
220 | + { |
|
221 | + } |
|
222 | + |
|
223 | + /** |
|
224 | + * Merges the application definition with the command definition. |
|
225 | + * |
|
226 | + * This method is not part of public API and should not be used directly. |
|
227 | + * |
|
228 | + * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments |
|
229 | + * |
|
230 | + * @internal |
|
231 | + */ |
|
232 | + public function mergeApplicationDefinition(bool $mergeArgs = true): void |
|
233 | + { |
|
234 | + } |
|
235 | + |
|
236 | + /** |
|
237 | + * Sets an array of argument and option instances. |
|
238 | + * |
|
239 | + * @return $this |
|
240 | + */ |
|
241 | + public function setDefinition(array|InputDefinition $definition): static |
|
242 | + { |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * Gets the InputDefinition attached to this Command. |
|
247 | + */ |
|
248 | + public function getDefinition(): InputDefinition |
|
249 | + { |
|
250 | + } |
|
251 | + |
|
252 | + /** |
|
253 | + * Gets the InputDefinition to be used to create representations of this Command. |
|
254 | + * |
|
255 | + * Can be overridden to provide the original command representation when it would otherwise |
|
256 | + * be changed by merging with the application InputDefinition. |
|
257 | + * |
|
258 | + * This method is not part of public API and should not be used directly. |
|
259 | + */ |
|
260 | + public function getNativeDefinition(): InputDefinition |
|
261 | + { |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * Adds an argument. |
|
266 | + * |
|
267 | + * @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL |
|
268 | + * @param $default The default value (for InputArgument::OPTIONAL mode only) |
|
269 | + * @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion |
|
270 | + * |
|
271 | + * @return $this |
|
272 | + * |
|
273 | + * @throws InvalidArgumentException When argument mode is not valid |
|
274 | + */ |
|
275 | + public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null): static |
|
276 | + { |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * Adds an option. |
|
281 | + * |
|
282 | + * @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts |
|
283 | + * @param $mode The option mode: One of the InputOption::VALUE_* constants |
|
284 | + * @param $default The default value (must be null for InputOption::VALUE_NONE) |
|
285 | + * @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion |
|
286 | + * |
|
287 | + * @return $this |
|
288 | + * |
|
289 | + * @throws InvalidArgumentException If option mode is invalid or incompatible |
|
290 | + */ |
|
291 | + public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static |
|
292 | + { |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * Sets the name of the command. |
|
297 | + * |
|
298 | + * This method can set both the namespace and the name if |
|
299 | + * you separate them by a colon (:) |
|
300 | + * |
|
301 | + * $command->setName('foo:bar'); |
|
302 | + * |
|
303 | + * @return $this |
|
304 | + * |
|
305 | + * @throws InvalidArgumentException When the name is invalid |
|
306 | + */ |
|
307 | + public function setName(string $name): static |
|
308 | + { |
|
309 | + } |
|
310 | + |
|
311 | + /** |
|
312 | + * Sets the process title of the command. |
|
313 | + * |
|
314 | + * This feature should be used only when creating a long process command, |
|
315 | + * like a daemon. |
|
316 | + * |
|
317 | + * @return $this |
|
318 | + */ |
|
319 | + public function setProcessTitle(string $title): static |
|
320 | + { |
|
321 | + } |
|
322 | + |
|
323 | + /** |
|
324 | + * Returns the command name. |
|
325 | + */ |
|
326 | + public function getName(): ?string |
|
327 | + { |
|
328 | + } |
|
329 | + |
|
330 | + /** |
|
331 | + * @param bool $hidden Whether or not the command should be hidden from the list of commands |
|
332 | + * |
|
333 | + * @return $this |
|
334 | + */ |
|
335 | + public function setHidden(bool $hidden = true): static |
|
336 | + { |
|
337 | + } |
|
338 | + |
|
339 | + /** |
|
340 | + * @return bool whether the command should be publicly shown or not |
|
341 | + */ |
|
342 | + public function isHidden(): bool |
|
343 | + { |
|
344 | + } |
|
345 | + |
|
346 | + /** |
|
347 | + * Sets the description for the command. |
|
348 | + * |
|
349 | + * @return $this |
|
350 | + */ |
|
351 | + public function setDescription(string $description): static |
|
352 | + { |
|
353 | + } |
|
354 | + |
|
355 | + /** |
|
356 | + * Returns the description for the command. |
|
357 | + */ |
|
358 | + public function getDescription(): string |
|
359 | + { |
|
360 | + } |
|
361 | + |
|
362 | + /** |
|
363 | + * Sets the help for the command. |
|
364 | + * |
|
365 | + * @return $this |
|
366 | + */ |
|
367 | + public function setHelp(string $help): static |
|
368 | + { |
|
369 | + } |
|
370 | + |
|
371 | + /** |
|
372 | + * Returns the help for the command. |
|
373 | + */ |
|
374 | + public function getHelp(): string |
|
375 | + { |
|
376 | + } |
|
377 | + |
|
378 | + /** |
|
379 | + * Returns the processed help for the command replacing the %command.name% and |
|
380 | + * %command.full_name% patterns with the real values dynamically. |
|
381 | + */ |
|
382 | + public function getProcessedHelp(): string |
|
383 | + { |
|
384 | + } |
|
385 | + |
|
386 | + /** |
|
387 | + * Sets the aliases for the command. |
|
388 | + * |
|
389 | + * @param string[] $aliases An array of aliases for the command |
|
390 | + * |
|
391 | + * @return $this |
|
392 | + * |
|
393 | + * @throws InvalidArgumentException When an alias is invalid |
|
394 | + */ |
|
395 | + public function setAliases(iterable $aliases): static |
|
396 | + { |
|
397 | + } |
|
398 | + |
|
399 | + /** |
|
400 | + * Returns the aliases for the command. |
|
401 | + */ |
|
402 | + public function getAliases(): array |
|
403 | + { |
|
404 | + } |
|
405 | + |
|
406 | + /** |
|
407 | + * Returns the synopsis for the command. |
|
408 | + * |
|
409 | + * @param bool $short Whether to show the short version of the synopsis (with options folded) or not |
|
410 | + */ |
|
411 | + public function getSynopsis(bool $short = false): string |
|
412 | + { |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * Add a command usage example, it'll be prefixed with the command name. |
|
417 | + * |
|
418 | + * @return $this |
|
419 | + */ |
|
420 | + public function addUsage(string $usage): static |
|
421 | + { |
|
422 | + } |
|
423 | + |
|
424 | + /** |
|
425 | + * Returns alternative usages of the command. |
|
426 | + */ |
|
427 | + public function getUsages(): array |
|
428 | + { |
|
429 | + } |
|
430 | + |
|
431 | + /** |
|
432 | + * Gets a helper instance by name. |
|
433 | + * |
|
434 | + * @return HelperInterface |
|
435 | + * |
|
436 | + * @throws LogicException if no HelperSet is defined |
|
437 | + * @throws InvalidArgumentException if the helper is not defined |
|
438 | + */ |
|
439 | + public function getHelper(string $name): mixed |
|
440 | + { |
|
441 | + } |
|
442 | 442 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return $this |
240 | 240 | */ |
241 | - public function setDefinition(array|InputDefinition $definition): static |
|
241 | + public function setDefinition(array | InputDefinition $definition): static |
|
242 | 242 | { |
243 | 243 | } |
244 | 244 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @throws InvalidArgumentException If option mode is invalid or incompatible |
290 | 290 | */ |
291 | - public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static |
|
291 | + public function addOption(string $name, string | array | null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static |
|
292 | 292 | { |
293 | 293 | } |
294 | 294 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $search |
99 | 99 | * @return int|bool |
100 | 100 | */ |
101 | - public function count($search = ''): int|bool |
|
101 | + public function count($search = ''): int | bool |
|
102 | 102 | { |
103 | 103 | } |
104 | 104 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return int|bool |
109 | 109 | */ |
110 | - public function countDisabled(): int|bool |
|
110 | + public function countDisabled(): int | bool |
|
111 | 111 | { |
112 | 112 | } |
113 | 113 |
@@ -18,28 +18,28 @@ |
||
18 | 18 | */ |
19 | 19 | interface HelperInterface |
20 | 20 | { |
21 | - /** |
|
22 | - * Sets the helper set associated with this helper. |
|
23 | - * |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function setHelperSet(?HelperSet $helperSet) |
|
27 | - { |
|
28 | - } |
|
21 | + /** |
|
22 | + * Sets the helper set associated with this helper. |
|
23 | + * |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function setHelperSet(?HelperSet $helperSet) |
|
27 | + { |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Gets the helper set associated with this helper. |
|
32 | - */ |
|
33 | - public function getHelperSet(): ?HelperSet |
|
34 | - { |
|
35 | - } |
|
30 | + /** |
|
31 | + * Gets the helper set associated with this helper. |
|
32 | + */ |
|
33 | + public function getHelperSet(): ?HelperSet |
|
34 | + { |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Returns the canonical name of this helper. |
|
39 | - * |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function getName() |
|
43 | - { |
|
44 | - } |
|
37 | + /** |
|
38 | + * Returns the canonical name of this helper. |
|
39 | + * |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function getName() |
|
43 | + { |
|
44 | + } |
|
45 | 45 | } |
@@ -15,24 +15,24 @@ |
||
15 | 15 | */ |
16 | 16 | class DriverException extends Exception implements TheDriverException |
17 | 17 | { |
18 | - /** |
|
19 | - * @internal |
|
20 | - * |
|
21 | - * @param TheDriverException $driverException The DBAL driver exception to chain. |
|
22 | - * @param Query|null $query The SQL query that triggered the exception, if any. |
|
23 | - */ |
|
24 | - public function __construct(TheDriverException $driverException, ?Query $query) |
|
25 | - { |
|
26 | - } |
|
18 | + /** |
|
19 | + * @internal |
|
20 | + * |
|
21 | + * @param TheDriverException $driverException The DBAL driver exception to chain. |
|
22 | + * @param Query|null $query The SQL query that triggered the exception, if any. |
|
23 | + */ |
|
24 | + public function __construct(TheDriverException $driverException, ?Query $query) |
|
25 | + { |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * {@inheritDoc} |
|
30 | - */ |
|
31 | - public function getSQLState() |
|
32 | - { |
|
33 | - } |
|
28 | + /** |
|
29 | + * {@inheritDoc} |
|
30 | + */ |
|
31 | + public function getSQLState() |
|
32 | + { |
|
33 | + } |
|
34 | 34 | |
35 | - public function getQuery(): ?Query |
|
36 | - { |
|
37 | - } |
|
35 | + public function getQuery(): ?Query |
|
36 | + { |
|
37 | + } |
|
38 | 38 | } |
@@ -22,167 +22,167 @@ |
||
22 | 22 | /** @psalm-immutable */ |
23 | 23 | class SchemaException extends Exception |
24 | 24 | { |
25 | - /** @deprecated Use {@see TableDoesNotExist} instead. */ |
|
26 | - public const TABLE_DOESNT_EXIST = 10; |
|
27 | - |
|
28 | - /** @deprecated Use {@see TableAlreadyExists} instead. */ |
|
29 | - public const TABLE_ALREADY_EXISTS = 20; |
|
30 | - |
|
31 | - /** @deprecated Use {@see ColumnDoesNotExist} instead. */ |
|
32 | - public const COLUMN_DOESNT_EXIST = 30; |
|
33 | - |
|
34 | - /** @deprecated Use {@see ColumnAlreadyExists} instead. */ |
|
35 | - public const COLUMN_ALREADY_EXISTS = 40; |
|
36 | - |
|
37 | - /** @deprecated Use {@see IndexDoesNotExist} instead. */ |
|
38 | - public const INDEX_DOESNT_EXIST = 50; |
|
39 | - |
|
40 | - /** @deprecated Use {@see IndexAlreadyExists} instead. */ |
|
41 | - public const INDEX_ALREADY_EXISTS = 60; |
|
42 | - |
|
43 | - /** @deprecated Use {@see SequenceDoesNotExist} instead. */ |
|
44 | - public const SEQUENCE_DOENST_EXIST = 70; |
|
45 | - |
|
46 | - /** @deprecated Use {@see SequenceAlreadyExists} instead. */ |
|
47 | - public const SEQUENCE_ALREADY_EXISTS = 80; |
|
48 | - |
|
49 | - /** @deprecated Use {@see IndexNameInvalid} instead. */ |
|
50 | - public const INDEX_INVALID_NAME = 90; |
|
51 | - |
|
52 | - /** @deprecated Use {@see ForeignKeyDoesNotExist} instead. */ |
|
53 | - public const FOREIGNKEY_DOESNT_EXIST = 100; |
|
54 | - |
|
55 | - /** @deprecated Use {@see UniqueConstraintDoesNotExist} instead. */ |
|
56 | - public const CONSTRAINT_DOESNT_EXIST = 110; |
|
57 | - |
|
58 | - /** @deprecated Use {@see NamespaceAlreadyExists} instead. */ |
|
59 | - public const NAMESPACE_ALREADY_EXISTS = 120; |
|
60 | - |
|
61 | - /** |
|
62 | - * @param string $tableName |
|
63 | - * |
|
64 | - * @return SchemaException |
|
65 | - */ |
|
66 | - public static function tableDoesNotExist($tableName) |
|
67 | - { |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param string $indexName |
|
72 | - * |
|
73 | - * @return SchemaException |
|
74 | - */ |
|
75 | - public static function indexNameInvalid($indexName) |
|
76 | - { |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @param string $indexName |
|
81 | - * @param string $table |
|
82 | - * |
|
83 | - * @return SchemaException |
|
84 | - */ |
|
85 | - public static function indexDoesNotExist($indexName, $table) |
|
86 | - { |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @param string $indexName |
|
91 | - * @param string $table |
|
92 | - * |
|
93 | - * @return SchemaException |
|
94 | - */ |
|
95 | - public static function indexAlreadyExists($indexName, $table) |
|
96 | - { |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @param string $columnName |
|
101 | - * @param string $table |
|
102 | - * |
|
103 | - * @return SchemaException |
|
104 | - */ |
|
105 | - public static function columnDoesNotExist($columnName, $table) |
|
106 | - { |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @param string $namespaceName |
|
111 | - * |
|
112 | - * @return SchemaException |
|
113 | - */ |
|
114 | - public static function namespaceAlreadyExists($namespaceName) |
|
115 | - { |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @param string $tableName |
|
120 | - * |
|
121 | - * @return SchemaException |
|
122 | - */ |
|
123 | - public static function tableAlreadyExists($tableName) |
|
124 | - { |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * @param string $tableName |
|
129 | - * @param string $columnName |
|
130 | - * |
|
131 | - * @return SchemaException |
|
132 | - */ |
|
133 | - public static function columnAlreadyExists($tableName, $columnName) |
|
134 | - { |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * @param string $name |
|
139 | - * |
|
140 | - * @return SchemaException |
|
141 | - */ |
|
142 | - public static function sequenceAlreadyExists($name) |
|
143 | - { |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @param string $name |
|
148 | - * |
|
149 | - * @return SchemaException |
|
150 | - */ |
|
151 | - public static function sequenceDoesNotExist($name) |
|
152 | - { |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * @param string $constraintName |
|
157 | - * @param string $table |
|
158 | - * |
|
159 | - * @return SchemaException |
|
160 | - */ |
|
161 | - public static function uniqueConstraintDoesNotExist($constraintName, $table) |
|
162 | - { |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @param string $fkName |
|
167 | - * @param string $table |
|
168 | - * |
|
169 | - * @return SchemaException |
|
170 | - */ |
|
171 | - public static function foreignKeyDoesNotExist($fkName, $table) |
|
172 | - { |
|
173 | - } |
|
174 | - |
|
175 | - /** @return SchemaException */ |
|
176 | - public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey) |
|
177 | - { |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * @param string $changeName |
|
182 | - * |
|
183 | - * @return SchemaException |
|
184 | - */ |
|
185 | - public static function alterTableChangeNotSupported($changeName) |
|
186 | - { |
|
187 | - } |
|
25 | + /** @deprecated Use {@see TableDoesNotExist} instead. */ |
|
26 | + public const TABLE_DOESNT_EXIST = 10; |
|
27 | + |
|
28 | + /** @deprecated Use {@see TableAlreadyExists} instead. */ |
|
29 | + public const TABLE_ALREADY_EXISTS = 20; |
|
30 | + |
|
31 | + /** @deprecated Use {@see ColumnDoesNotExist} instead. */ |
|
32 | + public const COLUMN_DOESNT_EXIST = 30; |
|
33 | + |
|
34 | + /** @deprecated Use {@see ColumnAlreadyExists} instead. */ |
|
35 | + public const COLUMN_ALREADY_EXISTS = 40; |
|
36 | + |
|
37 | + /** @deprecated Use {@see IndexDoesNotExist} instead. */ |
|
38 | + public const INDEX_DOESNT_EXIST = 50; |
|
39 | + |
|
40 | + /** @deprecated Use {@see IndexAlreadyExists} instead. */ |
|
41 | + public const INDEX_ALREADY_EXISTS = 60; |
|
42 | + |
|
43 | + /** @deprecated Use {@see SequenceDoesNotExist} instead. */ |
|
44 | + public const SEQUENCE_DOENST_EXIST = 70; |
|
45 | + |
|
46 | + /** @deprecated Use {@see SequenceAlreadyExists} instead. */ |
|
47 | + public const SEQUENCE_ALREADY_EXISTS = 80; |
|
48 | + |
|
49 | + /** @deprecated Use {@see IndexNameInvalid} instead. */ |
|
50 | + public const INDEX_INVALID_NAME = 90; |
|
51 | + |
|
52 | + /** @deprecated Use {@see ForeignKeyDoesNotExist} instead. */ |
|
53 | + public const FOREIGNKEY_DOESNT_EXIST = 100; |
|
54 | + |
|
55 | + /** @deprecated Use {@see UniqueConstraintDoesNotExist} instead. */ |
|
56 | + public const CONSTRAINT_DOESNT_EXIST = 110; |
|
57 | + |
|
58 | + /** @deprecated Use {@see NamespaceAlreadyExists} instead. */ |
|
59 | + public const NAMESPACE_ALREADY_EXISTS = 120; |
|
60 | + |
|
61 | + /** |
|
62 | + * @param string $tableName |
|
63 | + * |
|
64 | + * @return SchemaException |
|
65 | + */ |
|
66 | + public static function tableDoesNotExist($tableName) |
|
67 | + { |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param string $indexName |
|
72 | + * |
|
73 | + * @return SchemaException |
|
74 | + */ |
|
75 | + public static function indexNameInvalid($indexName) |
|
76 | + { |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @param string $indexName |
|
81 | + * @param string $table |
|
82 | + * |
|
83 | + * @return SchemaException |
|
84 | + */ |
|
85 | + public static function indexDoesNotExist($indexName, $table) |
|
86 | + { |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @param string $indexName |
|
91 | + * @param string $table |
|
92 | + * |
|
93 | + * @return SchemaException |
|
94 | + */ |
|
95 | + public static function indexAlreadyExists($indexName, $table) |
|
96 | + { |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @param string $columnName |
|
101 | + * @param string $table |
|
102 | + * |
|
103 | + * @return SchemaException |
|
104 | + */ |
|
105 | + public static function columnDoesNotExist($columnName, $table) |
|
106 | + { |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @param string $namespaceName |
|
111 | + * |
|
112 | + * @return SchemaException |
|
113 | + */ |
|
114 | + public static function namespaceAlreadyExists($namespaceName) |
|
115 | + { |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @param string $tableName |
|
120 | + * |
|
121 | + * @return SchemaException |
|
122 | + */ |
|
123 | + public static function tableAlreadyExists($tableName) |
|
124 | + { |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * @param string $tableName |
|
129 | + * @param string $columnName |
|
130 | + * |
|
131 | + * @return SchemaException |
|
132 | + */ |
|
133 | + public static function columnAlreadyExists($tableName, $columnName) |
|
134 | + { |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * @param string $name |
|
139 | + * |
|
140 | + * @return SchemaException |
|
141 | + */ |
|
142 | + public static function sequenceAlreadyExists($name) |
|
143 | + { |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @param string $name |
|
148 | + * |
|
149 | + * @return SchemaException |
|
150 | + */ |
|
151 | + public static function sequenceDoesNotExist($name) |
|
152 | + { |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * @param string $constraintName |
|
157 | + * @param string $table |
|
158 | + * |
|
159 | + * @return SchemaException |
|
160 | + */ |
|
161 | + public static function uniqueConstraintDoesNotExist($constraintName, $table) |
|
162 | + { |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @param string $fkName |
|
167 | + * @param string $table |
|
168 | + * |
|
169 | + * @return SchemaException |
|
170 | + */ |
|
171 | + public static function foreignKeyDoesNotExist($fkName, $table) |
|
172 | + { |
|
173 | + } |
|
174 | + |
|
175 | + /** @return SchemaException */ |
|
176 | + public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey) |
|
177 | + { |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * @param string $changeName |
|
182 | + * |
|
183 | + * @return SchemaException |
|
184 | + */ |
|
185 | + public static function alterTableChangeNotSupported($changeName) |
|
186 | + { |
|
187 | + } |
|
188 | 188 | } |
@@ -23,500 +23,500 @@ |
||
23 | 23 | */ |
24 | 24 | class Table extends AbstractAsset |
25 | 25 | { |
26 | - /** @var Column[] */ |
|
27 | - protected $_columns = []; |
|
28 | - |
|
29 | - /** @var Index[] */ |
|
30 | - protected $_indexes = []; |
|
31 | - |
|
32 | - /** @var string|null */ |
|
33 | - protected $_primaryKeyName; |
|
34 | - |
|
35 | - /** @var UniqueConstraint[] */ |
|
36 | - protected $uniqueConstraints = []; |
|
37 | - |
|
38 | - /** @var ForeignKeyConstraint[] */ |
|
39 | - protected $_fkConstraints = []; |
|
40 | - |
|
41 | - /** @var mixed[] */ |
|
42 | - protected $_options = [ |
|
43 | - 'create_options' => [], |
|
44 | - ]; |
|
45 | - |
|
46 | - /** @var SchemaConfig|null */ |
|
47 | - protected $_schemaConfig; |
|
48 | - |
|
49 | - /** |
|
50 | - * @param Column[] $columns |
|
51 | - * @param Index[] $indexes |
|
52 | - * @param UniqueConstraint[] $uniqueConstraints |
|
53 | - * @param ForeignKeyConstraint[] $fkConstraints |
|
54 | - * @param mixed[] $options |
|
55 | - * |
|
56 | - * @throws SchemaException |
|
57 | - * @throws Exception |
|
58 | - */ |
|
59 | - public function __construct(string $name, array $columns = [], array $indexes = [], array $uniqueConstraints = [], array $fkConstraints = [], array $options = []) |
|
60 | - { |
|
61 | - } |
|
62 | - |
|
63 | - /** @return void */ |
|
64 | - public function setSchemaConfig(SchemaConfig $schemaConfig) |
|
65 | - { |
|
66 | - } |
|
67 | - |
|
68 | - /** @return int */ |
|
69 | - protected function _getMaxIdentifierLength() |
|
70 | - { |
|
71 | - } |
|
72 | - |
|
73 | - /** |
|
74 | - * Sets the Primary Key. |
|
75 | - * |
|
76 | - * @param string[] $columnNames |
|
77 | - * @param string|false $indexName |
|
78 | - * |
|
79 | - * @return self |
|
80 | - * |
|
81 | - * @throws SchemaException |
|
82 | - */ |
|
83 | - public function setPrimaryKey(array $columnNames, $indexName = false) |
|
84 | - { |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @param string[] $columnNames |
|
89 | - * @param string[] $flags |
|
90 | - * @param mixed[] $options |
|
91 | - * |
|
92 | - * @return self |
|
93 | - * |
|
94 | - * @throws SchemaException |
|
95 | - */ |
|
96 | - public function addIndex(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []) |
|
97 | - { |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @param string[] $columnNames |
|
102 | - * @param string[] $flags |
|
103 | - * @param mixed[] $options |
|
104 | - * |
|
105 | - * @return self |
|
106 | - */ |
|
107 | - public function addUniqueConstraint(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []): Table |
|
108 | - { |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * Drops the primary key from this table. |
|
113 | - * |
|
114 | - * @return void |
|
115 | - * |
|
116 | - * @throws SchemaException |
|
117 | - */ |
|
118 | - public function dropPrimaryKey() |
|
119 | - { |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * Drops an index from this table. |
|
124 | - * |
|
125 | - * @param string $name The index name. |
|
126 | - * |
|
127 | - * @return void |
|
128 | - * |
|
129 | - * @throws SchemaException If the index does not exist. |
|
130 | - */ |
|
131 | - public function dropIndex($name) |
|
132 | - { |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * @param string[] $columnNames |
|
137 | - * @param string|null $indexName |
|
138 | - * @param mixed[] $options |
|
139 | - * |
|
140 | - * @return self |
|
141 | - * |
|
142 | - * @throws SchemaException |
|
143 | - */ |
|
144 | - public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) |
|
145 | - { |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Renames an index. |
|
150 | - * |
|
151 | - * @param string $oldName The name of the index to rename from. |
|
152 | - * @param string|null $newName The name of the index to rename to. |
|
153 | - * If null is given, the index name will be auto-generated. |
|
154 | - * |
|
155 | - * @return self This table instance. |
|
156 | - * |
|
157 | - * @throws SchemaException If no index exists for the given current name |
|
158 | - * or if an index with the given new name already exists on this table. |
|
159 | - */ |
|
160 | - public function renameIndex($oldName, $newName = null) |
|
161 | - { |
|
162 | - } |
|
163 | - |
|
164 | - /** |
|
165 | - * Checks if an index begins in the order of the given columns. |
|
166 | - * |
|
167 | - * @param string[] $columnNames |
|
168 | - * |
|
169 | - * @return bool |
|
170 | - */ |
|
171 | - public function columnsAreIndexed(array $columnNames) |
|
172 | - { |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * @param string $name |
|
177 | - * @param string $typeName |
|
178 | - * @param mixed[] $options |
|
179 | - * |
|
180 | - * @return Column |
|
181 | - * |
|
182 | - * @throws SchemaException |
|
183 | - */ |
|
184 | - public function addColumn($name, $typeName, array $options = []) |
|
185 | - { |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * Change Column Details. |
|
190 | - * |
|
191 | - * @deprecated Use {@link modifyColumn()} instead. |
|
192 | - * |
|
193 | - * @param string $name |
|
194 | - * @param mixed[] $options |
|
195 | - * |
|
196 | - * @return self |
|
197 | - * |
|
198 | - * @throws SchemaException |
|
199 | - */ |
|
200 | - public function changeColumn($name, array $options) |
|
201 | - { |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * @param string $name |
|
206 | - * @param mixed[] $options |
|
207 | - * |
|
208 | - * @return self |
|
209 | - * |
|
210 | - * @throws SchemaException |
|
211 | - */ |
|
212 | - public function modifyColumn($name, array $options) |
|
213 | - { |
|
214 | - } |
|
215 | - |
|
216 | - /** |
|
217 | - * Drops a Column from the Table. |
|
218 | - * |
|
219 | - * @param string $name |
|
220 | - * |
|
221 | - * @return self |
|
222 | - */ |
|
223 | - public function dropColumn($name) |
|
224 | - { |
|
225 | - } |
|
226 | - |
|
227 | - /** |
|
228 | - * Adds a foreign key constraint. |
|
229 | - * |
|
230 | - * Name is inferred from the local columns. |
|
231 | - * |
|
232 | - * @param Table|string $foreignTable Table schema instance or table name |
|
233 | - * @param string[] $localColumnNames |
|
234 | - * @param string[] $foreignColumnNames |
|
235 | - * @param mixed[] $options |
|
236 | - * @param string|null $name |
|
237 | - * |
|
238 | - * @return self |
|
239 | - * |
|
240 | - * @throws SchemaException |
|
241 | - */ |
|
242 | - public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], $name = null) |
|
243 | - { |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * @param string $name |
|
248 | - * @param mixed $value |
|
249 | - * |
|
250 | - * @return self |
|
251 | - */ |
|
252 | - public function addOption($name, $value) |
|
253 | - { |
|
254 | - } |
|
255 | - |
|
256 | - /** |
|
257 | - * @return void |
|
258 | - * |
|
259 | - * @throws SchemaException |
|
260 | - */ |
|
261 | - protected function _addColumn(Column $column) |
|
262 | - { |
|
263 | - } |
|
264 | - |
|
265 | - /** |
|
266 | - * Adds an index to the table. |
|
267 | - * |
|
268 | - * @return self |
|
269 | - * |
|
270 | - * @throws SchemaException |
|
271 | - */ |
|
272 | - protected function _addIndex(Index $indexCandidate) |
|
273 | - { |
|
274 | - } |
|
275 | - |
|
276 | - /** @return self */ |
|
277 | - protected function _addUniqueConstraint(UniqueConstraint $constraint): Table |
|
278 | - { |
|
279 | - } |
|
280 | - |
|
281 | - /** @return self */ |
|
282 | - protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) |
|
283 | - { |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * Returns whether this table has a foreign key constraint with the given name. |
|
288 | - * |
|
289 | - * @param string $name |
|
290 | - * |
|
291 | - * @return bool |
|
292 | - */ |
|
293 | - public function hasForeignKey($name) |
|
294 | - { |
|
295 | - } |
|
296 | - |
|
297 | - /** |
|
298 | - * Returns the foreign key constraint with the given name. |
|
299 | - * |
|
300 | - * @param string $name The constraint name. |
|
301 | - * |
|
302 | - * @return ForeignKeyConstraint |
|
303 | - * |
|
304 | - * @throws SchemaException If the foreign key does not exist. |
|
305 | - */ |
|
306 | - public function getForeignKey($name) |
|
307 | - { |
|
308 | - } |
|
309 | - |
|
310 | - /** |
|
311 | - * Removes the foreign key constraint with the given name. |
|
312 | - * |
|
313 | - * @param string $name The constraint name. |
|
314 | - * |
|
315 | - * @return void |
|
316 | - * |
|
317 | - * @throws SchemaException |
|
318 | - */ |
|
319 | - public function removeForeignKey($name) |
|
320 | - { |
|
321 | - } |
|
322 | - |
|
323 | - /** |
|
324 | - * Returns whether this table has a unique constraint with the given name. |
|
325 | - */ |
|
326 | - public function hasUniqueConstraint(string $name): bool |
|
327 | - { |
|
328 | - } |
|
329 | - |
|
330 | - /** |
|
331 | - * Returns the unique constraint with the given name. |
|
332 | - * |
|
333 | - * @throws SchemaException If the unique constraint does not exist. |
|
334 | - */ |
|
335 | - public function getUniqueConstraint(string $name): UniqueConstraint |
|
336 | - { |
|
337 | - } |
|
338 | - |
|
339 | - /** |
|
340 | - * Removes the unique constraint with the given name. |
|
341 | - * |
|
342 | - * @throws SchemaException If the unique constraint does not exist. |
|
343 | - */ |
|
344 | - public function removeUniqueConstraint(string $name): void |
|
345 | - { |
|
346 | - } |
|
347 | - |
|
348 | - /** |
|
349 | - * Returns ordered list of columns (primary keys are first, then foreign keys, then the rest) |
|
350 | - * |
|
351 | - * @return Column[] |
|
352 | - */ |
|
353 | - public function getColumns() |
|
354 | - { |
|
355 | - } |
|
356 | - |
|
357 | - /** |
|
358 | - * Returns the foreign key columns |
|
359 | - * |
|
360 | - * @deprecated Use {@see getForeignKey()} and {@see ForeignKeyConstraint::getLocalColumns()} instead. |
|
361 | - * |
|
362 | - * @return Column[] |
|
363 | - */ |
|
364 | - public function getForeignKeyColumns() |
|
365 | - { |
|
366 | - } |
|
367 | - |
|
368 | - /** |
|
369 | - * Returns whether this table has a Column with the given name. |
|
370 | - * |
|
371 | - * @param string $name The column name. |
|
372 | - * |
|
373 | - * @return bool |
|
374 | - */ |
|
375 | - public function hasColumn($name) |
|
376 | - { |
|
377 | - } |
|
378 | - |
|
379 | - /** |
|
380 | - * Returns the Column with the given name. |
|
381 | - * |
|
382 | - * @param string $name The column name. |
|
383 | - * |
|
384 | - * @return Column |
|
385 | - * |
|
386 | - * @throws SchemaException If the column does not exist. |
|
387 | - */ |
|
388 | - public function getColumn($name) |
|
389 | - { |
|
390 | - } |
|
391 | - |
|
392 | - /** |
|
393 | - * Returns the primary key. |
|
394 | - * |
|
395 | - * @return Index|null The primary key, or null if this Table has no primary key. |
|
396 | - */ |
|
397 | - public function getPrimaryKey() |
|
398 | - { |
|
399 | - } |
|
400 | - |
|
401 | - /** |
|
402 | - * Returns the primary key columns. |
|
403 | - * |
|
404 | - * @deprecated Use {@see getPrimaryKey()} and {@see Index::getColumns()} instead. |
|
405 | - * |
|
406 | - * @return Column[] |
|
407 | - * |
|
408 | - * @throws Exception |
|
409 | - */ |
|
410 | - public function getPrimaryKeyColumns() |
|
411 | - { |
|
412 | - } |
|
413 | - |
|
414 | - /** |
|
415 | - * Returns whether this table has a primary key. |
|
416 | - * |
|
417 | - * @deprecated Use {@see getPrimaryKey()} instead. |
|
418 | - * |
|
419 | - * @return bool |
|
420 | - */ |
|
421 | - public function hasPrimaryKey() |
|
422 | - { |
|
423 | - } |
|
424 | - |
|
425 | - /** |
|
426 | - * Returns whether this table has an Index with the given name. |
|
427 | - * |
|
428 | - * @param string $name The index name. |
|
429 | - * |
|
430 | - * @return bool |
|
431 | - */ |
|
432 | - public function hasIndex($name) |
|
433 | - { |
|
434 | - } |
|
435 | - |
|
436 | - /** |
|
437 | - * Returns the Index with the given name. |
|
438 | - * |
|
439 | - * @param string $name The index name. |
|
440 | - * |
|
441 | - * @return Index |
|
442 | - * |
|
443 | - * @throws SchemaException If the index does not exist. |
|
444 | - */ |
|
445 | - public function getIndex($name) |
|
446 | - { |
|
447 | - } |
|
448 | - |
|
449 | - /** @return Index[] */ |
|
450 | - public function getIndexes() |
|
451 | - { |
|
452 | - } |
|
453 | - |
|
454 | - /** |
|
455 | - * Returns the unique constraints. |
|
456 | - * |
|
457 | - * @return UniqueConstraint[] |
|
458 | - */ |
|
459 | - public function getUniqueConstraints(): array |
|
460 | - { |
|
461 | - } |
|
462 | - |
|
463 | - /** |
|
464 | - * Returns the foreign key constraints. |
|
465 | - * |
|
466 | - * @return ForeignKeyConstraint[] |
|
467 | - */ |
|
468 | - public function getForeignKeys() |
|
469 | - { |
|
470 | - } |
|
471 | - |
|
472 | - /** |
|
473 | - * @param string $name |
|
474 | - * |
|
475 | - * @return bool |
|
476 | - */ |
|
477 | - public function hasOption($name) |
|
478 | - { |
|
479 | - } |
|
480 | - |
|
481 | - /** |
|
482 | - * @param string $name |
|
483 | - * |
|
484 | - * @return mixed |
|
485 | - */ |
|
486 | - public function getOption($name) |
|
487 | - { |
|
488 | - } |
|
489 | - |
|
490 | - /** @return mixed[] */ |
|
491 | - public function getOptions() |
|
492 | - { |
|
493 | - } |
|
494 | - |
|
495 | - /** |
|
496 | - * @deprecated |
|
497 | - * |
|
498 | - * @return void |
|
499 | - * |
|
500 | - * @throws SchemaException |
|
501 | - */ |
|
502 | - public function visit(Visitor $visitor) |
|
503 | - { |
|
504 | - } |
|
505 | - |
|
506 | - /** |
|
507 | - * Clone of a Table triggers a deep clone of all affected assets. |
|
508 | - * |
|
509 | - * @return void |
|
510 | - */ |
|
511 | - public function __clone() |
|
512 | - { |
|
513 | - } |
|
514 | - |
|
515 | - public function setComment(?string $comment): self |
|
516 | - { |
|
517 | - } |
|
518 | - |
|
519 | - public function getComment(): ?string |
|
520 | - { |
|
521 | - } |
|
26 | + /** @var Column[] */ |
|
27 | + protected $_columns = []; |
|
28 | + |
|
29 | + /** @var Index[] */ |
|
30 | + protected $_indexes = []; |
|
31 | + |
|
32 | + /** @var string|null */ |
|
33 | + protected $_primaryKeyName; |
|
34 | + |
|
35 | + /** @var UniqueConstraint[] */ |
|
36 | + protected $uniqueConstraints = []; |
|
37 | + |
|
38 | + /** @var ForeignKeyConstraint[] */ |
|
39 | + protected $_fkConstraints = []; |
|
40 | + |
|
41 | + /** @var mixed[] */ |
|
42 | + protected $_options = [ |
|
43 | + 'create_options' => [], |
|
44 | + ]; |
|
45 | + |
|
46 | + /** @var SchemaConfig|null */ |
|
47 | + protected $_schemaConfig; |
|
48 | + |
|
49 | + /** |
|
50 | + * @param Column[] $columns |
|
51 | + * @param Index[] $indexes |
|
52 | + * @param UniqueConstraint[] $uniqueConstraints |
|
53 | + * @param ForeignKeyConstraint[] $fkConstraints |
|
54 | + * @param mixed[] $options |
|
55 | + * |
|
56 | + * @throws SchemaException |
|
57 | + * @throws Exception |
|
58 | + */ |
|
59 | + public function __construct(string $name, array $columns = [], array $indexes = [], array $uniqueConstraints = [], array $fkConstraints = [], array $options = []) |
|
60 | + { |
|
61 | + } |
|
62 | + |
|
63 | + /** @return void */ |
|
64 | + public function setSchemaConfig(SchemaConfig $schemaConfig) |
|
65 | + { |
|
66 | + } |
|
67 | + |
|
68 | + /** @return int */ |
|
69 | + protected function _getMaxIdentifierLength() |
|
70 | + { |
|
71 | + } |
|
72 | + |
|
73 | + /** |
|
74 | + * Sets the Primary Key. |
|
75 | + * |
|
76 | + * @param string[] $columnNames |
|
77 | + * @param string|false $indexName |
|
78 | + * |
|
79 | + * @return self |
|
80 | + * |
|
81 | + * @throws SchemaException |
|
82 | + */ |
|
83 | + public function setPrimaryKey(array $columnNames, $indexName = false) |
|
84 | + { |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @param string[] $columnNames |
|
89 | + * @param string[] $flags |
|
90 | + * @param mixed[] $options |
|
91 | + * |
|
92 | + * @return self |
|
93 | + * |
|
94 | + * @throws SchemaException |
|
95 | + */ |
|
96 | + public function addIndex(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []) |
|
97 | + { |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @param string[] $columnNames |
|
102 | + * @param string[] $flags |
|
103 | + * @param mixed[] $options |
|
104 | + * |
|
105 | + * @return self |
|
106 | + */ |
|
107 | + public function addUniqueConstraint(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []): Table |
|
108 | + { |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * Drops the primary key from this table. |
|
113 | + * |
|
114 | + * @return void |
|
115 | + * |
|
116 | + * @throws SchemaException |
|
117 | + */ |
|
118 | + public function dropPrimaryKey() |
|
119 | + { |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * Drops an index from this table. |
|
124 | + * |
|
125 | + * @param string $name The index name. |
|
126 | + * |
|
127 | + * @return void |
|
128 | + * |
|
129 | + * @throws SchemaException If the index does not exist. |
|
130 | + */ |
|
131 | + public function dropIndex($name) |
|
132 | + { |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * @param string[] $columnNames |
|
137 | + * @param string|null $indexName |
|
138 | + * @param mixed[] $options |
|
139 | + * |
|
140 | + * @return self |
|
141 | + * |
|
142 | + * @throws SchemaException |
|
143 | + */ |
|
144 | + public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) |
|
145 | + { |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Renames an index. |
|
150 | + * |
|
151 | + * @param string $oldName The name of the index to rename from. |
|
152 | + * @param string|null $newName The name of the index to rename to. |
|
153 | + * If null is given, the index name will be auto-generated. |
|
154 | + * |
|
155 | + * @return self This table instance. |
|
156 | + * |
|
157 | + * @throws SchemaException If no index exists for the given current name |
|
158 | + * or if an index with the given new name already exists on this table. |
|
159 | + */ |
|
160 | + public function renameIndex($oldName, $newName = null) |
|
161 | + { |
|
162 | + } |
|
163 | + |
|
164 | + /** |
|
165 | + * Checks if an index begins in the order of the given columns. |
|
166 | + * |
|
167 | + * @param string[] $columnNames |
|
168 | + * |
|
169 | + * @return bool |
|
170 | + */ |
|
171 | + public function columnsAreIndexed(array $columnNames) |
|
172 | + { |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * @param string $name |
|
177 | + * @param string $typeName |
|
178 | + * @param mixed[] $options |
|
179 | + * |
|
180 | + * @return Column |
|
181 | + * |
|
182 | + * @throws SchemaException |
|
183 | + */ |
|
184 | + public function addColumn($name, $typeName, array $options = []) |
|
185 | + { |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * Change Column Details. |
|
190 | + * |
|
191 | + * @deprecated Use {@link modifyColumn()} instead. |
|
192 | + * |
|
193 | + * @param string $name |
|
194 | + * @param mixed[] $options |
|
195 | + * |
|
196 | + * @return self |
|
197 | + * |
|
198 | + * @throws SchemaException |
|
199 | + */ |
|
200 | + public function changeColumn($name, array $options) |
|
201 | + { |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * @param string $name |
|
206 | + * @param mixed[] $options |
|
207 | + * |
|
208 | + * @return self |
|
209 | + * |
|
210 | + * @throws SchemaException |
|
211 | + */ |
|
212 | + public function modifyColumn($name, array $options) |
|
213 | + { |
|
214 | + } |
|
215 | + |
|
216 | + /** |
|
217 | + * Drops a Column from the Table. |
|
218 | + * |
|
219 | + * @param string $name |
|
220 | + * |
|
221 | + * @return self |
|
222 | + */ |
|
223 | + public function dropColumn($name) |
|
224 | + { |
|
225 | + } |
|
226 | + |
|
227 | + /** |
|
228 | + * Adds a foreign key constraint. |
|
229 | + * |
|
230 | + * Name is inferred from the local columns. |
|
231 | + * |
|
232 | + * @param Table|string $foreignTable Table schema instance or table name |
|
233 | + * @param string[] $localColumnNames |
|
234 | + * @param string[] $foreignColumnNames |
|
235 | + * @param mixed[] $options |
|
236 | + * @param string|null $name |
|
237 | + * |
|
238 | + * @return self |
|
239 | + * |
|
240 | + * @throws SchemaException |
|
241 | + */ |
|
242 | + public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], $name = null) |
|
243 | + { |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * @param string $name |
|
248 | + * @param mixed $value |
|
249 | + * |
|
250 | + * @return self |
|
251 | + */ |
|
252 | + public function addOption($name, $value) |
|
253 | + { |
|
254 | + } |
|
255 | + |
|
256 | + /** |
|
257 | + * @return void |
|
258 | + * |
|
259 | + * @throws SchemaException |
|
260 | + */ |
|
261 | + protected function _addColumn(Column $column) |
|
262 | + { |
|
263 | + } |
|
264 | + |
|
265 | + /** |
|
266 | + * Adds an index to the table. |
|
267 | + * |
|
268 | + * @return self |
|
269 | + * |
|
270 | + * @throws SchemaException |
|
271 | + */ |
|
272 | + protected function _addIndex(Index $indexCandidate) |
|
273 | + { |
|
274 | + } |
|
275 | + |
|
276 | + /** @return self */ |
|
277 | + protected function _addUniqueConstraint(UniqueConstraint $constraint): Table |
|
278 | + { |
|
279 | + } |
|
280 | + |
|
281 | + /** @return self */ |
|
282 | + protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) |
|
283 | + { |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * Returns whether this table has a foreign key constraint with the given name. |
|
288 | + * |
|
289 | + * @param string $name |
|
290 | + * |
|
291 | + * @return bool |
|
292 | + */ |
|
293 | + public function hasForeignKey($name) |
|
294 | + { |
|
295 | + } |
|
296 | + |
|
297 | + /** |
|
298 | + * Returns the foreign key constraint with the given name. |
|
299 | + * |
|
300 | + * @param string $name The constraint name. |
|
301 | + * |
|
302 | + * @return ForeignKeyConstraint |
|
303 | + * |
|
304 | + * @throws SchemaException If the foreign key does not exist. |
|
305 | + */ |
|
306 | + public function getForeignKey($name) |
|
307 | + { |
|
308 | + } |
|
309 | + |
|
310 | + /** |
|
311 | + * Removes the foreign key constraint with the given name. |
|
312 | + * |
|
313 | + * @param string $name The constraint name. |
|
314 | + * |
|
315 | + * @return void |
|
316 | + * |
|
317 | + * @throws SchemaException |
|
318 | + */ |
|
319 | + public function removeForeignKey($name) |
|
320 | + { |
|
321 | + } |
|
322 | + |
|
323 | + /** |
|
324 | + * Returns whether this table has a unique constraint with the given name. |
|
325 | + */ |
|
326 | + public function hasUniqueConstraint(string $name): bool |
|
327 | + { |
|
328 | + } |
|
329 | + |
|
330 | + /** |
|
331 | + * Returns the unique constraint with the given name. |
|
332 | + * |
|
333 | + * @throws SchemaException If the unique constraint does not exist. |
|
334 | + */ |
|
335 | + public function getUniqueConstraint(string $name): UniqueConstraint |
|
336 | + { |
|
337 | + } |
|
338 | + |
|
339 | + /** |
|
340 | + * Removes the unique constraint with the given name. |
|
341 | + * |
|
342 | + * @throws SchemaException If the unique constraint does not exist. |
|
343 | + */ |
|
344 | + public function removeUniqueConstraint(string $name): void |
|
345 | + { |
|
346 | + } |
|
347 | + |
|
348 | + /** |
|
349 | + * Returns ordered list of columns (primary keys are first, then foreign keys, then the rest) |
|
350 | + * |
|
351 | + * @return Column[] |
|
352 | + */ |
|
353 | + public function getColumns() |
|
354 | + { |
|
355 | + } |
|
356 | + |
|
357 | + /** |
|
358 | + * Returns the foreign key columns |
|
359 | + * |
|
360 | + * @deprecated Use {@see getForeignKey()} and {@see ForeignKeyConstraint::getLocalColumns()} instead. |
|
361 | + * |
|
362 | + * @return Column[] |
|
363 | + */ |
|
364 | + public function getForeignKeyColumns() |
|
365 | + { |
|
366 | + } |
|
367 | + |
|
368 | + /** |
|
369 | + * Returns whether this table has a Column with the given name. |
|
370 | + * |
|
371 | + * @param string $name The column name. |
|
372 | + * |
|
373 | + * @return bool |
|
374 | + */ |
|
375 | + public function hasColumn($name) |
|
376 | + { |
|
377 | + } |
|
378 | + |
|
379 | + /** |
|
380 | + * Returns the Column with the given name. |
|
381 | + * |
|
382 | + * @param string $name The column name. |
|
383 | + * |
|
384 | + * @return Column |
|
385 | + * |
|
386 | + * @throws SchemaException If the column does not exist. |
|
387 | + */ |
|
388 | + public function getColumn($name) |
|
389 | + { |
|
390 | + } |
|
391 | + |
|
392 | + /** |
|
393 | + * Returns the primary key. |
|
394 | + * |
|
395 | + * @return Index|null The primary key, or null if this Table has no primary key. |
|
396 | + */ |
|
397 | + public function getPrimaryKey() |
|
398 | + { |
|
399 | + } |
|
400 | + |
|
401 | + /** |
|
402 | + * Returns the primary key columns. |
|
403 | + * |
|
404 | + * @deprecated Use {@see getPrimaryKey()} and {@see Index::getColumns()} instead. |
|
405 | + * |
|
406 | + * @return Column[] |
|
407 | + * |
|
408 | + * @throws Exception |
|
409 | + */ |
|
410 | + public function getPrimaryKeyColumns() |
|
411 | + { |
|
412 | + } |
|
413 | + |
|
414 | + /** |
|
415 | + * Returns whether this table has a primary key. |
|
416 | + * |
|
417 | + * @deprecated Use {@see getPrimaryKey()} instead. |
|
418 | + * |
|
419 | + * @return bool |
|
420 | + */ |
|
421 | + public function hasPrimaryKey() |
|
422 | + { |
|
423 | + } |
|
424 | + |
|
425 | + /** |
|
426 | + * Returns whether this table has an Index with the given name. |
|
427 | + * |
|
428 | + * @param string $name The index name. |
|
429 | + * |
|
430 | + * @return bool |
|
431 | + */ |
|
432 | + public function hasIndex($name) |
|
433 | + { |
|
434 | + } |
|
435 | + |
|
436 | + /** |
|
437 | + * Returns the Index with the given name. |
|
438 | + * |
|
439 | + * @param string $name The index name. |
|
440 | + * |
|
441 | + * @return Index |
|
442 | + * |
|
443 | + * @throws SchemaException If the index does not exist. |
|
444 | + */ |
|
445 | + public function getIndex($name) |
|
446 | + { |
|
447 | + } |
|
448 | + |
|
449 | + /** @return Index[] */ |
|
450 | + public function getIndexes() |
|
451 | + { |
|
452 | + } |
|
453 | + |
|
454 | + /** |
|
455 | + * Returns the unique constraints. |
|
456 | + * |
|
457 | + * @return UniqueConstraint[] |
|
458 | + */ |
|
459 | + public function getUniqueConstraints(): array |
|
460 | + { |
|
461 | + } |
|
462 | + |
|
463 | + /** |
|
464 | + * Returns the foreign key constraints. |
|
465 | + * |
|
466 | + * @return ForeignKeyConstraint[] |
|
467 | + */ |
|
468 | + public function getForeignKeys() |
|
469 | + { |
|
470 | + } |
|
471 | + |
|
472 | + /** |
|
473 | + * @param string $name |
|
474 | + * |
|
475 | + * @return bool |
|
476 | + */ |
|
477 | + public function hasOption($name) |
|
478 | + { |
|
479 | + } |
|
480 | + |
|
481 | + /** |
|
482 | + * @param string $name |
|
483 | + * |
|
484 | + * @return mixed |
|
485 | + */ |
|
486 | + public function getOption($name) |
|
487 | + { |
|
488 | + } |
|
489 | + |
|
490 | + /** @return mixed[] */ |
|
491 | + public function getOptions() |
|
492 | + { |
|
493 | + } |
|
494 | + |
|
495 | + /** |
|
496 | + * @deprecated |
|
497 | + * |
|
498 | + * @return void |
|
499 | + * |
|
500 | + * @throws SchemaException |
|
501 | + */ |
|
502 | + public function visit(Visitor $visitor) |
|
503 | + { |
|
504 | + } |
|
505 | + |
|
506 | + /** |
|
507 | + * Clone of a Table triggers a deep clone of all affected assets. |
|
508 | + * |
|
509 | + * @return void |
|
510 | + */ |
|
511 | + public function __clone() |
|
512 | + { |
|
513 | + } |
|
514 | + |
|
515 | + public function setComment(?string $comment): self |
|
516 | + { |
|
517 | + } |
|
518 | + |
|
519 | + public function getComment(): ?string |
|
520 | + { |
|
521 | + } |
|
522 | 522 | } |
@@ -31,743 +31,743 @@ |
||
31 | 31 | */ |
32 | 32 | class Process implements \IteratorAggregate |
33 | 33 | { |
34 | - public const ERR = 'err'; |
|
35 | - public const OUT = 'out'; |
|
36 | - |
|
37 | - public const STATUS_READY = 'ready'; |
|
38 | - public const STATUS_STARTED = 'started'; |
|
39 | - public const STATUS_TERMINATED = 'terminated'; |
|
40 | - |
|
41 | - public const STDIN = 0; |
|
42 | - public const STDOUT = 1; |
|
43 | - public const STDERR = 2; |
|
44 | - |
|
45 | - // Timeout Precision in seconds. |
|
46 | - public const TIMEOUT_PRECISION = 0.2; |
|
47 | - |
|
48 | - public const ITER_NON_BLOCKING = 1; // By default, iterating over outputs is a blocking call, use this flag to make it non-blocking |
|
49 | - public const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory |
|
50 | - public const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating |
|
51 | - public const ITER_SKIP_ERR = 8; |
|
52 | - |
|
53 | - /** |
|
54 | - * Exit codes translation table. |
|
55 | - * |
|
56 | - * User-defined errors must use exit codes in the 64-113 range. |
|
57 | - */ |
|
58 | - public static $exitCodes = [ |
|
59 | - 0 => 'OK', |
|
60 | - 1 => 'General error', |
|
61 | - 2 => 'Misuse of shell builtins', |
|
62 | - |
|
63 | - 126 => 'Invoked command cannot execute', |
|
64 | - 127 => 'Command not found', |
|
65 | - 128 => 'Invalid exit argument', |
|
66 | - |
|
67 | - // signals |
|
68 | - 129 => 'Hangup', |
|
69 | - 130 => 'Interrupt', |
|
70 | - 131 => 'Quit and dump core', |
|
71 | - 132 => 'Illegal instruction', |
|
72 | - 133 => 'Trace/breakpoint trap', |
|
73 | - 134 => 'Process aborted', |
|
74 | - 135 => 'Bus error: "access to undefined portion of memory object"', |
|
75 | - 136 => 'Floating point exception: "erroneous arithmetic operation"', |
|
76 | - 137 => 'Kill (terminate immediately)', |
|
77 | - 138 => 'User-defined 1', |
|
78 | - 139 => 'Segmentation violation', |
|
79 | - 140 => 'User-defined 2', |
|
80 | - 141 => 'Write to pipe with no one reading', |
|
81 | - 142 => 'Signal raised by alarm', |
|
82 | - 143 => 'Termination (request to terminate)', |
|
83 | - // 144 - not defined |
|
84 | - 145 => 'Child process terminated, stopped (or continued*)', |
|
85 | - 146 => 'Continue if stopped', |
|
86 | - 147 => 'Stop executing temporarily', |
|
87 | - 148 => 'Terminal stop signal', |
|
88 | - 149 => 'Background process attempting to read from tty ("in")', |
|
89 | - 150 => 'Background process attempting to write to tty ("out")', |
|
90 | - 151 => 'Urgent data available on socket', |
|
91 | - 152 => 'CPU time limit exceeded', |
|
92 | - 153 => 'File size limit exceeded', |
|
93 | - 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"', |
|
94 | - 155 => 'Profiling timer expired', |
|
95 | - // 156 - not defined |
|
96 | - 157 => 'Pollable event', |
|
97 | - // 158 - not defined |
|
98 | - 159 => 'Bad syscall', |
|
99 | - ]; |
|
100 | - |
|
101 | - /** |
|
102 | - * @param array $command The command to run and its arguments listed as separate entries |
|
103 | - * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
|
104 | - * @param array|null $env The environment variables or null to use the same environment as the current PHP process |
|
105 | - * @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input |
|
106 | - * @param int|float|null $timeout The timeout in seconds or null to disable |
|
107 | - * |
|
108 | - * @throws LogicException When proc_open is not installed |
|
109 | - */ |
|
110 | - public function __construct(array $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60) |
|
111 | - { |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Creates a Process instance as a command-line to be run in a shell wrapper. |
|
116 | - * |
|
117 | - * Command-lines are parsed by the shell of your OS (/bin/sh on Unix-like, cmd.exe on Windows.) |
|
118 | - * This allows using e.g. pipes or conditional execution. In this mode, signals are sent to the |
|
119 | - * shell wrapper and not to your commands. |
|
120 | - * |
|
121 | - * In order to inject dynamic values into command-lines, we strongly recommend using placeholders. |
|
122 | - * This will save escaping values, which is not portable nor secure anyway: |
|
123 | - * |
|
124 | - * $process = Process::fromShellCommandline('my_command "${:MY_VAR}"'); |
|
125 | - * $process->run(null, ['MY_VAR' => $theValue]); |
|
126 | - * |
|
127 | - * @param string $command The command line to pass to the shell of the OS |
|
128 | - * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
|
129 | - * @param array|null $env The environment variables or null to use the same environment as the current PHP process |
|
130 | - * @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input |
|
131 | - * @param int|float|null $timeout The timeout in seconds or null to disable |
|
132 | - * |
|
133 | - * @throws LogicException When proc_open is not installed |
|
134 | - */ |
|
135 | - public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static |
|
136 | - { |
|
137 | - } |
|
138 | - |
|
139 | - public function __sleep(): array |
|
140 | - { |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * @return void |
|
145 | - */ |
|
146 | - public function __wakeup() |
|
147 | - { |
|
148 | - } |
|
149 | - |
|
150 | - public function __destruct() |
|
151 | - { |
|
152 | - } |
|
153 | - |
|
154 | - public function __clone() |
|
155 | - { |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * Runs the process. |
|
160 | - * |
|
161 | - * The callback receives the type of output (out or err) and |
|
162 | - * some bytes from the output in real-time. It allows to have feedback |
|
163 | - * from the independent process during execution. |
|
164 | - * |
|
165 | - * The STDOUT and STDERR are also available after the process is finished |
|
166 | - * via the getOutput() and getErrorOutput() methods. |
|
167 | - * |
|
168 | - * @param callable|null $callback A PHP callback to run whenever there is some |
|
169 | - * output available on STDOUT or STDERR |
|
170 | - * |
|
171 | - * @return int The exit status code |
|
172 | - * |
|
173 | - * @throws RuntimeException When process can't be launched |
|
174 | - * @throws RuntimeException When process is already running |
|
175 | - * @throws ProcessTimedOutException When process timed out |
|
176 | - * @throws ProcessSignaledException When process stopped after receiving signal |
|
177 | - * @throws LogicException In case a callback is provided and output has been disabled |
|
178 | - * |
|
179 | - * @final |
|
180 | - */ |
|
181 | - public function run(?callable $callback = null, array $env = []): int |
|
182 | - { |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * Runs the process. |
|
187 | - * |
|
188 | - * This is identical to run() except that an exception is thrown if the process |
|
189 | - * exits with a non-zero exit code. |
|
190 | - * |
|
191 | - * @return $this |
|
192 | - * |
|
193 | - * @throws ProcessFailedException if the process didn't terminate successfully |
|
194 | - * |
|
195 | - * @final |
|
196 | - */ |
|
197 | - public function mustRun(?callable $callback = null, array $env = []): static |
|
198 | - { |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * Starts the process and returns after writing the input to STDIN. |
|
203 | - * |
|
204 | - * This method blocks until all STDIN data is sent to the process then it |
|
205 | - * returns while the process runs in the background. |
|
206 | - * |
|
207 | - * The termination of the process can be awaited with wait(). |
|
208 | - * |
|
209 | - * The callback receives the type of output (out or err) and some bytes from |
|
210 | - * the output in real-time while writing the standard input to the process. |
|
211 | - * It allows to have feedback from the independent process during execution. |
|
212 | - * |
|
213 | - * @param callable|null $callback A PHP callback to run whenever there is some |
|
214 | - * output available on STDOUT or STDERR |
|
215 | - * |
|
216 | - * @return void |
|
217 | - * |
|
218 | - * @throws RuntimeException When process can't be launched |
|
219 | - * @throws RuntimeException When process is already running |
|
220 | - * @throws LogicException In case a callback is provided and output has been disabled |
|
221 | - */ |
|
222 | - public function start(?callable $callback = null, array $env = []) |
|
223 | - { |
|
224 | - } |
|
225 | - |
|
226 | - /** |
|
227 | - * Restarts the process. |
|
228 | - * |
|
229 | - * Be warned that the process is cloned before being started. |
|
230 | - * |
|
231 | - * @param callable|null $callback A PHP callback to run whenever there is some |
|
232 | - * output available on STDOUT or STDERR |
|
233 | - * |
|
234 | - * @throws RuntimeException When process can't be launched |
|
235 | - * @throws RuntimeException When process is already running |
|
236 | - * |
|
237 | - * @see start() |
|
238 | - * |
|
239 | - * @final |
|
240 | - */ |
|
241 | - public function restart(?callable $callback = null, array $env = []): static |
|
242 | - { |
|
243 | - } |
|
244 | - |
|
245 | - /** |
|
246 | - * Waits for the process to terminate. |
|
247 | - * |
|
248 | - * The callback receives the type of output (out or err) and some bytes |
|
249 | - * from the output in real-time while writing the standard input to the process. |
|
250 | - * It allows to have feedback from the independent process during execution. |
|
251 | - * |
|
252 | - * @param callable|null $callback A valid PHP callback |
|
253 | - * |
|
254 | - * @return int The exitcode of the process |
|
255 | - * |
|
256 | - * @throws ProcessTimedOutException When process timed out |
|
257 | - * @throws ProcessSignaledException When process stopped after receiving signal |
|
258 | - * @throws LogicException When process is not yet started |
|
259 | - */ |
|
260 | - public function wait(?callable $callback = null): int |
|
261 | - { |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * Waits until the callback returns true. |
|
266 | - * |
|
267 | - * The callback receives the type of output (out or err) and some bytes |
|
268 | - * from the output in real-time while writing the standard input to the process. |
|
269 | - * It allows to have feedback from the independent process during execution. |
|
270 | - * |
|
271 | - * @throws RuntimeException When process timed out |
|
272 | - * @throws LogicException When process is not yet started |
|
273 | - * @throws ProcessTimedOutException In case the timeout was reached |
|
274 | - */ |
|
275 | - public function waitUntil(callable $callback): bool |
|
276 | - { |
|
277 | - } |
|
278 | - |
|
279 | - /** |
|
280 | - * Returns the Pid (process identifier), if applicable. |
|
281 | - * |
|
282 | - * @return int|null The process id if running, null otherwise |
|
283 | - */ |
|
284 | - public function getPid(): ?int |
|
285 | - { |
|
286 | - } |
|
287 | - |
|
288 | - /** |
|
289 | - * Sends a POSIX signal to the process. |
|
290 | - * |
|
291 | - * @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants) |
|
292 | - * |
|
293 | - * @return $this |
|
294 | - * |
|
295 | - * @throws LogicException In case the process is not running |
|
296 | - * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed |
|
297 | - * @throws RuntimeException In case of failure |
|
298 | - */ |
|
299 | - public function signal(int $signal): static |
|
300 | - { |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * Disables fetching output and error output from the underlying process. |
|
305 | - * |
|
306 | - * @return $this |
|
307 | - * |
|
308 | - * @throws RuntimeException In case the process is already running |
|
309 | - * @throws LogicException if an idle timeout is set |
|
310 | - */ |
|
311 | - public function disableOutput(): static |
|
312 | - { |
|
313 | - } |
|
314 | - |
|
315 | - /** |
|
316 | - * Enables fetching output and error output from the underlying process. |
|
317 | - * |
|
318 | - * @return $this |
|
319 | - * |
|
320 | - * @throws RuntimeException In case the process is already running |
|
321 | - */ |
|
322 | - public function enableOutput(): static |
|
323 | - { |
|
324 | - } |
|
325 | - |
|
326 | - /** |
|
327 | - * Returns true in case the output is disabled, false otherwise. |
|
328 | - */ |
|
329 | - public function isOutputDisabled(): bool |
|
330 | - { |
|
331 | - } |
|
332 | - |
|
333 | - /** |
|
334 | - * Returns the current output of the process (STDOUT). |
|
335 | - * |
|
336 | - * @throws LogicException in case the output has been disabled |
|
337 | - * @throws LogicException In case the process is not started |
|
338 | - */ |
|
339 | - public function getOutput(): string |
|
340 | - { |
|
341 | - } |
|
342 | - |
|
343 | - /** |
|
344 | - * Returns the output incrementally. |
|
345 | - * |
|
346 | - * In comparison with the getOutput method which always return the whole |
|
347 | - * output, this one returns the new output since the last call. |
|
348 | - * |
|
349 | - * @throws LogicException in case the output has been disabled |
|
350 | - * @throws LogicException In case the process is not started |
|
351 | - */ |
|
352 | - public function getIncrementalOutput(): string |
|
353 | - { |
|
354 | - } |
|
355 | - |
|
356 | - /** |
|
357 | - * Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR). |
|
358 | - * |
|
359 | - * @param int $flags A bit field of Process::ITER_* flags |
|
360 | - * |
|
361 | - * @return \Generator<string, string> |
|
362 | - * |
|
363 | - * @throws LogicException in case the output has been disabled |
|
364 | - * @throws LogicException In case the process is not started |
|
365 | - */ |
|
366 | - public function getIterator(int $flags = 0): \Generator |
|
367 | - { |
|
368 | - } |
|
369 | - |
|
370 | - /** |
|
371 | - * Clears the process output. |
|
372 | - * |
|
373 | - * @return $this |
|
374 | - */ |
|
375 | - public function clearOutput(): static |
|
376 | - { |
|
377 | - } |
|
378 | - |
|
379 | - /** |
|
380 | - * Returns the current error output of the process (STDERR). |
|
381 | - * |
|
382 | - * @throws LogicException in case the output has been disabled |
|
383 | - * @throws LogicException In case the process is not started |
|
384 | - */ |
|
385 | - public function getErrorOutput(): string |
|
386 | - { |
|
387 | - } |
|
388 | - |
|
389 | - /** |
|
390 | - * Returns the errorOutput incrementally. |
|
391 | - * |
|
392 | - * In comparison with the getErrorOutput method which always return the |
|
393 | - * whole error output, this one returns the new error output since the last |
|
394 | - * call. |
|
395 | - * |
|
396 | - * @throws LogicException in case the output has been disabled |
|
397 | - * @throws LogicException In case the process is not started |
|
398 | - */ |
|
399 | - public function getIncrementalErrorOutput(): string |
|
400 | - { |
|
401 | - } |
|
402 | - |
|
403 | - /** |
|
404 | - * Clears the process output. |
|
405 | - * |
|
406 | - * @return $this |
|
407 | - */ |
|
408 | - public function clearErrorOutput(): static |
|
409 | - { |
|
410 | - } |
|
411 | - |
|
412 | - /** |
|
413 | - * Returns the exit code returned by the process. |
|
414 | - * |
|
415 | - * @return int|null The exit status code, null if the Process is not terminated |
|
416 | - */ |
|
417 | - public function getExitCode(): ?int |
|
418 | - { |
|
419 | - } |
|
420 | - |
|
421 | - /** |
|
422 | - * Returns a string representation for the exit code returned by the process. |
|
423 | - * |
|
424 | - * This method relies on the Unix exit code status standardization |
|
425 | - * and might not be relevant for other operating systems. |
|
426 | - * |
|
427 | - * @return string|null A string representation for the exit status code, null if the Process is not terminated |
|
428 | - * |
|
429 | - * @see http://tldp.org/LDP/abs/html/exitcodes.html |
|
430 | - * @see http://en.wikipedia.org/wiki/Unix_signal |
|
431 | - */ |
|
432 | - public function getExitCodeText(): ?string |
|
433 | - { |
|
434 | - } |
|
435 | - |
|
436 | - /** |
|
437 | - * Checks if the process ended successfully. |
|
438 | - */ |
|
439 | - public function isSuccessful(): bool |
|
440 | - { |
|
441 | - } |
|
442 | - |
|
443 | - /** |
|
444 | - * Returns true if the child process has been terminated by an uncaught signal. |
|
445 | - * |
|
446 | - * It always returns false on Windows. |
|
447 | - * |
|
448 | - * @throws LogicException In case the process is not terminated |
|
449 | - */ |
|
450 | - public function hasBeenSignaled(): bool |
|
451 | - { |
|
452 | - } |
|
453 | - |
|
454 | - /** |
|
455 | - * Returns the number of the signal that caused the child process to terminate its execution. |
|
456 | - * |
|
457 | - * It is only meaningful if hasBeenSignaled() returns true. |
|
458 | - * |
|
459 | - * @throws RuntimeException In case --enable-sigchild is activated |
|
460 | - * @throws LogicException In case the process is not terminated |
|
461 | - */ |
|
462 | - public function getTermSignal(): int |
|
463 | - { |
|
464 | - } |
|
465 | - |
|
466 | - /** |
|
467 | - * Returns true if the child process has been stopped by a signal. |
|
468 | - * |
|
469 | - * It always returns false on Windows. |
|
470 | - * |
|
471 | - * @throws LogicException In case the process is not terminated |
|
472 | - */ |
|
473 | - public function hasBeenStopped(): bool |
|
474 | - { |
|
475 | - } |
|
476 | - |
|
477 | - /** |
|
478 | - * Returns the number of the signal that caused the child process to stop its execution. |
|
479 | - * |
|
480 | - * It is only meaningful if hasBeenStopped() returns true. |
|
481 | - * |
|
482 | - * @throws LogicException In case the process is not terminated |
|
483 | - */ |
|
484 | - public function getStopSignal(): int |
|
485 | - { |
|
486 | - } |
|
487 | - |
|
488 | - /** |
|
489 | - * Checks if the process is currently running. |
|
490 | - */ |
|
491 | - public function isRunning(): bool |
|
492 | - { |
|
493 | - } |
|
494 | - |
|
495 | - /** |
|
496 | - * Checks if the process has been started with no regard to the current state. |
|
497 | - */ |
|
498 | - public function isStarted(): bool |
|
499 | - { |
|
500 | - } |
|
501 | - |
|
502 | - /** |
|
503 | - * Checks if the process is terminated. |
|
504 | - */ |
|
505 | - public function isTerminated(): bool |
|
506 | - { |
|
507 | - } |
|
508 | - |
|
509 | - /** |
|
510 | - * Gets the process status. |
|
511 | - * |
|
512 | - * The status is one of: ready, started, terminated. |
|
513 | - */ |
|
514 | - public function getStatus(): string |
|
515 | - { |
|
516 | - } |
|
517 | - |
|
518 | - /** |
|
519 | - * Stops the process. |
|
520 | - * |
|
521 | - * @param int|float $timeout The timeout in seconds |
|
522 | - * @param int|null $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) |
|
523 | - * |
|
524 | - * @return int|null The exit-code of the process or null if it's not running |
|
525 | - */ |
|
526 | - public function stop(float $timeout = 10, ?int $signal = null): ?int |
|
527 | - { |
|
528 | - } |
|
529 | - |
|
530 | - /** |
|
531 | - * Adds a line to the STDOUT stream. |
|
532 | - * |
|
533 | - * @internal |
|
534 | - */ |
|
535 | - public function addOutput(string $line): void |
|
536 | - { |
|
537 | - } |
|
538 | - |
|
539 | - /** |
|
540 | - * Adds a line to the STDERR stream. |
|
541 | - * |
|
542 | - * @internal |
|
543 | - */ |
|
544 | - public function addErrorOutput(string $line): void |
|
545 | - { |
|
546 | - } |
|
547 | - |
|
548 | - /** |
|
549 | - * Gets the last output time in seconds. |
|
550 | - */ |
|
551 | - public function getLastOutputTime(): ?float |
|
552 | - { |
|
553 | - } |
|
554 | - |
|
555 | - /** |
|
556 | - * Gets the command line to be executed. |
|
557 | - */ |
|
558 | - public function getCommandLine(): string |
|
559 | - { |
|
560 | - } |
|
561 | - |
|
562 | - /** |
|
563 | - * Gets the process timeout in seconds (max. runtime). |
|
564 | - */ |
|
565 | - public function getTimeout(): ?float |
|
566 | - { |
|
567 | - } |
|
568 | - |
|
569 | - /** |
|
570 | - * Gets the process idle timeout in seconds (max. time since last output). |
|
571 | - */ |
|
572 | - public function getIdleTimeout(): ?float |
|
573 | - { |
|
574 | - } |
|
575 | - |
|
576 | - /** |
|
577 | - * Sets the process timeout (max. runtime) in seconds. |
|
578 | - * |
|
579 | - * To disable the timeout, set this value to null. |
|
580 | - * |
|
581 | - * @return $this |
|
582 | - * |
|
583 | - * @throws InvalidArgumentException if the timeout is negative |
|
584 | - */ |
|
585 | - public function setTimeout(?float $timeout): static |
|
586 | - { |
|
587 | - } |
|
588 | - |
|
589 | - /** |
|
590 | - * Sets the process idle timeout (max. time since last output) in seconds. |
|
591 | - * |
|
592 | - * To disable the timeout, set this value to null. |
|
593 | - * |
|
594 | - * @return $this |
|
595 | - * |
|
596 | - * @throws LogicException if the output is disabled |
|
597 | - * @throws InvalidArgumentException if the timeout is negative |
|
598 | - */ |
|
599 | - public function setIdleTimeout(?float $timeout): static |
|
600 | - { |
|
601 | - } |
|
602 | - |
|
603 | - /** |
|
604 | - * Enables or disables the TTY mode. |
|
605 | - * |
|
606 | - * @return $this |
|
607 | - * |
|
608 | - * @throws RuntimeException In case the TTY mode is not supported |
|
609 | - */ |
|
610 | - public function setTty(bool $tty): static |
|
611 | - { |
|
612 | - } |
|
613 | - |
|
614 | - /** |
|
615 | - * Checks if the TTY mode is enabled. |
|
616 | - */ |
|
617 | - public function isTty(): bool |
|
618 | - { |
|
619 | - } |
|
620 | - |
|
621 | - /** |
|
622 | - * Sets PTY mode. |
|
623 | - * |
|
624 | - * @return $this |
|
625 | - */ |
|
626 | - public function setPty(bool $bool): static |
|
627 | - { |
|
628 | - } |
|
629 | - |
|
630 | - /** |
|
631 | - * Returns PTY state. |
|
632 | - */ |
|
633 | - public function isPty(): bool |
|
634 | - { |
|
635 | - } |
|
636 | - |
|
637 | - /** |
|
638 | - * Gets the working directory. |
|
639 | - */ |
|
640 | - public function getWorkingDirectory(): ?string |
|
641 | - { |
|
642 | - } |
|
643 | - |
|
644 | - /** |
|
645 | - * Sets the current working directory. |
|
646 | - * |
|
647 | - * @return $this |
|
648 | - */ |
|
649 | - public function setWorkingDirectory(string $cwd): static |
|
650 | - { |
|
651 | - } |
|
652 | - |
|
653 | - /** |
|
654 | - * Gets the environment variables. |
|
655 | - */ |
|
656 | - public function getEnv(): array |
|
657 | - { |
|
658 | - } |
|
659 | - |
|
660 | - /** |
|
661 | - * Sets the environment variables. |
|
662 | - * |
|
663 | - * @param array<string|\Stringable> $env The new environment variables |
|
664 | - * |
|
665 | - * @return $this |
|
666 | - */ |
|
667 | - public function setEnv(array $env): static |
|
668 | - { |
|
669 | - } |
|
670 | - |
|
671 | - /** |
|
672 | - * Gets the Process input. |
|
673 | - * |
|
674 | - * @return resource|string|\Iterator|null |
|
675 | - */ |
|
676 | - public function getInput() |
|
677 | - { |
|
678 | - } |
|
679 | - |
|
680 | - /** |
|
681 | - * Sets the input. |
|
682 | - * |
|
683 | - * This content will be passed to the underlying process standard input. |
|
684 | - * |
|
685 | - * @param string|resource|\Traversable|self|null $input The content |
|
686 | - * |
|
687 | - * @return $this |
|
688 | - * |
|
689 | - * @throws LogicException In case the process is running |
|
690 | - */ |
|
691 | - public function setInput(mixed $input): static |
|
692 | - { |
|
693 | - } |
|
694 | - |
|
695 | - /** |
|
696 | - * Performs a check between the timeout definition and the time the process started. |
|
697 | - * |
|
698 | - * In case you run a background process (with the start method), you should |
|
699 | - * trigger this method regularly to ensure the process timeout |
|
700 | - * |
|
701 | - * @return void |
|
702 | - * |
|
703 | - * @throws ProcessTimedOutException In case the timeout was reached |
|
704 | - */ |
|
705 | - public function checkTimeout() |
|
706 | - { |
|
707 | - } |
|
708 | - |
|
709 | - /** |
|
710 | - * @throws LogicException in case process is not started |
|
711 | - */ |
|
712 | - public function getStartTime(): float |
|
713 | - { |
|
714 | - } |
|
715 | - |
|
716 | - /** |
|
717 | - * Defines options to pass to the underlying proc_open(). |
|
718 | - * |
|
719 | - * @see https://php.net/proc_open for the options supported by PHP. |
|
720 | - * |
|
721 | - * Enabling the "create_new_console" option allows a subprocess to continue |
|
722 | - * to run after the main process exited, on both Windows and *nix |
|
723 | - * |
|
724 | - * @return void |
|
725 | - */ |
|
726 | - public function setOptions(array $options) |
|
727 | - { |
|
728 | - } |
|
729 | - |
|
730 | - /** |
|
731 | - * Returns whether TTY is supported on the current operating system. |
|
732 | - */ |
|
733 | - public static function isTtySupported(): bool |
|
734 | - { |
|
735 | - } |
|
736 | - |
|
737 | - /** |
|
738 | - * Returns whether PTY is supported on the current operating system. |
|
739 | - */ |
|
740 | - public static function isPtySupported(): bool |
|
741 | - { |
|
742 | - } |
|
743 | - |
|
744 | - /** |
|
745 | - * Builds up the callback used by wait(). |
|
746 | - * |
|
747 | - * The callbacks adds all occurred output to the specific buffer and calls |
|
748 | - * the user callback (if present) with the received output. |
|
749 | - * |
|
750 | - * @param callable|null $callback The user defined PHP callback |
|
751 | - */ |
|
752 | - protected function buildCallback(?callable $callback = null): \Closure |
|
753 | - { |
|
754 | - } |
|
755 | - |
|
756 | - /** |
|
757 | - * Updates the status of the process, reads pipes. |
|
758 | - * |
|
759 | - * @param bool $blocking Whether to use a blocking read call |
|
760 | - * |
|
761 | - * @return void |
|
762 | - */ |
|
763 | - protected function updateStatus(bool $blocking) |
|
764 | - { |
|
765 | - } |
|
766 | - |
|
767 | - /** |
|
768 | - * Returns whether PHP has been compiled with the '--enable-sigchild' option or not. |
|
769 | - */ |
|
770 | - protected function isSigchildEnabled(): bool |
|
771 | - { |
|
772 | - } |
|
34 | + public const ERR = 'err'; |
|
35 | + public const OUT = 'out'; |
|
36 | + |
|
37 | + public const STATUS_READY = 'ready'; |
|
38 | + public const STATUS_STARTED = 'started'; |
|
39 | + public const STATUS_TERMINATED = 'terminated'; |
|
40 | + |
|
41 | + public const STDIN = 0; |
|
42 | + public const STDOUT = 1; |
|
43 | + public const STDERR = 2; |
|
44 | + |
|
45 | + // Timeout Precision in seconds. |
|
46 | + public const TIMEOUT_PRECISION = 0.2; |
|
47 | + |
|
48 | + public const ITER_NON_BLOCKING = 1; // By default, iterating over outputs is a blocking call, use this flag to make it non-blocking |
|
49 | + public const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory |
|
50 | + public const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating |
|
51 | + public const ITER_SKIP_ERR = 8; |
|
52 | + |
|
53 | + /** |
|
54 | + * Exit codes translation table. |
|
55 | + * |
|
56 | + * User-defined errors must use exit codes in the 64-113 range. |
|
57 | + */ |
|
58 | + public static $exitCodes = [ |
|
59 | + 0 => 'OK', |
|
60 | + 1 => 'General error', |
|
61 | + 2 => 'Misuse of shell builtins', |
|
62 | + |
|
63 | + 126 => 'Invoked command cannot execute', |
|
64 | + 127 => 'Command not found', |
|
65 | + 128 => 'Invalid exit argument', |
|
66 | + |
|
67 | + // signals |
|
68 | + 129 => 'Hangup', |
|
69 | + 130 => 'Interrupt', |
|
70 | + 131 => 'Quit and dump core', |
|
71 | + 132 => 'Illegal instruction', |
|
72 | + 133 => 'Trace/breakpoint trap', |
|
73 | + 134 => 'Process aborted', |
|
74 | + 135 => 'Bus error: "access to undefined portion of memory object"', |
|
75 | + 136 => 'Floating point exception: "erroneous arithmetic operation"', |
|
76 | + 137 => 'Kill (terminate immediately)', |
|
77 | + 138 => 'User-defined 1', |
|
78 | + 139 => 'Segmentation violation', |
|
79 | + 140 => 'User-defined 2', |
|
80 | + 141 => 'Write to pipe with no one reading', |
|
81 | + 142 => 'Signal raised by alarm', |
|
82 | + 143 => 'Termination (request to terminate)', |
|
83 | + // 144 - not defined |
|
84 | + 145 => 'Child process terminated, stopped (or continued*)', |
|
85 | + 146 => 'Continue if stopped', |
|
86 | + 147 => 'Stop executing temporarily', |
|
87 | + 148 => 'Terminal stop signal', |
|
88 | + 149 => 'Background process attempting to read from tty ("in")', |
|
89 | + 150 => 'Background process attempting to write to tty ("out")', |
|
90 | + 151 => 'Urgent data available on socket', |
|
91 | + 152 => 'CPU time limit exceeded', |
|
92 | + 153 => 'File size limit exceeded', |
|
93 | + 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"', |
|
94 | + 155 => 'Profiling timer expired', |
|
95 | + // 156 - not defined |
|
96 | + 157 => 'Pollable event', |
|
97 | + // 158 - not defined |
|
98 | + 159 => 'Bad syscall', |
|
99 | + ]; |
|
100 | + |
|
101 | + /** |
|
102 | + * @param array $command The command to run and its arguments listed as separate entries |
|
103 | + * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
|
104 | + * @param array|null $env The environment variables or null to use the same environment as the current PHP process |
|
105 | + * @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input |
|
106 | + * @param int|float|null $timeout The timeout in seconds or null to disable |
|
107 | + * |
|
108 | + * @throws LogicException When proc_open is not installed |
|
109 | + */ |
|
110 | + public function __construct(array $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60) |
|
111 | + { |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Creates a Process instance as a command-line to be run in a shell wrapper. |
|
116 | + * |
|
117 | + * Command-lines are parsed by the shell of your OS (/bin/sh on Unix-like, cmd.exe on Windows.) |
|
118 | + * This allows using e.g. pipes or conditional execution. In this mode, signals are sent to the |
|
119 | + * shell wrapper and not to your commands. |
|
120 | + * |
|
121 | + * In order to inject dynamic values into command-lines, we strongly recommend using placeholders. |
|
122 | + * This will save escaping values, which is not portable nor secure anyway: |
|
123 | + * |
|
124 | + * $process = Process::fromShellCommandline('my_command "${:MY_VAR}"'); |
|
125 | + * $process->run(null, ['MY_VAR' => $theValue]); |
|
126 | + * |
|
127 | + * @param string $command The command line to pass to the shell of the OS |
|
128 | + * @param string|null $cwd The working directory or null to use the working dir of the current PHP process |
|
129 | + * @param array|null $env The environment variables or null to use the same environment as the current PHP process |
|
130 | + * @param mixed $input The input as stream resource, scalar or \Traversable, or null for no input |
|
131 | + * @param int|float|null $timeout The timeout in seconds or null to disable |
|
132 | + * |
|
133 | + * @throws LogicException When proc_open is not installed |
|
134 | + */ |
|
135 | + public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static |
|
136 | + { |
|
137 | + } |
|
138 | + |
|
139 | + public function __sleep(): array |
|
140 | + { |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * @return void |
|
145 | + */ |
|
146 | + public function __wakeup() |
|
147 | + { |
|
148 | + } |
|
149 | + |
|
150 | + public function __destruct() |
|
151 | + { |
|
152 | + } |
|
153 | + |
|
154 | + public function __clone() |
|
155 | + { |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * Runs the process. |
|
160 | + * |
|
161 | + * The callback receives the type of output (out or err) and |
|
162 | + * some bytes from the output in real-time. It allows to have feedback |
|
163 | + * from the independent process during execution. |
|
164 | + * |
|
165 | + * The STDOUT and STDERR are also available after the process is finished |
|
166 | + * via the getOutput() and getErrorOutput() methods. |
|
167 | + * |
|
168 | + * @param callable|null $callback A PHP callback to run whenever there is some |
|
169 | + * output available on STDOUT or STDERR |
|
170 | + * |
|
171 | + * @return int The exit status code |
|
172 | + * |
|
173 | + * @throws RuntimeException When process can't be launched |
|
174 | + * @throws RuntimeException When process is already running |
|
175 | + * @throws ProcessTimedOutException When process timed out |
|
176 | + * @throws ProcessSignaledException When process stopped after receiving signal |
|
177 | + * @throws LogicException In case a callback is provided and output has been disabled |
|
178 | + * |
|
179 | + * @final |
|
180 | + */ |
|
181 | + public function run(?callable $callback = null, array $env = []): int |
|
182 | + { |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * Runs the process. |
|
187 | + * |
|
188 | + * This is identical to run() except that an exception is thrown if the process |
|
189 | + * exits with a non-zero exit code. |
|
190 | + * |
|
191 | + * @return $this |
|
192 | + * |
|
193 | + * @throws ProcessFailedException if the process didn't terminate successfully |
|
194 | + * |
|
195 | + * @final |
|
196 | + */ |
|
197 | + public function mustRun(?callable $callback = null, array $env = []): static |
|
198 | + { |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * Starts the process and returns after writing the input to STDIN. |
|
203 | + * |
|
204 | + * This method blocks until all STDIN data is sent to the process then it |
|
205 | + * returns while the process runs in the background. |
|
206 | + * |
|
207 | + * The termination of the process can be awaited with wait(). |
|
208 | + * |
|
209 | + * The callback receives the type of output (out or err) and some bytes from |
|
210 | + * the output in real-time while writing the standard input to the process. |
|
211 | + * It allows to have feedback from the independent process during execution. |
|
212 | + * |
|
213 | + * @param callable|null $callback A PHP callback to run whenever there is some |
|
214 | + * output available on STDOUT or STDERR |
|
215 | + * |
|
216 | + * @return void |
|
217 | + * |
|
218 | + * @throws RuntimeException When process can't be launched |
|
219 | + * @throws RuntimeException When process is already running |
|
220 | + * @throws LogicException In case a callback is provided and output has been disabled |
|
221 | + */ |
|
222 | + public function start(?callable $callback = null, array $env = []) |
|
223 | + { |
|
224 | + } |
|
225 | + |
|
226 | + /** |
|
227 | + * Restarts the process. |
|
228 | + * |
|
229 | + * Be warned that the process is cloned before being started. |
|
230 | + * |
|
231 | + * @param callable|null $callback A PHP callback to run whenever there is some |
|
232 | + * output available on STDOUT or STDERR |
|
233 | + * |
|
234 | + * @throws RuntimeException When process can't be launched |
|
235 | + * @throws RuntimeException When process is already running |
|
236 | + * |
|
237 | + * @see start() |
|
238 | + * |
|
239 | + * @final |
|
240 | + */ |
|
241 | + public function restart(?callable $callback = null, array $env = []): static |
|
242 | + { |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * Waits for the process to terminate. |
|
247 | + * |
|
248 | + * The callback receives the type of output (out or err) and some bytes |
|
249 | + * from the output in real-time while writing the standard input to the process. |
|
250 | + * It allows to have feedback from the independent process during execution. |
|
251 | + * |
|
252 | + * @param callable|null $callback A valid PHP callback |
|
253 | + * |
|
254 | + * @return int The exitcode of the process |
|
255 | + * |
|
256 | + * @throws ProcessTimedOutException When process timed out |
|
257 | + * @throws ProcessSignaledException When process stopped after receiving signal |
|
258 | + * @throws LogicException When process is not yet started |
|
259 | + */ |
|
260 | + public function wait(?callable $callback = null): int |
|
261 | + { |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * Waits until the callback returns true. |
|
266 | + * |
|
267 | + * The callback receives the type of output (out or err) and some bytes |
|
268 | + * from the output in real-time while writing the standard input to the process. |
|
269 | + * It allows to have feedback from the independent process during execution. |
|
270 | + * |
|
271 | + * @throws RuntimeException When process timed out |
|
272 | + * @throws LogicException When process is not yet started |
|
273 | + * @throws ProcessTimedOutException In case the timeout was reached |
|
274 | + */ |
|
275 | + public function waitUntil(callable $callback): bool |
|
276 | + { |
|
277 | + } |
|
278 | + |
|
279 | + /** |
|
280 | + * Returns the Pid (process identifier), if applicable. |
|
281 | + * |
|
282 | + * @return int|null The process id if running, null otherwise |
|
283 | + */ |
|
284 | + public function getPid(): ?int |
|
285 | + { |
|
286 | + } |
|
287 | + |
|
288 | + /** |
|
289 | + * Sends a POSIX signal to the process. |
|
290 | + * |
|
291 | + * @param int $signal A valid POSIX signal (see https://php.net/pcntl.constants) |
|
292 | + * |
|
293 | + * @return $this |
|
294 | + * |
|
295 | + * @throws LogicException In case the process is not running |
|
296 | + * @throws RuntimeException In case --enable-sigchild is activated and the process can't be killed |
|
297 | + * @throws RuntimeException In case of failure |
|
298 | + */ |
|
299 | + public function signal(int $signal): static |
|
300 | + { |
|
301 | + } |
|
302 | + |
|
303 | + /** |
|
304 | + * Disables fetching output and error output from the underlying process. |
|
305 | + * |
|
306 | + * @return $this |
|
307 | + * |
|
308 | + * @throws RuntimeException In case the process is already running |
|
309 | + * @throws LogicException if an idle timeout is set |
|
310 | + */ |
|
311 | + public function disableOutput(): static |
|
312 | + { |
|
313 | + } |
|
314 | + |
|
315 | + /** |
|
316 | + * Enables fetching output and error output from the underlying process. |
|
317 | + * |
|
318 | + * @return $this |
|
319 | + * |
|
320 | + * @throws RuntimeException In case the process is already running |
|
321 | + */ |
|
322 | + public function enableOutput(): static |
|
323 | + { |
|
324 | + } |
|
325 | + |
|
326 | + /** |
|
327 | + * Returns true in case the output is disabled, false otherwise. |
|
328 | + */ |
|
329 | + public function isOutputDisabled(): bool |
|
330 | + { |
|
331 | + } |
|
332 | + |
|
333 | + /** |
|
334 | + * Returns the current output of the process (STDOUT). |
|
335 | + * |
|
336 | + * @throws LogicException in case the output has been disabled |
|
337 | + * @throws LogicException In case the process is not started |
|
338 | + */ |
|
339 | + public function getOutput(): string |
|
340 | + { |
|
341 | + } |
|
342 | + |
|
343 | + /** |
|
344 | + * Returns the output incrementally. |
|
345 | + * |
|
346 | + * In comparison with the getOutput method which always return the whole |
|
347 | + * output, this one returns the new output since the last call. |
|
348 | + * |
|
349 | + * @throws LogicException in case the output has been disabled |
|
350 | + * @throws LogicException In case the process is not started |
|
351 | + */ |
|
352 | + public function getIncrementalOutput(): string |
|
353 | + { |
|
354 | + } |
|
355 | + |
|
356 | + /** |
|
357 | + * Returns an iterator to the output of the process, with the output type as keys (Process::OUT/ERR). |
|
358 | + * |
|
359 | + * @param int $flags A bit field of Process::ITER_* flags |
|
360 | + * |
|
361 | + * @return \Generator<string, string> |
|
362 | + * |
|
363 | + * @throws LogicException in case the output has been disabled |
|
364 | + * @throws LogicException In case the process is not started |
|
365 | + */ |
|
366 | + public function getIterator(int $flags = 0): \Generator |
|
367 | + { |
|
368 | + } |
|
369 | + |
|
370 | + /** |
|
371 | + * Clears the process output. |
|
372 | + * |
|
373 | + * @return $this |
|
374 | + */ |
|
375 | + public function clearOutput(): static |
|
376 | + { |
|
377 | + } |
|
378 | + |
|
379 | + /** |
|
380 | + * Returns the current error output of the process (STDERR). |
|
381 | + * |
|
382 | + * @throws LogicException in case the output has been disabled |
|
383 | + * @throws LogicException In case the process is not started |
|
384 | + */ |
|
385 | + public function getErrorOutput(): string |
|
386 | + { |
|
387 | + } |
|
388 | + |
|
389 | + /** |
|
390 | + * Returns the errorOutput incrementally. |
|
391 | + * |
|
392 | + * In comparison with the getErrorOutput method which always return the |
|
393 | + * whole error output, this one returns the new error output since the last |
|
394 | + * call. |
|
395 | + * |
|
396 | + * @throws LogicException in case the output has been disabled |
|
397 | + * @throws LogicException In case the process is not started |
|
398 | + */ |
|
399 | + public function getIncrementalErrorOutput(): string |
|
400 | + { |
|
401 | + } |
|
402 | + |
|
403 | + /** |
|
404 | + * Clears the process output. |
|
405 | + * |
|
406 | + * @return $this |
|
407 | + */ |
|
408 | + public function clearErrorOutput(): static |
|
409 | + { |
|
410 | + } |
|
411 | + |
|
412 | + /** |
|
413 | + * Returns the exit code returned by the process. |
|
414 | + * |
|
415 | + * @return int|null The exit status code, null if the Process is not terminated |
|
416 | + */ |
|
417 | + public function getExitCode(): ?int |
|
418 | + { |
|
419 | + } |
|
420 | + |
|
421 | + /** |
|
422 | + * Returns a string representation for the exit code returned by the process. |
|
423 | + * |
|
424 | + * This method relies on the Unix exit code status standardization |
|
425 | + * and might not be relevant for other operating systems. |
|
426 | + * |
|
427 | + * @return string|null A string representation for the exit status code, null if the Process is not terminated |
|
428 | + * |
|
429 | + * @see http://tldp.org/LDP/abs/html/exitcodes.html |
|
430 | + * @see http://en.wikipedia.org/wiki/Unix_signal |
|
431 | + */ |
|
432 | + public function getExitCodeText(): ?string |
|
433 | + { |
|
434 | + } |
|
435 | + |
|
436 | + /** |
|
437 | + * Checks if the process ended successfully. |
|
438 | + */ |
|
439 | + public function isSuccessful(): bool |
|
440 | + { |
|
441 | + } |
|
442 | + |
|
443 | + /** |
|
444 | + * Returns true if the child process has been terminated by an uncaught signal. |
|
445 | + * |
|
446 | + * It always returns false on Windows. |
|
447 | + * |
|
448 | + * @throws LogicException In case the process is not terminated |
|
449 | + */ |
|
450 | + public function hasBeenSignaled(): bool |
|
451 | + { |
|
452 | + } |
|
453 | + |
|
454 | + /** |
|
455 | + * Returns the number of the signal that caused the child process to terminate its execution. |
|
456 | + * |
|
457 | + * It is only meaningful if hasBeenSignaled() returns true. |
|
458 | + * |
|
459 | + * @throws RuntimeException In case --enable-sigchild is activated |
|
460 | + * @throws LogicException In case the process is not terminated |
|
461 | + */ |
|
462 | + public function getTermSignal(): int |
|
463 | + { |
|
464 | + } |
|
465 | + |
|
466 | + /** |
|
467 | + * Returns true if the child process has been stopped by a signal. |
|
468 | + * |
|
469 | + * It always returns false on Windows. |
|
470 | + * |
|
471 | + * @throws LogicException In case the process is not terminated |
|
472 | + */ |
|
473 | + public function hasBeenStopped(): bool |
|
474 | + { |
|
475 | + } |
|
476 | + |
|
477 | + /** |
|
478 | + * Returns the number of the signal that caused the child process to stop its execution. |
|
479 | + * |
|
480 | + * It is only meaningful if hasBeenStopped() returns true. |
|
481 | + * |
|
482 | + * @throws LogicException In case the process is not terminated |
|
483 | + */ |
|
484 | + public function getStopSignal(): int |
|
485 | + { |
|
486 | + } |
|
487 | + |
|
488 | + /** |
|
489 | + * Checks if the process is currently running. |
|
490 | + */ |
|
491 | + public function isRunning(): bool |
|
492 | + { |
|
493 | + } |
|
494 | + |
|
495 | + /** |
|
496 | + * Checks if the process has been started with no regard to the current state. |
|
497 | + */ |
|
498 | + public function isStarted(): bool |
|
499 | + { |
|
500 | + } |
|
501 | + |
|
502 | + /** |
|
503 | + * Checks if the process is terminated. |
|
504 | + */ |
|
505 | + public function isTerminated(): bool |
|
506 | + { |
|
507 | + } |
|
508 | + |
|
509 | + /** |
|
510 | + * Gets the process status. |
|
511 | + * |
|
512 | + * The status is one of: ready, started, terminated. |
|
513 | + */ |
|
514 | + public function getStatus(): string |
|
515 | + { |
|
516 | + } |
|
517 | + |
|
518 | + /** |
|
519 | + * Stops the process. |
|
520 | + * |
|
521 | + * @param int|float $timeout The timeout in seconds |
|
522 | + * @param int|null $signal A POSIX signal to send in case the process has not stop at timeout, default is SIGKILL (9) |
|
523 | + * |
|
524 | + * @return int|null The exit-code of the process or null if it's not running |
|
525 | + */ |
|
526 | + public function stop(float $timeout = 10, ?int $signal = null): ?int |
|
527 | + { |
|
528 | + } |
|
529 | + |
|
530 | + /** |
|
531 | + * Adds a line to the STDOUT stream. |
|
532 | + * |
|
533 | + * @internal |
|
534 | + */ |
|
535 | + public function addOutput(string $line): void |
|
536 | + { |
|
537 | + } |
|
538 | + |
|
539 | + /** |
|
540 | + * Adds a line to the STDERR stream. |
|
541 | + * |
|
542 | + * @internal |
|
543 | + */ |
|
544 | + public function addErrorOutput(string $line): void |
|
545 | + { |
|
546 | + } |
|
547 | + |
|
548 | + /** |
|
549 | + * Gets the last output time in seconds. |
|
550 | + */ |
|
551 | + public function getLastOutputTime(): ?float |
|
552 | + { |
|
553 | + } |
|
554 | + |
|
555 | + /** |
|
556 | + * Gets the command line to be executed. |
|
557 | + */ |
|
558 | + public function getCommandLine(): string |
|
559 | + { |
|
560 | + } |
|
561 | + |
|
562 | + /** |
|
563 | + * Gets the process timeout in seconds (max. runtime). |
|
564 | + */ |
|
565 | + public function getTimeout(): ?float |
|
566 | + { |
|
567 | + } |
|
568 | + |
|
569 | + /** |
|
570 | + * Gets the process idle timeout in seconds (max. time since last output). |
|
571 | + */ |
|
572 | + public function getIdleTimeout(): ?float |
|
573 | + { |
|
574 | + } |
|
575 | + |
|
576 | + /** |
|
577 | + * Sets the process timeout (max. runtime) in seconds. |
|
578 | + * |
|
579 | + * To disable the timeout, set this value to null. |
|
580 | + * |
|
581 | + * @return $this |
|
582 | + * |
|
583 | + * @throws InvalidArgumentException if the timeout is negative |
|
584 | + */ |
|
585 | + public function setTimeout(?float $timeout): static |
|
586 | + { |
|
587 | + } |
|
588 | + |
|
589 | + /** |
|
590 | + * Sets the process idle timeout (max. time since last output) in seconds. |
|
591 | + * |
|
592 | + * To disable the timeout, set this value to null. |
|
593 | + * |
|
594 | + * @return $this |
|
595 | + * |
|
596 | + * @throws LogicException if the output is disabled |
|
597 | + * @throws InvalidArgumentException if the timeout is negative |
|
598 | + */ |
|
599 | + public function setIdleTimeout(?float $timeout): static |
|
600 | + { |
|
601 | + } |
|
602 | + |
|
603 | + /** |
|
604 | + * Enables or disables the TTY mode. |
|
605 | + * |
|
606 | + * @return $this |
|
607 | + * |
|
608 | + * @throws RuntimeException In case the TTY mode is not supported |
|
609 | + */ |
|
610 | + public function setTty(bool $tty): static |
|
611 | + { |
|
612 | + } |
|
613 | + |
|
614 | + /** |
|
615 | + * Checks if the TTY mode is enabled. |
|
616 | + */ |
|
617 | + public function isTty(): bool |
|
618 | + { |
|
619 | + } |
|
620 | + |
|
621 | + /** |
|
622 | + * Sets PTY mode. |
|
623 | + * |
|
624 | + * @return $this |
|
625 | + */ |
|
626 | + public function setPty(bool $bool): static |
|
627 | + { |
|
628 | + } |
|
629 | + |
|
630 | + /** |
|
631 | + * Returns PTY state. |
|
632 | + */ |
|
633 | + public function isPty(): bool |
|
634 | + { |
|
635 | + } |
|
636 | + |
|
637 | + /** |
|
638 | + * Gets the working directory. |
|
639 | + */ |
|
640 | + public function getWorkingDirectory(): ?string |
|
641 | + { |
|
642 | + } |
|
643 | + |
|
644 | + /** |
|
645 | + * Sets the current working directory. |
|
646 | + * |
|
647 | + * @return $this |
|
648 | + */ |
|
649 | + public function setWorkingDirectory(string $cwd): static |
|
650 | + { |
|
651 | + } |
|
652 | + |
|
653 | + /** |
|
654 | + * Gets the environment variables. |
|
655 | + */ |
|
656 | + public function getEnv(): array |
|
657 | + { |
|
658 | + } |
|
659 | + |
|
660 | + /** |
|
661 | + * Sets the environment variables. |
|
662 | + * |
|
663 | + * @param array<string|\Stringable> $env The new environment variables |
|
664 | + * |
|
665 | + * @return $this |
|
666 | + */ |
|
667 | + public function setEnv(array $env): static |
|
668 | + { |
|
669 | + } |
|
670 | + |
|
671 | + /** |
|
672 | + * Gets the Process input. |
|
673 | + * |
|
674 | + * @return resource|string|\Iterator|null |
|
675 | + */ |
|
676 | + public function getInput() |
|
677 | + { |
|
678 | + } |
|
679 | + |
|
680 | + /** |
|
681 | + * Sets the input. |
|
682 | + * |
|
683 | + * This content will be passed to the underlying process standard input. |
|
684 | + * |
|
685 | + * @param string|resource|\Traversable|self|null $input The content |
|
686 | + * |
|
687 | + * @return $this |
|
688 | + * |
|
689 | + * @throws LogicException In case the process is running |
|
690 | + */ |
|
691 | + public function setInput(mixed $input): static |
|
692 | + { |
|
693 | + } |
|
694 | + |
|
695 | + /** |
|
696 | + * Performs a check between the timeout definition and the time the process started. |
|
697 | + * |
|
698 | + * In case you run a background process (with the start method), you should |
|
699 | + * trigger this method regularly to ensure the process timeout |
|
700 | + * |
|
701 | + * @return void |
|
702 | + * |
|
703 | + * @throws ProcessTimedOutException In case the timeout was reached |
|
704 | + */ |
|
705 | + public function checkTimeout() |
|
706 | + { |
|
707 | + } |
|
708 | + |
|
709 | + /** |
|
710 | + * @throws LogicException in case process is not started |
|
711 | + */ |
|
712 | + public function getStartTime(): float |
|
713 | + { |
|
714 | + } |
|
715 | + |
|
716 | + /** |
|
717 | + * Defines options to pass to the underlying proc_open(). |
|
718 | + * |
|
719 | + * @see https://php.net/proc_open for the options supported by PHP. |
|
720 | + * |
|
721 | + * Enabling the "create_new_console" option allows a subprocess to continue |
|
722 | + * to run after the main process exited, on both Windows and *nix |
|
723 | + * |
|
724 | + * @return void |
|
725 | + */ |
|
726 | + public function setOptions(array $options) |
|
727 | + { |
|
728 | + } |
|
729 | + |
|
730 | + /** |
|
731 | + * Returns whether TTY is supported on the current operating system. |
|
732 | + */ |
|
733 | + public static function isTtySupported(): bool |
|
734 | + { |
|
735 | + } |
|
736 | + |
|
737 | + /** |
|
738 | + * Returns whether PTY is supported on the current operating system. |
|
739 | + */ |
|
740 | + public static function isPtySupported(): bool |
|
741 | + { |
|
742 | + } |
|
743 | + |
|
744 | + /** |
|
745 | + * Builds up the callback used by wait(). |
|
746 | + * |
|
747 | + * The callbacks adds all occurred output to the specific buffer and calls |
|
748 | + * the user callback (if present) with the received output. |
|
749 | + * |
|
750 | + * @param callable|null $callback The user defined PHP callback |
|
751 | + */ |
|
752 | + protected function buildCallback(?callable $callback = null): \Closure |
|
753 | + { |
|
754 | + } |
|
755 | + |
|
756 | + /** |
|
757 | + * Updates the status of the process, reads pipes. |
|
758 | + * |
|
759 | + * @param bool $blocking Whether to use a blocking read call |
|
760 | + * |
|
761 | + * @return void |
|
762 | + */ |
|
763 | + protected function updateStatus(bool $blocking) |
|
764 | + { |
|
765 | + } |
|
766 | + |
|
767 | + /** |
|
768 | + * Returns whether PHP has been compiled with the '--enable-sigchild' option or not. |
|
769 | + */ |
|
770 | + protected function isSigchildEnabled(): bool |
|
771 | + { |
|
772 | + } |
|
773 | 773 | } |
@@ -46,8 +46,8 @@ |
||
46 | 46 | public const TIMEOUT_PRECISION = 0.2; |
47 | 47 | |
48 | 48 | public const ITER_NON_BLOCKING = 1; // By default, iterating over outputs is a blocking call, use this flag to make it non-blocking |
49 | - public const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory |
|
50 | - public const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating |
|
49 | + public const ITER_KEEP_OUTPUT = 2; // By default, outputs are cleared while iterating, use this flag to keep them in memory |
|
50 | + public const ITER_SKIP_OUT = 4; // Use this flag to skip STDOUT while iterating |
|
51 | 51 | public const ITER_SKIP_ERR = 8; |
52 | 52 | |
53 | 53 | /** |