From f8bc00f970eb52951ec2bea2c7aa53e258faa50b Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Mon, 19 Oct 2026 11:56:19 +0200 Subject: [PATCH] #58 - Mark the classes not meant to be extended @final and the infrastructure classes @internal - @final since 3.3 (final in 4.0): FileFetchTask, ListContentTask, RemoveFileTask, CleverAgeFlysystemProcessBundle. Extending them triggers a deprecation with the Symfony DebugClassLoader. - @internal: CleverAgeFlysystemProcessExtension. - FileFetchTask::doFileCopy() never returns bool nor null, which PHPStan reports once the class is @final: the protected return type is kept (a subclass may override it) and will be narrowed in 4.0. - Same model as cleverage/process-bundle#279. Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 1 + src/CleverAgeFlysystemProcessBundle.php | 3 +++ .../CleverAgeFlysystemProcessExtension.php | 2 ++ src/Task/FileFetchTask.php | 4 +++- src/Task/ListContentTask.php | 2 ++ src/Task/RemoveFileTask.php | 2 ++ 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9696c45..8ddd21c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Latest ------ ### Changes +* [#58](https://github.com/cleverage/flysystem-process-bundle/issues/58) Define the public API (Symfony BC promise, as [cleverage/process-bundle#279](https://github.com/cleverage/process-bundle/issues/279)): `FileFetchTask`, `ListContentTask`, `RemoveFileTask` and `CleverAgeFlysystemProcessBundle` are marked `@final since 3.3`, they will be `final` in 4.0: extending them triggers a deprecation with the Symfony `DebugClassLoader`. `CleverAgeFlysystemProcessExtension` is marked `@internal`. * [#57](https://github.com/cleverage/flysystem-process-bundle/issues/57) `CleverAgeFlysystemProcessExtension::findServices()` loads the service definition files with a glob pattern instead of a `Finder` (same files, as [cleverage/process-bundle#271](https://github.com/cleverage/process-bundle/issues/271)), `symfony/finder` is no longer required. Add tests. * [#55](https://github.com/cleverage/flysystem-process-bundle/issues/55) Use the PHP 8.3 to 8.5 functions through the Symfony polyfills ([cleverage/process-bundle#299](https://github.com/cleverage/process-bundle/issues/299)): require `symfony/polyfill-php83`, `symfony/polyfill-php84` and `symfony/polyfill-php85`. Configure Rector for the minimum PHP version (`withPhpVersion(PHP_82)` instead of `PHP_85`, `withPhpSets()` read from `composer.json` instead of the `php81` leftover, which also enables the polyfill rules; `UP_TO_PHP_82` set removed): no change proposed on the current code. Document the PHP version policy in CONTRIBUTING. * [#51](https://github.com/cleverage/flysystem-process-bundle/issues/51) Give a code to the tasks ([cleverage/process-bundle#91](https://github.com/cleverage/process-bundle/issues/91)): `flysystem_file_fetch`, `flysystem_list_content` and `flysystem_remove_file` (`task: flysystem_file_fetch`, with `cleverage/process-bundle` 5.4 or later, referencing them by `service` being deprecated there). The tasks have their class name as service id; fetching them directly from the service container is deprecated (`container.private`), they will be private in 4.0. The former ids `cleverage_flysystem_process.task.file_fetch` / `cleverage_flysystem_process.task.list_content` / `cleverage_flysystem_process.task.remove_file` are deprecated aliases, removed in 4.0. Update documentation, add tests. diff --git a/src/CleverAgeFlysystemProcessBundle.php b/src/CleverAgeFlysystemProcessBundle.php index 12e4933..6e887f0 100644 --- a/src/CleverAgeFlysystemProcessBundle.php +++ b/src/CleverAgeFlysystemProcessBundle.php @@ -15,6 +15,9 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; +/** + * @final since 3.3 + */ class CleverAgeFlysystemProcessBundle extends Bundle { #[\Override] diff --git a/src/DependencyInjection/CleverAgeFlysystemProcessExtension.php b/src/DependencyInjection/CleverAgeFlysystemProcessExtension.php index 7667390..75caee6 100644 --- a/src/DependencyInjection/CleverAgeFlysystemProcessExtension.php +++ b/src/DependencyInjection/CleverAgeFlysystemProcessExtension.php @@ -22,6 +22,8 @@ * This is the class that loads and manages your bundle configuration. * * @see https://symfony.com/doc/current/bundles/extension.html + * + * @internal */ class CleverAgeFlysystemProcessExtension extends Extension { diff --git a/src/Task/FileFetchTask.php b/src/Task/FileFetchTask.php index fc950a4..fde7719 100644 --- a/src/Task/FileFetchTask.php +++ b/src/Task/FileFetchTask.php @@ -24,6 +24,8 @@ /** * Copy (or move) file from one filesystem to another, using Flysystem * Either get files using a file regexp, or take files from input. + * + * @final since 3.3 */ class FileFetchTask extends AbstractConfigurableTask implements IterableTaskInterface { @@ -148,7 +150,7 @@ protected function findMatchingFiles(ProcessState $state): array * @throws \InvalidArgumentException * @throws FilesystemException */ - protected function doFileCopy(ProcessState $state, string $filename, bool $removeSource): bool|string|null + protected function doFileCopy(ProcessState $state, string $filename, bool $removeSource): bool|string|null // @phpstan-ignore return.unusedType, return.unusedType (protected: narrowed when the class becomes final, in 4.0) { $buffer = $this->sourceFS->readStream($filename); diff --git a/src/Task/ListContentTask.php b/src/Task/ListContentTask.php index c804135..ba843cc 100644 --- a/src/Task/ListContentTask.php +++ b/src/Task/ListContentTask.php @@ -23,6 +23,8 @@ /** * Iterate over the content of a filesystem. + * + * @final since 3.3 */ class ListContentTask extends AbstractConfigurableTask implements IterableTaskInterface { diff --git a/src/Task/RemoveFileTask.php b/src/Task/RemoveFileTask.php index d03f9af..a53d99e 100644 --- a/src/Task/RemoveFileTask.php +++ b/src/Task/RemoveFileTask.php @@ -23,6 +23,8 @@ /** * Remove files from a filesystem. + * + * @final since 3.3 */ class RemoveFileTask extends AbstractConfigurableTask {