File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -157,4 +157,27 @@ private static function schemesToList(iterable $schemes): array
157157
158158 return $ result ;
159159 }
160+
161+ /**
162+ * @param list<ExtensionProviderInterface<Application>> $with
163+ * @param list<class-string<ExtensionProviderInterface<Application>>> $except
164+ *
165+ * @return iterable<array-key, ExtensionProviderInterface<Application>>
166+ */
167+ public static function extensions (array $ with = [], array $ except = []): iterable
168+ {
169+ /**
170+ * @var ExtensionProviderInterface<Application> $extension
171+ * @phpstan-ignore-next-line PHPStan does not support this constant
172+ */
173+ foreach (self ::DEFAULT_APPLICATION_EXTENSIONS as $ extension ) {
174+ if (\in_array ($ extension ::class, $ except , true )) {
175+ continue ;
176+ }
177+
178+ yield $ extension ;
179+ }
180+
181+ yield from $ with ;
182+ }
160183}
Original file line number Diff line number Diff line change @@ -169,4 +169,27 @@ private static function extensionsToList(iterable $extensions): array
169169 {
170170 return \iterator_to_array ($ extensions , false );
171171 }
172+
173+ /**
174+ * @param list<ExtensionProviderInterface<WebView>> $with
175+ * @param list<class-string<ExtensionProviderInterface<WebView>>> $except
176+ *
177+ * @return iterable<array-key, ExtensionProviderInterface<WebView>>
178+ */
179+ public static function extensions (array $ with = [], array $ except = []): iterable
180+ {
181+ /**
182+ * @var ExtensionProviderInterface<WebView> $extension
183+ * @phpstan-ignore-next-line PHPStan does not support this constant
184+ */
185+ foreach (self ::DEFAULT_WEBVIEW_EXTENSIONS as $ extension ) {
186+ if (\in_array ($ extension ::class, $ except , true )) {
187+ continue ;
188+ }
189+
190+ yield $ extension ;
191+ }
192+
193+ yield from $ with ;
194+ }
172195}
Original file line number Diff line number Diff line change @@ -122,4 +122,27 @@ private static function extensionsToList(iterable $extensions): array
122122 {
123123 return \iterator_to_array ($ extensions , false );
124124 }
125+
126+ /**
127+ * @param list<ExtensionProviderInterface<Window>> $with
128+ * @param list<class-string<ExtensionProviderInterface<Window>>> $except
129+ *
130+ * @return iterable<array-key, ExtensionProviderInterface<Window>>
131+ */
132+ public static function extensions (array $ with = [], array $ except = []): iterable
133+ {
134+ /**
135+ * @var ExtensionProviderInterface<Window> $extension
136+ * @phpstan-ignore-next-line PHPStan does not support this constant
137+ */
138+ foreach (self ::DEFAULT_WINDOW_EXTENSIONS as $ extension ) {
139+ if (\in_array ($ extension ::class, $ except , true )) {
140+ continue ;
141+ }
142+
143+ yield $ extension ;
144+ }
145+
146+ yield from $ with ;
147+ }
125148}
You can’t perform that action at this time.
0 commit comments